From 862854fb004b0bb140e6eb6bf44f05b48439d0f9 Mon Sep 17 00:00:00 2001 From: wisonic Date: Wed, 27 Nov 2024 15:40:22 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=9B=BE=E8=A1=A8):=20=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=8C=BA=E5=9F=9F=E6=94=AF=E6=8C=81=E5=9C=B0?= =?UTF-8?q?=E5=90=8D=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editor/editor-senior/components/MapMapping.vue | 7 ++++++- .../src/views/chart/components/js/panel/charts/map/map.ts | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/core-frontend/src/views/chart/components/editor/editor-senior/components/MapMapping.vue b/core/core-frontend/src/views/chart/components/editor/editor-senior/components/MapMapping.vue index 1ba14a552c..88ba9561d9 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-senior/components/MapMapping.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-senior/components/MapMapping.vue @@ -3,6 +3,7 @@ import { computed, nextTick, onMounted, PropType, reactive, ref, watch } from 'v import { getGeoJsonFile, parseJson } from '../../../js/util' import { forEach, debounce } from 'lodash-es' import { toRefs } from 'vue' +import { getCustomGeoArea } from '@/api/map' const props = defineProps({ chart: { @@ -70,7 +71,11 @@ const getAreaMapping = async areaId => { return {} } if (areaId.startsWith('custom_')) { - areaId = '156' + const areaList = (await getCustomGeoArea(areaId)).data + return areaList.reduce((p, n) => { + p[n.name] = n.name + return p + }, {}) } const geoJson = await getGeoJsonFile(areaId) return geoJson.features.reduce((p, n) => { diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/map/map.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/map/map.ts index 11264ff31c..ce6ccc819e 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/map/map.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/map/map.ts @@ -99,7 +99,12 @@ export class Map extends L7PlotChartView { p['156' + n.properties.adcode] = n.properties.name return p }, {}) + const { areaMapping } = parseJson(chart.senior) const areaMap = customSubArea.reduce((p, n) => { + const mappedName = areaMapping?.[areaId]?.[n.name] + if (mappedName) { + n.name = mappedName + } p[n.name] = n n.scopeArr = n.scope?.split(',') || [] return p