From 5808f76456ca0d40de5074f132b73a5a488e3e13 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Tue, 09 Dec 2025 09:12:03 +0800
Subject: [PATCH] Merge branch 'refs/heads/feature/v9.0/9.0.1' into test
---
src/views/resource/patchManagement.vue | 182 ++++++++++++++++++++++++++++++---------------
1 files changed, 121 insertions(+), 61 deletions(-)
diff --git a/src/views/resource/patchManagement.vue b/src/views/resource/patchManagement.vue
index 9783ca5..1d73c99 100644
--- a/src/views/resource/patchManagement.vue
+++ b/src/views/resource/patchManagement.vue
@@ -35,13 +35,13 @@
<el-button type="primary" text icon="el-icon-edit" @click="uploadPatch(scope.row, 'edit')"
>编辑
</el-button>
- <el-button type="primary" text icon="el-icon-delete" @click="rowDel(scope.row)"
+ <el-button :disabled="scope.row.patches_type_desc==='综合类'" type="primary" text icon="el-icon-delete" @click="rowDel(scope.row)"
>删除
</el-button>
</template>
</avue-crud>
- <el-dialog title="上传图斑" append-to-body align-center v-model="box" width="550px">
+ <el-dialog title="上传图斑" class="ztzf-dialog-mange" append-to-body align-center v-model="box" width="550px">
<el-form
ref="ruleFormRef"
style="max-width: 600px"
@@ -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"
@@ -63,7 +63,6 @@
</el-select>
</el-form-item>
<el-form-item class="center-align">
- <!-- <el-button type="primary"> 图斑上传 </el-button> -->
<el-upload
action="#"
:show-file-list="false"
@@ -83,12 +82,14 @@
v-model:show="uploadPatchDialog"
:title="spotDetailsTitle"
:detailid="detailid"
+ :detailList="detailList"
+ :spotTypeOption="allspotTypeOption"
+ :regionalData="regionalData"
></SpotDetails>
- <!-- <patchDetails ref="patchDetails" /> -->
</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,6 +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 store = useStore();
const router = useRouter();
const ruleFormRef = ref(null);
@@ -141,21 +144,25 @@
currentPage: 1,
total: 0,
lotTypeId: '',
- updateUser: '',
- areaCode:'',
- fileName:''
+ createUser: '',
+ areaCode: '',
+ fileName: '',
});
const selectionList = ref([]);
-
const option = ref({
+ align: 'center',
+ headerAlign: 'center',
addBtn: false,
tip: false,
searchShow: true,
- searchMenuSpan: 8,
- searchMenuPosition: 'right',
+ searchGutter: 30,
+ searchMenuPosition: 'left',
+ searchMenuSpan: 4,
border: true,
index: true,
+ indexLabel: '序号',
+ indexWidth: 60,
selection: true,
grid: false,
menuWidth: 240,
@@ -177,6 +184,8 @@
prop: 'file_name',
span: 24,
search: true,
+ overHidden: true,
+ showOverflowTooltip: true,
searchSpan: 4,
rules: [{ required: true, message: '请输入文件名称', trigger: 'blur' }],
},
@@ -184,7 +193,7 @@
label: '图斑类型',
prop: 'patches_type_desc',
span: 24,
- searchLabelWidth: 100,
+ // searchLabelWidth: 100,
search: true,
searchSpan: 4,
type: 'select',
@@ -209,9 +218,10 @@
},
{
label: '行政区划',
- prop: 'ossCode111',
+ prop: 'areaName',
span: 24,
- searchLabelWidth: 100,
+ width: 180,
+ // searchLabelWidth: 100,
search: true,
searchSpan: 4,
type: 'tree',
@@ -225,7 +235,7 @@
},
{
label: '数据来源',
- prop: 'ossCode',
+ prop: 'dataFrom',
span: 24,
rules: [{ required: true, message: '请输入数据来源', trigger: 'blur' }],
},
@@ -239,7 +249,7 @@
label: '创建人',
prop: 'user_name',
span: 24,
- searchLabelWidth: 100,
+ // searchLabelWidth: 100,
search: true,
searchSpan: 4,
type: 'select',
@@ -260,7 +270,6 @@
// ===== computed =====
const userInfo = computed(() => store.getters.userInfo);
const permission = computed(() => store.getters.permission);
-
const permissionList = computed(() => ({
addBtn: !!permission.value.oss_add,
viewBtn: !!permission.value.oss_view,
@@ -270,12 +279,11 @@
const ids = computed(() => selectionList.value.map(ele => ele.id).join(','));
// 获取行政区划
-
+const regionalData = ref([]);
const requestDockInfo = () => {
getRegionTreeAll({ parentCode: userAreaCode.value }).then(res => {
- const areaCodes = [361104, 361124, 3611040, 361104000000];
const rawData = res.data.data ? [res.data.data] : [];
- // 过滤函数
+ regionalData.value = rawData;
const filterTree = nodes => {
return nodes.filter(node => {
const nodeCodeStr = node.id.toString();
@@ -292,6 +300,7 @@
});
};
deptTreeData.value = filterTree(rawData);
+ onLoad(page.value);
});
};
// 获取搜索数据
@@ -304,16 +313,37 @@
uniqueMap.set(key, value);
}
});
+ const creatorOptionuniqueMap = new Map();
+ res.data.data.user_names.forEach(item => {
+ const [key, value] = Object.entries(item)[0];
+ if (!creatorOptionuniqueMap.has(key)) {
+ creatorOptionuniqueMap.set(key, value);
+ }
+ });
spotTypeOption.value = Array.from(uniqueMap).map(([key, value]) => ({
label: value,
value: key,
}));
- creatorOption.value = res.data.data.user_names.map(item => ({
- label: item,
- value: item,
+ creatorOption.value = Array.from(creatorOptionuniqueMap).map(([key, value]) => ({
+ label: value,
+ value: key,
}));
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 =====
@@ -358,23 +388,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.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);
};
@@ -382,7 +414,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;
onLoad(page.value);
done();
};
@@ -424,13 +458,19 @@
current: pageInfo.currentPage,
size: pageInfo.pageSize,
lotTypeId: pageInfo.lotTypeId,
-
+ 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;
+ data.value = d.records.map(i => ({
+ ...i,
+ dataFrom: i.date_from === 0 ? '本地上传' : '国土调查云',
+ areaName: findAreaName(i.area_code, regionalData.value, true),
+ }));
loading.value = false;
selectionClear();
});
@@ -441,7 +481,7 @@
detailid.value = row.id;
uploadPatchDialog.value = true;
spotDetailsTitle.value = type === 'detail' ? '图斑详情' : '图斑编辑';
-
+ detailList.value = row;
};
// 跳转至图斑类型管理页面
@@ -451,11 +491,11 @@
// 下载图斑
const downloadPatch = () => {
-
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';
@@ -466,37 +506,57 @@
document.body.appendChild(elink);
elink.click();
document.body.removeChild(elink);
-
loading.value = false;
});
};
// 图斑上传
-const uploadFlightFile = (file, t) => {
- console.log('ruleForm', ruleForm, file);
+const uploadFlightFile = async (file, t) => {
+ loading.value = true;
+ try {
+ const fileSuffix = file.name.substring(file.name.lastIndexOf('.') + 1);
+ if (!['kmz', 'kml', 'zip'].includes(fileSuffix)) {
+ ElMessage.error('请上传zip/kmz/kml格式的文件');
+ return;
+ }
+ box.value = false;
+ let data = new FormData();
+ let type = t === '3' ? '' : t;
+ const params = {
+ file: file,
+ fileName: ruleForm.name,
+ LotTypeId: ruleForm.region,
+ };
- 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 = {
- file: file,
- 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('上传失败');
+ Object.keys(params).forEach(key => {
+ data.append(key, params[key]);
+ });
+
+ const res = await uploadManagementApi(data);
+ if (res.data.code !== 0) {
+ ElMessage.error('上传失败');
+ return;
+ }
+
ElMessage.success('上传成功');
+
+ // 重置表单
+ ruleForm.name = '';
+ ruleForm.region = '';
+ if (ruleFormRef.value) {
+ ruleFormRef.value.resetFields();
+ }
- init();
- });
+ searchReset();
+ } catch (error) {
+ loading.value = false;
+ } finally {
+ loading.value = false;
+ }
};
+provide('searchReset', searchReset);
onMounted(() => {
getsearchManagementApi();
+ getlistOfSpotTypesApi();
});
</script>
--
Gitblit v1.9.3