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" />