diff --git a/sub-government-affairs-service/src/apis/land.js b/sub-government-affairs-service/src/apis/land.js index 742ed68..e1425e4 100644 --- a/sub-government-affairs-service/src/apis/land.js +++ b/sub-government-affairs-service/src/apis/land.js @@ -58,7 +58,7 @@ export function exportAnnua(params = {}) { } export function delAnnual(params) { - return request('/trace/code/annualManage/delete/' + params.id, { + return request('land-resource/annualManage/delete/' + params.id, { method: 'DELETE', }); } @@ -193,3 +193,25 @@ export function importLands(data) { }, }); } + +//土地巡查相关 +export function getlandInspection(params = {}) { + return request('land-resource/landInspection/page', { + method: 'GET', + params, + }); +} + +export function savelandInspection(data) { + return request('land-resource/landInspection/save', { + method: 'POST', + data, + }); +} + +export function editlandInspection(data = {}) { + return request('land-resource/landInspection/update', { + method: 'PUT', + data, + }); +} diff --git a/sub-government-affairs-service/src/views/annualPlan/component/annualPlans/index.vue b/sub-government-affairs-service/src/views/annualPlan/component/annualPlans/index.vue index 35b85b0..f1afda5 100644 --- a/sub-government-affairs-service/src/views/annualPlan/component/annualPlans/index.vue +++ b/sub-government-affairs-service/src/views/annualPlan/component/annualPlans/index.vue @@ -30,75 +30,39 @@ 拒绝 + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - -   -   - - - - - - - - - - - - - - - - - - - - {{ currentRow.id || '--' }} - {{ currentRow.planName || '--' }} - {{ currentRow.plantingArea || '--' }} - {{ currentRow.plantingMonths || '--' }} - {{ currentRow.growthCycle || '--' }} - {{ currentRow.note || '--' }} - {{ currentRow.planProgress || '--' }} - - 待提交 - 审核中 - 通过 - 拒绝 - - - - diff --git a/sub-government-affairs-service/src/views/dict/component/dictCrop/index.vue b/sub-government-affairs-service/src/views/dict/component/dictCrop/index.vue index 4122778..feddd81 100644 --- a/sub-government-affairs-service/src/views/dict/component/dictCrop/index.vue +++ b/sub-government-affairs-service/src/views/dict/component/dictCrop/index.vue @@ -341,7 +341,7 @@ const stageInfoRules = reactive({ // 加载 const loadData = () => { - state.loading = true; + // state.loading = true; // getOperationRecord(state.query) // .then((res) => { // if (res.code === 200) { @@ -427,7 +427,7 @@ const onExport = () => { app.$message.error('当前暂时没有可供导出的数据!'); return; } - state.loading = true; + // state.loading = true; const fileName = '土地巡查明细表'; // exportOperationRecord(state.query) // .then((res) => { diff --git a/sub-government-affairs-service/src/views/landManage/component/landPartol/index.vue b/sub-government-affairs-service/src/views/landManage/component/landPartol/index.vue index 1591e1d..1c8017a 100644 --- a/sub-government-affairs-service/src/views/landManage/component/landPartol/index.vue +++ b/sub-government-affairs-service/src/views/landManage/component/landPartol/index.vue @@ -15,6 +15,7 @@ @current-change="currentChange" @size-change="sizeChange" @row-save="rowSave" + @row-update="rowUpdate" > + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - 种植阶段详情
- +
@@ -219,12 +162,18 @@ const { VITE_APP_BASE_API } = import.meta.env; const app = useApp(); const UserStore = useUserStore(); const crudRef = ref(null); +const stateCrudRef = ref(null); const stageOptions = reactive([ { value: '0', label: '苗期' }, { value: '1', label: '花果期' }, { value: '2', label: '采收期' }, ]); +const workOptions = reactive([ + { label: '作业计划1', value: '000001' }, + { label: '作业计划2', value: '000002' }, +]); + const state = reactive({ loading: false, query: { @@ -233,89 +182,116 @@ const state = reactive({ }, form: {}, selection: [], - tableClumn: [ - { - label: '地块名', - type: 'input', - prop: 'landName', - disabled: true, - search: true, - rules: { - required: true, - message: '请输入', - trigger: 'blur', - }, - }, - { label: '地址', prop: 'address', width: '240px', showOverflowTooltip: true, disabled: true }, - { - label: '种植产物', - type: 'input', - prop: 'crop', - disabled: true, - search: true, - rules: { - required: true, - message: '请输入', - trigger: 'blur', - }, - }, - { - label: '产权人', - type: 'input', - prop: 'owner', - disabled: true, - search: true, - rules: { - required: true, - message: '请输入', - trigger: 'blur', - }, - }, - { - label: '农用地分类', - prop: 'landClassificationType', - disabled: true, - }, - { - label: '面积', - prop: 'area', - disabled: true, - }, - { label: '坐标', prop: 'coordinate', disabled: true, width: '120px', showOverflowTooltip: true }, - { - label: '土壤类型', - prop: 'soilType', - disabled: true, - }, - { - label: '种植产物', - prop: 'crop', - rules: { - required: true, - message: '请输入', - trigger: 'blur', - }, - }, - { - label: '种子供应商', - prop: 'seedSupplier', - disabled: true, - }, - { - label: '年度计划', - prop: 'planName', - disabled: true, - }, - { - label: '种植日期', - prop: 'planDate', - disabled: true, - }, - ], options: { ...CRUD_OPTIONS, addBtn: false, - column: [], + rowKey: 'landId', + column: [ + { + label: '地块名', + type: 'input', + prop: 'landName', + search: true, + addDisplay: false, + editDisplay: false, + rules: { + required: true, + message: '请输入', + trigger: 'blur', + }, + }, + { label: '地址', prop: 'address', width: '240px', showOverflowTooltip: true, addDisplay: false, editDisplay: false }, + { + label: '种植产物', + type: 'input', + prop: 'crop', + search: true, + rules: { + required: true, + message: '请输入', + trigger: 'blur', + }, + }, + { + label: '产权人', + type: 'input', + prop: 'owner', + search: true, + addDisplay: false, + editDisplay: false, + rules: { + required: true, + message: '请输入', + trigger: 'blur', + }, + }, + { + label: '农用地分类', + prop: 'landClassificationType', + addDisplay: false, + editDisplay: false, + }, + { + label: '面积', + prop: 'area', + addDisplay: false, + editDisplay: false, + }, + { label: '坐标', prop: 'coordinate', width: '120px', showOverflowTooltip: true, addDisplay: false, editDisplay: false }, + { + label: '土壤类型', + prop: 'soilType', + addDisplay: false, + editDisplay: false, + }, + { + label: '种子供应商', + prop: 'seedSupplier', + rules: { + required: true, + message: '请选择', + trigger: 'blur', + }, + }, + { + label: '年度计划', + prop: 'planId', + type: 'select', + remote: false, + props: { + label: 'planName', + value: 'id', + }, + dicHeaders: { + authorization: UserStore.token, + }, + dicUrl: `${VITE_APP_BASE_API}/land-resource/annualManage/page`, + dicFormatter: (res) => res.data.records ?? [], + rules: [ + { + required: true, + message: '请选择', + trigger: 'blur', + }, + ], + }, + { + label: '种植日期', + prop: 'planDate', + rules: { + required: true, + message: '请选择', + trigger: 'blur', + validator: (rule, value, callback) => { + if (!infoFirst.value.planDate || infoFirst.value.planDate == '') { + callback(new Error('请选择')); + } else { + callback(); + } + }, + }, + }, + ], actions: [ { name: '编辑', @@ -363,9 +339,20 @@ const stageState = reactive({ trigger: 'blur', }, }, - { label: '作业计划', prop: 'area', disabled: true }, - { label: '作业时间', prop: 'coordinate', disabled: true }, - { label: '结束时间', prop: 'createTime', disabled: true }, + { + label: '作业计划', + prop: 'workId', + type: 'select', + search: true, + dicData: workOptions, + rules: { + required: true, + message: '请选择', + trigger: 'blur', + }, + }, + { label: '作业时间', prop: 'coordinate', addDisplay: false, editDisplay: false }, + { label: '结束时间', prop: 'createTime', addDisplay: false, editDisplay: false }, ], actions: [ { @@ -401,14 +388,9 @@ const landClassificationType = reactive({ 7: '农村宅基地', }); -const infoVisible = ref(false); -const infoRef = ref(); -let infoData = reactive({ - landId: [], //土地主键id +let infoFirst = ref({ planId: '', //种植规划主键id - crop: '', //种植产物 - seedSupplier: '', //供应商 - planDate: '', //种植时间 + planDate: '', }); const infoRules = reactive({ @@ -423,10 +405,6 @@ const stageObj = reactive({ 1: '花果期', 2: '采收期', }); -const workOptions = reactive([ - { planName: '作业计划1', id: '000001' }, - { planName: '作业计划2', id: '000002' }, -]); let stageInfoVisible = ref(false); const stageInfoRef = ref(); @@ -447,7 +425,6 @@ const stageInfoRules = reactive({ // 加载 const loadData = () => { state.loading = true; - state.options.column = JSON.parse(JSON.stringify(state.tableClumn)); getPlanList(state.query) .then((res) => { if (res.code === 200) { @@ -500,64 +477,63 @@ const refreshChange = () => { // 选择 const selectionChange = (rows) => { state.selection = rows; + console.info('selectionChange', state.selection); }; -const setCity = (row) => { - if (!isEmpty(row.cities)) { - row.provinceCode = row?.cities[0] ?? null; - row.cityCode = row?.cities[1] ?? null; - row.gridAreaCode = row?.cities[2] ?? null; - row.townCode = row?.cities[3] ?? null; - row.village = row?.cities[3] ?? null; - } -}; +const handleIds = () => { + let datalist = state.selection.map((m) => { + return { landId: m.landId, landName: m.landName }; + }); + let selectIdlist = uniqueObjects(datalist, 'landId'); + let selectIdsVal = selectIdlist.map((n) => { + return n.landId; + }); + + return selectIdsVal.toString() || ''; +}; // 新增 const rowSave = (row, done, loading) => { - state.options.column = JSON.parse(JSON.stringify(state.tableClumn)); - console.info('新增'); - // savePlan(row) - // .then((res) => { - // if (res.code === 200) { - // app.$message.success('添加成功!'); - // done(); - // loadData(); - // } - // }) - // .catch((err) => { - // app.$message.error(err.msg); - // }) - // .finally(() => { - // loading(); - // }); + console.info('新增', infoFirst.value); + row.planDate = infoFirst.value.planDate || ''; + row.landId = handleIds(); + savePlan(row) + .then((res) => { + if (res.code === 200) { + app.$message.success('添加成功!'); + done(); + loadData(); + } + }) + .catch((err) => { + app.$message.error(err.msg); + }) + .finally(() => { + loading(); + }); }; // 编辑 const rowEdit = (row) => { - infoVisible.value = true; - infoData = reactive({ - ...row, - }); - // console.info('编辑'); - // row.cities = compact([row.provinceCode, row.cityCode, row.gridAreaCode ?? '', row.townCode ?? '', row.village ?? '']); - // crudRef.value.rowEdit(row); + console.info('编辑', row); + crudRef.value.rowEdit(row); }; const rowUpdate = (row, index, done, loading) => { console.info('更新'); - // editAlan(row) - // .then((res) => { - // if (res.code === 200) { - // app.$message.success('更新成功!'); - // done(); - // loadData(); - // } - // }) - // .catch((err) => { - // app.$message.error(err.msg); - // }) - // .finally(() => { - // loading(); - // }); + editAlan(row) + .then((res) => { + if (res.code === 200) { + app.$message.success('更新成功!'); + done(); + loadData(); + } + }) + .catch((err) => { + app.$message.error(err.msg); + }) + .finally(() => { + loading(); + }); }; // 删除 @@ -575,7 +551,7 @@ const rowDel = (row, index, done) => { .then((res) => { if (res.code === 200) { app.$message.success('删除成功!'); - done(); + // done(); loadData(); } }) @@ -612,70 +588,12 @@ const onExport = () => { }; const onAdd = () => { - infoVisible.value = true; -}; -const subMitInfo = (formEl) => { - if (!formEl) return; - formEl.validate((valid) => { - if (valid) { - let parmer = { - ...infoData, - }; - - if (!parmer.id) { - let datalist = state.selection.map((m) => { - return { landId: m.landId, landName: m.landName }; - }); - - let selectIdlist = uniqueObjects(datalist, 'landId'); - let selectIdsVal = selectIdlist.map((n) => { - return n.landId; - }); - - parmer.landId = selectIdsVal.toString() || ''; - } - - console.info('新增种植计划', parmer); - - if (parmer.id) { - editAlan(parmer) - .then((res) => { - if (res.code === 200) { - app.$message.success('编辑成功!'); - loadData(); - infoHide(); - } - }) - .catch((err) => { - app.$message.error(err.msg); - }) - .finally(() => {}); - } else { - savePlan(parmer) - .then((res) => { - if (res.code === 200) { - loadData(); - infoHide(); - app.$message.success('添加成功!'); - } - }) - .catch((err) => { - app.$message.error(err.msg); - }) - .finally(() => {}); - } - } else { - console.log('error submit!'); - } - }); -}; - -const infoCancel = () => { - infoHide(); -}; - -const infoHide = () => { - infoVisible.value = false; + infoFirst.value.planDate = infoFirst.value.planId = ''; + let ids = handleIds(); + if (ids == '') { + return app.$message.error('先选择土地!'); + } + crudRef.value.rowAdd(); }; function uniqueObjects(arr, key) { @@ -769,61 +687,7 @@ const stageRowDel = (row, index, done) => { .catch(() => {}); }; const stageRowEdit = (row) => { - stageInfoData.landName = row.landName ? row.landName : state.currentRow.landName || ''; - stageInfoData.landId = row.landId ? row.landId : state.currentRow.landId || ''; - stageInfoData.crop = row.crop ? row.crop : state.currentRow.crop || ''; - stageInfoData.stage = row.stage.toString() || '0'; - stageInfoVisible.value = true; -}; - -const stageinfoHide = () => { - stageInfoRef.value && stageInfoRef.value.resetFields(); - stageInfoVisible.value = false; -}; - -const subMitStateInfo = (formEl) => { - if (!formEl) return; - formEl.validate((valid) => { - if (valid) { - let parmer = { - planId: state.currentRow.id || '', //种植规划主键id - stage: stageInfoData.stage || 0, //种植阶段:0->苗期,1>花果期,2->采收期 - workId: stageInfoData.workId || '', - }; - - console.info('新增种植阶段', parmer); - - if (parmer.id) { - editPlantingStage(parmer) - .then((res) => { - if (res.code === 200) { - app.$message.success('编辑成功!'); - getStageList(); - stageinfoHide(); - } - }) - .catch((err) => { - app.$message.error(err.msg); - }) - .finally(() => {}); - } else { - savePlantingStage(parmer) - .then((res) => { - if (res.code === 200) { - getStageList(); - stageinfoHide(); - app.$message.success('添加成功!'); - } - }) - .catch((err) => { - app.$message.error(err.msg); - }) - .finally(() => {}); - } - } else { - console.log('error submit!'); - } - }); + stateCrudRef.value.rowEdit(row); }; const onStateAdd = () => { @@ -831,10 +695,43 @@ const onStateAdd = () => { app.$message.error('请选择种植规划'); return; } + stateCrudRef.value.rowAdd(); +}; - console.info('onStateAdd', state.currentRow); - stageInfoData.landName = state.currentRow.landName || ''; - stageInfoData.crop = state.currentRow.crop || ''; - stageInfoVisible.value = true; +const stageRowSave = (row, done, loading) => { + row.planId = state.currentRow.planId; + console.info('stageRowSave', row); + savePlantingStage({ ...row }) + .then((res) => { + if (res.code === 200) { + app.$message.success('添加成功!'); + done(); + getStageList(); + } + }) + .catch((err) => { + app.$message.error(err.msg); + }) + .finally(() => { + loading(); + }); +}; + +const stageRowUpdate = (row, index, done, loading) => { + console.info('stageRowUpdate'); + editPlantingStage(row) + .then((res) => { + if (res.code === 200) { + app.$message.success('更新成功!'); + done(); + getStageList(); + } + }) + .catch((err) => { + app.$message.error(err.msg); + }) + .finally(() => { + loading(); + }); };