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