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-24 17:21:44 +08:00
|
|
|
<TypeMenu v-if="materialTypes.length > 1" v-model:type="_type" :types="materialTypes['1']" />
|
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"
|
2025-03-24 17:21:44 +08:00
|
|
|
@refresh-change="getData"
|
2025-03-17 17:32:59 +08:00
|
|
|
@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>
|
2025-03-24 17:21:44 +08:00
|
|
|
<template #photoUrl-form="{ type }">
|
|
|
|
<Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" />
|
2025-03-17 17:32:59 +08:00
|
|
|
</template>
|
|
|
|
<template #checkInfo-form="{ row }">
|
|
|
|
<section style="text-align: center; line-height: 58px">
|
|
|
|
<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>
|
2025-03-24 17:21:44 +08:00
|
|
|
<template #productSpecification-form>
|
|
|
|
<NumberSelect v-model:value="productSpecification" :options="goodsUnitOptions" />
|
|
|
|
</template>
|
|
|
|
<template #dosage-form>
|
|
|
|
<NumberSelect v-model:value="useDosage" :options="useDosageUnit" />
|
|
|
|
</template>
|
2025-03-17 17:32:59 +08:00
|
|
|
<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-24 17:21:44 +08:00
|
|
|
import { reactive, ref, watch, onMounted, h, computed } 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';
|
2025-03-24 17:21:44 +08:00
|
|
|
import NumberSelect from '@/views/inputSuppliesManage/common/NumberSelect.vue';
|
|
|
|
import inputSuppliesApi from '@/apis/inputSuppliesApi';
|
2025-03-17 17:32:59 +08:00
|
|
|
|
2025-03-24 17:21:44 +08:00
|
|
|
const { loadFinish, materialTypes, materialTwoLevel, goodsUnitOptions, useDosageUnit, filterTypes } = useBasicInfo({
|
|
|
|
moduleType: '1',
|
|
|
|
});
|
|
|
|
const { getPesticideList } = inputSuppliesApi;
|
|
|
|
onMounted(getData);
|
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-24 17:21:44 +08:00
|
|
|
const searchCondition = ref({
|
|
|
|
pesticideName: '',
|
|
|
|
});
|
2025-03-14 17:33:44 +08:00
|
|
|
const crud = ref();
|
2025-03-17 17:32:59 +08:00
|
|
|
const _loading = ref(false);
|
2025-03-24 17:21:44 +08:00
|
|
|
const data = ref([]);
|
2025-03-14 17:33:44 +08:00
|
|
|
const pageData = ref({
|
|
|
|
total: 0,
|
|
|
|
currentPage: 1,
|
2025-03-24 17:21:44 +08:00
|
|
|
size: 10,
|
2025-03-14 17:33:44 +08:00
|
|
|
});
|
|
|
|
const option = ref({
|
2025-03-24 17:21:44 +08:00
|
|
|
...CRUD_OPTIONS,
|
2025-03-14 17:33:44 +08:00
|
|
|
selection: false,
|
2025-03-17 17:32:59 +08:00
|
|
|
labelWidth: 124,
|
|
|
|
editBtn: false,
|
|
|
|
delBtn: false,
|
2025-03-24 17:21:44 +08:00
|
|
|
menuWidth: 220,
|
|
|
|
dialogWidth: '60%',
|
2025-03-14 17:33:44 +08:00
|
|
|
column: [
|
2025-03-24 17:21:44 +08:00
|
|
|
{
|
|
|
|
hide: true,
|
|
|
|
label: '关键字',
|
|
|
|
search: true,
|
|
|
|
addDisplay: false,
|
|
|
|
editDisplay: false,
|
|
|
|
},
|
2025-03-14 17:33:44 +08:00
|
|
|
{
|
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-24 17:21:44 +08:00
|
|
|
prop: 'pesticideName',
|
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,
|
2025-03-24 17:21:44 +08:00
|
|
|
prop: 'productStandCode',
|
2025-03-17 17:32:59 +08:00
|
|
|
label: '产品标准证号',
|
|
|
|
viewDisplay: false,
|
|
|
|
editDisplay: false,
|
2025-03-14 17:33:44 +08:00
|
|
|
},
|
|
|
|
{
|
2025-03-17 17:32:59 +08:00
|
|
|
hide: true,
|
2025-03-24 17:21:44 +08:00
|
|
|
prop: 'photoUrl',
|
2025-03-17 17:32:59 +08:00
|
|
|
label: '农药图片',
|
|
|
|
editDisplay: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
hide: true,
|
2025-03-24 17:21:44 +08:00
|
|
|
prop: 'pesticideRegistCode',
|
2025-03-17 17:32:59 +08:00
|
|
|
label: '农药登记证号',
|
|
|
|
viewDisplay: false,
|
|
|
|
editDisplay: false,
|
|
|
|
},
|
|
|
|
{
|
2025-03-24 17:21:44 +08:00
|
|
|
prop: 'manufacturer',
|
2025-03-17 17:32:59 +08:00
|
|
|
label: '生产厂家',
|
|
|
|
editDisplay: false,
|
|
|
|
},
|
|
|
|
{
|
2025-03-24 17:21:44 +08:00
|
|
|
prop: 'distributor',
|
2025-03-14 17:33:44 +08:00
|
|
|
label: '经销商',
|
2025-03-17 17:32:59 +08:00
|
|
|
editDisplay: false,
|
|
|
|
},
|
|
|
|
{
|
2025-03-24 17:21:44 +08:00
|
|
|
prop: 'productSpecification',
|
2025-03-17 17:32:59 +08:00
|
|
|
label: '产品规格',
|
|
|
|
editDisplay: false,
|
|
|
|
},
|
|
|
|
{
|
2025-03-24 17:21:44 +08:00
|
|
|
prop: 'toxicityLevel',
|
2025-03-17 17:32:59 +08:00
|
|
|
label: '毒性',
|
|
|
|
editDisplay: false,
|
2025-03-14 17:33:44 +08:00
|
|
|
},
|
2025-03-24 17:21:44 +08:00
|
|
|
{
|
|
|
|
prop: 'dosage',
|
|
|
|
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,
|
2025-03-24 17:21:44 +08:00
|
|
|
dicData: [],
|
2025-03-17 17:32:59 +08:00
|
|
|
span: 24,
|
|
|
|
editDisplay: false,
|
2025-03-14 17:33:44 +08:00
|
|
|
},
|
|
|
|
{
|
2025-03-24 17:21:44 +08:00
|
|
|
prop: 'mainComponents',
|
2025-03-14 17:33:44 +08:00
|
|
|
label: '化学成分',
|
2025-03-17 17:32:59 +08:00
|
|
|
type: 'cascader',
|
|
|
|
checkStrictly: true,
|
|
|
|
multiple: true,
|
2025-03-24 17:21:44 +08:00
|
|
|
dicData: materialTwoLevel.value?.['1']?.['2'] ?? [],
|
2025-03-17 17:32:59 +08:00
|
|
|
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,
|
2025-03-24 17:21:44 +08:00
|
|
|
dicData: materialTwoLevel.value?.['1']?.['3'] ?? [],
|
2025-03-17 17:32:59 +08:00
|
|
|
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,
|
|
|
|
},
|
|
|
|
{
|
2025-03-24 17:21:44 +08:00
|
|
|
prop: 'manufacturer',
|
2025-03-17 17:32:59 +08:00
|
|
|
label: '生产商',
|
|
|
|
editDisabled: true,
|
|
|
|
},
|
|
|
|
{
|
2025-03-24 17:21:44 +08:00
|
|
|
prop: 'photoUrl',
|
2025-03-17 17:32:59 +08:00
|
|
|
label: '农药图片',
|
|
|
|
editDisabled: true,
|
|
|
|
},
|
|
|
|
{
|
2025-03-24 17:21:44 +08:00
|
|
|
prop: 'distributor',
|
2025-03-17 17:32:59 +08:00
|
|
|
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-24 17:21:44 +08:00
|
|
|
watch(
|
|
|
|
() => loadFinish.value,
|
|
|
|
() => {
|
|
|
|
if (loadFinish.value) {
|
|
|
|
let newDicName = [
|
|
|
|
{ key: '', one: '1', two: '1' },
|
|
|
|
{ key: '', one: '1', two: '2' },
|
|
|
|
{ key: '', one: '1', two: '3' },
|
|
|
|
];
|
|
|
|
newDicName.forEach((v) => {
|
|
|
|
option.value.column.forEach((item) => {
|
|
|
|
if (item.prop === v.key) {
|
|
|
|
item.dicData = materialTwoLevel?.[v.one]?.[v.two] ?? [];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
const attrs = ref([]);
|
2025-03-17 17:32:59 +08:00
|
|
|
const reportAttrs = ref([]);
|
2025-03-24 17:21:44 +08:00
|
|
|
const productSpecification = ref({
|
|
|
|
num: 1,
|
|
|
|
type: '1',
|
|
|
|
});
|
|
|
|
const useDosage = ref({
|
|
|
|
num: 1,
|
|
|
|
type: '1',
|
|
|
|
});
|
|
|
|
|
2025-03-07 14:36:54 +08:00
|
|
|
// #endregion
|
|
|
|
|
|
|
|
/* --------------- methods --------------- */
|
|
|
|
// #region
|
2025-03-24 17:21:44 +08:00
|
|
|
async function getData(reset) {
|
|
|
|
_loading.value = true;
|
|
|
|
reset == 1 && (pageData.value.currentPage = 1);
|
|
|
|
let params = {
|
|
|
|
current: pageData.value.currentPage,
|
|
|
|
size: pageData.value.size,
|
|
|
|
...searchCondition.value,
|
|
|
|
};
|
|
|
|
let res = await getPesticideList(params);
|
|
|
|
console.log('res --- ', res);
|
|
|
|
_loading.value = false;
|
|
|
|
if (res && res.code === 200) {
|
|
|
|
data.value = res.data.records;
|
|
|
|
pageData.value.total = res.data.total;
|
|
|
|
}
|
|
|
|
}
|
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');
|
2025-03-24 17:21:44 +08:00
|
|
|
attrs.value = row.map((v) => {
|
2025-03-17 17:32:59 +08:00
|
|
|
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) => {
|
2025-03-24 17:21:44 +08:00
|
|
|
if (!v.hide || v.prop == 'photoUrl') {
|
2025-03-17 17:32:59 +08:00
|
|
|
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>
|