From d173c4205cefd9ad47d38c035ae2bcac13b574c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=83=B3?= <826276471@qq.com> Date: Tue, 11 Mar 2025 16:02:07 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=E5=9C=9F=E5=9C=B0=E8=BF=9D=E6=B3=95?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/soilClassification/index.vue | 4 +- .../inputSuppliesManage/common/typeRadio.vue | 7 - .../redBlackRank/common/RankType.vue | 86 ++++++ .../redBlackRank/common/rankCard.vue | 104 +++++--- .../redBlackRank/index.vue | 6 +- .../src/views/landManage/common/Attrs.vue | 10 +- .../illegalHandle/common/FileUpload.vue | 59 ++++- .../component/illegalHandle/index.vue | 250 +++++++++++++----- .../component/landsManage/common/Attrs.vue | 10 +- .../component/landsManage/index.vue | 6 +- 10 files changed, 395 insertions(+), 147 deletions(-) create mode 100644 sub-government-affairs-service/src/views/inputSuppliesManage/redBlackRank/common/RankType.vue diff --git a/sub-government-affairs-service/src/views/dict/component/soilClassification/index.vue b/sub-government-affairs-service/src/views/dict/component/soilClassification/index.vue index 7fa5fca..e4d6ba1 100644 --- a/sub-government-affairs-service/src/views/dict/component/soilClassification/index.vue +++ b/sub-government-affairs-service/src/views/dict/component/soilClassification/index.vue @@ -15,8 +15,8 @@ @row-update="handleUpdete" > @@ -41,7 +41,7 @@ import useSoilTypeHook from './useSoilTypeHook'; const { crudRef, condition, - loading, + _loading, data, pageData, option, @@ -51,7 +51,7 @@ const { handleSearch, handleSearchReset, handleSave, - handleUpdete, + handleUpdate, } = useSoilTypeHook(); /* --------------- data --------------- */ diff --git a/sub-government-affairs-service/src/views/dict/component/soilClassification/useSoilTypeHook.js b/sub-government-affairs-service/src/views/dict/component/soilClassification/useSoilTypeHook.js index f16e863..8cf1e59 100644 --- a/sub-government-affairs-service/src/views/dict/component/soilClassification/useSoilTypeHook.js +++ b/sub-government-affairs-service/src/views/dict/component/soilClassification/useSoilTypeHook.js @@ -1,31 +1,17 @@ -import { ref, onMounted } from 'vue'; +import { ref, onMounted, nextTick } from 'vue'; import { CRUD_OPTIONS } from '@/config'; +import { getSoilType, saveSoilType, updateSoilType } from '@/apis/baseInfo'; +import { ElMessage } from 'element-plus'; export default function useSoilTypeHook() { onMounted(getList); const crudRef = ref(); const condition = ref({ - soilType: '', + soilType: null, }); - const data = ref([ - { - code: 'a123456', - soilType: '黑土地', - status: 0, - }, - { - code: 'b258369', - soilType: '黄土地', - status: 1, - }, - { - code: 'c987654', - soilType: '盐碱土地', - status: 0, - }, - ]); - const loading = ref(false); + const data = ref([]); + const _loading = ref(false); const pageData = ref({ currentPage: 1, pageSize: 10, @@ -40,7 +26,7 @@ export default function useSoilTypeHook() { column: [ { label: '编号', - prop: 'code', + prop: 'id', display: false, addDisplay: false, }, @@ -69,7 +55,7 @@ export default function useSoilTypeHook() { display: false, addDisplay: false, render: ({ row }) => { - return row.status === 0 ? '启用' : '禁用'; + return row.status === '1' ? '启用' : '禁用'; }, }, ], @@ -92,34 +78,32 @@ export default function useSoilTypeHook() { event: handleDel, }, ]); - function getList() { + async function getList() { let params = { current: pageData.value.currentPage, - pageSize: pageData.value.pageSize, + size: pageData.value.pageSize, ...condition.value, }; - console.log('get --- ', params); - console.table(data.value); + let res = await getSoilType(params); + if (res.code == 200) { + data.value = res.data.records; + pageData.value.total = res.data.total; + } + console.log('get --- ', res); } - function handleStatusChange(row, index) { - console.log('handleStatusChange --- ', row); - data.value[index].status = data.value[index].status === 0 ? 1 : 0; - console.table(data.value); + async function handleStatusChange(row, index) { + await editSoilType(row, index); } function handleCurrentChange(val) { - console.log('handleCurrentChange --- ', val); pageData.value.currentPage = val; getList(); } function handleSizeChange(val) { - console.log('handleSizeChange --- ', val); pageData.value.currentPage = 1; pageData.value.pageSize = val; getList(); } function handleSearch(val, done) { - console.log('handleSearch --- ', val); - console.log('ccc', condition.value); resetPage(); done(); } @@ -127,22 +111,44 @@ export default function useSoilTypeHook() { resetPage(); } function handleEdit(row, index) { - console.log('handleEdit --- ', row); - console.log('index --- ', index); - crudRef.value.rowEdit(row); + crudRef.value.rowEdit(row, index); } function handleDel(row) { console.log('handleDel --- ', row); } - function handleSave(form, _loading, done) { - console.log('save --- ', form); - _loading(); + async function handleSave(form, loading, done) { + let res = await saveSoilType(form); + if (res.code == 200) { + ElMessage({ + type: 'success', + message: '添加成功', + }); + } + loading(); getList(); } - function handleUpdate(form, _loading, done) { - console.log('update --- ', form); - _loading(); - getList(); + async function handleUpdate(row, index, done, loading) { + await editSoilType(row, index); + loading(); + done(); + } + async function editSoilType(row, index) { + let res = await updateSoilType({ + id: row.id, + soilType: row.soilType, + status: row.status === '0' ? '1' : '0', + }); + console.log('res ------', res); + if (res.code == 200) { + ElMessage({ + type: 'success', + message: '修改成功', + }); + nextTick(() => { + data.value[index].soilType = row.soilType; + data.value[index].status = row.status === '0' ? '1' : '0'; + }); + } } function resetPage() { pageData.value.currentPage = 1; @@ -152,7 +158,7 @@ export default function useSoilTypeHook() { return { crudRef, condition, - loading, + _loading, data, pageData, option, From 8412ba4bf872b041cc5cf73a167feac80e25612a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=83=B3?= <826276471@qq.com> Date: Tue, 11 Mar 2025 17:26:03 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat:=E5=9C=9F=E5=A3=A4=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/dict/component/soilClassification/useSoilTypeHook.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/sub-government-affairs-service/src/views/dict/component/soilClassification/useSoilTypeHook.js b/sub-government-affairs-service/src/views/dict/component/soilClassification/useSoilTypeHook.js index 8cf1e59..bc27dd0 100644 --- a/sub-government-affairs-service/src/views/dict/component/soilClassification/useSoilTypeHook.js +++ b/sub-government-affairs-service/src/views/dict/component/soilClassification/useSoilTypeHook.js @@ -89,7 +89,6 @@ export default function useSoilTypeHook() { data.value = res.data.records; pageData.value.total = res.data.total; } - console.log('get --- ', res); } async function handleStatusChange(row, index) { await editSoilType(row, index); @@ -138,7 +137,6 @@ export default function useSoilTypeHook() { soilType: row.soilType, status: row.status === '0' ? '1' : '0', }); - console.log('res ------', res); if (res.code == 200) { ElMessage({ type: 'success',