diff --git a/sub-government-affairs-service/src/apis/inputSuppliesApi/demandManage.js b/sub-government-affairs-service/src/apis/inputSuppliesApi/demandManage.js
index 5cc8c3c..6099fc1 100644
--- a/sub-government-affairs-service/src/apis/inputSuppliesApi/demandManage.js
+++ b/sub-government-affairs-service/src/apis/inputSuppliesApi/demandManage.js
@@ -2,7 +2,7 @@ import request from '@/utils/axios';
/* 种子种苗需求-列表 */
export function getSeedDemandRecords(params) {
- return request('/inputGoods/supervise/provenance/page', {
+ return request('/inputGoods/demand/provenance/page', {
params,
});
}
diff --git a/sub-government-affairs-service/src/views/inputSuppliesManage/demandManage/fertilizerDemand.vue b/sub-government-affairs-service/src/views/inputSuppliesManage/demandManage/fertilizerDemand.vue
index b6a9a1a..0b942bd 100644
--- a/sub-government-affairs-service/src/views/inputSuppliesManage/demandManage/fertilizerDemand.vue
+++ b/sub-government-affairs-service/src/views/inputSuppliesManage/demandManage/fertilizerDemand.vue
@@ -7,7 +7,7 @@
-
+
+
+ 查看
+ 编辑
+ 删除
+
+
+
+
+
+
+
+
+
+
+ 查询
+
+
+
+ kooriookami
+ 18100000000
+ Suzhou
+
+
+ kooriookami
+ 18100000000
+
+
+ 农药用药详情
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+import { ref, reactive, computed, onMounted, onBeforeUnmount, nextTick } from 'vue';
+import tableComponent from '@/components/tableComponent.vue';
+import { ElMessage } from 'element-plus';
+import inputSuppliesApi from '@/apis/inputSuppliesApi';
+const { getMaterailTypes } = inputSuppliesApi;
+import { getSeedDemandRecords, seedDemandSave, editSeedDemand, delSeedDemand, getRowDetails } from '@/apis/inputSuppliesApi/demandManage';
+import { useApp } from '@/hooks';
+const app = useApp();
+import Mock from 'mockjs';
-
+// 查询条件
+const formInline = reactive({
+ regionCode: '',
+ regionName: '',
+ gridId: '',
+ gridName: '',
+ seedId: '',
+ current: 1,
+ size: 10,
+});
+const searchForm = ref(null);
+const onSubmit = () => {
+ console.log(formInline);
+ formInline.current = 1;
+ loadData();
+};
+const resetForm = () => {
+ searchForm.value.resetFields();
+};
+
+// 表格数据
+const tableData = ref([]);
+const selectedIds = ref([]);
+const selectedRows = ref([]);
+const tableLoading = ref(false);
+const tableTotal = ref(0);
+const columns = ref([
+ { prop: 'regionCode', label: '编码' },
+ { prop: 'regionName', label: '化肥名称' },
+ { prop: 'gridId', label: '品牌' },
+ { prop: 'gridName', label: '生产厂家' },
+ { prop: 'landId', label: '营养分类' },
+ { prop: 'landName', label: '形态分类' },
+ { prop: 'extent', label: '产品规格' },
+ // { prop: 'action', label: '操作', slotName: 'action', width: 230, fixed: 'right' },
+]);
+
+const data = ref([
+ { regionCode: 'HF005', regionName: '尿素', gridId: '中化化肥', gridName: '中化化肥厂家', landId: '氮肥', landName: '固体肥', extent: '30千克/袋' },
+ {
+ regionCode: 'HF004',
+ regionName: '磷酸二氢钾',
+ gridId: '史丹利',
+ gridName: '史丹利',
+ landId: '复合肥',
+ landName: '固体肥',
+ extent: '40千克/袋',
+ },
+ {
+ regionCode: 'HF003',
+ regionName: '氮磷钾复合肥',
+ gridId: '全正大',
+ gridName: '全正大',
+ landId: '复合肥',
+ landName: '固体肥',
+ extent: '10千克/桶',
+ },
+]);
+const handlePaginationChange = ({ page, pageSize }) => {
+ formInline.current = page;
+ formInline.size = pageSize;
+ loadData();
+};
+let landNums = ref(0);
+let totalArea = computed(() => {
+ const sum = selectedRows.value.reduce((sum, item) => {
+ return sum + Math.round(item.extent * 100);
+ }, 0);
+ const result = sum / 100;
+ return parseFloat(result.toFixed(2));
+});
+let totalSeed = computed(() => {
+ const sum = selectedRows.value.reduce((sum, item) => {
+ return sum + Math.round(item.useNumber * 100);
+ }, 0);
+ const result = sum / 100;
+ return parseFloat(result.toFixed(2));
+});
+const handleSelectionChange = (selection, keys) => {
+ // console.log(selection, keys);
+ selectedRows.value = selection;
+ landNums.value = selection.length;
+};
+const extentArr = Mock.mock({
+ 'list|10': [{ extent: () => Mock.Random.float(100, 200, 2, 2) }],
+}).list;
+const loadData = async () => {
+ tableLoading.value = true;
+ try {
+ let response = await getSeedDemandRecords(formInline);
+ tableLoading.value = false;
+ if (response.code == 200) {
+ tableData.value = response.data.records;
+ tableTotal.value = response.data.total;
+
+ // 没有接口,添加模拟数据
+ tableData.value.forEach((el, index) => {
+ el.extent = extentArr[index].extent;
+ });
+ }
+ } catch (error) {
+ tableLoading.value = false;
+ console.error(error);
+ }
+};
+
+const extractThirdLevelChildren = (dataArray) => {
+ let result = [];
+ // 遍历第一层数组
+ for (const level1 of dataArray) {
+ // 检查第一层是否有children且是数组
+ if (level1.children && Array.isArray(level1.children)) {
+ // 遍历第二层数组
+ for (const level2 of level1.children) {
+ // 检查第二层是否有children且是数组
+ if (level2.children && Array.isArray(level2.children)) {
+ // 将第三层的所有对象添加到结果数组中
+ result.push(...level2.children);
+ }
+ }
+ }
+ }
+ return result;
+};
+const seedTypeChange = () => {
+ console.log(formInline.seedId);
+ // 重新获取表格数据,需添加参数
+};
+
+const dialogFormVisible = ref(false);
+const dialogRef = ref(null);
+const dialogTitle = ref('新增');
+const formDisabled = ref(false);
+const dialogForm = reactive({
+ id: '',
+ seedName: '', //种子种苗名称
+ varietyName: '', //品种名称
+ brand: '', //品牌
+ manufacturer: '', //生产厂家
+ classifyId: '', //蔬菜种苗id
+ classifyName: '', //蔬菜种苗名称
+ productSpecification: '', //产品规格(number)
+ productUnit: '', //产品规格单位
+ productAttributes: '', //自定义商品属性
+ photoUrl: '', //种子种苗主图
+ photoUrlDetail: '', //种子种苗详情图
+});
+const dialogFormRules = ref({
+ seedName: [{ required: true, message: '请输入种子种苗名称', trigger: 'blur' }],
+ varietyName: [{ required: true, message: '请输入品种名称', trigger: 'blur' }],
+ brand: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
+ manufacturer: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
+ classifyId: [{ required: true, message: '请选择蔬菜种苗', trigger: ['change', 'blur'] }],
+ productUnit: [{ required: true, message: '请输入产品规格', trigger: 'blur' }],
+});
+
+const addItem = async () => {
+ ElMessage.success('点击新增!');
+ // restDialogForm();
+ // dialogTitle.value = '新增';
+ // formDisabled.value = false;
+ // dialogFormVisible.value = true;
+};
+const seeDetails = async (row) => {
+ console.log('查看详情: ', row);
+ ElMessage.success('点击查看详情!');
+ // dialogTitle.value = '详情';
+ // setDialogForm(row);
+ // formDisabled.value = true;
+ // dialogFormVisible.value = true;
+};
+const handleEdit = (row) => {
+ console.log('要编辑的行: ', row);
+ ElMessage.success('点击编辑!');
+ // dialogTitle.value = '编辑';
+ // setDialogForm(row);
+ // formDisabled.value = false;
+ // dialogFormVisible.value = true;
+};
+const getDetails = async () => {
+ let response = await getRowDetails({
+ url: '/inputGoods/supervise/provenance/getDetail/',
+ id: dialogForm.id,
+ });
+ console.log(response);
+ if (response.code == 200) {
+ setDialogForm(response.data);
+ } else {
+ ElMessage.error(response.message);
+ }
+};
+const setDialogForm = (row) => {
+ // for (let key in row) {
+ // dialogForm[key] = row[key];
+ // }
+ dialogForm.id = row.id;
+ dialogForm.seedName = row.seedName;
+ dialogForm.varietyName = row.varietyName;
+ dialogForm.brand = row.brand;
+ dialogForm.manufacturer = row.manufacturer;
+ dialogForm.classifyId = row.classifyId;
+ dialogForm.classifyName = row.classifyName;
+ dialogForm.productSpecification = row.productSpecification;
+ dialogForm.productUnit = row.productUnit;
+ dialogForm.productAttributes = row.productAttributes;
+ dialogForm.photoUrl = row.photoUrl;
+ dialogForm.photoUrlDetail = row.photoUrlDetail;
+};
+const handleDelete = (row) => {
+ console.log('删除操作: ', row);
+ app
+ .$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ })
+ .then(() => {
+ deleteGoods(row.id)
+ .then((res) => {
+ if (res.code === 200) {
+ onSubmit();
+ app.$message.success('删除成功!');
+ }
+ })
+ .catch((err) => {
+ app.$message.error(err.msg);
+ });
+ })
+ .catch(() => {});
+};
+const deleteGoods = async (ids) => {
+ try {
+ let res = await delSeedDemand(ids);
+ return res;
+ } catch (error) {
+ return false;
+ }
+};
+const onSaveCategory = () => {
+ console.log(dialogForm);
+ dialogRef.value.validate(async (valid, fields) => {
+ if (valid) {
+ try {
+ let param = { ...dialogForm };
+ param.classifyId = dialogForm.classifyId.join(',');
+ param.classifyName = dialogForm.classifyName.join(',');
+ console.log(param);
+ let response;
+ if (dialogTitle.value == '新增') {
+ response = await seedDemandSave(param);
+ } else {
+ response = await editSeedDemand(param);
+ }
+ if (response.code == 200) {
+ cancelDialog();
+ onSubmit();
+ if (dialogTitle.value == '新增') {
+ ElMessage.success('新增成功!');
+ } else {
+ ElMessage.success('编辑成功!');
+ }
+ } else {
+ ElMessage.error(response.msg);
+ }
+ } catch (error) {
+ console.error(error);
+ }
+ }
+ });
+};
+const cancelDialog = async () => {
+ restDialogForm();
+ dialogFormVisible.value = false;
+};
+const restDialogForm = () => {
+ Object.assign(dialogForm, {
+ id: '',
+ seedName: '', //种子种苗名称
+ varietyName: '', //品种名称
+ brand: '', //品牌
+ manufacturer: '', //生产厂家
+ classifyId: '', //蔬菜种苗id
+ classifyName: '', //蔬菜种苗名称
+ productSpecification: '', //产品规格(number)
+ productUnit: '', //产品规格单位
+ productAttributes: '', //自定义商品属性
+ photoUrl: '', //种子种苗主图
+ photoUrlDetail: '', //种子种苗详情图
+ });
+};
+
+const seedTypeList = ref([
+ { id: '1', dataName: '氮肥' },
+ { id: '2', dataName: '磷肥' },
+ { id: '3', dataName: '钾肥' },
+ { id: '4', dataName: '复合肥' },
+]);
+const seedTypeList1 = ref([
+ { id: '1', dataName: '固体肥' },
+ { id: '2', dataName: '液体肥' },
+]);
+const seedTypeDialogList = ref([]);
+const getSeedTypeList = async () => {
+ try {
+ let response = await getMaterailTypes({ moduleType: '4' });
+ console.log(response);
+ if (response.code == 200) {
+ if (response.data?.length > 0) {
+ seedTypeDialogList.value = response.data[0].children;
+ let result = extractThirdLevelChildren(response.data);
+ // seedTypeList.value = result;
+ console.log(seedTypeDialogList.value);
+ }
+ }
+ } catch (error) {
+ console.error(error);
+ }
+};
+// 级联选择器配置
+const cascaderProps = ref({
+ label: 'dataName', // 选项标签字段名
+ value: 'id', // 选项值字段名
+ children: 'children', // 子选项字段名
+ emitPath: true,
+ expandTrigger: 'hover',
+});
+const handleCascaderChange = () => {
+ const selectedNames = getSelectedNames(dialogForm.classifyId);
+ console.log('对应的名称:', selectedNames); // 例如: ['花草类种子', '具体种子名称']
+ // 如果需要,可以将名称也保存到表单数据中
+ dialogForm.classifyName = selectedNames;
+};
+const getSelectedNames = (ids) => {
+ if (!ids || !ids.length) return [];
+
+ let names = [];
+ let currentLevel = seedTypeDialogList.value;
+
+ for (const id of ids) {
+ const foundItem = currentLevel.find((item) => item.id === id);
+ if (!foundItem) break;
+
+ names.push(foundItem.dataName);
+ currentLevel = foundItem.children || [];
+ }
+
+ return names;
+};
+
+const unitList = ref([
+ { id: '1', unit: 'kg' },
+ { id: '2', unit: 'g' },
+ { id: '3', unit: 'L' },
+ { id: '4', unit: 'ml' },
+]);
+
+onMounted(() => {
+ onSubmit();
+ getSeedTypeList();
+});
+
+
diff --git a/sub-government-affairs-service/src/views/trace/input-products/fertilizer/use/index.vue b/sub-government-affairs-service/src/views/trace/input-products/fertilizer/use/index.vue
index b9cdb79..d898b98 100644
--- a/sub-government-affairs-service/src/views/trace/input-products/fertilizer/use/index.vue
+++ b/sub-government-affairs-service/src/views/trace/input-products/fertilizer/use/index.vue
@@ -1,9 +1,479 @@
-
+
+
+
化肥使用档案
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+ 查看
+ 编辑
+ 删除
+
+
+
+
+
+
+
+
+
+
+ 查询
+
+
+
+ kooriookami
+ 18100000000
+ Suzhou
+
+
+ kooriookami
+ 18100000000
+
+
+ 农药用药详情
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+import { ref, reactive, computed, onMounted, onBeforeUnmount, nextTick } from 'vue';
+import tableComponent from '@/components/tableComponent.vue';
+import { ElMessage } from 'element-plus';
+import inputSuppliesApi from '@/apis/inputSuppliesApi';
+const { getMaterailTypes } = inputSuppliesApi;
+import { getSeedDemandRecords, seedDemandSave, editSeedDemand, delSeedDemand, getRowDetails } from '@/apis/inputSuppliesApi/demandManage';
+import { useApp } from '@/hooks';
+const app = useApp();
+import Mock from 'mockjs';
-
+// 查询条件
+const formInline = reactive({
+ regionCode: '',
+ regionName: '',
+ gridId: '',
+ gridName: '',
+ seedId: '',
+ current: 1,
+ size: 10,
+});
+const searchForm = ref(null);
+const onSubmit = () => {
+ console.log(formInline);
+ formInline.current = 1;
+ loadData();
+};
+const resetForm = () => {
+ searchForm.value.resetFields();
+};
+
+// 表格数据
+const tableData = ref([]);
+const selectedIds = ref([]);
+const selectedRows = ref([]);
+const tableLoading = ref(false);
+const tableTotal = ref(0);
+const columns = ref([
+ { prop: 'regionCode', label: '地块' },
+ { prop: 'regionName', label: '所属行政区域' },
+ { prop: 'gridId', label: '所属网格' },
+ { prop: 'gridName', label: '姓名' },
+ { prop: 'landId', label: '联系方式' },
+ { prop: 'landName', label: '化肥编号' },
+ { prop: 'extent', label: '化肥名称' },
+ { prop: 'extent1', label: '使用量' },
+ { prop: 'extent2', label: '使用时间' },
+ { prop: 'extent3', label: '检测时间' },
+ { prop: 'extent4', label: '检测结果' },
+ { prop: 'extent5', label: '检测单位' },
+ // { prop: 'action', label: '操作', slotName: 'action', width: 230, fixed: 'right' },
+]);
+
+const data = ref([
+ {
+ regionCode: '碧泉湖25号地块',
+ regionName: '耿马镇白塔社区',
+ gridId: '团结村1号网格',
+ gridName: '顾伦',
+ landId: '19578012123',
+ landName: 'HF005',
+ extent: '尿素',
+ extent1: '5kg/亩',
+ extent2: '2024-10-15',
+ extent3: '2025-2-11',
+ extent4: '合格',
+ extent5: '星辰土地环境监测站',
+ },
+]);
+
+const handlePaginationChange = ({ page, pageSize }) => {
+ formInline.current = page;
+ formInline.size = pageSize;
+ loadData();
+};
+let landNums = ref(0);
+let totalArea = computed(() => {
+ const sum = selectedRows.value.reduce((sum, item) => {
+ return sum + Math.round(item.extent * 100);
+ }, 0);
+ const result = sum / 100;
+ return parseFloat(result.toFixed(2));
+});
+let totalSeed = computed(() => {
+ const sum = selectedRows.value.reduce((sum, item) => {
+ return sum + Math.round(item.useNumber * 100);
+ }, 0);
+ const result = sum / 100;
+ return parseFloat(result.toFixed(2));
+});
+const handleSelectionChange = (selection, keys) => {
+ // console.log(selection, keys);
+ selectedRows.value = selection;
+ landNums.value = selection.length;
+};
+const extentArr = Mock.mock({
+ 'list|10': [{ extent: () => Mock.Random.float(100, 200, 2, 2) }],
+}).list;
+const loadData = async () => {
+ tableLoading.value = true;
+ try {
+ let response = await getSeedDemandRecords(formInline);
+ tableLoading.value = false;
+ if (response.code == 200) {
+ tableData.value = response.data.records;
+ tableTotal.value = response.data.total;
+
+ // 没有接口,添加模拟数据
+ tableData.value.forEach((el, index) => {
+ el.extent = extentArr[index].extent;
+ });
+ }
+ } catch (error) {
+ tableLoading.value = false;
+ console.error(error);
+ }
+};
+
+const extractThirdLevelChildren = (dataArray) => {
+ let result = [];
+ // 遍历第一层数组
+ for (const level1 of dataArray) {
+ // 检查第一层是否有children且是数组
+ if (level1.children && Array.isArray(level1.children)) {
+ // 遍历第二层数组
+ for (const level2 of level1.children) {
+ // 检查第二层是否有children且是数组
+ if (level2.children && Array.isArray(level2.children)) {
+ // 将第三层的所有对象添加到结果数组中
+ result.push(...level2.children);
+ }
+ }
+ }
+ }
+ return result;
+};
+const seedTypeChange = () => {
+ console.log(formInline.seedId);
+ // 重新获取表格数据,需添加参数
+};
+
+const dialogFormVisible = ref(false);
+const dialogRef = ref(null);
+const dialogTitle = ref('新增');
+const formDisabled = ref(false);
+const dialogForm = reactive({
+ id: '',
+ seedName: '', //种子种苗名称
+ varietyName: '', //品种名称
+ brand: '', //品牌
+ manufacturer: '', //生产厂家
+ classifyId: '', //蔬菜种苗id
+ classifyName: '', //蔬菜种苗名称
+ productSpecification: '', //产品规格(number)
+ productUnit: '', //产品规格单位
+ productAttributes: '', //自定义商品属性
+ photoUrl: '', //种子种苗主图
+ photoUrlDetail: '', //种子种苗详情图
+});
+const dialogFormRules = ref({
+ seedName: [{ required: true, message: '请输入种子种苗名称', trigger: 'blur' }],
+ varietyName: [{ required: true, message: '请输入品种名称', trigger: 'blur' }],
+ brand: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
+ manufacturer: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
+ classifyId: [{ required: true, message: '请选择蔬菜种苗', trigger: ['change', 'blur'] }],
+ productUnit: [{ required: true, message: '请输入产品规格', trigger: 'blur' }],
+});
+
+const addItem = async () => {
+ ElMessage.success('点击新增!');
+ // restDialogForm();
+ // dialogTitle.value = '新增';
+ // formDisabled.value = false;
+ // dialogFormVisible.value = true;
+};
+const seeDetails = async (row) => {
+ console.log('查看详情: ', row);
+ ElMessage.success('点击查看详情!');
+ // dialogTitle.value = '详情';
+ // setDialogForm(row);
+ // formDisabled.value = true;
+ // dialogFormVisible.value = true;
+};
+const handleEdit = (row) => {
+ console.log('要编辑的行: ', row);
+ ElMessage.success('点击编辑!');
+ // dialogTitle.value = '编辑';
+ // setDialogForm(row);
+ // formDisabled.value = false;
+ // dialogFormVisible.value = true;
+};
+const getDetails = async () => {
+ let response = await getRowDetails({
+ url: '/inputGoods/supervise/provenance/getDetail/',
+ id: dialogForm.id,
+ });
+ console.log(response);
+ if (response.code == 200) {
+ setDialogForm(response.data);
+ } else {
+ ElMessage.error(response.message);
+ }
+};
+const setDialogForm = (row) => {
+ dialogForm.id = row.id;
+ dialogForm.seedName = row.seedName;
+ dialogForm.varietyName = row.varietyName;
+ dialogForm.brand = row.brand;
+ dialogForm.manufacturer = row.manufacturer;
+ dialogForm.classifyId = row.classifyId;
+ dialogForm.classifyName = row.classifyName;
+ dialogForm.productSpecification = row.productSpecification;
+ dialogForm.productUnit = row.productUnit;
+ dialogForm.productAttributes = row.productAttributes;
+ dialogForm.photoUrl = row.photoUrl;
+ dialogForm.photoUrlDetail = row.photoUrlDetail;
+};
+const handleDelete = (row) => {
+ console.log('删除操作: ', row);
+ app
+ .$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ })
+ .then(() => {
+ deleteGoods(row.id)
+ .then((res) => {
+ if (res.code === 200) {
+ onSubmit();
+ app.$message.success('删除成功!');
+ }
+ })
+ .catch((err) => {
+ app.$message.error(err.msg);
+ });
+ })
+ .catch(() => {});
+};
+const deleteGoods = async (ids) => {
+ try {
+ let res = await delSeedDemand(ids);
+ return res;
+ } catch (error) {
+ return false;
+ }
+};
+const onSaveCategory = () => {
+ console.log(dialogForm);
+ dialogRef.value.validate(async (valid, fields) => {
+ if (valid) {
+ try {
+ let param = { ...dialogForm };
+ param.classifyId = dialogForm.classifyId.join(',');
+ param.classifyName = dialogForm.classifyName.join(',');
+ console.log(param);
+ let response;
+ if (dialogTitle.value == '新增') {
+ response = await seedDemandSave(param);
+ } else {
+ response = await editSeedDemand(param);
+ }
+ if (response.code == 200) {
+ cancelDialog();
+ onSubmit();
+ if (dialogTitle.value == '新增') {
+ ElMessage.success('新增成功!');
+ } else {
+ ElMessage.success('编辑成功!');
+ }
+ } else {
+ ElMessage.error(response.msg);
+ }
+ } catch (error) {
+ console.error(error);
+ }
+ }
+ });
+};
+const cancelDialog = async () => {
+ restDialogForm();
+ dialogFormVisible.value = false;
+};
+const restDialogForm = () => {
+ Object.assign(dialogForm, {
+ id: '',
+ seedName: '', //种子种苗名称
+ varietyName: '', //品种名称
+ brand: '', //品牌
+ manufacturer: '', //生产厂家
+ classifyId: '', //蔬菜种苗id
+ classifyName: '', //蔬菜种苗名称
+ productSpecification: '', //产品规格(number)
+ productUnit: '', //产品规格单位
+ productAttributes: '', //自定义商品属性
+ photoUrl: '', //种子种苗主图
+ photoUrlDetail: '', //种子种苗详情图
+ });
+};
+
+const seedTypeList = ref([
+ { id: '1', dataName: '番茄' },
+ { id: '2', dataName: '白菜' },
+ { id: '3', dataName: '辣椒' },
+]);
+const seedTypeDialogList = ref([]);
+const getSeedTypeList = async () => {
+ try {
+ let response = await getMaterailTypes({ moduleType: '4' });
+ console.log(response);
+ if (response.code == 200) {
+ if (response.data?.length > 0) {
+ seedTypeDialogList.value = response.data[0].children;
+ let result = extractThirdLevelChildren(response.data);
+ seedTypeList.value = result;
+ console.log(seedTypeDialogList.value);
+ }
+ }
+ } catch (error) {
+ console.error(error);
+ }
+};
+// 级联选择器配置
+const cascaderProps = ref({
+ label: 'dataName', // 选项标签字段名
+ value: 'id', // 选项值字段名
+ children: 'children', // 子选项字段名
+ emitPath: true,
+ expandTrigger: 'hover',
+});
+const handleCascaderChange = () => {
+ const selectedNames = getSelectedNames(dialogForm.classifyId);
+ console.log('对应的名称:', selectedNames); // 例如: ['花草类种子', '具体种子名称']
+ // 如果需要,可以将名称也保存到表单数据中
+ dialogForm.classifyName = selectedNames;
+};
+const getSelectedNames = (ids) => {
+ if (!ids || !ids.length) return [];
+
+ let names = [];
+ let currentLevel = seedTypeDialogList.value;
+
+ for (const id of ids) {
+ const foundItem = currentLevel.find((item) => item.id === id);
+ if (!foundItem) break;
+
+ names.push(foundItem.dataName);
+ currentLevel = foundItem.children || [];
+ }
+
+ return names;
+};
+
+const unitList = ref([
+ { id: '1', unit: 'kg' },
+ { id: '2', unit: 'g' },
+ { id: '3', unit: 'L' },
+ { id: '4', unit: 'ml' },
+]);
+
+onMounted(() => {
+ onSubmit();
+ getSeedTypeList();
+});
+
+
diff --git a/sub-government-affairs-service/src/views/trace/input-products/pesticide/basic/index.vue b/sub-government-affairs-service/src/views/trace/input-products/pesticide/basic/index.vue
index b9cdb79..2ec6d48 100644
--- a/sub-government-affairs-service/src/views/trace/input-products/pesticide/basic/index.vue
+++ b/sub-government-affairs-service/src/views/trace/input-products/pesticide/basic/index.vue
@@ -1,9 +1,471 @@
-
+
+
+
农药基本信息档案
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+ 查看
+ 编辑
+ 删除
+
+
+
+
+
+
+
+
+
+
+ 查询
+
+
+
+ kooriookami
+ 18100000000
+ Suzhou
+
+
+ kooriookami
+ 18100000000
+
+
+ 农药用药详情
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+import { ref, reactive, computed, onMounted, onBeforeUnmount, nextTick } from 'vue';
+import tableComponent from '@/components/tableComponent.vue';
+import { ElMessage } from 'element-plus';
+import inputSuppliesApi from '@/apis/inputSuppliesApi';
+const { getMaterailTypes } = inputSuppliesApi;
+import { getSeedDemandRecords, seedDemandSave, editSeedDemand, delSeedDemand, getRowDetails } from '@/apis/inputSuppliesApi/demandManage';
+import { useApp } from '@/hooks';
+const app = useApp();
+import Mock from 'mockjs';
-
+// 查询条件
+const formInline = reactive({
+ regionCode: '',
+ regionName: '',
+ gridId: '',
+ gridName: '',
+ seedId: '',
+ current: 1,
+ size: 10,
+});
+const searchForm = ref(null);
+const onSubmit = () => {
+ console.log(formInline);
+ formInline.current = 1;
+ loadData();
+};
+const resetForm = () => {
+ searchForm.value.resetFields();
+};
+
+// 表格数据
+const tableData = ref([]);
+const selectedIds = ref([]);
+const selectedRows = ref([]);
+const tableLoading = ref(false);
+const tableTotal = ref(0);
+const columns = ref([
+ { prop: 'regionCode', label: '编码' },
+ { prop: 'regionName', label: '农药名称' },
+ { prop: 'gridId', label: '品牌' },
+ { prop: 'gridName', label: '生产厂家' },
+ { prop: 'landId', label: '分类' },
+ { prop: 'extent', label: '产品规格' },
+ // { prop: 'action', label: '操作', slotName: 'action', width: 230, fixed: 'right' },
+]);
+
+const data = ref([
+ { regionCode: 'F005', regionName: '三氟吡啶胺', gridId: '先正达', gridName: '先正达', landId: '杀虫剂', extent: '3千克/瓶' },
+ { regionCode: 'F004', regionName: '氟螨双醚', gridId: '拜耳', gridName: '拜耳作物科学', landId: '杀菌剂', extent: '4千克/瓶' },
+ { regionCode: 'F003', regionName: '草甘膦铵盐', gridId: '杨农', gridName: '杨农化工', landId: '除草剂', extent: '1千克/瓶' },
+ { regionCode: 'F002', regionName: '氯虫苯甲酰胺', gridId: '新安', gridName: '新安化工', landId: '杀虫剂', extent: '4千克/瓶' },
+ { regionCode: 'F001', regionName: '高效氯氟氰菊酯', gridId: '利尔', gridName: '利尔化学', landId: '植物生长调节剂', extent: '5千克/瓶' },
+]);
+
+const handlePaginationChange = ({ page, pageSize }) => {
+ formInline.current = page;
+ formInline.size = pageSize;
+ loadData();
+};
+let landNums = ref(0);
+let totalArea = computed(() => {
+ const sum = selectedRows.value.reduce((sum, item) => {
+ return sum + Math.round(item.extent * 100);
+ }, 0);
+ const result = sum / 100;
+ return parseFloat(result.toFixed(2));
+});
+let totalSeed = computed(() => {
+ const sum = selectedRows.value.reduce((sum, item) => {
+ return sum + Math.round(item.useNumber * 100);
+ }, 0);
+ const result = sum / 100;
+ return parseFloat(result.toFixed(2));
+});
+const handleSelectionChange = (selection, keys) => {
+ // console.log(selection, keys);
+ selectedRows.value = selection;
+ landNums.value = selection.length;
+};
+const extentArr = Mock.mock({
+ 'list|10': [{ extent: () => Mock.Random.float(100, 200, 2, 2) }],
+}).list;
+const loadData = async () => {
+ tableLoading.value = true;
+ try {
+ let response = await getSeedDemandRecords(formInline);
+ tableLoading.value = false;
+ if (response.code == 200) {
+ tableData.value = response.data.records;
+ tableTotal.value = response.data.total;
+
+ // 没有接口,添加模拟数据
+ tableData.value.forEach((el, index) => {
+ el.extent = extentArr[index].extent;
+ });
+ }
+ } catch (error) {
+ tableLoading.value = false;
+ console.error(error);
+ }
+};
+
+const extractThirdLevelChildren = (dataArray) => {
+ let result = [];
+ // 遍历第一层数组
+ for (const level1 of dataArray) {
+ // 检查第一层是否有children且是数组
+ if (level1.children && Array.isArray(level1.children)) {
+ // 遍历第二层数组
+ for (const level2 of level1.children) {
+ // 检查第二层是否有children且是数组
+ if (level2.children && Array.isArray(level2.children)) {
+ // 将第三层的所有对象添加到结果数组中
+ result.push(...level2.children);
+ }
+ }
+ }
+ }
+ return result;
+};
+const seedTypeChange = () => {
+ console.log(formInline.seedId);
+ // 重新获取表格数据,需添加参数
+};
+
+const dialogFormVisible = ref(false);
+const dialogRef = ref(null);
+const dialogTitle = ref('新增');
+const formDisabled = ref(false);
+const dialogForm = reactive({
+ id: '',
+ seedName: '', //种子种苗名称
+ varietyName: '', //品种名称
+ brand: '', //品牌
+ manufacturer: '', //生产厂家
+ classifyId: '', //蔬菜种苗id
+ classifyName: '', //蔬菜种苗名称
+ productSpecification: '', //产品规格(number)
+ productUnit: '', //产品规格单位
+ productAttributes: '', //自定义商品属性
+ photoUrl: '', //种子种苗主图
+ photoUrlDetail: '', //种子种苗详情图
+});
+const dialogFormRules = ref({
+ seedName: [{ required: true, message: '请输入种子种苗名称', trigger: 'blur' }],
+ varietyName: [{ required: true, message: '请输入品种名称', trigger: 'blur' }],
+ brand: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
+ manufacturer: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
+ classifyId: [{ required: true, message: '请选择蔬菜种苗', trigger: ['change', 'blur'] }],
+ productUnit: [{ required: true, message: '请输入产品规格', trigger: 'blur' }],
+});
+
+const addItem = async () => {
+ ElMessage.success('点击新增!');
+ // restDialogForm();
+ // dialogTitle.value = '新增';
+ // formDisabled.value = false;
+ // dialogFormVisible.value = true;
+};
+const seeDetails = async (row) => {
+ console.log('查看详情: ', row);
+ ElMessage.success('点击查看详情!');
+ // dialogTitle.value = '详情';
+ // setDialogForm(row);
+ // formDisabled.value = true;
+ // dialogFormVisible.value = true;
+};
+const handleEdit = (row) => {
+ console.log('要编辑的行: ', row);
+ ElMessage.success('点击编辑!');
+ // dialogTitle.value = '编辑';
+ // setDialogForm(row);
+ // formDisabled.value = false;
+ // dialogFormVisible.value = true;
+};
+const getDetails = async () => {
+ let response = await getRowDetails({
+ url: '/inputGoods/supervise/provenance/getDetail/',
+ id: dialogForm.id,
+ });
+ console.log(response);
+ if (response.code == 200) {
+ setDialogForm(response.data);
+ } else {
+ ElMessage.error(response.message);
+ }
+};
+const setDialogForm = (row) => {
+ dialogForm.id = row.id;
+ dialogForm.seedName = row.seedName;
+ dialogForm.varietyName = row.varietyName;
+ dialogForm.brand = row.brand;
+ dialogForm.manufacturer = row.manufacturer;
+ dialogForm.classifyId = row.classifyId;
+ dialogForm.classifyName = row.classifyName;
+ dialogForm.productSpecification = row.productSpecification;
+ dialogForm.productUnit = row.productUnit;
+ dialogForm.productAttributes = row.productAttributes;
+ dialogForm.photoUrl = row.photoUrl;
+ dialogForm.photoUrlDetail = row.photoUrlDetail;
+};
+const handleDelete = (row) => {
+ console.log('删除操作: ', row);
+ app
+ .$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ })
+ .then(() => {
+ deleteGoods(row.id)
+ .then((res) => {
+ if (res.code === 200) {
+ onSubmit();
+ app.$message.success('删除成功!');
+ }
+ })
+ .catch((err) => {
+ app.$message.error(err.msg);
+ });
+ })
+ .catch(() => {});
+};
+const deleteGoods = async (ids) => {
+ try {
+ let res = await delSeedDemand(ids);
+ return res;
+ } catch (error) {
+ return false;
+ }
+};
+const onSaveCategory = () => {
+ console.log(dialogForm);
+ dialogRef.value.validate(async (valid, fields) => {
+ if (valid) {
+ try {
+ let param = { ...dialogForm };
+ param.classifyId = dialogForm.classifyId.join(',');
+ param.classifyName = dialogForm.classifyName.join(',');
+ console.log(param);
+ let response;
+ if (dialogTitle.value == '新增') {
+ response = await seedDemandSave(param);
+ } else {
+ response = await editSeedDemand(param);
+ }
+ if (response.code == 200) {
+ cancelDialog();
+ onSubmit();
+ if (dialogTitle.value == '新增') {
+ ElMessage.success('新增成功!');
+ } else {
+ ElMessage.success('编辑成功!');
+ }
+ } else {
+ ElMessage.error(response.msg);
+ }
+ } catch (error) {
+ console.error(error);
+ }
+ }
+ });
+};
+const cancelDialog = async () => {
+ restDialogForm();
+ dialogFormVisible.value = false;
+};
+const restDialogForm = () => {
+ Object.assign(dialogForm, {
+ id: '',
+ seedName: '', //种子种苗名称
+ varietyName: '', //品种名称
+ brand: '', //品牌
+ manufacturer: '', //生产厂家
+ classifyId: '', //蔬菜种苗id
+ classifyName: '', //蔬菜种苗名称
+ productSpecification: '', //产品规格(number)
+ productUnit: '', //产品规格单位
+ productAttributes: '', //自定义商品属性
+ photoUrl: '', //种子种苗主图
+ photoUrlDetail: '', //种子种苗详情图
+ });
+};
+
+const seedTypeList = ref([
+ { id: '1', dataName: '杀虫剂' },
+ { id: '2', dataName: '杀菌剂' },
+ { id: '3', dataName: '除草剂' },
+ { id: '4', dataName: '杀虫剂' },
+ { id: '5', dataName: '植物生长调节剂' },
+]);
+const seedTypeDialogList = ref([]);
+const getSeedTypeList = async () => {
+ try {
+ let response = await getMaterailTypes({ moduleType: '4' });
+ console.log(response);
+ if (response.code == 200) {
+ if (response.data?.length > 0) {
+ seedTypeDialogList.value = response.data[0].children;
+ let result = extractThirdLevelChildren(response.data);
+ // seedTypeList.value = result;
+ console.log(seedTypeDialogList.value);
+ }
+ }
+ } catch (error) {
+ console.error(error);
+ }
+};
+// 级联选择器配置
+const cascaderProps = ref({
+ label: 'dataName', // 选项标签字段名
+ value: 'id', // 选项值字段名
+ children: 'children', // 子选项字段名
+ emitPath: true,
+ expandTrigger: 'hover',
+});
+const handleCascaderChange = () => {
+ const selectedNames = getSelectedNames(dialogForm.classifyId);
+ console.log('对应的名称:', selectedNames); // 例如: ['花草类种子', '具体种子名称']
+ // 如果需要,可以将名称也保存到表单数据中
+ dialogForm.classifyName = selectedNames;
+};
+const getSelectedNames = (ids) => {
+ if (!ids || !ids.length) return [];
+
+ let names = [];
+ let currentLevel = seedTypeDialogList.value;
+
+ for (const id of ids) {
+ const foundItem = currentLevel.find((item) => item.id === id);
+ if (!foundItem) break;
+
+ names.push(foundItem.dataName);
+ currentLevel = foundItem.children || [];
+ }
+
+ return names;
+};
+
+const unitList = ref([
+ { id: '1', unit: 'kg' },
+ { id: '2', unit: 'g' },
+ { id: '3', unit: 'L' },
+ { id: '4', unit: 'ml' },
+]);
+
+onMounted(() => {
+ onSubmit();
+ getSeedTypeList();
+});
+
+
diff --git a/sub-government-affairs-service/src/views/trace/input-products/pesticide/use/index.vue b/sub-government-affairs-service/src/views/trace/input-products/pesticide/use/index.vue
index b9cdb79..f862f1b 100644
--- a/sub-government-affairs-service/src/views/trace/input-products/pesticide/use/index.vue
+++ b/sub-government-affairs-service/src/views/trace/input-products/pesticide/use/index.vue
@@ -1,9 +1,490 @@
-
+
+
+
农药使用档案
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+ 查看
+ 编辑
+ 删除
+
+
+
+
+
+
+
+
+
+
+ 查询
+
+
+
+ kooriookami
+ 18100000000
+ Suzhou
+
+
+ kooriookami
+ 18100000000
+
+
+ 农药用药详情
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+import { ref, reactive, computed, onMounted, onBeforeUnmount, nextTick } from 'vue';
+import tableComponent from '@/components/tableComponent.vue';
+import { ElMessage } from 'element-plus';
+import inputSuppliesApi from '@/apis/inputSuppliesApi';
+const { getMaterailTypes } = inputSuppliesApi;
+import { getSeedDemandRecords, seedDemandSave, editSeedDemand, delSeedDemand, getRowDetails } from '@/apis/inputSuppliesApi/demandManage';
+import { useApp } from '@/hooks';
+const app = useApp();
+import Mock from 'mockjs';
-
+// 查询条件
+const formInline = reactive({
+ regionCode: '',
+ regionName: '',
+ gridId: '',
+ gridName: '',
+ seedId: '',
+ current: 1,
+ size: 10,
+});
+const searchForm = ref(null);
+const onSubmit = () => {
+ console.log(formInline);
+ formInline.current = 1;
+ loadData();
+};
+const resetForm = () => {
+ searchForm.value.resetFields();
+};
+
+// 表格数据
+const tableData = ref([]);
+const selectedIds = ref([]);
+const selectedRows = ref([]);
+const tableLoading = ref(false);
+const tableTotal = ref(0);
+const columns = ref([
+ { prop: 'regionCode', label: '姓名' },
+ { prop: 'regionName', label: '联系方式' },
+ { prop: 'gridId', label: '用药地块' },
+ { prop: 'gridName', label: '检测时间' },
+ { prop: 'landId', label: '检测结果' },
+ { prop: 'landName', label: '检测单位' },
+ { prop: 'extent', label: '检测报告(是否上传)' },
+ // { prop: 'action', label: '操作', slotName: 'action', width: 230, fixed: 'right' },
+]);
+
+const data = ref([
+ {
+ regionCode: '周乐心',
+ regionName: '19533319000',
+ gridId: '碧泉湖25号地块',
+ gridName: '2024-11-22',
+ landId: '合格',
+ landName: '星辰士地环境监测站',
+ extent: '是',
+ },
+ {
+ regionCode: '孙忆枫',
+ regionName: '19876782134',
+ gridId: '晓东塘87号地块',
+ gridName: '2024-11-22',
+ landId: '合格',
+ landName: '星辰士地环境监测站',
+ extent: '否',
+ },
+ {
+ regionCode: '李书易',
+ regionName: '19578012123',
+ gridId: '月华路东52号地块',
+ gridName: '2024-11-22',
+ landId: '合格',
+ landName: '星辰士地环境监测站',
+ extent: '是',
+ },
+]);
+const handlePaginationChange = ({ page, pageSize }) => {
+ formInline.current = page;
+ formInline.size = pageSize;
+ loadData();
+};
+let landNums = ref(0);
+let totalArea = computed(() => {
+ const sum = selectedRows.value.reduce((sum, item) => {
+ return sum + Math.round(item.extent * 100);
+ }, 0);
+ const result = sum / 100;
+ return parseFloat(result.toFixed(2));
+});
+let totalSeed = computed(() => {
+ const sum = selectedRows.value.reduce((sum, item) => {
+ return sum + Math.round(item.useNumber * 100);
+ }, 0);
+ const result = sum / 100;
+ return parseFloat(result.toFixed(2));
+});
+const handleSelectionChange = (selection, keys) => {
+ // console.log(selection, keys);
+ selectedRows.value = selection;
+ landNums.value = selection.length;
+};
+const extentArr = Mock.mock({
+ 'list|10': [{ extent: () => Mock.Random.float(100, 200, 2, 2) }],
+}).list;
+const loadData = async () => {
+ tableLoading.value = true;
+ try {
+ let response = await getSeedDemandRecords(formInline);
+ tableLoading.value = false;
+ if (response.code == 200) {
+ tableData.value = response.data.records;
+ tableTotal.value = response.data.total;
+
+ // 没有接口,添加模拟数据
+ tableData.value.forEach((el, index) => {
+ el.extent = extentArr[index].extent;
+ });
+ }
+ } catch (error) {
+ tableLoading.value = false;
+ console.error(error);
+ }
+};
+
+const extractThirdLevelChildren = (dataArray) => {
+ let result = [];
+ // 遍历第一层数组
+ for (const level1 of dataArray) {
+ // 检查第一层是否有children且是数组
+ if (level1.children && Array.isArray(level1.children)) {
+ // 遍历第二层数组
+ for (const level2 of level1.children) {
+ // 检查第二层是否有children且是数组
+ if (level2.children && Array.isArray(level2.children)) {
+ // 将第三层的所有对象添加到结果数组中
+ result.push(...level2.children);
+ }
+ }
+ }
+ }
+ return result;
+};
+const seedTypeChange = () => {
+ console.log(formInline.seedId);
+ // 重新获取表格数据,需添加参数
+};
+
+const dialogFormVisible = ref(false);
+const dialogRef = ref(null);
+const dialogTitle = ref('新增');
+const formDisabled = ref(false);
+const dialogForm = reactive({
+ id: '',
+ seedName: '', //种子种苗名称
+ varietyName: '', //品种名称
+ brand: '', //品牌
+ manufacturer: '', //生产厂家
+ classifyId: '', //蔬菜种苗id
+ classifyName: '', //蔬菜种苗名称
+ productSpecification: '', //产品规格(number)
+ productUnit: '', //产品规格单位
+ productAttributes: '', //自定义商品属性
+ photoUrl: '', //种子种苗主图
+ photoUrlDetail: '', //种子种苗详情图
+});
+const dialogFormRules = ref({
+ seedName: [{ required: true, message: '请输入种子种苗名称', trigger: 'blur' }],
+ varietyName: [{ required: true, message: '请输入品种名称', trigger: 'blur' }],
+ brand: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
+ manufacturer: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
+ classifyId: [{ required: true, message: '请选择蔬菜种苗', trigger: ['change', 'blur'] }],
+ productUnit: [{ required: true, message: '请输入产品规格', trigger: 'blur' }],
+});
+
+const addItem = async () => {
+ ElMessage.success('点击新增!');
+ // restDialogForm();
+ // dialogTitle.value = '新增';
+ // formDisabled.value = false;
+ // dialogFormVisible.value = true;
+};
+const seeDetails = async (row) => {
+ console.log('查看详情: ', row);
+ ElMessage.success('点击查看详情!');
+ // dialogTitle.value = '详情';
+ // setDialogForm(row);
+ // formDisabled.value = true;
+ // dialogFormVisible.value = true;
+};
+const handleEdit = (row) => {
+ console.log('要编辑的行: ', row);
+ ElMessage.success('点击编辑!');
+ // dialogTitle.value = '编辑';
+ // setDialogForm(row);
+ // formDisabled.value = false;
+ // dialogFormVisible.value = true;
+};
+const getDetails = async () => {
+ let response = await getRowDetails({
+ url: '/inputGoods/supervise/provenance/getDetail/',
+ id: dialogForm.id,
+ });
+ console.log(response);
+ if (response.code == 200) {
+ setDialogForm(response.data);
+ } else {
+ ElMessage.error(response.message);
+ }
+};
+const setDialogForm = (row) => {
+ dialogForm.id = row.id;
+ dialogForm.seedName = row.seedName;
+ dialogForm.varietyName = row.varietyName;
+ dialogForm.brand = row.brand;
+ dialogForm.manufacturer = row.manufacturer;
+ dialogForm.classifyId = row.classifyId;
+ dialogForm.classifyName = row.classifyName;
+ dialogForm.productSpecification = row.productSpecification;
+ dialogForm.productUnit = row.productUnit;
+ dialogForm.productAttributes = row.productAttributes;
+ dialogForm.photoUrl = row.photoUrl;
+ dialogForm.photoUrlDetail = row.photoUrlDetail;
+};
+const handleDelete = (row) => {
+ console.log('删除操作: ', row);
+ app
+ .$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ })
+ .then(() => {
+ deleteGoods(row.id)
+ .then((res) => {
+ if (res.code === 200) {
+ onSubmit();
+ app.$message.success('删除成功!');
+ }
+ })
+ .catch((err) => {
+ app.$message.error(err.msg);
+ });
+ })
+ .catch(() => {});
+};
+const deleteGoods = async (ids) => {
+ try {
+ let res = await delSeedDemand(ids);
+ return res;
+ } catch (error) {
+ return false;
+ }
+};
+const onSaveCategory = () => {
+ console.log(dialogForm);
+ dialogRef.value.validate(async (valid, fields) => {
+ if (valid) {
+ try {
+ let param = { ...dialogForm };
+ param.classifyId = dialogForm.classifyId.join(',');
+ param.classifyName = dialogForm.classifyName.join(',');
+ console.log(param);
+ let response;
+ if (dialogTitle.value == '新增') {
+ response = await seedDemandSave(param);
+ } else {
+ response = await editSeedDemand(param);
+ }
+ if (response.code == 200) {
+ cancelDialog();
+ onSubmit();
+ if (dialogTitle.value == '新增') {
+ ElMessage.success('新增成功!');
+ } else {
+ ElMessage.success('编辑成功!');
+ }
+ } else {
+ ElMessage.error(response.msg);
+ }
+ } catch (error) {
+ console.error(error);
+ }
+ }
+ });
+};
+const cancelDialog = async () => {
+ restDialogForm();
+ dialogFormVisible.value = false;
+};
+const restDialogForm = () => {
+ Object.assign(dialogForm, {
+ id: '',
+ seedName: '', //种子种苗名称
+ varietyName: '', //品种名称
+ brand: '', //品牌
+ manufacturer: '', //生产厂家
+ classifyId: '', //蔬菜种苗id
+ classifyName: '', //蔬菜种苗名称
+ productSpecification: '', //产品规格(number)
+ productUnit: '', //产品规格单位
+ productAttributes: '', //自定义商品属性
+ photoUrl: '', //种子种苗主图
+ photoUrlDetail: '', //种子种苗详情图
+ });
+};
+
+const seedTypeList = ref([
+ { id: '1', dataName: '合格' },
+ { id: '2', dataName: '不合格' },
+]);
+const seedTypeDialogList = ref([]);
+const getSeedTypeList = async () => {
+ try {
+ let response = await getMaterailTypes({ moduleType: '4' });
+ console.log(response);
+ if (response.code == 200) {
+ if (response.data?.length > 0) {
+ seedTypeDialogList.value = response.data[0].children;
+ let result = extractThirdLevelChildren(response.data);
+ // seedTypeList.value = result;
+ console.log(seedTypeDialogList.value);
+ }
+ }
+ } catch (error) {
+ console.error(error);
+ }
+};
+// 级联选择器配置
+const cascaderProps = ref({
+ label: 'dataName', // 选项标签字段名
+ value: 'id', // 选项值字段名
+ children: 'children', // 子选项字段名
+ emitPath: true,
+ expandTrigger: 'hover',
+});
+const handleCascaderChange = () => {
+ const selectedNames = getSelectedNames(dialogForm.classifyId);
+ console.log('对应的名称:', selectedNames); // 例如: ['花草类种子', '具体种子名称']
+ // 如果需要,可以将名称也保存到表单数据中
+ dialogForm.classifyName = selectedNames;
+};
+const getSelectedNames = (ids) => {
+ if (!ids || !ids.length) return [];
+
+ let names = [];
+ let currentLevel = seedTypeDialogList.value;
+
+ for (const id of ids) {
+ const foundItem = currentLevel.find((item) => item.id === id);
+ if (!foundItem) break;
+
+ names.push(foundItem.dataName);
+ currentLevel = foundItem.children || [];
+ }
+
+ return names;
+};
+
+const unitList = ref([
+ { id: '1', unit: 'kg' },
+ { id: '2', unit: 'g' },
+ { id: '3', unit: 'L' },
+ { id: '4', unit: 'ml' },
+]);
+
+onMounted(() => {
+ onSubmit();
+ getSeedTypeList();
+});
+
+
diff --git a/sub-government-affairs-service/src/views/trace/planting/seedling/basic/index.vue b/sub-government-affairs-service/src/views/trace/planting/seedling/basic/index.vue
index e69de29..76c6419 100644
--- a/sub-government-affairs-service/src/views/trace/planting/seedling/basic/index.vue
+++ b/sub-government-affairs-service/src/views/trace/planting/seedling/basic/index.vue
@@ -0,0 +1,437 @@
+
+
+
+
种子种苗基本信息档案
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sub-government-affairs-service/src/views/trace/planting/seedling/use/index.vue b/sub-government-affairs-service/src/views/trace/planting/seedling/use/index.vue
index b9cdb79..b3d0c42 100644
--- a/sub-government-affairs-service/src/views/trace/planting/seedling/use/index.vue
+++ b/sub-government-affairs-service/src/views/trace/planting/seedling/use/index.vue
@@ -1,9 +1,479 @@
-
+
+
+
种子种苗使用档案
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+ 新增
+
+
+
+
+
+
+
+
+ {{ dialogForm.regionCode }}
+ {{ dialogForm.regionName }}
+ {{ dialogForm.gridId }}
+ {{ dialogForm.gridName }}
+ {{ dialogForm.landId }}
+ {{ dialogForm.landName }}
+
+
+ {{ dialogForm.businessEntityCode }}
+ {{ dialogForm.businessEntityName }}
+
+
+ 使用信息
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+import { ref, reactive, computed, onMounted, onBeforeUnmount, nextTick } from 'vue';
+import tableComponent from '@/components/tableComponent.vue';
+import LandSelect from '@/components/LandSelect.vue';
+import { ElMessage } from 'element-plus';
+import inputSuppliesApi from '@/apis/inputSuppliesApi';
+const { getMaterailTypes } = inputSuppliesApi;
+import {
+ getSeedUseRegulatoryRecords,
+ seedUseRegulatorySave,
+ editSeedUseRegulatory,
+ delSeedUseRegulatory,
+ getLandList,
+} from '@/apis/inputSuppliesApi/supervisionOfInputs';
+import request from '@/utils/axios';
+import { GetDictTypeInfo } from '@/apis/system/dictType';
+import { useApp } from '@/hooks';
+const app = useApp();
-
+// 查询条件
+const formInline = reactive({
+ name: '',
+ seedTypeId: '',
+ current: 1,
+ size: 10,
+});
+const searchForm = ref(null);
+const onSubmit = () => {
+ formInline.current = 1;
+ loadData();
+};
+const resetForm = () => {
+ searchForm.value.resetFields();
+};
+
+// 表格数据
+const tableData = ref([]);
+const selectedIds = ref([]);
+const tableLoading = ref(false);
+const tableTotal = ref(0);
+const columns = ref([
+ { prop: 'landName', label: '地块名称' },
+ { prop: 'regionCode', label: '所属行政区划' },
+ { prop: 'gridName', label: '所属网格' },
+ { prop: 'name', label: '姓名' },
+ { prop: 'phone', label: '联系方式' },
+ { prop: 'provenanceId', label: '种子编号' },
+ { prop: 'provenanceName', label: '种子种苗名称' },
+ { prop: 'useNumber', label: '使用量' },
+ { prop: 'useTime', label: '使用时间' },
+ { prop: 'action', label: '操作', slotName: 'action', width: 100, fixed: 'right' },
+]);
+const handlePaginationChange = ({ page, pageSize }) => {
+ formInline.current = page;
+ formInline.size = pageSize;
+ loadData();
+};
+const loadData = async () => {
+ tableLoading.value = true;
+ try {
+ let response = await getSeedUseRegulatoryRecords(formInline);
+ tableLoading.value = false;
+ if (response.code == 200) {
+ tableData.value = response.data.records;
+ tableTotal.value = response.data.total;
+ }
+ } catch (error) {
+ tableLoading.value = false;
+ console.error(error);
+ }
+};
+
+const extractThirdLevelChildren = (dataArray) => {
+ let result = [];
+ // 遍历第一层数组
+ for (const level1 of dataArray) {
+ // 检查第一层是否有children且是数组
+ if (level1.children && Array.isArray(level1.children)) {
+ // 遍历第二层数组
+ for (const level2 of level1.children) {
+ // 检查第二层是否有children且是数组
+ if (level2.children && Array.isArray(level2.children)) {
+ // 将第三层的所有对象添加到结果数组中
+ result.push(...level2.children);
+ }
+ }
+ }
+ }
+ return result;
+};
+const seedTypeChange = () => {
+ console.log(formInline.seedTypeId);
+ // 重新获取表格数据,需添加参数
+};
+
+const dialogFormVisible = ref(false);
+const dialogRef = ref(null);
+const dialogTitle = ref('新增');
+const formDisabled = ref(false);
+const landSelectRef = ref(null);
+const nowSelectRow = ref({});
+const dialogForm = reactive({
+ regionCode: '', //所属行政区域代码
+ regionName: '', //所属行政区域名称
+ gridId: '', //所属网格代码
+ gridName: '', //所属网格名称
+ landId: '', //地块id
+ landName: '', //地块名称
+ name: '', //姓名
+ phone: '', //联系方式
+ provenanceId: '', //种子种苗名称id
+ provenanceName: '', //种子种苗名称
+ useNumber: 1, //使用量
+ useUnit: 'g', //使用量单位
+ detectionTime: '', //使用时间
+ businessEntityCode: '', //经营主体编码
+ businessEntityName: '', //经营主体名称
+});
+const dialogFormRules = ref({
+ provenanceId: [{ required: true, message: '请输入种子种苗编号', trigger: 'blur' }],
+ provenanceName: [{ required: true, message: '请输入种子种苗名称', trigger: 'blur' }],
+ useNumber: [{ required: true, message: '请输入使用量', trigger: ['change', 'blur'] }],
+ detectionTime: [{ required: true, message: '请选择使用时间', trigger: 'blur' }],
+});
+const addItem = async () => {
+ // ElMessage.success('点击新增!');
+ restDialogForm();
+ dialogTitle.value = '新增';
+ formDisabled.value = false;
+ dialogFormVisible.value = true;
+};
+const seeDetails = async (row) => {
+ // ElMessage.success('查看详情!');
+ dialogTitle.value = '详情';
+ console.log(row);
+ formDisabled.value = true;
+ dialogForm.landId = row.landId;
+ getDetails();
+ dialogForm.provenanceId = row.provenanceId;
+ dialogForm.provenanceName = row.provenanceName;
+ dialogForm.useNumber = row.useNumber;
+ dialogForm.useUnit = row.useUnit;
+ dialogForm.detectionTime = row.useTime;
+ dialogFormVisible.value = true;
+};
+const handleEdit = (row) => {
+ // ElMessage.success('点击编辑!');
+ nowSelectRow.value = row;
+ dialogTitle.value = '编辑';
+ console.log(row);
+ formDisabled.value = false;
+ dialogForm.landId = row.landId;
+ getDetails();
+ dialogForm.provenanceId = row.provenanceId;
+ dialogForm.provenanceName = row.provenanceName;
+ dialogForm.useNumber = row.useNumber;
+ dialogForm.useUnit = row.useUnit;
+ dialogForm.detectionTime = row.useTime;
+ dialogFormVisible.value = true;
+};
+// 获取地块信息
+const getDetails = async () => {
+ let response = await request({
+ url: `/land-resource/landManage/getLandInfo?landId=${dialogForm.landId}`,
+ });
+ console.log(response);
+ if (response.code == 200) {
+ if (response.data) {
+ setDialogForm(response.data);
+ } else {
+ ElMessage.error('未查询到数据');
+ }
+ } else {
+ ElMessage.error(response.message);
+ }
+};
+const setDialogForm = (row) => {
+ dialogForm.regionCode = row.gridAreaCode;
+ dialogForm.regionName = row.fullRegionName;
+ dialogForm.gridId = row.gridId;
+ dialogForm.gridName = row.gridName;
+ dialogForm.landId = row.id;
+ dialogForm.landName = row.landName;
+ dialogForm.name = row.propertyName;
+ dialogForm.phone = row.propertyPhone;
+ dialogForm.businessEntityCode = row.businessEntityCode ?? '';
+ dialogForm.businessEntityName = row.businessEntityName ?? '';
+};
+const handleDelete = (row) => {
+ console.log('删除操作: ', row);
+ app
+ .$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ })
+ .then(() => {
+ deleteGoods(row.id)
+ .then((res) => {
+ if (res.code === 200) {
+ onSubmit();
+ app.$message.success('删除成功!');
+ }
+ })
+ .catch((err) => {
+ app.$message.error(err.msg);
+ });
+ })
+ .catch(() => {});
+};
+const deleteGoods = async (ids) => {
+ try {
+ let res = await delSeedUseRegulatory(ids);
+ return res;
+ } catch (error) {
+ return false;
+ }
+};
+const onSaveCategory = () => {
+ console.log(dialogForm);
+ if (dialogForm.landId == '') {
+ landSelectRef.value.handleChange();
+ return;
+ }
+ dialogRef.value.validate(async (valid, fields) => {
+ if (valid) {
+ try {
+ let param = { ...dialogForm };
+ param.useTime = dialogForm.detectionTime;
+ console.log(param);
+ // valid.businessEntityCode = dialogForm.businessEntityCode; //经营主体编码
+ // valid.businessEntityName = dialogForm.businessEntityName; //经营主体名称
+ let response;
+ if (dialogTitle.value == '新增') {
+ response = await seedUseRegulatorySave(param);
+ } else {
+ param.id = nowSelectRow.value.id;
+ response = await editSeedUseRegulatory(param);
+ }
+ if (response.code == 200) {
+ cancelDialog();
+ onSubmit();
+ if (dialogTitle.value == '新增') {
+ ElMessage.success('新增成功!');
+ } else {
+ ElMessage.success('编辑成功!');
+ }
+ } else {
+ ElMessage.error(response.msg);
+ }
+ } catch (error) {
+ console.error(error);
+ }
+ }
+ });
+};
+const cancelDialog = async () => {
+ restDialogForm();
+ dialogFormVisible.value = false;
+};
+const restDialogForm = () => {
+ Object.assign(dialogForm, {
+ regionCode: '', //所属行政区域代码
+ regionName: '', //所属行政区域名称
+ gridId: '', //所属网格代码
+ gridName: '', //所属网格名称
+ landId: '', //地块id
+ landName: '', //地块名称
+ name: '', //姓名
+ phone: '', //联系方式
+ provenanceId: '', //种子种苗名称id
+ provenanceName: '', //种子种苗名称
+ useNumber: 1, //使用量
+ useUnit: 'g', //使用量单位
+ useTime: '', //使用时间
+ businessEntityCode: '', //经营主体编码
+ businessEntityName: '', //经营主体名称
+ });
+ nowSelectRow.value = ref({});
+};
+
+const seedTypeList = ref([]);
+const seedTypeDialogList = ref([]);
+const getSeedTypeList = async () => {
+ try {
+ let response = await getMaterailTypes({ moduleType: '4' });
+ console.log(response);
+ if (response.code == 200) {
+ if (response.data?.length > 0) {
+ seedTypeDialogList.value = response.data[0].children;
+ let result = extractThirdLevelChildren(response.data);
+ seedTypeList.value = result;
+ console.log(seedTypeDialogList.value);
+ }
+ }
+ } catch (error) {
+ console.error(error);
+ }
+};
+
+const unitList = ref([
+ { dictCode: '52', dictValue: 'g' },
+ { dictCode: '53', dictValue: 'kg' },
+]);
+
+const landSelectList = ref([]);
+const getLandsList = async () => {
+ let res = await getLandList();
+ if (res.code == 200) {
+ landSelectList.value = res.data;
+ }
+};
+const handleLandChange = (val) => {
+ console.log(val);
+ if (val) {
+ getDetails();
+ } else {
+ restDialogForm();
+ }
+};
+
+const getEntityOptions = async () => {
+ let res = await GetDictTypeInfo('sys_use_supervise_number');
+ console.log(res);
+ if (res.code == 200) {
+ unitList.value = res.data;
+ } else {
+ unitList.value = [
+ { dictCode: '52', dictValue: 'g' },
+ { dictCode: '53', dictValue: 'kg' },
+ ];
+ }
+};
+
+onMounted(() => {
+ onSubmit();
+ getLandsList();
+ getEntityOptions();
+ // getSeedTypeList();
+});
+
+
diff --git a/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/Attrs.vue b/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/Attrs.vue
new file mode 100644
index 0000000..6e8ed76
--- /dev/null
+++ b/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/Attrs.vue
@@ -0,0 +1,137 @@
+
+
+
+
+
+
+
+
![]()
+
+
+
+
+
+
+
diff --git a/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/TabBasicInfo.vue b/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/TabBasicInfo.vue
new file mode 100644
index 0000000..4af8da8
--- /dev/null
+++ b/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/TabBasicInfo.vue
@@ -0,0 +1,71 @@
+
+
+ 经营主体信息
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 证件资料
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/TabBusinessInfo.vue b/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/TabBusinessInfo.vue
new file mode 100644
index 0000000..f15bfef
--- /dev/null
+++ b/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/TabBusinessInfo.vue
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+ 负债表
+
+
+
+ 导入表格
+ 下载模板
+
+
+
+
+
+ 利润表
+
+
+
+ 导入表格
+ 下载模板
+
+
+
+
+
+ 现金流量表
+
+
+
+ 导入表格
+ 下载模板
+
+
+
+
+
+
+
+
+
+
diff --git a/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/TabCreditEvaluation.vue b/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/TabCreditEvaluation.vue
new file mode 100644
index 0000000..652a5e5
--- /dev/null
+++ b/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/TabCreditEvaluation.vue
@@ -0,0 +1,78 @@
+
+
+
+
信用评级
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/TabMember.vue b/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/TabMember.vue
new file mode 100644
index 0000000..0cac7f7
--- /dev/null
+++ b/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/TabMember.vue
@@ -0,0 +1,336 @@
+
+
+
+
+ 新增
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 男
+ 女
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/TabRegister.vue b/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/TabRegister.vue
new file mode 100644
index 0000000..67d16c5
--- /dev/null
+++ b/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/components/TabRegister.vue
@@ -0,0 +1,100 @@
+
+
+ 登记注册信息
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/index.vue b/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/index.vue
index b9cdb79..6f1c0ff 100644
--- a/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/index.vue
+++ b/sub-government-affairs-service/src/views/trace/production-subjects/enterprise/index.vue
@@ -1,9 +1,631 @@
-
+
+
+
企业档案
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 上一步
+ 下一步
+ 跳过
+ 保存
+ 跳过并保存
+
+
+
-
+