2025-03-07 14:36:54 +08:00
|
|
|
|
<template>
|
2025-03-27 15:56:05 +08:00
|
|
|
|
<section class="custom-page">
|
2025-03-14 17:33:44 +08:00
|
|
|
|
<h2>农药基本信息</h2>
|
2025-03-26 13:37:24 +08:00
|
|
|
|
<TypeMenu v-if="materialTypes[1].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"
|
2025-03-26 13:37:24 +08:00
|
|
|
|
v-model:search="searchCondition"
|
2025-03-17 17:32:59 +08:00
|
|
|
|
:table-loading="_loading"
|
|
|
|
|
:data="data"
|
|
|
|
|
:option="option"
|
|
|
|
|
:before-close="handleCloseDialog"
|
2025-03-26 13:37:24 +08:00
|
|
|
|
@search-change="
|
|
|
|
|
(form, done) => {
|
|
|
|
|
getData(1);
|
|
|
|
|
done();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@search-reset="getData(1)"
|
2025-03-24 17:21:44 +08:00
|
|
|
|
@refresh-change="getData"
|
2025-03-26 13:37:24 +08:00
|
|
|
|
@current-change="getData"
|
|
|
|
|
@size-change="getData(1)"
|
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 }">
|
2025-03-27 15:56:05 +08:00
|
|
|
|
<Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" :limit="2" />
|
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>
|
2025-03-27 15:56:05 +08:00
|
|
|
|
<template #detectionReport-form="{ type }">
|
|
|
|
|
<Attrs v-model:attrs="reportAttrs" :type="type" :up-btn="reportAttrs.length < 1" :file-num="reportAttrs.length > 0 ? 1 : 3" :limit="2" />
|
2025-03-17 17:32:59 +08:00
|
|
|
|
</template>
|
2025-03-27 15:56:05 +08:00
|
|
|
|
<template #productSpecification-form="{ value, type }">
|
|
|
|
|
<NumberSelect v-if="type == 'add'" v-model:value="productSpecification" :options="goodsUnitOptions" />
|
|
|
|
|
<span v-if="type == 'view'">{{ value }}</span>
|
2025-03-24 17:21:44 +08:00
|
|
|
|
</template>
|
2025-03-27 15:56:05 +08:00
|
|
|
|
<template #dosage-form="{ value, type }">
|
|
|
|
|
<NumberSelect v-if="type == 'add'" v-model:value="useDosage" :options="useDosageUnit" />
|
|
|
|
|
<span v-if="type == 'view'">{{ value }}</span>
|
2025-03-24 17:21:44 +08:00
|
|
|
|
</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-27 15:56:05 +08:00
|
|
|
|
</section>
|
2025-03-07 14:36:54 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2025-03-27 15:56:05 +08:00
|
|
|
|
import { ref, watch, onMounted } from 'vue';
|
2025-03-14 17:33:44 +08:00
|
|
|
|
import TypeMenu from '../../common/TypeMenu.vue';
|
2025-03-26 13:37:24 +08:00
|
|
|
|
import { CRUD_OPTIONS, customRules } 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-26 13:37:24 +08:00
|
|
|
|
import { ElMessage } from 'element-plus';
|
2025-03-17 17:32:59 +08:00
|
|
|
|
|
2025-03-27 15:56:05 +08:00
|
|
|
|
const { defaultGet, loadFinish, materialTypes, materialTwoLevel, goodsUnitOptions, useDosageUnit, targetName, filterTypes } = useBasicInfo({
|
2025-03-24 17:21:44 +08:00
|
|
|
|
moduleType: '1',
|
|
|
|
|
});
|
2025-03-27 15:56:05 +08:00
|
|
|
|
const { getPesticideList, addPesticide, pesticideReportSave } = inputSuppliesApi;
|
2025-03-14 17:33:44 +08:00
|
|
|
|
|
2025-03-07 14:36:54 +08:00
|
|
|
|
/* --------------- data --------------- */
|
|
|
|
|
// #region
|
2025-03-26 13:37:24 +08:00
|
|
|
|
const _type = ref('0');
|
2025-03-14 17:33:44 +08:00
|
|
|
|
watch(
|
2025-03-17 17:32:59 +08:00
|
|
|
|
() => _type.value,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
() => getData(1),
|
2025-03-14 17:33:44 +08:00
|
|
|
|
{
|
|
|
|
|
deep: true,
|
|
|
|
|
}
|
|
|
|
|
);
|
2025-03-24 17:21:44 +08:00
|
|
|
|
const searchCondition = ref({
|
2025-03-26 13:37:24 +08:00
|
|
|
|
keywords: '',
|
2025-03-24 17:21:44 +08:00
|
|
|
|
});
|
2025-03-14 17:33:44 +08:00
|
|
|
|
const crud = ref();
|
2025-03-27 15:56:05 +08:00
|
|
|
|
const _loading = ref(true);
|
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
|
|
|
|
});
|
2025-03-26 13:37:24 +08:00
|
|
|
|
|
|
|
|
|
const dicDatas = ref({
|
|
|
|
|
_targetPests: {
|
|
|
|
|
one: '1',
|
|
|
|
|
two: '1',
|
|
|
|
|
dic: [],
|
|
|
|
|
},
|
|
|
|
|
_mainComponent: {
|
|
|
|
|
one: '1',
|
|
|
|
|
two: '2',
|
|
|
|
|
dic: [],
|
|
|
|
|
},
|
|
|
|
|
_produceDosage: {
|
|
|
|
|
one: '1',
|
|
|
|
|
two: '3',
|
|
|
|
|
dic: [],
|
|
|
|
|
},
|
|
|
|
|
});
|
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-27 15:56:05 +08:00
|
|
|
|
editBtnText: '上传报告',
|
2025-03-14 17:33:44 +08:00
|
|
|
|
column: [
|
2025-03-24 17:21:44 +08:00
|
|
|
|
{
|
|
|
|
|
hide: true,
|
|
|
|
|
label: '关键字',
|
2025-03-26 13:37:24 +08:00
|
|
|
|
prop: 'keywords',
|
2025-03-24 17:21:44 +08:00
|
|
|
|
search: true,
|
|
|
|
|
addDisplay: false,
|
|
|
|
|
editDisplay: false,
|
2025-03-27 15:56:05 +08:00
|
|
|
|
searchPlaceholder: '输入肥料名称',
|
|
|
|
|
viewDisplay: false,
|
2025-03-24 17:21:44 +08:00
|
|
|
|
},
|
2025-03-27 15:56:05 +08:00
|
|
|
|
// {
|
|
|
|
|
// prop: 'id',
|
|
|
|
|
// label: '农药编号',
|
|
|
|
|
// 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-27 15:56:05 +08:00
|
|
|
|
width: '120',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
editDisplay: false,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
rules: customRules({ msg: '请输入农药名称' }),
|
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: '产品标准证号',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
width: '120',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
viewDisplay: false,
|
|
|
|
|
editDisplay: false,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
rules: customRules({ msg: '请输入产品标准证号' }),
|
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: '农药图片',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
span: 24,
|
2025-03-17 17:32:59 +08:00
|
|
|
|
editDisplay: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
hide: true,
|
2025-03-24 17:21:44 +08:00
|
|
|
|
prop: 'pesticideRegistCode',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
label: '农药登记证号',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
width: '120',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
viewDisplay: false,
|
|
|
|
|
editDisplay: false,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
rules: customRules({ msg: '请输登记证号' }),
|
2025-03-17 17:32:59 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-24 17:21:44 +08:00
|
|
|
|
prop: 'manufacturer',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
label: '生产厂家',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
width: '120',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
editDisplay: false,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
rules: customRules({ msg: '请输入生产厂家' }),
|
2025-03-17 17:32:59 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-24 17:21:44 +08:00
|
|
|
|
prop: 'distributor',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
width: '120',
|
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-27 15:56:05 +08:00
|
|
|
|
width: '100',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
label: '产品规格',
|
|
|
|
|
editDisplay: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-24 17:21:44 +08:00
|
|
|
|
prop: 'toxicityLevel',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
width: '100',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
label: '毒性',
|
|
|
|
|
editDisplay: false,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
value: '无毒',
|
2025-03-14 17:33:44 +08:00
|
|
|
|
},
|
2025-03-24 17:21:44 +08:00
|
|
|
|
{
|
|
|
|
|
prop: 'dosage',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
width: '100',
|
2025-03-24 17:21:44 +08:00
|
|
|
|
label: '建议用量',
|
|
|
|
|
editDisplay: false,
|
|
|
|
|
},
|
2025-03-14 17:33:44 +08:00
|
|
|
|
{
|
2025-03-26 13:37:24 +08:00
|
|
|
|
prop: 'expiryDate',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
label: '保质期',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
addDisplay: false,
|
2025-03-17 17:32:59 +08:00
|
|
|
|
editDisplay: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-26 13:37:24 +08:00
|
|
|
|
prop: 'targetPests',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
width: '200',
|
2025-03-26 13:37:24 +08:00
|
|
|
|
label: '防治对象',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
addDisplay: false,
|
|
|
|
|
editDisplay: false,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'mainComponent',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
width: '200',
|
2025-03-26 13:37:24 +08:00
|
|
|
|
label: '化学成分',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
addDisplay: false,
|
|
|
|
|
editDisplay: false,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'produceDosage',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
width: '200',
|
2025-03-26 13:37:24 +08:00
|
|
|
|
label: '加工剂型',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
addDisplay: false,
|
|
|
|
|
editDisplay: false,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
hide: true,
|
|
|
|
|
prop: '_targetPests',
|
2025-03-14 17:33:44 +08:00
|
|
|
|
label: '防治对象',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
type: 'cascader',
|
|
|
|
|
multiple: true,
|
2025-03-24 17:21:44 +08:00
|
|
|
|
dicData: [],
|
2025-03-26 13:37:24 +08:00
|
|
|
|
value: [],
|
2025-03-17 17:32:59 +08:00
|
|
|
|
span: 24,
|
2025-03-27 15:56:05 +08:00
|
|
|
|
viewDisplay: false,
|
2025-03-17 17:32:59 +08:00
|
|
|
|
editDisplay: false,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
rules: customRules({ msg: '请选择防治对象' }),
|
2025-03-14 17:33:44 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-26 13:37:24 +08:00
|
|
|
|
hide: true,
|
|
|
|
|
prop: '_mainComponent',
|
2025-03-14 17:33:44 +08:00
|
|
|
|
label: '化学成分',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
type: 'cascader',
|
|
|
|
|
multiple: true,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
dicData: [],
|
|
|
|
|
value: [],
|
2025-03-17 17:32:59 +08:00
|
|
|
|
span: 24,
|
2025-03-27 15:56:05 +08:00
|
|
|
|
viewDisplay: false,
|
2025-03-17 17:32:59 +08:00
|
|
|
|
editDisplay: false,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
rules: customRules({ msg: '请选择主要成分' }),
|
2025-03-14 17:33:44 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-26 13:37:24 +08:00
|
|
|
|
hide: true,
|
|
|
|
|
prop: '_produceDosage',
|
2025-03-14 17:33:44 +08:00
|
|
|
|
label: '加工剂型',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
type: 'cascader',
|
|
|
|
|
multiple: true,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
dicData: [],
|
|
|
|
|
value: [],
|
2025-03-17 17:32:59 +08:00
|
|
|
|
span: 24,
|
2025-03-27 15:56:05 +08:00
|
|
|
|
viewDisplay: false,
|
2025-03-17 17:32:59 +08:00
|
|
|
|
editDisplay: false,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
rules: customRules({ msg: '加工剂型' }),
|
2025-03-14 17:33:44 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-17 17:32:59 +08:00
|
|
|
|
hide: true,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
prop: 'usageMethod',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
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,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
prop: 'precautions',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
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: [
|
|
|
|
|
{
|
2025-03-27 15:56:05 +08:00
|
|
|
|
prop: 'pesticideName',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
label: '农药名称',
|
|
|
|
|
editDisabled: true,
|
2025-03-27 15:56:05 +08:00
|
|
|
|
span: 24,
|
2025-03-17 17:32:59 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-24 17:21:44 +08:00
|
|
|
|
prop: 'manufacturer',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
label: '生产商',
|
|
|
|
|
editDisabled: true,
|
2025-03-27 15:56:05 +08:00
|
|
|
|
span: 24,
|
2025-03-17 17:32:59 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-27 15:56:05 +08:00
|
|
|
|
prop: 'distributor',
|
|
|
|
|
label: '经销商',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
editDisabled: true,
|
2025-03-27 15:56:05 +08:00
|
|
|
|
span: 24,
|
2025-03-17 17:32:59 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-27 15:56:05 +08:00
|
|
|
|
prop: 'photoUrl',
|
|
|
|
|
label: '农药图片',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
editDisabled: true,
|
2025-03-27 15:56:05 +08:00
|
|
|
|
span: 24,
|
2025-03-17 17:32:59 +08:00
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '农药检测信息',
|
|
|
|
|
prop: 'check_info',
|
|
|
|
|
addDisplay: false,
|
|
|
|
|
viewDisplay: false,
|
|
|
|
|
column: [
|
|
|
|
|
{
|
2025-03-27 15:56:05 +08:00
|
|
|
|
prop: 'detectionTime',
|
|
|
|
|
label: '检测时间',
|
|
|
|
|
type: 'date',
|
|
|
|
|
valueFormat: 'YYYY-MM-DD',
|
|
|
|
|
rules: customRules({ msg: '请选择检测时间' }),
|
2025-03-17 17:32:59 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-27 15:56:05 +08:00
|
|
|
|
prop: 'detectionResult',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
label: '检测结果',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
type: 'select',
|
|
|
|
|
clearable: false,
|
|
|
|
|
rules: customRules({ msg: '请选择检测结果' }),
|
|
|
|
|
dicData: [
|
|
|
|
|
{ value: '0', label: '合格' },
|
|
|
|
|
{ value: '1', label: '不合格' },
|
|
|
|
|
],
|
|
|
|
|
value: '0',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-27 15:56:05 +08:00
|
|
|
|
prop: 'detectionUnit',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
label: '检测单位',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
rules: customRules({ msg: '请输入检测单位' }),
|
2025-03-17 17:32:59 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-27 15:56:05 +08:00
|
|
|
|
prop: 'detectionConclusion',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
label: '检测结论',
|
2025-03-27 15:56:05 +08:00
|
|
|
|
rules: customRules({ msg: '请输入检测结论' }),
|
2025-03-17 17:32:59 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2025-03-27 15:56:05 +08:00
|
|
|
|
prop: 'detectionReport',
|
2025-03-17 17:32:59 +08:00
|
|
|
|
label: '质检报告',
|
|
|
|
|
span: 24,
|
2025-03-27 15:56:05 +08:00
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
trigger: ['blur', 'change'],
|
|
|
|
|
validator: (rule, value, callback) => {
|
|
|
|
|
if (!reportAttrs.value.length) {
|
|
|
|
|
callback(new Error('请上传检测报告'));
|
|
|
|
|
} else {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
2025-03-17 17:32:59 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
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) {
|
2025-03-26 13:37:24 +08:00
|
|
|
|
for (let key in dicDatas.value) {
|
2025-03-24 17:21:44 +08:00
|
|
|
|
option.value.column.forEach((item) => {
|
2025-03-26 13:37:24 +08:00
|
|
|
|
if (item.prop === key) {
|
2025-03-27 15:56:05 +08:00
|
|
|
|
let dic = materialTwoLevel?.[dicDatas.value[key].one]?.[dicDatas.value[key].two] ?? [];
|
2025-03-26 13:37:24 +08:00
|
|
|
|
dicDatas.value[key].dic = dic;
|
|
|
|
|
item.dicData = dic;
|
2025-03-24 17:21:44 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
2025-03-26 13:37:24 +08:00
|
|
|
|
}
|
2025-03-24 17:21:44 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
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-27 15:56:05 +08:00
|
|
|
|
|
|
|
|
|
defaultGet(getData);
|
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,
|
2025-03-26 13:37:24 +08:00
|
|
|
|
pesticideName: searchCondition.value.keywords,
|
2025-03-24 17:21:44 +08:00
|
|
|
|
};
|
2025-03-26 13:37:24 +08:00
|
|
|
|
_type.value != '0' && (params.classifyId = _type.value);
|
2025-03-24 17:21:44 +08:00
|
|
|
|
let res = await getPesticideList(params);
|
|
|
|
|
console.log('res --- ', res);
|
|
|
|
|
_loading.value = false;
|
|
|
|
|
if (res && res.code === 200) {
|
|
|
|
|
data.value = res.data.records;
|
2025-03-27 15:56:05 +08:00
|
|
|
|
data.value.forEach((v) => {
|
|
|
|
|
v.productSpecification = `${v.productSpecification}${goodsUnitOptions.find((_v) => _v.value == v.productUnit).label}`;
|
|
|
|
|
v.dosage = `${v.suggestDosage}${useDosageUnit.find((_v) => _v.value == v.suggestUnit).label}`;
|
|
|
|
|
v.targetPests = handleShowName(v.targetPests);
|
|
|
|
|
v.mainComponent = handleShowName(v.mainComponent);
|
|
|
|
|
v.produceDosage = handleShowName(v.produceDosage);
|
|
|
|
|
});
|
2025-03-24 17:21:44 +08:00
|
|
|
|
pageData.value.total = res.data.total;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-03-17 17:32:59 +08:00
|
|
|
|
function handleCloseDialog(done) {
|
2025-03-27 15:56:05 +08:00
|
|
|
|
delete option.value.column[1].span;
|
2025-03-26 13:37:24 +08:00
|
|
|
|
resetOtherInfo();
|
2025-03-17 17:32:59 +08:00
|
|
|
|
handleCheckInfoChange();
|
|
|
|
|
done();
|
|
|
|
|
}
|
2025-03-07 14:36:54 +08:00
|
|
|
|
|
2025-03-26 13:37:24 +08:00
|
|
|
|
async function handleRowSave(form, done, loading) {
|
|
|
|
|
let data = {
|
|
|
|
|
pesticideName: form.pesticideName,
|
|
|
|
|
productStandCode: form.productStandCode,
|
|
|
|
|
pesticideRegistCode: form.pesticideRegistCode,
|
|
|
|
|
manufacturer: form.manufacturer,
|
|
|
|
|
distributor: form.distributor,
|
|
|
|
|
toxicityLevel: form.toxicityLevel,
|
|
|
|
|
usageMethod: form.usageMethod,
|
|
|
|
|
precautions: form.precautions,
|
|
|
|
|
expiryDate: form.expiryDate,
|
|
|
|
|
productSpecification: productSpecification.value.num,
|
|
|
|
|
productUnit: productSpecification.value.type,
|
|
|
|
|
suggestDosage: useDosage.value.num,
|
|
|
|
|
suggestUnit: useDosage.value.type,
|
|
|
|
|
};
|
|
|
|
|
if (attrs.value.length) {
|
2025-03-27 15:56:05 +08:00
|
|
|
|
data.photoUrl = attrs.value.map((v) => v.url).join();
|
2025-03-26 13:37:24 +08:00
|
|
|
|
}
|
|
|
|
|
if (form._targetPests.length) {
|
|
|
|
|
let names = [];
|
|
|
|
|
form._targetPests.forEach((item) => {
|
|
|
|
|
names.push(targetName(dicDatas.value._targetPests.dic, item, ''));
|
|
|
|
|
});
|
|
|
|
|
data.targetPests = JSON.stringify(form._targetPests) + '|' + JSON.stringify(names);
|
|
|
|
|
}
|
|
|
|
|
if (form._mainComponent.length) {
|
|
|
|
|
let names = [];
|
|
|
|
|
form._mainComponent.forEach((item) => {
|
|
|
|
|
names.push(targetName(dicDatas.value._mainComponent.dic, item, ''));
|
|
|
|
|
});
|
|
|
|
|
data.mainComponent = JSON.stringify(form._mainComponent) + '|' + JSON.stringify(names);
|
|
|
|
|
}
|
|
|
|
|
if (form._produceDosage.length) {
|
|
|
|
|
let names = [];
|
|
|
|
|
form._produceDosage.forEach((item) => {
|
|
|
|
|
names.push(targetName(dicDatas.value._produceDosage.dic, item, ''));
|
|
|
|
|
});
|
|
|
|
|
data.produceDosage = JSON.stringify(form._produceDosage) + '|' + JSON.stringify(names);
|
|
|
|
|
}
|
|
|
|
|
let res = await addPesticide(data);
|
2025-03-27 15:56:05 +08:00
|
|
|
|
loading();
|
2025-03-26 13:37:24 +08:00
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
ElMessage.success('保存成功');
|
|
|
|
|
getData();
|
2025-03-27 15:56:05 +08:00
|
|
|
|
resetOtherInfo();
|
|
|
|
|
done();
|
2025-03-26 13:37:24 +08:00
|
|
|
|
}
|
2025-03-17 17:32:59 +08:00
|
|
|
|
}
|
2025-03-26 13:37:24 +08:00
|
|
|
|
function resetOtherInfo() {
|
|
|
|
|
let obj = { num: 1, type: '1' };
|
|
|
|
|
attrs.value = [];
|
2025-03-27 15:56:05 +08:00
|
|
|
|
reportAttrs.value = [];
|
2025-03-26 13:37:24 +08:00
|
|
|
|
productSpecification.value = obj;
|
|
|
|
|
useDosage.value = obj;
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-17 17:32:59 +08:00
|
|
|
|
function handleEdit(row) {
|
2025-03-27 15:56:05 +08:00
|
|
|
|
handleAttrs(row);
|
|
|
|
|
option.value.group[1].column[0].value = row.detectionTime;
|
|
|
|
|
option.value.group[1].column[1].value = row.detectionResult;
|
|
|
|
|
option.value.group[1].column[2].value = row.detectionUnit;
|
|
|
|
|
option.value.group[1].column[3].value = row.detectionConclusion;
|
2025-03-17 17:32:59 +08:00
|
|
|
|
handleCheckInfoChange('open');
|
|
|
|
|
crud.value.rowEdit(row);
|
|
|
|
|
}
|
|
|
|
|
function handleInfo(row) {
|
2025-03-27 15:56:05 +08:00
|
|
|
|
handleAttrs(row);
|
|
|
|
|
option.value.column[1].span = 24;
|
2025-03-17 17:32:59 +08:00
|
|
|
|
crud.value.rowView(row);
|
|
|
|
|
}
|
2025-03-27 15:56:05 +08:00
|
|
|
|
/* 处理展示附件 */
|
|
|
|
|
function handleAttrs(row = {}) {
|
|
|
|
|
if (!row) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (row.photoUrl) {
|
|
|
|
|
attrs.value = row.photoUrl.split(',').map((v, i) => {
|
|
|
|
|
return {
|
|
|
|
|
url: v,
|
|
|
|
|
uid: `photo_${i}_${Date.now()}`,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (row.detectionReport) {
|
|
|
|
|
reportAttrs.value = row.detectionReport.split(',').map((v, i) => {
|
|
|
|
|
return {
|
|
|
|
|
url: v,
|
|
|
|
|
uid: `report_${i}_${Date.now()}`,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-03-17 17:32:59 +08:00
|
|
|
|
function handleCheckInfo(type) {
|
|
|
|
|
handleCheckInfoChange(type == 'open');
|
|
|
|
|
}
|
|
|
|
|
/* bol && 查看检测报告关闭其他信息 !bol && 关闭检测报告打开其他信息 */
|
|
|
|
|
function handleCheckInfoChange(bol = false) {
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-03-27 15:56:05 +08:00
|
|
|
|
async function handleRowUpdate(form, index, done, loading) {
|
2025-03-17 17:32:59 +08:00
|
|
|
|
console.log('update from -- ', form);
|
2025-03-27 15:56:05 +08:00
|
|
|
|
let data = {
|
|
|
|
|
id: form.id,
|
|
|
|
|
detectionTime: form.detectionTime,
|
|
|
|
|
detectionResult: form.detectionResult,
|
|
|
|
|
detectionUnit: form.detectionUnit,
|
|
|
|
|
detectionConclusion: form.detectionConclusion,
|
|
|
|
|
detectionReport: reportAttrs.value.map((v) => v.url).join(),
|
|
|
|
|
};
|
|
|
|
|
let res = await pesticideReportSave(data);
|
2025-03-17 17:32:59 +08:00
|
|
|
|
loading();
|
2025-03-27 15:56:05 +08:00
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
ElMessage.success('检测报告保存成功');
|
|
|
|
|
getData();
|
|
|
|
|
done();
|
|
|
|
|
}
|
2025-03-17 17:32:59 +08:00
|
|
|
|
}
|
2025-03-26 13:37:24 +08:00
|
|
|
|
function handleShowName(text = '') {
|
2025-03-27 15:56:05 +08:00
|
|
|
|
if (!text || !text.includes('|')) return false;
|
|
|
|
|
let names = JSON.parse(text.split('|')[1]);
|
|
|
|
|
let _t = '';
|
|
|
|
|
names.forEach((v, i) => {
|
|
|
|
|
_t += (i == 0 ? '' : ',') + v;
|
|
|
|
|
});
|
|
|
|
|
return _t;
|
2025-03-26 13:37:24 +08:00
|
|
|
|
}
|
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>
|