产出品信息,溯源企业管理页面增删改查功能开发对接后台
This commit is contained in:
parent
d7fbd3d720
commit
6b1d0fbbf8
@ -48,6 +48,10 @@ export function delLand(id) {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
// 获取地块信息
|
||||
export function getLandInfo(landId) {
|
||||
return request(`/land-resource/landManage/getLandInfo?landId=${landId}`);
|
||||
}
|
||||
// #endregion
|
||||
/* 土地列表 */
|
||||
|
||||
@ -162,6 +166,10 @@ export function delPlantingStage(params) {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
// 获取种植作物列表
|
||||
export function getCropsList() {
|
||||
return request('land-resource/crops/list');
|
||||
}
|
||||
|
||||
//作业记录相关
|
||||
export function getOperationRecord(params = {}) {
|
||||
|
29
sub-government-affairs-service/src/apis/trace/products.js
Normal file
29
sub-government-affairs-service/src/apis/trace/products.js
Normal file
@ -0,0 +1,29 @@
|
||||
import request from '@/utils/axios';
|
||||
|
||||
// 溯源企业管理 - 列表
|
||||
export function getTraceCompanyList(params) {
|
||||
return request('/trace/traceCompany/page', {
|
||||
method: 'GET',
|
||||
params,
|
||||
});
|
||||
}
|
||||
// 溯源企业管理 - 新增
|
||||
export function addTraceCompany(data) {
|
||||
return request('/trace/traceCompany/save', {
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
}
|
||||
// 溯源企业管理 - 编辑
|
||||
export function editTraceCompany(data) {
|
||||
return request('/trace/traceCompany/edit', {
|
||||
method: 'PUT',
|
||||
data,
|
||||
});
|
||||
}
|
||||
// 溯源企业管理 - 删除
|
||||
export function deleteTraceCompany(ids) {
|
||||
return request('/trace/traceCompany/delete/' + ids, {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
@ -7,13 +7,7 @@
|
||||
<div class="search-bar-left">
|
||||
<el-form ref="searchForm" :inline="true" :model="formInline" class="demo-form-inline" :label-width="'auto'">
|
||||
<el-form-item label="" style="margin-left: -15px">
|
||||
<AreaCascader
|
||||
v-model:value="areaFormData"
|
||||
v-model:region-code="formInline.regionCode"
|
||||
v-model:grid-id="formInline.gridId"
|
||||
label="行政区域-网格"
|
||||
:width="500"
|
||||
/>
|
||||
<AreaCascader v-model:region-code="formInline.regionCode" v-model:grid-id="formInline.gridId" label="行政区域-网格" :width="500" />
|
||||
</el-form-item>
|
||||
<el-form-item label="种子名称" prop="seedId">
|
||||
<el-select v-model="formInline.seedId" placeholder="请选择" clearable @change="seedTypeChange">
|
||||
|
@ -6,14 +6,14 @@
|
||||
<div class="search-bar">
|
||||
<div class="search-bar-left">
|
||||
<el-form ref="searchForm" :inline="true" :model="formInline" class="demo-form-inline" :label-width="'auto'">
|
||||
<el-form-item label="关键词" prop="name">
|
||||
<el-input v-model="formInline.name" placeholder="请输入关键词" clearable />
|
||||
<el-form-item label="" style="margin-left: -15px">
|
||||
<AreaCascader v-model:region-code="formInline.regionCode" v-model:grid-id="formInline.gridId" label="行政区域-网格" :width="500" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="分类" prop="seedTypeId">
|
||||
<el-select v-model="formInline.seedTypeId" placeholder="请选择" clearable @change="seedTypeChange">
|
||||
<el-option v-for="item in seedTypeList" :key="item.id" :value="item.id" :label="item.dataName" />
|
||||
<el-form-item label="农产品" prop="cropId">
|
||||
<el-select v-model="formInline.cropId" placeholder="请选择" clearable @change="seedTypeChange">
|
||||
<el-option v-for="item in cropypeList" :key="item.id" :value="item.id" :label="item.cropsName" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="">
|
||||
<el-button type="primary" icon="Search" @click="onSubmit">查询</el-button>
|
||||
<el-button icon="Refresh" @click="resetForm">重置</el-button>
|
||||
@ -53,7 +53,7 @@
|
||||
<!-- 自定义-操作 -->
|
||||
<template #action="slotProps">
|
||||
<!-- <el-button type="primary" @click="seeDetails(slotProps.row)">查看</el-button> -->
|
||||
<!-- <el-button type="primary" @click="handleEdit(slotProps.row)">编辑</el-button> -->
|
||||
<el-button type="primary" @click="handleEdit(slotProps.row)">编辑</el-button>
|
||||
<el-button @click="handleDelete(slotProps.row)">删除</el-button>
|
||||
</template>
|
||||
</tableComponent>
|
||||
@ -122,15 +122,18 @@ import inputSuppliesApi from '@/apis/inputSuppliesApi';
|
||||
const { getMaterailTypes } = inputSuppliesApi;
|
||||
import { GetOutputList, AddOutput, UpdateOutput, DeleteOutput } from '@/apis/outputProducts';
|
||||
import { getLandList } from '@/apis/inputSuppliesApi/supervisionOfInputs';
|
||||
import request from '@/utils/axios';
|
||||
import { getCropsList, getLandInfo } from '@/apis/land';
|
||||
import { GetDictTypeInfo } from '@/apis/system/dictType';
|
||||
import { useApp } from '@/hooks';
|
||||
const app = useApp();
|
||||
|
||||
// 查询条件
|
||||
const formInline = reactive({
|
||||
name: '',
|
||||
seedTypeId: '',
|
||||
regionCode: '',
|
||||
regionName: '',
|
||||
gridId: '',
|
||||
gridName: '',
|
||||
cropId: '',
|
||||
current: 1,
|
||||
size: 10,
|
||||
});
|
||||
@ -164,7 +167,7 @@ const columns = ref([
|
||||
{ label: '生产经营主体类型', prop: 'businessEntityType', width: 150 },
|
||||
{ label: '生产经营主体名称', prop: 'businessEntityName' },
|
||||
{ label: '是否溯源', prop: 'isTrace' },
|
||||
{ prop: 'action', label: '操作', slotName: 'action', width: 100, fixed: 'right' },
|
||||
{ prop: 'action', label: '操作', slotName: 'action', width: 150, fixed: 'right' },
|
||||
]);
|
||||
const handlePaginationChange = ({ page, pageSize }) => {
|
||||
formInline.current = page;
|
||||
@ -205,25 +208,6 @@ const loadData = async () => {
|
||||
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);
|
||||
// 重新获取表格数据,需添加参数
|
||||
@ -277,32 +261,28 @@ const seeDetails = async (row) => {
|
||||
console.log(row);
|
||||
formDisabled.value = true;
|
||||
dialogForm.landId = row.landId;
|
||||
getDetails();
|
||||
dialogForm.totalYield = row.totalYield ?? 0;
|
||||
await getDetails();
|
||||
dialogForm.yield = row.yield;
|
||||
dialogForm.useUnit = row.useUnit;
|
||||
dialogForm.detectionTime = row.useTime;
|
||||
// dialogForm.totalYield = row.totalYield ?? 0;
|
||||
dialogForm.detectionTime = row.harvestDate;
|
||||
dialogFormVisible.value = true;
|
||||
};
|
||||
const handleEdit = (row) => {
|
||||
const handleEdit = async (row) => {
|
||||
// ElMessage.success('点击编辑!');
|
||||
nowSelectRow.value = row;
|
||||
dialogTitle.value = '编辑';
|
||||
console.log(row);
|
||||
formDisabled.value = false;
|
||||
dialogForm.landId = row.landId;
|
||||
getDetails();
|
||||
dialogForm.totalYield = row.totalYield ?? 0;
|
||||
await getDetails();
|
||||
dialogForm.yield = row.yield;
|
||||
dialogForm.useUnit = row.useUnit;
|
||||
dialogForm.detectionTime = row.useTime;
|
||||
// dialogForm.totalYield = row.totalYield ?? 0;
|
||||
dialogForm.detectionTime = row.harvestDate;
|
||||
dialogFormVisible.value = true;
|
||||
};
|
||||
// 获取地块信息
|
||||
const getDetails = async () => {
|
||||
let response = await request({
|
||||
url: `/land-resource/landManage/getLandInfo?landId=${dialogForm.landId}`,
|
||||
});
|
||||
let response = await getLandInfo(dialogForm.landId);
|
||||
console.log(response);
|
||||
if (response.code == 200) {
|
||||
if (response.data) {
|
||||
@ -320,7 +300,6 @@ const setDialogForm = (row) => {
|
||||
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;
|
||||
@ -419,18 +398,14 @@ const restDialogForm = () => {
|
||||
nowSelectRow.value = ref({});
|
||||
};
|
||||
|
||||
const seedTypeList = ref([]);
|
||||
const seedTypeDialogList = ref([]);
|
||||
const getSeedTypeList = async () => {
|
||||
const cropypeList = ref([]);
|
||||
const getCropypeList = async () => {
|
||||
try {
|
||||
let response = await getMaterailTypes({ moduleType: '4' });
|
||||
let response = await getCropsList();
|
||||
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);
|
||||
cropypeList.value = response.data;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@ -476,7 +451,7 @@ onMounted(() => {
|
||||
onSubmit();
|
||||
getLandsList();
|
||||
getEntityOptions();
|
||||
// getSeedTypeList();
|
||||
getCropypeList();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
@ -6,8 +6,8 @@
|
||||
<div class="search-bar">
|
||||
<div class="search-bar-left">
|
||||
<el-form ref="searchForm" :inline="true" :model="formInline" class="demo-form-inline" :label-width="'auto'">
|
||||
<el-form-item label="关键字" prop="name">
|
||||
<el-input v-model="formInline.name" placeholder="请输入关键字" clearable />
|
||||
<el-form-item label="关键字" prop="keyword">
|
||||
<el-input v-model="formInline.keyword" placeholder="请输入关键字" clearable />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="">
|
||||
@ -42,75 +42,60 @@
|
||||
</tableComponent>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog v-model="dialogFormVisible" :title="dialogTitle" width="800" :close-on-click-modal="false" align-center>
|
||||
<el-form :inline="true" :label-width="'auto'">
|
||||
<LandSelect ref="landSelectRef" v-model="dialogForm.landId" :options="landSelectList" :disabled="formDisabled" @change="handleLandChange" />
|
||||
</el-form>
|
||||
<el-descriptions title="地块信息" border class="mb-20 custom-descriptions" :column="2">
|
||||
<el-descriptions-item label="行政区域编码">{{ dialogForm.regionCode }}</el-descriptions-item>
|
||||
<el-descriptions-item label="行政区域名称">{{ dialogForm.regionName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="网格编码">{{ dialogForm.gridId }}</el-descriptions-item>
|
||||
<el-descriptions-item label="网格名称">{{ dialogForm.gridName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="地块编码">{{ dialogForm.landId }}</el-descriptions-item>
|
||||
<el-descriptions-item label="地块名称">{{ dialogForm.landName }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions title="经营主体信息" border class="mb-20 custom-descriptions" :column="2">
|
||||
<el-descriptions-item label="经营主体编码">{{ dialogForm.businessEntityCode }}</el-descriptions-item>
|
||||
<el-descriptions-item label="经营主体名称">{{ dialogForm.businessEntityName }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-dialog v-model="dialogFormVisible" :title="dialogTitle" width="900" :close-on-click-modal="false" align-center>
|
||||
<el-form
|
||||
ref="dialogRef"
|
||||
:model="dialogForm"
|
||||
:inline="true"
|
||||
:label-width="'100'"
|
||||
:label-width="'150'"
|
||||
:rules="dialogFormRules"
|
||||
:disabled="formDisabled"
|
||||
class="dialog-form-container"
|
||||
>
|
||||
<div class="el-descriptions__title" style="margin-bottom: 16px">农药用药详情</div>
|
||||
<el-form-item label="肥料编号" prop="fertilizeId" class="dialog-form-item">
|
||||
<el-input v-model="dialogForm.fertilizeId" clearable placeholder="请输入肥料编号" />
|
||||
<el-form-item label="企业名称" prop="comName" class="dialog-form-item" style="width: 100%">
|
||||
<el-input v-model="dialogForm.comName" clearable placeholder="请输入" style="width: 80%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="肥料名称" prop="fertilizeName" class="dialog-form-item">
|
||||
<el-input v-model="dialogForm.fertilizeName" clearable placeholder="请输入肥料名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="使用量" required prop="useNumber" class="dialog-form-item">
|
||||
<el-input-number v-model="dialogForm.useNumber" :min="1" controls-position="right" placeholder="请输入使用量" style="width: 150px" />
|
||||
<el-select v-model="dialogForm.useUnit" placeholder="请选择" style="width: 80px">
|
||||
<el-option v-for="el in unitList" :key="el.dictValue" :value="el.dictValue" :label="el.dictValue" />
|
||||
<el-form-item label="企业类型" prop="comType" class="dialog-form-item">
|
||||
<el-select v-model="dialogForm.comType" placeholder="请选择">
|
||||
<el-option value="合作社" label="合作社" />
|
||||
<el-option value="有限责任公司" label="有限责任公司" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="使用时间" prop="useTime" class="dialog-form-item">
|
||||
<el-date-picker v-model="dialogForm.useTime" :clearable="false" type="date" value-format="YYYY-MM-DD" placeholder="请选择使用时间" />
|
||||
<el-form-item label="统一社会信用代码" prop="uscc" class="dialog-form-item">
|
||||
<el-input v-model="dialogForm.uscc" clearable placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<div class="el-descriptions__title" style="margin-bottom: 16px">检测信息</div>
|
||||
<div style="display: flex">
|
||||
<div style="display: inline-block; width: 48%">
|
||||
<el-form-item label="检测时间" prop="detectionTime" class="dialog-form-item" :label-width="'100'">
|
||||
<el-form-item label="法人信息" prop="legalName" class="dialog-form-item">
|
||||
<el-input v-model="dialogForm.legalName" clearable placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="厂址" prop="address" class="dialog-form-item">
|
||||
<el-input v-model="dialogForm.address" clearable placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人" prop="contactName" class="dialog-form-item">
|
||||
<el-input v-model="dialogForm.contactName" clearable placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="电话" prop="phone" class="dialog-form-item">
|
||||
<el-input v-model="dialogForm.phone" clearable placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入驻时间" prop="tenancyTime" class="dialog-form-item">
|
||||
<el-date-picker
|
||||
v-model="dialogForm.detectionTime"
|
||||
v-model="dialogForm.tenancyTime"
|
||||
:clearable="false"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择检测时间"
|
||||
type="datetime"
|
||||
format="YYYY/MM/DD HH:mm:ss"
|
||||
value-format="YYYY/MM/DD HH:mm:ss"
|
||||
placeholder="请选择使用时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="检测结果" prop="detectionResult" class="dialog-form-item" :label-width="'100'">
|
||||
<el-select v-model="dialogForm.detectionResult" placeholder="请选择">
|
||||
<el-option value="合格" label="合格" />
|
||||
<el-option value="不合格" label="不合格" />
|
||||
</el-select>
|
||||
<el-form-item label="申请时间" prop="applyTime" class="dialog-form-item">
|
||||
<el-date-picker
|
||||
v-model="dialogForm.applyTime"
|
||||
:clearable="false"
|
||||
type="datetime"
|
||||
format="YYYY/MM/DD HH:mm:ss"
|
||||
value-format="YYYY/MM/DD HH:mm:ss"
|
||||
placeholder="请选择使用时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="检测单位" prop="detectionUnit" class="dialog-form-item" :label-width="'100'">
|
||||
<el-input v-model="dialogForm.detectionUnit" clearable placeholder="请输入检测单位" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div style="display: inline-block; width: 50%">
|
||||
<el-form-item label="检测报告" prop="detectionReport" class="dialog-form-item" :label-width="'80'">
|
||||
<FileUploader v-model="dialogForm.detectionReport" :limit="1" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
@ -127,23 +112,16 @@
|
||||
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 {
|
||||
getFertilizeUseRegulatoryRecords,
|
||||
fertilizeUseRegulatorySave,
|
||||
editFertilizeUseRegulatory,
|
||||
delFertilizeUseRegulatory,
|
||||
getLandList,
|
||||
} from '@/apis/inputSuppliesApi/supervisionOfInputs';
|
||||
import request from '@/utils/axios';
|
||||
import { getLandList } from '@/apis/inputSuppliesApi/supervisionOfInputs';
|
||||
import { getTraceCompanyList, addTraceCompany, editTraceCompany, deleteTraceCompany } from '@/apis/trace/products';
|
||||
import { getLandInfo } from '@/apis/land';
|
||||
import { GetDictTypeInfo } from '@/apis/system/dictType';
|
||||
import { useApp } from '@/hooks';
|
||||
const app = useApp();
|
||||
|
||||
// 查询条件
|
||||
const formInline = reactive({
|
||||
name: '',
|
||||
keyword: '',
|
||||
current: 1,
|
||||
size: 10,
|
||||
});
|
||||
@ -157,79 +135,21 @@ const resetForm = () => {
|
||||
};
|
||||
|
||||
// 表格数据
|
||||
const tableData = ref([
|
||||
{
|
||||
batchCode: 'QY-GM-001',
|
||||
productTypes: '耿马蔗香食品有限公司',
|
||||
name: '有限责任公司',
|
||||
purchaseDate: '91530925MA6P8E1234',
|
||||
number: '杨志明',
|
||||
Unit: '刀玉兰',
|
||||
baseCode: '188-8786-1234',
|
||||
厂址: '云南省临沧市耿马县勐永镇工业园区',
|
||||
入驻时间: '2023-05-10 00:00:00',
|
||||
申请时间: '2023-04-25 00:00:00',
|
||||
},
|
||||
{
|
||||
batchCode: 'QY-GM-002',
|
||||
productTypes: '耿马绿丰食品加工厂',
|
||||
name: '个体工商户',
|
||||
purchaseDate: '92530925L3D5F9876',
|
||||
number: '李红梅',
|
||||
Unit: '岩温罕',
|
||||
baseCode: '159-8723-4567',
|
||||
厂址: '云南省临沧市耿马县孟定镇',
|
||||
入驻时间: '2022-11-15 00:00:00',
|
||||
申请时间: '2022-10-30 00:00:00',
|
||||
},
|
||||
{
|
||||
batchCode: 'QY-GM-003',
|
||||
productTypes: '耿马辣味坊食品厂',
|
||||
name: '个人独资企业',
|
||||
purchaseDate: '91530925G7H2K6543',
|
||||
number: '张丽华',
|
||||
Unit: '罕香',
|
||||
baseCode: '137-8765-3210',
|
||||
厂址: '云南省临沧市耿马县四排山乡',
|
||||
入驻时间: '2024-02-20 00:00:00',
|
||||
申请时间: '2024-01-18 00:00:00',
|
||||
},
|
||||
{
|
||||
batchCode: 'QY-GM-004',
|
||||
productTypes: '耿马山野农产加工厂',
|
||||
name: '有限责任公司',
|
||||
purchaseDate: '91530925N9J4R7890',
|
||||
number: '周建国',
|
||||
Unit: '俸春燕',
|
||||
baseCode: '182-8834-5678',
|
||||
厂址: '云南省临沧市耿马县贺派乡',
|
||||
入驻时间: '2023-08-05 00:00:00',
|
||||
申请时间: '2023-07-22 00:00:00',
|
||||
},
|
||||
{
|
||||
batchCode: 'QY-GM-005',
|
||||
productTypes: '耿马原生茶业',
|
||||
name: '农民专业合作社',
|
||||
purchaseDate: '93530925P5K6T2345',
|
||||
number: '赵志强',
|
||||
Unit: '艾叶',
|
||||
baseCode: '151-8790-4321',
|
||||
厂址: '云南省临沧市耿马县大兴乡',
|
||||
入驻时间: '2022-09-12 00:00:00',
|
||||
申请时间: '2022-08-28 00:00:00',
|
||||
},
|
||||
]);
|
||||
const tableData = ref([]);
|
||||
const selectedIds = ref([]);
|
||||
const tableLoading = ref(false);
|
||||
const tableTotal = ref(0);
|
||||
const columns = ref([
|
||||
{ prop: 'batchCode', label: '企业编码' },
|
||||
{ prop: 'productTypes', label: '生产商' },
|
||||
{ prop: 'name', label: '企业类型' },
|
||||
{ prop: 'purchaseDate', label: '统一社会信用代码' },
|
||||
{ prop: 'number', label: '法人信息' },
|
||||
{ prop: 'Unit', label: '联系人' },
|
||||
{ prop: 'baseCode', label: '电话' },
|
||||
{ prop: 'comCode', label: '企业编码' },
|
||||
{ prop: 'comName', label: '企业名称' },
|
||||
{ prop: 'comType', label: '企业类型' },
|
||||
{ prop: 'uscc', label: '统一社会信用代码' },
|
||||
{ prop: 'legalName', label: '法人信息' },
|
||||
{ prop: 'contactName', label: '联系人' },
|
||||
{ prop: 'phone', label: '电话' },
|
||||
{ prop: 'address', label: '厂址' },
|
||||
{ prop: 'tenancyTime', label: '入驻时间' },
|
||||
{ prop: 'applyTime', label: '申请时间' },
|
||||
{ prop: 'action', label: '操作', slotName: 'action', width: 100, fixed: 'right' },
|
||||
]);
|
||||
const handlePaginationChange = ({ page, pageSize }) => {
|
||||
@ -238,37 +158,18 @@ const handlePaginationChange = ({ page, pageSize }) => {
|
||||
loadData();
|
||||
};
|
||||
const loadData = async () => {
|
||||
// tableLoading.value = true;
|
||||
// try {
|
||||
// let response = await getFertilizeUseRegulatoryRecords(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);
|
||||
tableLoading.value = true;
|
||||
try {
|
||||
let response = await getTraceCompanyList(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
const seedTypeChange = () => {
|
||||
console.log(formInline.seedTypeId);
|
||||
@ -279,100 +180,90 @@ 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: '', //姓名
|
||||
comCode: '', //企业编码
|
||||
comName: '', //企业名称
|
||||
comType: '', //企业类型
|
||||
uscc: '', //统一社会信用代码
|
||||
legalName: '', //法人信息
|
||||
contactName: '', //联系人
|
||||
phone: '', //联系方式
|
||||
fertilizeId: '', //肥料名称id
|
||||
fertilizeName: '', //肥料名称
|
||||
useNumber: 1, //使用量
|
||||
useUnit: 'g', //使用量单位
|
||||
useTime: '', //使用时间
|
||||
businessEntityCode: '', //经营主体编码
|
||||
businessEntityName: '', //经营主体名称
|
||||
detectionTime: '', //检测时间
|
||||
detectionResult: '', //检测结果'
|
||||
detectionUnit: '', //检测单位
|
||||
detectionReport: '', //检测报告
|
||||
address: '', //厂址
|
||||
tenancyTime: '', //入驻时间
|
||||
applyTime: '', //申请时间
|
||||
});
|
||||
const initDialogForm = { ...dialogForm };
|
||||
console.log(initDialogForm);
|
||||
const dialogFormRules = ref({
|
||||
fertilizeId: [{ required: true, message: '请输入肥料编号', trigger: 'blur' }],
|
||||
fertilizeName: [{ required: true, message: '请输入肥料名称', trigger: 'blur' }],
|
||||
useNumber: [{ required: true, message: '请输入使用量', trigger: ['change', 'blur'] }],
|
||||
useTime: [{ required: true, message: '请选择使用时间', trigger: 'blur' }],
|
||||
detectionTime: [{ required: true, message: '请选择检测时间', trigger: ['change', 'blur'] }],
|
||||
detectionResult: [
|
||||
comName: [{ required: true, message: '请输入', trigger: 'blur' }],
|
||||
uscc: [
|
||||
{ required: true, message: '请输入', trigger: 'blur' },
|
||||
{
|
||||
required: true,
|
||||
message: '请选择检测结果',
|
||||
validator: (rule, value, callback) => {
|
||||
if (!/^[0-9A-Za-z]+$/.test(value)) {
|
||||
callback(new Error('企业信用代码只能包含数字和字母'));
|
||||
} else if (value.length !== 18) {
|
||||
// 可选:限制18位长度
|
||||
callback(new Error('企业信用代码必须为18位'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
legalName: [{ required: true, message: '请输入', trigger: 'blur' }],
|
||||
contactName: [{ required: true, message: '请输入', trigger: 'blur' }],
|
||||
phone: [
|
||||
{ required: true, message: '请输入', trigger: 'blur' },
|
||||
{
|
||||
pattern: /^1[3-9]\d{9}$/,
|
||||
message: '请输入正确的11位手机号',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
address: [{ required: true, message: '请输入', trigger: 'blur' }],
|
||||
tenancyTime: [{ required: true, message: '请选择入驻时间', trigger: 'blur' }],
|
||||
applyTime: [{ required: true, message: '请选择申请时间', trigger: 'blur' }],
|
||||
comType: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
detectionUnit: [{ required: true, message: '请输入检测单位', trigger: 'blur' }],
|
||||
});
|
||||
|
||||
const addItem = async () => {
|
||||
ElMessage.success('点击新增!');
|
||||
// restDialogForm();
|
||||
// dialogTitle.value = '新增';
|
||||
// formDisabled.value = false;
|
||||
// dialogFormVisible.value = true;
|
||||
restDialogForm();
|
||||
dialogTitle.value = '新增';
|
||||
formDisabled.value = false;
|
||||
dialogFormVisible.value = true;
|
||||
};
|
||||
const seeDetails = async (row) => {
|
||||
ElMessage.success('查看详情!');
|
||||
// dialogTitle.value = '详情';
|
||||
// formDisabled.value = true;
|
||||
// dialogForm.landId = row.landId;
|
||||
// getDetails();
|
||||
// setDialogForm2();
|
||||
// dialogFormVisible.value = true;
|
||||
// ElMessage.success('查看详情!');
|
||||
console.log('查看详情的行: ', row);
|
||||
dialogTitle.value = '详情';
|
||||
formDisabled.value = true;
|
||||
Object.assign(dialogForm, row);
|
||||
dialogFormVisible.value = true;
|
||||
};
|
||||
const handleEdit = (row) => {
|
||||
ElMessage.success('点击编辑!');
|
||||
// ElMessage.success('点击编辑!');
|
||||
console.log('要编辑的行: ', row);
|
||||
// nowSelectRow.value = row;
|
||||
// dialogTitle.value = '编辑';
|
||||
// formDisabled.value = false;
|
||||
// dialogForm.landId = row.landId;
|
||||
// getDetails();
|
||||
// setDialogForm2();
|
||||
// dialogFormVisible.value = true;
|
||||
nowSelectRow.value = row;
|
||||
dialogTitle.value = '编辑';
|
||||
formDisabled.value = false;
|
||||
Object.assign(dialogForm, row);
|
||||
dialogFormVisible.value = true;
|
||||
};
|
||||
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 setDialogForm2 = (row) => {
|
||||
dialogForm.fertilizeId = row.fertilizeId;
|
||||
dialogForm.fertilizeName = row.fertilizeName;
|
||||
dialogForm.useNumber = row.useNumber;
|
||||
dialogForm.useUnit = row.useUnit;
|
||||
dialogForm.useTime = row.useTime;
|
||||
dialogForm.detectionTime = row.detectionTime;
|
||||
dialogForm.detectionResult = row.detectionResult;
|
||||
dialogForm.detectionUnit = row.detectionUnit;
|
||||
dialogForm.detectionReport = row.detectionReport ?? '';
|
||||
Object.assign(dialogForm, row);
|
||||
};
|
||||
// 获取地块信息
|
||||
const getDetails = async () => {
|
||||
let response = await request({
|
||||
url: `/land-resource/landManage/getLandInfo?landId=${dialogForm.landId}`,
|
||||
});
|
||||
let response = await getLandInfo(dialogForm.landId);
|
||||
console.log(response);
|
||||
if (response.code == 200) {
|
||||
if (response.data) {
|
||||
@ -407,7 +298,7 @@ const handleDelete = (row) => {
|
||||
};
|
||||
const deleteGoods = async (ids) => {
|
||||
try {
|
||||
let res = await delFertilizeUseRegulatory(ids);
|
||||
let res = await deleteTraceCompany(ids);
|
||||
return res;
|
||||
} catch (error) {
|
||||
return false;
|
||||
@ -415,10 +306,6 @@ const deleteGoods = async (ids) => {
|
||||
};
|
||||
const onSaveCategory = () => {
|
||||
console.log(dialogForm);
|
||||
if (dialogForm.landId == '') {
|
||||
landSelectRef.value.handleChange();
|
||||
return;
|
||||
}
|
||||
dialogRef.value.validate(async (valid, fields) => {
|
||||
if (valid) {
|
||||
try {
|
||||
@ -426,10 +313,10 @@ const onSaveCategory = () => {
|
||||
console.log(param);
|
||||
let response;
|
||||
if (dialogTitle.value == '新增') {
|
||||
response = await fertilizeUseRegulatorySave(param);
|
||||
response = await addTraceCompany(param);
|
||||
} else {
|
||||
param.id = nowSelectRow.value.id;
|
||||
response = await editFertilizeUseRegulatory(param);
|
||||
response = await editTraceCompany(param);
|
||||
}
|
||||
if (response?.code == 200) {
|
||||
cancelDialog();
|
||||
@ -453,49 +340,10 @@ const cancelDialog = async () => {
|
||||
dialogFormVisible.value = false;
|
||||
};
|
||||
const restDialogForm = () => {
|
||||
Object.assign(dialogForm, {
|
||||
regionCode: '', //所属行政区域代码
|
||||
regionName: '', //所属行政区域名称
|
||||
gridId: '', //所属网格代码
|
||||
gridName: '', //所属网格名称
|
||||
landId: '', //地块id
|
||||
landName: '', //地块名称
|
||||
name: '', //姓名
|
||||
phone: '', //联系方式
|
||||
fertilizeId: '', //肥料名称id
|
||||
fertilizeName: '', //肥料名称
|
||||
useNumber: 1, //使用量
|
||||
useUnit: 'g', //使用量单位
|
||||
useTime: '', //使用时间
|
||||
businessEntityCode: '', //经营主体编码
|
||||
businessEntityName: '', //经营主体名称
|
||||
detectionTime: '', //检测时间
|
||||
detectionResult: '', //检测结果'
|
||||
detectionUnit: '', //检测单位
|
||||
detectionReport: '', //检测报告
|
||||
});
|
||||
Object.assign(dialogForm, initDialogForm);
|
||||
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' },
|
||||
@ -532,9 +380,8 @@ const getEntityOptions = async () => {
|
||||
|
||||
onMounted(() => {
|
||||
onSubmit();
|
||||
getLandsList();
|
||||
getEntityOptions();
|
||||
// getSeedTypeList();
|
||||
// getLandsList();
|
||||
// getEntityOptions();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
Loading…
x
Reference in New Issue
Block a user