2025-03-07 14:36:54 +08:00
|
|
|
<template>
|
2025-03-12 11:35:36 +08:00
|
|
|
<CustomCard>
|
2025-03-14 17:33:44 +08:00
|
|
|
<h2>农药基本信息</h2>
|
2025-03-17 17:32:59 +08:00
|
|
|
<TypeMenu v-model:type="_type" :types="pesticideData" />
|
2025-03-14 17:33:44 +08:00
|
|
|
<br />
|
2025-03-17 17:32:59 +08:00
|
|
|
<avue-crud
|
|
|
|
ref="crud"
|
|
|
|
v-model:page="pageData"
|
|
|
|
:table-loading="_loading"
|
|
|
|
:data="data"
|
|
|
|
:option="option"
|
|
|
|
:before-close="handleCloseDialog"
|
|
|
|
@row-save="handleRowSave"
|
|
|
|
@row-update="handleRowUpdate"
|
|
|
|
>
|
|
|
|
<template #menu="{ row }">
|
|
|
|
<el-button type="primary" @click="handleEdit(row)">上传报告</el-button>
|
|
|
|
<el-button @click="handleInfo(row)">详情</el-button>
|
|
|
|
</template>
|
|
|
|
<template #img-form="{ type }">
|
|
|
|
<Attrs v-model:attrs="img" :type="type == 'add' ? 'add' : 'view'" />
|
|
|
|
</template>
|
|
|
|
<template #checkInfo-form="{ row }">
|
|
|
|
<section style="text-align: center; line-height: 58px">
|
|
|
|
{{ row }}
|
|
|
|
<el-button @click="handleCheckInfo('open')">查看报告</el-button>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
<template #checkReport-form="{ type }">
|
|
|
|
<Attrs v-model:attrs="reportAttrs" :type="type" :up-btn="reportAttrs.length < 1" :file-num="reportAttrs.length > 0 ? 1 : 3" />
|
|
|
|
</template>
|
|
|
|
<template #checkBtn-form>
|
|
|
|
<section style="text-align: center; line-height: 58px">
|
|
|
|
<el-button @click="handleCheckInfo('close')">关闭</el-button>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
</avue-crud>
|
2025-03-12 11:35:36 +08:00
|
|
|
</CustomCard>
|
2025-03-07 14:36:54 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
2025-03-17 17:32:59 +08:00
|
|
|
import { reactive, ref, watch, h } from 'vue';
|
2025-03-07 14:36:54 +08:00
|
|
|
import CustomCard from '@/components/CustomCard.vue';
|
2025-03-14 17:33:44 +08:00
|
|
|
import TypeMenu from '../../common/TypeMenu.vue';
|
|
|
|
import { CRUD_OPTIONS } from '@/config';
|
2025-03-17 17:32:59 +08:00
|
|
|
import { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo';
|
|
|
|
import Attrs from '@/views/inputSuppliesManage/common/Attrs.vue';
|
|
|
|
|
|
|
|
const { pesticideData } = useBasicInfo();
|
2025-03-14 17:33:44 +08:00
|
|
|
|
2025-03-07 14:36:54 +08:00
|
|
|
/* --------------- data --------------- */
|
|
|
|
// #region
|
2025-03-17 17:32:59 +08:00
|
|
|
const _type = ref('');
|
2025-03-14 17:33:44 +08:00
|
|
|
watch(
|
2025-03-17 17:32:59 +08:00
|
|
|
() => _type.value,
|
2025-03-14 17:33:44 +08:00
|
|
|
() => {
|
2025-03-17 17:32:59 +08:00
|
|
|
console.log(_type.value);
|
2025-03-14 17:33:44 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
deep: true,
|
|
|
|
}
|
|
|
|
);
|
2025-03-07 14:36:54 +08:00
|
|
|
|
2025-03-14 17:33:44 +08:00
|
|
|
const crud = ref();
|
2025-03-17 17:32:59 +08:00
|
|
|
const _loading = ref(false);
|
|
|
|
const data = ref([
|
|
|
|
{
|
|
|
|
name: '农药1',
|
|
|
|
id: '1111',
|
|
|
|
produicer: '生产商1',
|
|
|
|
dealer: '经销商1',
|
|
|
|
img: [
|
|
|
|
'https://gips0.baidu.com/it/u=3602773692,1512483864&fm=3028',
|
|
|
|
'https://gips3.baidu.com/it/u=100751361,1567855012&fm=3028',
|
|
|
|
'https://gips2.baidu.com/it/u=195724436,3554684702&fm=3028',
|
|
|
|
],
|
|
|
|
checkReport: [],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '农药2',
|
|
|
|
id: '2222',
|
|
|
|
produicer: '生产商2',
|
|
|
|
dealer: '经销商2',
|
|
|
|
img: ['https://gips3.baidu.com/it/u=100751361,1567855012&fm=3028'],
|
|
|
|
checkReport: ['https://gips3.baidu.com/it/u=100751361,1567855012&fm=3028'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '农药3',
|
|
|
|
id: '3333',
|
|
|
|
produicer: '生产商3',
|
|
|
|
dealer: '经销商3',
|
|
|
|
img: [],
|
|
|
|
checkReport: [],
|
|
|
|
},
|
|
|
|
]);
|
2025-03-14 17:33:44 +08:00
|
|
|
const pageData = ref({
|
|
|
|
total: 0,
|
|
|
|
currentPage: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
});
|
|
|
|
const option = ref({
|
|
|
|
CRUD_OPTIONS,
|
|
|
|
selection: false,
|
2025-03-17 17:32:59 +08:00
|
|
|
labelWidth: 124,
|
|
|
|
editBtn: false,
|
|
|
|
delBtn: false,
|
2025-03-14 17:33:44 +08:00
|
|
|
column: [
|
|
|
|
{
|
2025-03-17 17:32:59 +08:00
|
|
|
prop: 'id',
|
2025-03-14 17:33:44 +08:00
|
|
|
label: '农药编号',
|
2025-03-17 17:32:59 +08:00
|
|
|
addDisplay: false,
|
|
|
|
editDisplay: false,
|
2025-03-14 17:33:44 +08:00
|
|
|
},
|
|
|
|
{
|
2025-03-17 17:32:59 +08:00
|
|
|
prop: 'name',
|
2025-03-14 17:33:44 +08:00
|
|
|
label: '名称',
|
2025-03-17 17:32:59 +08:00
|
|
|
editDisplay: false,
|
2025-03-14 17:33:44 +08:00
|
|
|
},
|
|
|
|
{
|
2025-03-17 17:32:59 +08:00
|
|
|
hide: true,
|
|
|
|
prop: 'code',
|
|
|
|
label: '产品标准证号',
|
|
|
|
viewDisplay: false,
|
|
|
|
editDisplay: false,
|
2025-03-14 17:33:44 +08:00
|
|
|
},
|
|
|
|
{
|
2025-03-17 17:32:59 +08:00
|
|
|
hide: true,
|
|
|
|
prop: 'img',
|
|
|
|
label: '农药图片',
|
|
|
|
editDisplay: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
hide: true,
|
|
|
|
prop: 'code1',
|
|
|
|
label: '农药登记证号',
|
|
|
|
viewDisplay: false,
|
|
|
|
editDisplay: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'producer',
|
|
|
|
label: '生产厂家',
|
|
|
|
editDisplay: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'dealer',
|
2025-03-14 17:33:44 +08:00
|
|
|
label: '经销商',
|
2025-03-17 17:32:59 +08:00
|
|
|
editDisplay: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'format',
|
|
|
|
label: '产品规格',
|
|
|
|
editDisplay: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'toxicity',
|
|
|
|
label: '毒性',
|
|
|
|
editDisplay: false,
|
2025-03-14 17:33:44 +08:00
|
|
|
},
|
|
|
|
{
|
2025-03-17 17:32:59 +08:00
|
|
|
prop: 'validity',
|
|
|
|
label: '保质期',
|
|
|
|
editDisplay: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'preventTargets',
|
2025-03-14 17:33:44 +08:00
|
|
|
label: '防治对象',
|
2025-03-17 17:32:59 +08:00
|
|
|
type: 'cascader',
|
|
|
|
checkStrictly: true,
|
|
|
|
multiple: true,
|
|
|
|
dicData: pesticideData.value[1].children,
|
|
|
|
span: 24,
|
|
|
|
editDisplay: false,
|
2025-03-14 17:33:44 +08:00
|
|
|
},
|
|
|
|
{
|
2025-03-17 17:32:59 +08:00
|
|
|
prop: 'chemicalComposition',
|
2025-03-14 17:33:44 +08:00
|
|
|
label: '化学成分',
|
2025-03-17 17:32:59 +08:00
|
|
|
type: 'cascader',
|
|
|
|
checkStrictly: true,
|
|
|
|
multiple: true,
|
|
|
|
dicData: pesticideData.value[2].children,
|
|
|
|
span: 24,
|
|
|
|
editDisplay: false,
|
2025-03-14 17:33:44 +08:00
|
|
|
},
|
|
|
|
{
|
2025-03-17 17:32:59 +08:00
|
|
|
prop: 'dosageForm',
|
2025-03-14 17:33:44 +08:00
|
|
|
label: '加工剂型',
|
2025-03-17 17:32:59 +08:00
|
|
|
type: 'cascader',
|
|
|
|
checkStrictly: true,
|
|
|
|
multiple: true,
|
|
|
|
dicData: pesticideData.value[3].children,
|
|
|
|
span: 24,
|
|
|
|
editDisplay: false,
|
2025-03-14 17:33:44 +08:00
|
|
|
},
|
|
|
|
{
|
2025-03-17 17:32:59 +08:00
|
|
|
hide: true,
|
|
|
|
prop: 'useMethods',
|
|
|
|
label: '使用方法',
|
|
|
|
type: 'textarea',
|
|
|
|
span: 24,
|
|
|
|
viewDisplay: false,
|
|
|
|
editDisplay: false,
|
2025-03-14 17:33:44 +08:00
|
|
|
},
|
|
|
|
{
|
2025-03-17 17:32:59 +08:00
|
|
|
hide: true,
|
|
|
|
prop: 'tips',
|
|
|
|
label: '注意事项',
|
|
|
|
type: 'textarea',
|
|
|
|
span: 24,
|
|
|
|
viewDisplay: false,
|
|
|
|
editDisplay: false,
|
2025-03-14 17:33:44 +08:00
|
|
|
},
|
|
|
|
{
|
2025-03-17 17:32:59 +08:00
|
|
|
labelWidth: 0,
|
|
|
|
border: false,
|
|
|
|
prop: 'checkInfo',
|
|
|
|
span: 24,
|
|
|
|
addDisplay: false,
|
|
|
|
editDisplay: false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
group: [
|
|
|
|
{
|
|
|
|
label: '农药基本信息',
|
|
|
|
prop: 'basic_info',
|
|
|
|
addDisplay: false,
|
|
|
|
viewDisplay: false,
|
|
|
|
column: [
|
|
|
|
{
|
|
|
|
prop: 'name',
|
|
|
|
label: '农药名称',
|
|
|
|
editDisabled: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'producer',
|
|
|
|
label: '生产商',
|
|
|
|
editDisabled: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'img',
|
|
|
|
label: '农药图片',
|
|
|
|
editDisabled: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'dealer',
|
|
|
|
label: '经销商',
|
|
|
|
editDisabled: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '农药检测信息',
|
|
|
|
prop: 'check_info',
|
|
|
|
addDisplay: false,
|
|
|
|
viewDisplay: false,
|
|
|
|
column: [
|
|
|
|
{
|
|
|
|
prop: 'checkDate',
|
|
|
|
label: '农药名称',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'checkResult',
|
|
|
|
label: '检测结果',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'checkUnit',
|
|
|
|
label: '检测单位',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'checkConclusion',
|
|
|
|
label: '检测结论',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
prop: 'checkReport',
|
|
|
|
label: '质检报告',
|
|
|
|
span: 24,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
labelWidth: 0,
|
|
|
|
prop: 'checkBtn',
|
|
|
|
span: 24,
|
|
|
|
editDisplay: false,
|
|
|
|
},
|
|
|
|
],
|
2025-03-14 17:33:44 +08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
2025-03-17 17:32:59 +08:00
|
|
|
const img = ref([]);
|
|
|
|
const reportAttrs = ref([]);
|
2025-03-07 14:36:54 +08:00
|
|
|
// #endregion
|
|
|
|
|
|
|
|
/* --------------- methods --------------- */
|
|
|
|
// #region
|
2025-03-17 17:32:59 +08:00
|
|
|
function handleCloseDialog(done) {
|
|
|
|
handleCheckInfoChange();
|
|
|
|
done();
|
|
|
|
}
|
2025-03-07 14:36:54 +08:00
|
|
|
|
2025-03-17 17:32:59 +08:00
|
|
|
function handleRowSave(form, done, loading) {
|
|
|
|
console.log('handleRowSave', form);
|
|
|
|
loading();
|
|
|
|
}
|
|
|
|
function handleEdit(row) {
|
|
|
|
console.log('handleEdit', row);
|
|
|
|
handleCheckInfoChange('open');
|
|
|
|
img.value = row.img.map((v) => {
|
|
|
|
return {
|
|
|
|
url: v,
|
|
|
|
uid: Date.now(),
|
|
|
|
};
|
|
|
|
});
|
|
|
|
reportAttrs.value = row.checkReport.map((v) => {
|
|
|
|
return {
|
|
|
|
url: v,
|
|
|
|
uid: Date.now(),
|
|
|
|
};
|
|
|
|
});
|
|
|
|
crud.value.rowEdit(row);
|
|
|
|
}
|
|
|
|
function handleInfo(row) {
|
|
|
|
console.log('row', row);
|
|
|
|
crud.value.rowView(row);
|
|
|
|
}
|
|
|
|
function handleCheckInfo(type) {
|
|
|
|
console.log('checkInfo', type);
|
|
|
|
handleCheckInfoChange(type == 'open');
|
|
|
|
}
|
|
|
|
/* bol && 查看检测报告关闭其他信息 !bol && 关闭检测报告打开其他信息 */
|
|
|
|
function handleCheckInfoChange(bol = false) {
|
|
|
|
console.log('bol', bol);
|
|
|
|
option.value.group.forEach((v) => {
|
|
|
|
v.viewDisplay = bol;
|
|
|
|
});
|
|
|
|
if (bol) {
|
|
|
|
option.value.column.forEach((v) => {
|
|
|
|
v.viewDisplay = false;
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
option.value.column.forEach((v) => {
|
|
|
|
if (!v.hide || v.prop == 'img') {
|
|
|
|
v.viewDisplay = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
async function handleRowUpdate(form, done, loading) {
|
|
|
|
console.log('update from -- ', form);
|
|
|
|
loading();
|
|
|
|
}
|
2025-03-07 14:36:54 +08:00
|
|
|
// #endregion
|
|
|
|
</script>
|
|
|
|
|
2025-03-14 17:33:44 +08:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
h2 {
|
|
|
|
font-size: 24px;
|
|
|
|
font-weight: bold;
|
|
|
|
font-family: '黑体';
|
|
|
|
}
|
|
|
|
</style>
|