diff --git a/main/index.html b/main/index.html index a900721..211ab8e 100644 --- a/main/index.html +++ b/main/index.html @@ -1,13 +1,24 @@ - - - - - - - -
- - - + + + + + + + + + + + + +
+ + + + \ No newline at end of file diff --git a/sub-government-affairs-service/index.html b/sub-government-affairs-service/index.html index 965338c..e1d7b64 100644 --- a/sub-government-affairs-service/index.html +++ b/sub-government-affairs-service/index.html @@ -1,13 +1,16 @@ - - - - - 政务服务 - - -
- - - + + + + + + 政务服务 + + + +
+ + + + \ No newline at end of file diff --git a/sub-government-affairs-service/src/apis/land.js b/sub-government-affairs-service/src/apis/land.js index 3d7cee1..4923747 100644 --- a/sub-government-affairs-service/src/apis/land.js +++ b/sub-government-affairs-service/src/apis/land.js @@ -132,3 +132,13 @@ export function delLand(id) { method: 'DELETE', }); } +/* 导入土地 */ +export function importLands(data) { + return request('land-resource/landManage/import', { + method: 'POST', + data, + Headers: { + 'Content-Type': 'multipart/form-data', + }, + }); +} diff --git a/sub-government-affairs-service/src/views/landManage/component/landsManage/common/Attrs.vue b/sub-government-affairs-service/src/views/landManage/component/landsManage/common/Attrs.vue new file mode 100644 index 0000000..8398310 --- /dev/null +++ b/sub-government-affairs-service/src/views/landManage/component/landsManage/common/Attrs.vue @@ -0,0 +1,104 @@ + + + + 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 05e9bef..a7e3d12 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 @@ -12,17 +12,21 @@ class="custon_create_land_" :data="data" :option="option" + :before-close="handleCloseFrom" @current-change="handlePageChange" @size-change="handleSizeChange" @search-reset="handleResetSearch" @search-change="handleSearch" @row-save="handleRowSave" > - + + - + + + @@ -62,24 +58,27 @@ import { ref, reactive, onMounted } from 'vue'; import CustomCard from '@/components/CustomCard'; import { CRUD_OPTIONS } from '@/config'; import { useUserStore } from '@/store/modules/user'; -import { getLandsList, exportLands, delLand, saveLand } from '@/apis/land.js'; +import { getLandsList, exportLands, delLand, saveLand, importLands } from '@/apis/land.js'; import { ElMessage } from 'element-plus'; - import useLandHook from './useLandHook'; import { CommonUpload } from '@/apis'; -import { get } from 'lodash'; +import Attrs from './common/Attrs.vue'; +import { add } from 'lodash'; + const { landType, landsType, landClassificationType, handleIficationType } = useLandHook(); const { VITE_APP_BASE_API } = import.meta.env; const UserStore = useUserStore(); -const landClassificationType_ = ref(''); onMounted(() => { getList(); }); - +const params = ref({ + zoom: 10, +}); +const local_ = ref([102.833669, 24.88149, '昆明市']); +const local = ref(JSON.parse(JSON.stringify(local_.value))); /* --------------- data --------------- */ // #region - const crudRef = ref(); const pageData = reactive({ currentPage: 1, @@ -223,6 +222,7 @@ const option = reactive({ prop: 'landClassificationType', type: 'select', dicData: landClassificationType, + viewDisplay: false, rules: [ { required: true, @@ -231,13 +231,30 @@ const option = reactive({ }, ], }, + { + label: '用地分类', + prop: 'landClassificationTypeView', + addDisplay: false, + }, { label: '位置', prop: 'villageCode', + type: 'cascader', + props: { + label: 'areaName', + value: 'areaCode', + children: 'areaChildVOS', + }, + dicUrl: `${VITE_APP_BASE_API}/system/area/region?areaCode=530000`, + dicHeaders: { + authorization: UserStore.token, + }, + dicFormatter: (res) => res.data ?? [], + // change: (o) => setCityChange(o), rules: [ { required: true, - message: '请输入', + message: '请选择', trigger: 'blur', }, ], @@ -246,6 +263,7 @@ const option = reactive({ label: '是否土地流转', prop: 'isTransfer', type: 'select', + viewDisplay: false, dicData: [ { label: '是', @@ -257,6 +275,11 @@ const option = reactive({ }, ], }, + { + label: '是否土地流转1', + prop: 'isTransferView', + addDisplay: false, + }, { label: '面积', prop: 'area', @@ -293,6 +316,48 @@ const option = reactive({ }, ], }, + { + label: '土地使用权信息', + prop: 'baseGroup', + column: [ + { + label: '联系人', + prop: 'landUseName', + }, + { + label: '联系电话', + prop: 'landUsePhone', + }, + { + label: '用地性质', + prop: 'nature', + }, + { + label: '证书', + prop: 'landCertificateUrl', + }, + ], + }, + { + label: '土地使用权信息', + prop: 'baseGroup', + column: [ + { + label: '地理位置', + prop: 'coordinate', + viewDisplay: false, + }, + { + label: '地理位置', + prop: 'coordinateView', + addDisplay: false, + }, + { + label: '图片', + prop: 'landUrl', + }, + ], + }, ], }); const searchData = reactive({ @@ -301,6 +366,8 @@ const searchData = reactive({ owner: '', }); const attrs = ref([]); +const landOwnerAttrs = ref([]); +const landAttrs = ref([]); const rowData = ref([]); // #endregion @@ -315,14 +382,18 @@ async function getList() { ...searchData, }; let res = await getLandsList(params); - console.log('res ---------', res); if (res.code == 200) { data.value = res.data.records; + data.value.forEach((v) => { + v.isTransfer = v.landTransfer || 1; + v.isTransferView = v.landTransfer == 1 ? '否' : '是'; + v.landClassificationTypeView = handleIficationType(v.handleIficationType); + v.coordinateView = v.coordinate; + }); pageData.total = res.data.total; } } function handlePageChange(val) { - console.log('page', val); pageData.currentPage = val; getList(); } @@ -346,29 +417,32 @@ async function handleResetSearch() { pageData.total = 0; await getList(); } -async function handleRowSave(val, done, loading) { - let data = JSON.parse(JSON.stringify(val)); - data.isDraftsSave = 0; - data.landType = 0; - let urls = []; - if (data.propertyCertificateUrl.length) { - data.propertyCertificateUrl.forEach((item) => urls.push(item.url)); - } - data.propertyCertificateUrl = urls.join(); - const res = await saveLand(data); +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('保存成功'); + ElMessage.success('导入成功'); getList(); - done(); } } async function handleExport() { let res = await exportLands({ - landType: 1, + landType: landType.value, }); if (res) { let a = document.createElement('a'); - // a.download = attrNames.value[Number(searchCondition.landType)] + '.xlsx'; + a.download = attrNames.value[Number(landType.value)] + '.xlsx'; a.download = 'test.xlsx'; let blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); let link = window.URL.createObjectURL(blob); @@ -379,20 +453,6 @@ async function handleExport() { window.URL.revokeObjectURL(link); } } -const rowUploadPicture = async ({ file }) => { - const formData = new FormData(); - formData.append('file', file); - const res = await CommonUpload(formData); - if (res.code === 200) { - attrs.value.push({ - ...res.data, - id: 'id_' + Date.now(), - }); - } -}; -function handleClearAttr(id) { - attrs.value = attrs.value.filter((item) => item.id !== id); -} async function handleDelete(id) { let res = await delLand(id); if (res.code == 200) { @@ -401,9 +461,76 @@ async function handleDelete(id) { } function handleView(obj) { rowData.value = obj; - console.log('row', rowData.value); + if (obj.propertyCertificateUrl) { + attrs.value = obj.propertyCertificateUrl.split(',').map((v, i) => { + return { + name: `产权附件_${i}`, + url: v, + id: 'id_' + Date.now(), + }; + }); + } + if (obj.landCertificateUrl) { + landOwnerAttrs.value = obj.landCertificateUrl.split(',').map((v, i) => { + return { + name: `使用信息附件_${i}`, + url: v, + id: 'id_' + Date.now(), + }; + }); + if (obj.landUrl) { + landAttrs.value = obj.landUrl.split(',').map((v, i) => { + return { + name: `位置附件_${i}`, + url: v, + id: 'id_' + Date.now(), + }; + }); + } + } crudRef.value.rowView(obj); } +function handleCloseFrom(done) { + landOwnerAttrs.value = []; + attrs.value = []; + landAttrs.value = []; + 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; + data.landType = landType.value; + let urls = []; + let landOwnerUrls = []; + let landUrls = []; + if (attrs.value.length) { + attrs.value.forEach((item) => urls.push(item.url)); + } + if (landOwnerAttrs.value.length) { + landOwnerAttrs.value.forEach((item) => landOwnerUrls.push(item.url)); + } + if (landAttrs.value.length) { + landAttrs.value.forEach((item) => landUrls.push(item.url)); + } + data.propertyCertificateUrl = urls.join(); + data.landCertificateUrl = landOwnerUrls.join(); + data.landUrl = landUrls.join(); + data.villageCode = data.villageCode[data.villageCode.length - 1] || ''; + if (local.value.length != 0) { + data.coordinate = `${local.value[0]}E,${local.value[1]}N`; + } + const res = await saveLand(data); + loading(); + if (res.code == 200) { + ElMessage.success('保存成功'); + getList(); + attrs.value = []; + landOwnerAttrs.value = []; + done(); + } +} // #endregion