From 93b2dc8b78f65f568cc471b3d6fff621f39cc6bf Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 13 Aug 2021 17:06:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E8=A1=8C=E6=94=BF?= =?UTF-8?q?=E5=8C=BA=E5=88=92=E4=BB=A3=E7=A0=81=E5=89=8D=E7=AB=AF=E7=BC=93?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/map/utils/MapUtils.java | 2 +- .../canvas/custom-component/UserView.vue | 22 ++++++++++------ frontend/src/views/chart/view/ChartEdit.vue | 25 +++++++++++++------ 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/backend/src/main/java/io/dataease/map/utils/MapUtils.java b/backend/src/main/java/io/dataease/map/utils/MapUtils.java index 99dc7b6f7b..9cfa679509 100644 --- a/backend/src/main/java/io/dataease/map/utils/MapUtils.java +++ b/backend/src/main/java/io/dataease/map/utils/MapUtils.java @@ -68,7 +68,7 @@ public class MapUtils { AreaEntity china = root(); - maps.parallelStream().forEach(map -> { + maps.stream().forEach(map -> { // maps.stream().forEach(map -> { String province_code = map.get(Constants.PROVINCE_CODE).toString(); String city_code = map.get(Constants.CITY_CODE).toString(); diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index 35a94904d3..939be53126 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -128,6 +128,9 @@ export default { console.log('trackMenuInfo' + JSON.stringify(trackMenuInfo)) return trackMenuInfo }, + chartType() { + return this.chart.type + }, ...mapState([ 'canvasStyleData', 'nowPanelTrackInfo' @@ -174,6 +177,11 @@ export default { if (val1 > 0) { this.getData(this.element.propValue.viewId) } + }, + 'chartType': function(newVal, oldVal) { + if (newVal === 'map' && newVal !== oldVal) { + this.initAreas() + } } }, @@ -181,7 +189,7 @@ export default { this.refId = uuid.v1 // this.filter.filter = this.$store.getters.conditions this.getData(this.element.propValue.viewId) - this.initAreas() + // this.initAreas() }, mounted() { }, @@ -349,14 +357,14 @@ export default { } }, initAreas() { - let mapping - if ((mapping = localStorage.getItem('areaMapping')) !== null) { - this.places = JSON.parse(mapping) - return - } + // let mapping + // if ((mapping = localStorage.getItem('areaMapping')) !== null) { + // this.places = JSON.parse(mapping) + // return + // } Object.keys(this.places).length === 0 && areaMapping().then(res => { this.places = res.data - localStorage.setItem('areaMapping', JSON.stringify(res.data)) + // localStorage.setItem('areaMapping', JSON.stringify(res.data)) }) }, doMapLink(linkFilters) { diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index b3b3350605..c20baa14d4 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -711,7 +711,8 @@ export default { }, moveId: -1, chart: { - id: 'echart' + id: 'echart', + type: null }, dimensionFilterEdit: false, dimensionItem: {}, @@ -754,6 +755,9 @@ export default { // this.getData(this.$store.state.chart.viewId) // return this.$store.state.chart.viewId // } + chartType() { + return this.chart.type + } }, watch: { 'param': function() { @@ -766,11 +770,16 @@ export default { }, searchField(val) { this.fieldFilter(val) + }, + 'chartType': function(newVal, oldVal) { + if (newVal === 'map' && newVal !== oldVal) { + this.initAreas() + } } }, created() { // this.get(this.$store.state.chart.viewId); - this.initAreas() + // this.initAreas() }, mounted() { // this.get(this.$store.state.chart.viewId); @@ -1327,14 +1336,14 @@ export default { }, initAreas() { - let mapping - if ((mapping = localStorage.getItem('areaMapping')) !== null) { - this.places = JSON.parse(mapping) - return - } + // let mapping + // if ((mapping = localStorage.getItem('areaMapping')) !== null) { + // this.places = JSON.parse(mapping) + // return + // } Object.keys(this.places).length === 0 && areaMapping().then(res => { this.places = res.data - localStorage.setItem('areaMapping', JSON.stringify(res.data)) + // localStorage.setItem('areaMapping', JSON.stringify(res.data)) }) },