| | |
| | | :detailid="detailid" |
| | | :detailList="detailList" |
| | | :spotTypeOption="allspotTypeOption" |
| | | :regionalData="regionalData" |
| | | ></SpotDetails> |
| | | </basic-container> |
| | | </template> |
| | | <script setup> |
| | | import {findAreaName} from '@/utils/areaUtils' |
| | | import { |
| | | spotManagementTableApi, |
| | | searchManagementApi, |
| | |
| | | data.value = d.records.map(i => ({ |
| | | ...i, |
| | | dataFrom: i.date_from === 0 ? '本地上传' : '国土调查云', |
| | | areaName: findAreaName(i.area_code), |
| | | 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; |