diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index b14ec0ca81..91d9454afc 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -759,6 +759,7 @@ export default { setDetailMapCode(code) { this.element.DetailAreaCode = code + bus.$emit('set-dynamic-area-code', code) return true }, diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 41c7a12949..e8fc3a684a 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -2282,5 +2282,12 @@ export default { fileplaceholder: 'Please upload the JSON format coordinate file', delete_confirm: 'And child nodes will be deleted. Confirm to execute ?', cur_node: 'Current node' + }, + map_mapping: { + map: 'Map', + attr: 'Attribute', + empty: 'Empty', + please_select_map: 'Please select a range of map' } + } diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index ff160c5712..0b14bbfa6b 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -2291,5 +2291,11 @@ export default { fileplaceholder: '請上傳json格式坐標文件', delete_confirm: '及子節點都會被刪除,確認執行?', cur_node: '當前節點' + }, + map_mapping: { + map: '圖形', + attr: '屬性', + empty: '無數據', + please_select_map: '請先選擇地圖範圍' } } diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 451cde01a4..e59eba52ad 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -2303,5 +2303,11 @@ export default { fileplaceholder: '请上传json格式坐标文件', delete_confirm: '及子节点都会被删除,确认执行?', cur_node: '当前节点' + }, + map_mapping: { + map: '图形', + attr: '属性', + empty: '无数据', + please_select_map: '请先选择地图范围' } } diff --git a/frontend/src/views/chart/chart/map/map.js b/frontend/src/views/chart/chart/map/map.js index 9af23ae8c0..0547b29a58 100644 --- a/frontend/src/views/chart/chart/map/map.js +++ b/frontend/src/views/chart/chart/map/map.js @@ -2,7 +2,7 @@ import { componentStyle, reverseColor } from '../common/common' import { BASE_ECHARTS_SELECT, DEFAULT_TOOLTIP } from '@/views/chart/chart/chart' -export function baseMapOption(chart_option, chart, themeStyle) { +export function baseMapOption(chart_option, chart, themeStyle, curAreaCode) { // 处理shape attr let customAttr = {} if (chart.customAttr) { @@ -91,7 +91,7 @@ export function baseMapOption(chart_option, chart, themeStyle) { if (chart.senior) { const senior = JSON.parse(chart.senior) - senior && senior.mapMapping && (chart_option.series[0].nameMap = senior.mapMapping) + senior && senior.mapMapping && senior.mapMapping[curAreaCode] && (chart_option.series[0].nameMap = senior.mapMapping[curAreaCode]) } } } diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue index c1ee8f2edd..4c60e80017 100644 --- a/frontend/src/views/chart/components/ChartComponent.vue +++ b/frontend/src/views/chart/components/ChartComponent.vue @@ -257,7 +257,7 @@ export default { const cCode = this.chart.DetailAreaCode || this.dynamicAreaCode || customAttr.areaCode if (this.$store.getters.geoMap[cCode]) { const json = this.$store.getters.geoMap[cCode] - this.initMapChart(json, chart) + this.initMapChart(json, chart, cCode) return } @@ -266,7 +266,7 @@ export default { key: cCode, value: res }).then(() => { - this.initMapChart(res, chart) + this.initMapChart(res, chart, cCode) }) }) return @@ -277,15 +277,22 @@ export default { registerDynamicMap(areaCode) { this.dynamicAreaCode = areaCode }, - - initMapChart(geoJson, chart) { + formatGeoJson(geoGson) { + geoGson.features.forEach(feature => { + Object.keys(feature.properties).forEach(property => { + feature.properties[property.toLocaleLowerCase()] = feature.properties[property] + }) + }) + }, + initMapChart(geoJson, chart, curAreaCode) { + this.formatGeoJson(geoJson) this.$echarts.registerMap('MAP', geoJson) const base_json = JSON.parse(JSON.stringify(BASE_MAP)) let themeStyle = null if (this.themeStyle) { themeStyle = JSON.parse(JSON.stringify(this.themeStyle)) } - const chart_option = baseMapOption(base_json, chart, themeStyle) + const chart_option = baseMapOption(base_json, chart, themeStyle, curAreaCode) this.myEcharts(chart_option) const opt = this.myChart.getOption() if (opt && opt.series) { diff --git a/frontend/src/views/chart/components/senior/MapMapping.vue b/frontend/src/views/chart/components/senior/MapMapping.vue index 6623d0156b..82290d59b7 100644 --- a/frontend/src/views/chart/components/senior/MapMapping.vue +++ b/frontend/src/views/chart/components/senior/MapMapping.vue @@ -8,13 +8,13 @@ :row-style="{height:0+'px'}" >