| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item class="center-align"> |
| | | <!-- <el-button type="primary"> 图斑上传 </el-button> --> |
| | | <el-upload |
| | | action="#" |
| | | :show-file-list="false" |
| | |
| | | v-model:show="uploadPatchDialog" |
| | | :title="spotDetailsTitle" |
| | | :detailid="detailid" |
| | | :detailList="detailList" |
| | | :spotTypeOption="spotTypeOption" |
| | | ></SpotDetails> |
| | | <!-- <patchDetails ref="patchDetails" /> --> |
| | | |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { |
| | | spotManagementTableApi, |
| | |
| | | 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); |
| | |
| | | currentPage: 1, |
| | | total: 0, |
| | | lotTypeId: '', |
| | | updateUser: '', |
| | | createUser: '', |
| | | areaCode:'', |
| | | fileName:'' |
| | | }); |
| | |
| | | const selectionList = ref([]); |
| | | |
| | | const option = ref({ |
| | | align: 'center', |
| | | headerAlign: 'center', |
| | | addBtn: false, |
| | | tip: false, |
| | | searchShow: true, |
| | |
| | | }, |
| | | { |
| | | label: '行政区划', |
| | | prop: 'ossCode111', |
| | | prop: 'areaName', |
| | | span: 24, |
| | | width:180, |
| | | searchLabelWidth: 100, |
| | | search: true, |
| | | searchSpan: 4, |
| | |
| | | }, |
| | | { |
| | | label: '数据来源', |
| | | prop: 'ossCode', |
| | | prop: 'dataFrom', |
| | | span: 24, |
| | | rules: [{ required: true, message: '请输入数据来源', trigger: 'blur' }], |
| | | }, |
| | |
| | | // ===== 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, |
| | |
| | | |
| | | 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] : []; |
| | | // 过滤函数 |
| | | 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(); |
| | |
| | | }); |
| | | }; |
| | | deptTreeData.value = filterTree(rawData); |
| | | onLoad(page.value); |
| | | }); |
| | | }; |
| | | // 获取搜索数据 |
| | |
| | | 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(); |
| | | |
| | | |
| | | }); |
| | | }; |
| | | // ===== watch ===== |
| | |
| | | }; |
| | | |
| | | const searchReset = () => { |
| | | page.value.areaCode='' |
| | | page.value.createUser='' |
| | | page.value.fileName='' |
| | | page.value.lotTypeId ='' |
| | | page.value.currentPage=1 |
| | | page.value.pageSize=20 |
| | |
| | | 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(); |
| | | }; |
| | |
| | | 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) |
| | | })); |
| | | console.log('表格数据',data.value ); |
| | | 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 |
| | | }; |
| | | |
| | | // 跳转至图斑类型管理页面 |
| | |
| | | |
| | | // 下载图斑 |
| | | const downloadPatch = () => { |
| | | |
| | | if (!selectionList.value.length) { |
| | | return ElMessage.warning('请选择需要导出的数据'); |
| | | } |
| | |
| | | document.body.appendChild(elink); |
| | | elink.click(); |
| | | document.body.removeChild(elink); |
| | | |
| | | loading.value = false; |
| | | }); |
| | | }; |
| | | // 图斑上传 |
| | | const uploadFlightFile = (file, t) => { |
| | | console.log('ruleForm', ruleForm, file); |
| | | |
| | | const fileSuffix = file.name.substring(file.name.lastIndexOf('.') + 1); |
| | | if (!['kmz', 'kml', 'zip'].includes(fileSuffix)) { |
| | | return ElMessage.error('请上传zip/kmz/kml格式的文件'); |
| | |
| | | uploadManagementApi(data).then(res => { |
| | | if (res.data.code !== 0) return ElMessage.error('上传失败'); |
| | | ElMessage.success('上传成功'); |
| | | |
| | | box.value = false |
| | | searchReset() |
| | | init(); |
| | | }); |
| | | }; |
| | | provide('searchReset', searchReset); |
| | | onMounted(() => { |
| | | getsearchManagementApi(); |
| | | |
| | | }); |
| | | </script> |
| | | |