From daae9c120f2551bd2f084dc64a5c18e2ff2befcf Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 23 Dec 2022 18:34:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9C=B0=E5=9B=BE):=20=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E5=90=8E=E6=A0=87=E8=AE=B0=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=B2=A1=E6=9C=89=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/chart/map/map.js | 2 +- .../functionStyle/MapMarkSelector.vue | 32 ++++++++++++++++++- .../components/map/MarkMapDataEditor.vue | 8 ++--- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/frontend/src/views/chart/chart/map/map.js b/frontend/src/views/chart/chart/map/map.js index 7645d6c1f1..b721601414 100644 --- a/frontend/src/views/chart/chart/map/map.js +++ b/frontend/src/views/chart/chart/map/map.js @@ -51,7 +51,7 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri currentSeriesId = yAxis?.length ? yAxis[0].id : null } chart.data?.series.forEach((item, index) => { - if (item.data[0].quotaList[0].id === currentSeriesId) { + if (item.data?.length && item.data[0].quotaList[0].id === currentSeriesId) { seriesIndex = index return false } diff --git a/frontend/src/views/chart/components/functionStyle/MapMarkSelector.vue b/frontend/src/views/chart/components/functionStyle/MapMarkSelector.vue index 5b06b3e706..3781a99fce 100644 --- a/frontend/src/views/chart/components/functionStyle/MapMarkSelector.vue +++ b/frontend/src/views/chart/components/functionStyle/MapMarkSelector.vue @@ -143,6 +143,8 @@ import { DEFAULT_MARK } from '../../chart/chart' import DeIconGroupPicker from '@/components/deIconPicker/deIconGroupPicker' import deSvgIcons from '@/deicons' +import { getItemType } from '@/views/chart/components/dragItem/utils' +import bus from '@/utils/bus' export default { name: 'MapMarkSelector', components: { DeIconGroupPicker }, @@ -275,7 +277,12 @@ export default { } } }, + + beforeDestroy() { + bus.$off('reset-change-table', this.getItemTagType) + }, mounted() { + bus.$on('reset-change-table', this.getItemTagType) this.initData() this.loadSvg() }, @@ -309,6 +316,12 @@ export default { } if (customAttr.mark) { this.markForm = customAttr.mark + if (this.markForm.fieldId) { + const valid = this.fieldOptions.some(group => group.options.some(item => item.id === this.markForm.fieldId)) + if (!valid) { + this.markForm.fieldId = null + } + } } } }, @@ -360,8 +373,25 @@ export default { } this.changeMarkAttr('fieldId') + }, + getItemTagType() { + if (this.markForm.fieldId) { + const field = this.getField(this.markForm.fieldId) + if (!field) { + this.changeFields() + this.markForm.fieldId = null + return + } + const tagType = getItemType(this.dimensionData, this.quotaData, field) + if (tagType === 'danger') { + this.changeFields() + this.markForm.fieldId = null + } + } else { + this.changeFields() + this.markForm.fieldId = null + } } - } } diff --git a/frontend/src/views/chart/components/map/MarkMapDataEditor.vue b/frontend/src/views/chart/components/map/MarkMapDataEditor.vue index 79507d669f..c330c799d6 100644 --- a/frontend/src/views/chart/components/map/MarkMapDataEditor.vue +++ b/frontend/src/views/chart/components/map/MarkMapDataEditor.vue @@ -29,8 +29,8 @@ :param="param" :index="index" :item="item" - :dimension-data="dimension" - :quota-data="quota" + :dimension-data="dimensionData" + :quota-data="quotaData" @onDetailItemRemove="locationXItemRemove" /> @@ -69,8 +69,8 @@ :param="param" :index="index" :item="item" - :dimension-data="dimension" - :quota-data="quota" + :dimension-data="dimensionData" + :quota-data="quotaData" @onDetailItemRemove="locationYItemRemove" />