| | |
| | | |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { |
| | | spotManagementTableApi, |
| | |
| | | const selectionList = ref([]); |
| | | |
| | | const option = ref({ |
| | | align: 'center', |
| | | headerAlign: 'center', |
| | | addBtn: false, |
| | | tip: false, |
| | | searchShow: true, |
| | |
| | | }, |
| | | { |
| | | label: '行政区划', |
| | | prop: 'area_code', |
| | | prop: 'areaName', |
| | | span: 24, |
| | | width:180, |
| | | searchLabelWidth: 100, |
| | | search: true, |
| | | searchSpan: 4, |
| | |
| | | // ===== 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(null) |
| | | const regionalData = ref([]) |
| | | const requestDockInfo = () => { |
| | | getRegionTreeAll({ parentCode: userAreaCode.value }).then(res => { |
| | | const rawData = res.data.data ? [res.data.data] : []; |
| | | regionalData.value = rawData |
| | | // console.log('quyu',regionalData.value); |
| | | // 过滤函数 |
| | | regionalData.value = rawData; |
| | | const filterTree = nodes => { |
| | | return nodes.filter(node => { |
| | | const nodeCodeStr = node.id.toString(); |
| | |
| | | }); |
| | | }; |
| | | deptTreeData.value = filterTree(rawData); |
| | | onLoad(page.value); |
| | | }); |
| | | }; |
| | | // 获取搜索数据 |
| | |
| | | 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(regionalData.value, i.area_code) |
| | | areaName: findAreaName(i.area_code) |
| | | })); |
| | | console.log('表格数据',data.value ); |
| | | loading.value = false; |
| | | selectionClear(); |
| | | }); |
| | | }; |
| | | const findAreaName = (nodes, areaCode) => { |
| | | if (!nodes || nodes.length === 0) return ''; |
| | | for (const node of nodes) { |
| | | if (node.id === areaCode) { |
| | | return node.name; |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | if (node.childrens && node.childrens.length > 0) { |
| | | const found = findAreaName(node.childrens, areaCode); |
| | | if (found) return found; |
| | | } |
| | | } |
| | | |
| | | return ''; |
| | | return null; |
| | | }; |
| | | |
| | | return findInTree(nodes, true) || areaCode; |
| | | }; |
| | | // 图斑详情/编辑 |
| | | const uploadPatch = (row, type = 'detail') => { |
| | |
| | | }; |
| | | provide('searchReset', searchReset); |
| | | onMounted(() => { |
| | | requestDockInfo() |
| | | getsearchManagementApi(); |
| | | |
| | | }); |