From 02409bfbe15f22fc3b5dccadabfd860a660a49d9 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Sat, 11 Oct 2025 10:37:14 +0800
Subject: [PATCH] feat: 名称修改
---
src/views/resource/patchManagement.vue | 146 ++++++++++++++++++++++--------------------------
1 files changed, 67 insertions(+), 79 deletions(-)
diff --git a/src/views/resource/patchManagement.vue b/src/views/resource/patchManagement.vue
index 1d88a2f..1ff8005 100644
--- a/src/views/resource/patchManagement.vue
+++ b/src/views/resource/patchManagement.vue
@@ -55,7 +55,7 @@
<el-form-item label="图斑类型" prop="region">
<el-select v-model="ruleForm.region" placeholder="请选择图斑类型">
<el-option
- v-for="item in spotTypeOption"
+ v-for="item in allspotTypeOption"
:key="item.value"
:label="item.label"
:value="item.value"
@@ -83,12 +83,13 @@
:title="spotDetailsTitle"
:detailid="detailid"
:detailList="detailList"
- :spotTypeOption="spotTypeOption"
+ :spotTypeOption="allspotTypeOption"
+ :regionalData="regionalData"
></SpotDetails>
-
</basic-container>
</template>
<script setup>
+import {findAreaName} from '@/utils/areaUtils'
import {
spotManagementTableApi,
searchManagementApi,
@@ -96,6 +97,7 @@
tableMapListApi,
exportExcel,
patchDeleteApi,
+ listOfSpotTypesApi,
} from '@/api/patchManagement/index';
import { getRegionTreeAll } from '@/api/job/task';
import { ref, computed, watch } from 'vue';
@@ -107,7 +109,7 @@
import patchDetails from '@/views/resource/components/patchDetails.vue';
import SpotDetails from '@/views/resource/components/spotDetails.vue';
const spotDetailsTitle = ref('');
-const detailList = ref('')
+const detailList = ref('');
const store = useStore();
const router = useRouter();
const ruleFormRef = ref(null);
@@ -143,14 +145,13 @@
total: 0,
lotTypeId: '',
createUser: '',
- areaCode:'',
- fileName:''
+ areaCode: '',
+ fileName: '',
});
const selectionList = ref([]);
-
const option = ref({
- align: 'center',
+ align: 'center',
headerAlign: 'center',
addBtn: false,
tip: false,
@@ -159,6 +160,8 @@
searchMenuPosition: 'right',
border: true,
index: true,
+ indexLabel: '序号',
+ indexWidth: 60,
selection: true,
grid: false,
menuWidth: 240,
@@ -180,8 +183,8 @@
prop: 'file_name',
span: 24,
search: true,
- overHidden: true,
- showOverflowTooltip: true,
+ overHidden: true,
+ showOverflowTooltip: true,
searchSpan: 4,
rules: [{ required: true, message: '请输入文件名称', trigger: 'blur' }],
},
@@ -216,7 +219,7 @@
label: '行政区划',
prop: 'areaName',
span: 24,
- width:180,
+ width: 180,
searchLabelWidth: 100,
search: true,
searchSpan: 4,
@@ -275,11 +278,11 @@
const ids = computed(() => selectionList.value.map(ele => ele.id).join(','));
// 获取行政区划
-const regionalData = ref([])
+const regionalData = ref([]);
const requestDockInfo = () => {
- getRegionTreeAll({ parentCode: userAreaCode.value }).then(res => {
- const rawData = res.data.data ? [res.data.data] : [];
- regionalData.value = rawData;
+ getRegionTreeAll({ parentCode: userAreaCode.value }).then(res => {
+ const rawData = res.data.data ? [res.data.data] : [];
+ regionalData.value = rawData;
const filterTree = nodes => {
return nodes.filter(node => {
const nodeCodeStr = node.id.toString();
@@ -296,7 +299,7 @@
});
};
deptTreeData.value = filterTree(rawData);
- onLoad(page.value);
+ onLoad(page.value);
});
};
// 获取搜索数据
@@ -309,7 +312,7 @@
uniqueMap.set(key, value);
}
});
- const creatorOptionuniqueMap = new Map();
+ const creatorOptionuniqueMap = new Map();
res.data.data.user_names.forEach(item => {
const [key, value] = Object.entries(item)[0];
if (!creatorOptionuniqueMap.has(key)) {
@@ -326,8 +329,20 @@
}));
regionalScope.value = res.data.data.area_codes;
requestDockInfo();
-
-
+ });
+};
+const allspotTypeOption = ref([]);
+// 获取上传图斑类型
+const getlistOfSpotTypesApi = () => {
+ const searchparams = {
+ current: 1,
+ size: 9999,
+ };
+ listOfSpotTypesApi(searchparams).then(res => {
+ allspotTypeOption.value = res.data.data.records.map(item => ({
+ label: item.patches_type,
+ value: item.id,
+ }));
});
};
// ===== watch =====
@@ -372,26 +387,25 @@
};
const rowDel = row => {
-
- ElMessageBox.confirm('确定将选择数据删除?', '提示', {
+ ElMessageBox.confirm('确定将选择数据删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
- .then(() => patchDeleteApi(row.id)) // 直接传递ID
- .then(() => {
- onLoad(page.value)
- ElMessage.success('操作成功!')
- })
+ .then(() => patchDeleteApi(row.id)) // 直接传递ID
+ .then(() => {
+ onLoad(page.value);
+ ElMessage.success('操作成功!');
+ });
};
const searchReset = () => {
-page.value.areaCode=''
-page.value.createUser=''
-page.value.fileName=''
- page.value.lotTypeId =''
-page.value.currentPage=1
-page.value.pageSize=20
+ page.value.areaCode = '';
+ page.value.createUser = '';
+ page.value.fileName = '';
+ page.value.lotTypeId = '';
+ page.value.currentPage = 1;
+ page.value.pageSize = 20;
onLoad(page.value);
};
@@ -399,9 +413,9 @@
page.value.currentPage = 1;
page.value.lotTypeId = params.patches_type_desc;
page.value.createUser = params.user_name;
- page.value.fileName=params.file_name
- page.value.areaCode=params.areaName
- page.value.createUser= params.user_name
+ page.value.fileName = params.file_name;
+ page.value.areaCode = params.areaName;
+ page.value.createUser = params.user_name;
onLoad(page.value);
done();
};
@@ -443,58 +457,30 @@
current: pageInfo.currentPage,
size: pageInfo.pageSize,
lotTypeId: pageInfo.lotTypeId,
- fileName:pageInfo.fileName,
- areaCode:pageInfo.areaCode,
- createUser:pageInfo.createUser
+ fileName: pageInfo.fileName,
+ areaCode: pageInfo.areaCode,
+ createUser: pageInfo.createUser,
};
loading.value = true;
spotManagementTableApi(searchparams).then(res => {
const d = res.data.data;
page.value.total = d.total;
- data.value = d.records
- .map(i=>({
+ data.value = d.records.map(i => ({
...i,
- dataFrom:i.date_from === 0? '本地上传':'国土调查云',
- areaName: findAreaName(i.area_code)
+ dataFrom: i.date_from === 0 ? '本地上传' : '国土调查云',
+ areaName: findAreaName(i.area_code, regionalData.value, true)
}));
loading.value = false;
selectionClear();
});
};
-const findAreaName = (areaCode) => {
- const nodes = regionalData.value;
- if (!nodes || nodes.length === 0) return areaCode;
- const normalizeCode = (code) => {
- if (!code) return '';
- const strCode = String(code).replace(/0+$/, '');
- return strCode.length >= 6 ? strCode : '';
- };
- const targetCode = normalizeCode(areaCode);
- const findInTree = (treeNodes, needFullPath = false, parentPath = []) => {
- for (const node of treeNodes) {
- const currentPath = [...parentPath, node.name];
-
- if (normalizeCode(node.id) === targetCode) {
- return needFullPath ? currentPath.join('/') : node.name;
- }
-
- if (node.childrens?.length > 0) {
- const found = findInTree(node.childrens, needFullPath, currentPath);
- if (found) return found;
- }
- }
- return null;
- };
-
- return findInTree(nodes, true) || areaCode;
-};
// 图斑详情/编辑
const uploadPatch = (row, type = 'detail') => {
detailid.value = row.id;
uploadPatchDialog.value = true;
spotDetailsTitle.value = type === 'detail' ? '图斑详情' : '图斑编辑';
- detailList.value = row
+ detailList.value = row;
};
// 跳转至图斑类型管理页面
@@ -507,7 +493,8 @@
if (!selectionList.value.length) {
return ElMessage.warning('请选择需要导出的数据');
}
- exportExcel(selectionList.value?.map(i => i.id).join(',')).then(res => {
+ const a = selectionList.value.map(i => Number(i.id));
+ exportExcel(a).then(res => {
const elink = document.createElement('a');
elink.download = new Date().getTime() + '.xls';
elink.style.display = 'none';
@@ -523,11 +510,12 @@
};
// 图斑上传
const uploadFlightFile = (file, t) => {
+loading.value = true
const fileSuffix = file.name.substring(file.name.lastIndexOf('.') + 1);
if (!['kmz', 'kml', 'zip'].includes(fileSuffix)) {
return ElMessage.error('请上传zip/kmz/kml格式的文件');
}
-
+
let data = new FormData();
let type = t === '3' ? '' : t;
const params = {
@@ -535,34 +523,34 @@
fileName: ruleForm.name,
LotTypeId: ruleForm.region,
};
-
+
Object.keys(params).forEach(key => {
data.append(key, params[key]);
});
-
+
uploadManagementApi(data).then(res => {
if (res.data.code !== 0) {
return ElMessage.error('上传失败');
}
-
+
ElMessage.success('上传成功');
-
+
box.value = false;
ruleForm.name = '';
ruleForm.region = '';
-
+
if (ruleFormRef.value) {
ruleFormRef.value.resetFields();
}
-
+loading.value = true
searchReset();
});
};
provide('searchReset', searchReset);
onMounted(() => {
getsearchManagementApi();
-
+ getlistOfSpotTypesApi();
});
</script>
--
Gitblit v1.9.3