From 91cf7b3b3c8569ca266b9b56c807d90ee3be07bf Mon Sep 17 00:00:00 2001 From: lzc Date: Fri, 28 Feb 2025 17:25:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=88=86=E6=9E=90=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sub-government-affairs-service/package.json | 2 +- .../src/apis/land.js | 37 +- .../src/router/index.js | 2 + .../src/router/modules/statistics.js | 32 ++ .../component/annualPlans/index.vue | 18 +- .../component/operationRecord/index.vue | 358 +++++++++++++++++- .../landManage/component/plantPlan/index.vue | 271 ++++++++++--- .../component/agriculture/index.vue | 261 +++++++++++++ .../component/environment/index.vue | 265 +++++++++++++ .../component/utilizePlan/index.vue | 187 +++++++++ .../src/views/statistics/index.vue | 19 + sub-government-affairs-service/yarn.lock | 2 +- 12 files changed, 1380 insertions(+), 74 deletions(-) create mode 100644 sub-government-affairs-service/src/router/modules/statistics.js create mode 100644 sub-government-affairs-service/src/views/statistics/component/agriculture/index.vue create mode 100644 sub-government-affairs-service/src/views/statistics/component/environment/index.vue create mode 100644 sub-government-affairs-service/src/views/statistics/component/utilizePlan/index.vue create mode 100644 sub-government-affairs-service/src/views/statistics/index.vue diff --git a/sub-government-affairs-service/package.json b/sub-government-affairs-service/package.json index 5ce1ea8..60f60c2 100644 --- a/sub-government-affairs-service/package.json +++ b/sub-government-affairs-service/package.json @@ -21,7 +21,7 @@ "@wangeditor/editor": "^5.1.23", "@wangeditor/editor-for-vue": "^5.1.12", "axios": "^1.6.5", - "echarts": "^5.5.0", + "echarts": "^5.6.0", "element-plus": "^2.7.2", "js-base64": "^3.7.6", "lodash": "^4.17.21", diff --git a/sub-government-affairs-service/src/apis/land.js b/sub-government-affairs-service/src/apis/land.js index 8f15386..20137ff 100644 --- a/sub-government-affairs-service/src/apis/land.js +++ b/sub-government-affairs-service/src/apis/land.js @@ -58,9 +58,8 @@ export function exportAnnua(params = {}) { } export function delAnnual(params) { - return request('/trace/code/annualManage/delete', { + return request('/trace/code/annualManage/delete/' + params.id, { method: 'DELETE', - params, }); } @@ -93,3 +92,37 @@ export function exportPlan(params = {}) { responseType: 'blob', }); } + +export function delPlan(params) { + return request('land-resource/planManage/delete/' + params.id, { + method: 'DELETE', + }); +} + +//种植阶段相关 +export function getPlantingStage(params = {}) { + return request('land-resource/planManage/pageStage', { + method: 'GET', + params, + }); +} + +export function savePlantingStage(data) { + return request('land-resource/planManage/stageSave', { + method: 'POST', + data, + }); +} + +export function editPlantingStage(data = {}) { + return request('land-resource/planManage/editStage', { + method: 'PUT', + data, + }); +} + +export function delPlantingStage(params) { + return request('land-resource/planManage/deleteStage/' + params.id, { + method: 'DELETE', + }); +} diff --git a/sub-government-affairs-service/src/router/index.js b/sub-government-affairs-service/src/router/index.js index 5b8e0d8..575bd9d 100644 --- a/sub-government-affairs-service/src/router/index.js +++ b/sub-government-affairs-service/src/router/index.js @@ -13,6 +13,7 @@ import resourceRouter from './modules/resource'; import plantingAndBreedingRouter from './modules/plantingAndBreeding'; import landsRoutes from './modules/lands'; import annualplanRoutes from './modules/annualplan'; +import statisticsRoutes from './modules/statistics'; const { VITE_APP_NAME } = import.meta.env; @@ -58,6 +59,7 @@ export const constantRoutes = [ ...plantingAndBreedingRouter, ...annualplanRoutes, ...landsRoutes, + ...statisticsRoutes, ]; /** diff --git a/sub-government-affairs-service/src/router/modules/statistics.js b/sub-government-affairs-service/src/router/modules/statistics.js new file mode 100644 index 0000000..16c2a03 --- /dev/null +++ b/sub-government-affairs-service/src/router/modules/statistics.js @@ -0,0 +1,32 @@ +import Layout from '@/layouts/index.vue'; + +const statisticsRoutes = [ + { + path: '/statistics', + name: 'statistics', + component: Layout, + redirect: '/utilizePlan', + meta: { title: '统计分析', icon: 'Document' }, + children: [ + { + path: '/utilizePlan', + name: 'utilizePlan', + component: () => import('@/views/statistics/component/utilizePlan/index.vue'), + meta: { title: '土地利用与规划分析', icon: 'Document' }, + }, + { + path: '/agriculture', + name: 'agriculture', + component: () => import('@/views/statistics/component/agriculture/index.vue'), + meta: { title: '农业生产效率分析', icon: 'Document' }, + }, + { + path: '/environment', + name: 'environment', + component: () => import('@/views/statistics/component/environment/index.vue'), + meta: { title: '环境影响与经济效益分析', icon: 'Document' }, + }, + ], + }, +]; +export default statisticsRoutes; 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 216ee62..f78883a 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,18 +30,18 @@ - + diff --git a/sub-government-affairs-service/src/views/landManage/component/operationRecord/index.vue b/sub-government-affairs-service/src/views/landManage/component/operationRecord/index.vue index 8a71b04..0610485 100644 --- a/sub-government-affairs-service/src/views/landManage/component/operationRecord/index.vue +++ b/sub-government-affairs-service/src/views/landManage/component/operationRecord/index.vue @@ -1,19 +1,355 @@ + - - diff --git a/sub-government-affairs-service/src/views/landManage/component/plantPlan/index.vue b/sub-government-affairs-service/src/views/landManage/component/plantPlan/index.vue index 079e4f9..e64559f 100644 --- a/sub-government-affairs-service/src/views/landManage/component/plantPlan/index.vue +++ b/sub-government-affairs-service/src/views/landManage/component/plantPlan/index.vue @@ -29,7 +29,7 @@ {{ item.label }} - + @@ -47,10 +47,10 @@ - + @@ -103,9 +103,6 @@ - - 查询 + 查询 重置 - - - - - + + + + + + - 编辑 - 删除 + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -171,7 +227,17 @@ import { ref, reactive, onMounted } from 'vue'; import Pagina from '@/components/pagina.vue'; import CustCard from '@/components/CustCard.vue'; -import { getPlanList, savePlan, exportPlan, editAlan } from '@/apis/land.js'; +import { + getPlanList, + savePlan, + exportPlan, + editAlan, + delPlan, + getPlantingStage, + savePlantingStage, + editPlantingStage, + delPlantingStage, +} from '@/apis/land.js'; import { useApp } from '@/hooks'; import CustomSelect from '@/components/CustomSelect.vue'; import { isEmpty, imageToBase64, getAssetsFile, downloadFile } from '@/utils'; @@ -287,15 +353,9 @@ const infoRules = reactive({ seedSupplier: [{ required: true, message: '请输入供应商', trigger: 'blur' }], planDate: [{ required: true, message: '请选择种植时间', trigger: 'blur' }], }); -const options = reactive([ - { - value: '年度计划1', - label: 'Option1', - }, - { - value: '年度计划2', - label: 'Option2', - }, +const workOptions = reactive([ + { value: '作业计划1', label: 'Option1' }, + { value: '作业计划2', label: 'Option2' }, ]); const subPageData = reactive({ @@ -309,16 +369,34 @@ const stageInfo = reactive({ }); const stageRef = ref(); const stageOptions = reactive([ - { - value: '阶段1', - label: 'Option1', - }, - { - value: '阶段2', - label: 'Option2', - }, + { value: '0', label: '苗期' }, + { value: '1', label: '花果期' }, + { value: '2', label: '采收期' }, ]); +let currentRow = reactive({}); +const stageObj = reactive({ + 0: '苗期', + 1: '花果期', + 2: '采收期', +}); + +let stageInfoVisible = ref(false); +const stageInfoRef = ref(); +let stageInfoData = reactive({ + landId: '', //土地主键id + planId: '', //种植规划主键id + crop: '', //种植产物 + stage: '', //所属阶段 + workId: '', //作业计划Id + landName: '', //地块 +}); + +const stageInfoRules = reactive({ + stage: [{ required: true, message: '请选择所属阶段', trigger: 'blur' }], + workId: [{ required: true, message: '请选择作业计划', trigger: 'blur' }], +}); + // #endregion /* --------------- methods --------------- */ @@ -381,7 +459,7 @@ function doEdit(row) { console.info('编辑', infoData); } -function doDel() { +function doDel(row) { console.info('删除'); app .$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', { @@ -390,16 +468,16 @@ function doDel() { type: 'warning', }) .then(() => { - // DeleteEntity({ ids: ids.join(',') }) - // .then((res) => { - // if (res.code === 200) { - // app.$message.success('删除成功!'); - // loadData(); - // } - // }) - // .catch((err) => { - // app.$message.error(err.msg); - // }); + delPlan({ id: row.id }) + .then((res) => { + if (res.code === 200) { + app.$message.success('删除成功!'); + getList(); + } + }) + .catch((err) => { + app.$message.error(err.msg); + }); }) .catch(() => {}); } @@ -458,12 +536,20 @@ const infoHide = () => { const addSub = () => { console.log('新增阶段'); + if (!currentRow.id) { + app.$message.error('请选择种植规划'); + return; + } + stageInfoData.landName = currentRow.landName || ''; + stageInfoData.crop = currentRow.crop || ''; + stageInfoVisible.value = true; }; async function getStageList() { - // const params = { current: pageData.page, size: pageData.size }; - // let res = await getLandsList(params); - // console.log('res ---------', res); + const params = { current: subPageData.page, size: subPageData.size, planId: currentRow.id }; + let { code, data, msg } = await getPlantingStage(params); + sublist.value = data.records || []; + subPageData.total = data.total; } function handleResetStage() { @@ -473,12 +559,97 @@ function handleResetStage() { getStageList(); } -const doSubEdit = () => { - console.log('编辑sub'); +const handleSearchStage = () => { + if (!currentRow.id) { + app.$message.error('请选择种植规划'); + return; + } + getStageList(); }; -const doSubDel = () => { +const rowClick = (row) => { + currentRow = reactive({ ...row }); + getStageList(); +}; + +const doSubEdit = (row) => { + console.log('编辑sub'); + stageInfoData.landName = row.landName || ''; + stageInfoData.crop = row.crop || ''; + stageInfoVisible.value = true; +}; + +const doSubDel = (row) => { console.log('删除sub'); + app + .$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then(() => { + delPlantingStage({ id: row.id }) + .then((res) => { + if (res.code === 200) { + app.$message.success('删除成功!'); + getStageList(); + } + }) + .catch((err) => { + app.$message.error(err.msg); + }); + }) + .catch(() => {}); +}; + +const stageinfoHide = () => { + stageInfoRef.value && stageInfoRef.value.resetFields(); + stageInfoVisible.value = false; +}; + +const subMitStateInfo = (formEl) => { + if (!formEl) return; + formEl.validate((valid) => { + if (valid) { + let parmer = { + planId: 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!'); + } + }); }; // #endregion diff --git a/sub-government-affairs-service/src/views/statistics/component/agriculture/index.vue b/sub-government-affairs-service/src/views/statistics/component/agriculture/index.vue new file mode 100644 index 0000000..a68e56c --- /dev/null +++ b/sub-government-affairs-service/src/views/statistics/component/agriculture/index.vue @@ -0,0 +1,261 @@ + + + + diff --git a/sub-government-affairs-service/src/views/statistics/component/environment/index.vue b/sub-government-affairs-service/src/views/statistics/component/environment/index.vue new file mode 100644 index 0000000..544f578 --- /dev/null +++ b/sub-government-affairs-service/src/views/statistics/component/environment/index.vue @@ -0,0 +1,265 @@ + + + + + diff --git a/sub-government-affairs-service/src/views/statistics/component/utilizePlan/index.vue b/sub-government-affairs-service/src/views/statistics/component/utilizePlan/index.vue new file mode 100644 index 0000000..8f7bfe0 --- /dev/null +++ b/sub-government-affairs-service/src/views/statistics/component/utilizePlan/index.vue @@ -0,0 +1,187 @@ + + + + diff --git a/sub-government-affairs-service/src/views/statistics/index.vue b/sub-government-affairs-service/src/views/statistics/index.vue new file mode 100644 index 0000000..d7d9c29 --- /dev/null +++ b/sub-government-affairs-service/src/views/statistics/index.vue @@ -0,0 +1,19 @@ + + + + + diff --git a/sub-government-affairs-service/yarn.lock b/sub-government-affairs-service/yarn.lock index 74473c4..78cc992 100644 --- a/sub-government-affairs-service/yarn.lock +++ b/sub-government-affairs-service/yarn.lock @@ -2171,7 +2171,7 @@ earcut@2.2.4: resolved "https://registry.npmmirror.com/earcut/-/earcut-2.2.4.tgz#6d02fd4d68160c114825d06890a92ecaae60343a" integrity sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ== -echarts@^5.5.0: +echarts@^5.6.0: version "5.6.0" resolved "https://registry.npmmirror.com/echarts/-/echarts-5.6.0.tgz#2377874dca9fb50f104051c3553544752da3c9d6" integrity sha512-oTbVTsXfKuEhxftHqL5xprgLoc0k7uScAwtryCgWF6hPYFLRwOUHiFmHGCBKP5NPFNkDVopOieyUqYGH8Fa3kA==