diff --git a/sub-government-affairs-service/src/apis/baseInfo.js b/sub-government-affairs-service/src/apis/baseInfo.js index 032eb6d..ddca6c8 100644 --- a/sub-government-affairs-service/src/apis/baseInfo.js +++ b/sub-government-affairs-service/src/apis/baseInfo.js @@ -1,4 +1,5 @@ import request from '@/utils/axios'; +import { method } from 'lodash'; //基础信息维护——字典项管理 @@ -73,8 +74,6 @@ export function delPlanCrop(params) { // #endregion -// #region - export function savePlanStage(data) { return request('land-resource/baseInfo/stageTypeSave', { method: 'POST', @@ -83,6 +82,7 @@ export function savePlanStage(data) { } /* ------ 土壤类型 ------ */ +// #region /* 获取土壤类型列表 */ export function getSoilType(params) { @@ -114,9 +114,53 @@ export function delSoilType(id) { } /* 导出土壤类型 */ export function exportSoilType() { - return request('/land-resource/baseInfo/soilTypeExport', { + return request('/land-resource/baseInfo/soilTypeExport/', { method: 'GET', responseType: 'blob', }); } // #endregion + +/* ------ 土地类型 ------ */ +// #region +/* 新增土地类型 */ +export function landTypeSave(data) { + return request('land-resource/baseInfo/landTypeSave', { + method: 'POST', + data, + }); +} +/* 土地类型树 */ +export function getLandTypeTree(params) { + return request('land-resource/baseInfo/landTree', { + params, + }); +} +/* 土地类型列表 */ +export function getLandType(params) { + return request('land-resource/baseInfo/landType', { + params, + }); +} +/* 土地类型导出 */ +export function exportLandType(params) { + return request('land-resource/baseInfo/landTypeExport', { + params, + responseType: 'blob', + }); +} +/* 土地类型删除 */ +export function delLandType(id) { + return request(`land-resource/baseInfo/landTypeDelete/${id}`, { + method: 'DELETE', + }); +} +/* 土地类型编辑 */ +export function editLandType(data) { + return request('land-resource/baseInfo/landTypeEdit', { + method: 'PUT', + data, + }); +} + +// #endregion diff --git a/sub-government-affairs-service/src/assets/template/土地模版表.xlsx b/sub-government-affairs-service/src/assets/template/土地模版表.xlsx new file mode 100644 index 0000000..92e040d Binary files /dev/null and b/sub-government-affairs-service/src/assets/template/土地模版表.xlsx differ diff --git a/sub-government-affairs-service/src/router/modules/lands.js b/sub-government-affairs-service/src/router/modules/lands.js index d4424b2..daf0024 100644 --- a/sub-government-affairs-service/src/router/modules/lands.js +++ b/sub-government-affairs-service/src/router/modules/lands.js @@ -13,7 +13,7 @@ const landsRoutes = [ path: '/sub-government-affairs-service/landsManage', name: 'landsManage', component: () => import('@/views/landManage/component/landsManage/index.vue'), - meta: { title: '土地管理', icon: 'Document' }, + meta: { title: '土地信息登记', icon: 'Document' }, }, { path: '/sub-government-affairs-service/plantPlan', diff --git a/sub-government-affairs-service/src/views/dict/component/landCassification/index.vue b/sub-government-affairs-service/src/views/dict/component/landCassification/index.vue index b2bef4e..54b1255 100644 --- a/sub-government-affairs-service/src/views/dict/component/landCassification/index.vue +++ b/sub-government-affairs-service/src/views/dict/component/landCassification/index.vue @@ -2,10 +2,24 @@
- - + + + + - + - + diff --git a/sub-government-affairs-service/src/views/dict/component/region/index.vue b/sub-government-affairs-service/src/views/dict/component/region/index.vue index 09f8c35..dbee06a 100644 --- a/sub-government-affairs-service/src/views/dict/component/region/index.vue +++ b/sub-government-affairs-service/src/views/dict/component/region/index.vue @@ -2,7 +2,7 @@
- + - + + + + + + + + + + diff --git a/sub-government-affairs-service/src/views/inputSuppliesManage/common/TypeMenu.vue b/sub-government-affairs-service/src/views/inputSuppliesManage/common/TypeMenu.vue new file mode 100644 index 0000000..bb07ce8 --- /dev/null +++ b/sub-government-affairs-service/src/views/inputSuppliesManage/common/TypeMenu.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/sub-government-affairs-service/src/views/inputSuppliesManage/material/fertilizer/index.vue b/sub-government-affairs-service/src/views/inputSuppliesManage/material/fertilizer/index.vue index 0e05b52..090d236 100644 --- a/sub-government-affairs-service/src/views/inputSuppliesManage/material/fertilizer/index.vue +++ b/sub-government-affairs-service/src/views/inputSuppliesManage/material/fertilizer/index.vue @@ -1,16 +1,72 @@ - + diff --git a/sub-government-affairs-service/src/views/inputSuppliesManage/material/pesticide/index.vue b/sub-government-affairs-service/src/views/inputSuppliesManage/material/pesticide/index.vue index 35b7864..5df6487 100644 --- a/sub-government-affairs-service/src/views/inputSuppliesManage/material/pesticide/index.vue +++ b/sub-government-affairs-service/src/views/inputSuppliesManage/material/pesticide/index.vue @@ -1,15 +1,84 @@ - + diff --git a/sub-government-affairs-service/src/views/landManage/component/landsManage/index.vue b/sub-government-affairs-service/src/views/landManage/component/landsManage/index.vue index faf2f5e..124e854 100644 --- a/sub-government-affairs-service/src/views/landManage/component/landsManage/index.vue +++ b/sub-government-affairs-service/src/views/landManage/component/landsManage/index.vue @@ -27,8 +27,8 @@ {{ row.isUpload != '1' ? '是' : '否' }} + @@ -60,22 +66,28 @@ import CustomCard from '@/components/CustomCard'; import { CRUD_OPTIONS } from '@/config'; import { useUserStore } from '@/store/modules/user'; import { getLandsList, exportLands, delLand, saveLand, importLands } from '@/apis/land.js'; +import { getLandTypeTree } from '@/apis/baseInfo'; import { ElMessage } from 'element-plus'; import useLandHook from './useLandHook'; import Attrs from './common/Attrs.vue'; +import { getAssetsFile, downloadFile } from '@/utils'; +import { useApp } from '@/hooks'; -const { landType, landsType, landClassificationType, handleIficationType } = useLandHook(); +const app = useApp(); +const { landType, landsType } = useLandHook(); const { VITE_APP_BASE_API } = import.meta.env; const UserStore = useUserStore(); onMounted(() => { getList(); + getLandTree(); }); const params = ref({ zoom: 10, }); const local_ = ref([102.833669, 24.88149, '昆明市']); const local = ref(JSON.parse(JSON.stringify(local_.value))); +const landTreeDic = ref([]); /* --------------- data --------------- */ // #region const loading = ref(false); @@ -127,7 +139,7 @@ const option = reactive({ label: '农用地分类', prop: 'landClassificationType', select: 'select', - dicData: landClassificationType, + dicData: landTreeDic, addDisplay: false, display: false, editDisplay: false, @@ -166,6 +178,9 @@ const option = reactive({ addDisplay: false, display: false, editDisplay: false, + render: ({ row }) => { + return row.soilType; + }, }, { label: '是否上传附件', @@ -219,9 +234,9 @@ const option = reactive({ }, { label: '用地分类', - prop: 'landClassificationType', - type: 'select', - dicData: landClassificationType, + prop: 'landTypeId', + type: 'cascader', + dicData: landTreeDic, viewDisplay: false, rules: [ { @@ -233,7 +248,7 @@ const option = reactive({ }, { label: '用地分类', - prop: 'landClassificationTypeView', + prop: 'landClassificationType', addDisplay: false, }, { @@ -288,9 +303,29 @@ const option = reactive({ label: '产权人', prop: 'owner', }, + { + label: '土壤类型', + prop: 'soilTypeId', + type: 'select', + viewDisplay: false, + dicUrl: `${VITE_APP_BASE_API}/land-resource/baseInfo/soilTypePage`, + dicQuery: { + current: 1, + size: 9999, + }, + dicHeaders: { + authorization: UserStore.token, + }, + dicFormatter: (res) => res.data.records ?? [], + props: { + value: 'id', + label: 'soilType', + }, + }, { label: '土壤类型', prop: 'soilType', + addDisplay: false, }, ], }, @@ -369,6 +404,7 @@ const attrs = ref([]); const landOwnerAttrs = ref([]); const landAttrs = ref([]); const rowData = ref([]); +const importExcelRef = ref(); // #endregion /* --------------- methods --------------- */ @@ -390,7 +426,6 @@ async function getList() { data.value.forEach((v) => { v.isTransfer = v.landTransfer || 1; v.isTransferView = v.landTransfer == 1 ? '否' : '是'; - v.landClassificationTypeView = handleIficationType(v.handleIficationType); v.coordinateView = v.coordinate; }); pageData.value.total = total; @@ -421,24 +456,6 @@ async function handleResetSearch() { await getList(); } const attrNames = reactive(landsType.map((v) => v.label)); -function handleImport() { - let inp = document.createElement('input'); - inp.type = 'file'; - inp.onchange = fileUp; - document.body.appendChild(inp); - inp.click(); - document.body.removeChild(inp); -} -async function fileUp(e) { - let formData = new FormData(); - formData.append('file', e.target.files[0]); - formData.append('landType', landType.value); - const res = await importLands(formData); - if (res.code == 200) { - ElMessage.success('导入成功'); - getList(); - } -} async function handleExport() { let res = await exportLands({ landType: landType.value, @@ -500,7 +517,6 @@ function handleCloseFrom(done) { local.value = JSON.parse(JSON.stringify(local_.value)); done(); } - async function handleRowSave(val, done, loading) { let data = JSON.parse(JSON.stringify(val)); data.isDraftsSave = 0; @@ -521,6 +537,7 @@ async function handleRowSave(val, done, loading) { data.landCertificateUrl = landOwnerUrls.join(); data.landUrl = landUrls.join(); data.villageCode = data.villageCode[data.villageCode.length - 1] || ''; + data.landTypeId = data.landTypeId[data.landTypeId.length - 1]; if (local.value.length != 0) { data.coordinate = `${local.value[0]}E,${local.value[1]}N`; } @@ -534,6 +551,50 @@ async function handleRowSave(val, done, loading) { done(); } } +// 导入 +const onUpload = () => { + importExcelRef?.value && importExcelRef.value.show(); +}; +const onDownloadExcel = (url) => { + downloadFile(url, `土地模版表.xlsx`); +}; +const onUploadExcel = (formData) => { + formData.append('landType', landType.value); + importLands(formData) + .then((res) => { + if (res.status === 200) { + app.$message.success('导入成功!'); + } + }) + .catch((err) => { + app.$message.error('导入失败!'); + importExcelRef.value.clear(); + }) + .finally(() => { + importExcelRef.value.hide(); + }); +}; +async function getLandTree() { + let res = await getLandTypeTree(); + if (res.code == 200) { + landTreeDic.value = newTree(res.data, 0); + console.log('landTreeDic', landTreeDic.value); + } +} +function newTree(arr, i) { + arr.forEach((v) => { + if (i == 0) { + v.value = v.id; + v.label = v.prentLandType; + v.disabled = !v.children || !v.children.length; + } else { + v.value = v.id; + v.label = v.childLandCategory; + } + if (v.children) v.children = newTree(v.children, i + 1); + }); + return arr; +} // #endregion