From c805f28089c1e9c985077a71dd01b530d650f54b Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 27 Jul 2021 18:03:56 +0800 Subject: [PATCH 1/4] =?UTF-8?q?perf:=20=E5=9C=B0=E5=9B=BE=E5=9D=90?= =?UTF-8?q?=E6=A0=87json=E4=BD=BF=E7=94=A8=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/store/getters.js | 3 ++- frontend/src/store/index.js | 4 ++- .../views/chart/components/ChartComponent.vue | 26 ++++++++++++++----- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/frontend/src/store/getters.js b/frontend/src/store/getters.js index 9f6d3cdd71..ada150bc49 100644 --- a/frontend/src/store/getters.js +++ b/frontend/src/store/getters.js @@ -26,6 +26,7 @@ const getters = { licMsg: state => state.lic.licMsg, uiInfo: state => state.user.uiInfo, conditions: state => state.conditions.conditions, - msgTypes: state => state.msg.msgTypes + msgTypes: state => state.msg.msgTypes, + geoMap: state => state.map.geoMap } export default getters diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index 37f0ba8fe9..35b26eac3f 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -12,6 +12,7 @@ import panel from './modules/panel' import application from './modules/application' import lic from './modules/lic' import msg from './modules/msg' +import map from './modules/map' import animation from '@/components/canvas/store/animation' import compose from '@/components/canvas/store/compose' import contextmenu from '@/components/canvas/store/contextmenu' @@ -185,7 +186,8 @@ const data = { panel, application, lic, - msg + msg, + map }, getters } diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue index 66f232ae31..7a0e986a46 100644 --- a/frontend/src/views/chart/components/ChartComponent.vue +++ b/frontend/src/views/chart/components/ChartComponent.vue @@ -35,7 +35,8 @@ export default { data() { return { myChart: {}, - chartId: uuid.v1() + chartId: uuid.v1(), + currentGeoJson: null } }, watch: { @@ -100,22 +101,33 @@ export default { const customAttr = JSON.parse(chart.customAttr) if (!customAttr.areaCode) return - let areaJson - if ((areaJson = localStorage.getItem('areaJson' + customAttr.areaCode)) !== null) { - this.initMapChart(areaJson, chart) + if (this.currentGeoJson) { + this.initMapChart(this.currentGeoJson, chart) return } + + if (this.$store.getters.geoMap[customAttr.areaCode]) { + this.currentGeoJson = this.$store.getters.geoMap[customAttr.areaCode] + this.initMapChart(this.currentGeoJson, chart) + return + } + geoJson(customAttr.areaCode).then(res => { this.initMapChart(res.data, chart) - // localStorage最大容量只有5M,先取消缓存 - // localStorage.setItem('areaJson' + customAttr.areaCode, res.data) + + this.$store.dispatch('map/setGeo', { + key: customAttr.areaCode, + value: res.data + }) + this.currentGeoJson = res.data }) return } this.myEcharts(chart_option) }, initMapChart(geoJson, chart) { - this.$echarts.registerMap('HK', geoJson) + // this.$echarts.registerMap('HK', geoJson) + this.$echarts.getMap('HK') || this.$echarts.registerMap('HK', geoJson) const base_json = JSON.parse(JSON.stringify(BASE_MAP)) const chart_option = baseMapOption(base_json, chart) this.myEcharts(chart_option) From a6a24db963b3f09f4ef11105ef600416ca0eadfb Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 27 Jul 2021 18:04:04 +0800 Subject: [PATCH 2/4] =?UTF-8?q?perf:=20=E5=9C=B0=E5=9B=BE=E5=9D=90?= =?UTF-8?q?=E6=A0=87json=E4=BD=BF=E7=94=A8=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/store/modules/map.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 frontend/src/store/modules/map.js diff --git a/frontend/src/store/modules/map.js b/frontend/src/store/modules/map.js new file mode 100644 index 0000000000..65d41d3cfd --- /dev/null +++ b/frontend/src/store/modules/map.js @@ -0,0 +1,25 @@ +const state = { + geoMap: {} +} + +const mutations = { + + SET_GEO: (state, { key, value }) => { + state.geoMap[key] = value + } + +} + +const actions = { + setGeo({ commit }, data) { + commit('SET_GEO', data) + } +} + +export default { + namespaced: true, + state, + mutations, + actions +} + From 50c8def3ab7b29ca48ac6ba0dbc37ad7f069f24e Mon Sep 17 00:00:00 2001 From: junjie Date: Tue, 27 Jul 2021 18:04:17 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E6=95=B0=E6=8D=AE=E9=9B=86=E7=BF=BB?= =?UTF-8?q?=E9=A1=B5=E4=B8=8D=E6=98=BE=E7=A4=BA=E6=95=B0=E6=8D=AE=EF=BC=9B?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/lang/en.js | 2 +- frontend/src/views/dataset/data/ViewTable.vue | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index f23c8183ca..a130d14633 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -592,7 +592,7 @@ export default { create_view: 'Create Chart', data_preview: 'Data preview', dimension: 'Dimension', - quota: 'Index', + quota: 'Quota', title: 'Title', show: 'Show', chart_type: 'Chart Type', diff --git a/frontend/src/views/dataset/data/ViewTable.vue b/frontend/src/views/dataset/data/ViewTable.vue index 31173716a1..10187440aa 100644 --- a/frontend/src/views/dataset/data/ViewTable.vue +++ b/frontend/src/views/dataset/data/ViewTable.vue @@ -117,6 +117,7 @@ export default { }, methods: { initTable(id) { + this.resetPage() this.tableViewRowForm.row = 1000 if (id !== null) { this.fields = [] @@ -198,6 +199,14 @@ export default { msg2Current(sourceParam) { this.tabActive = 'updateInfo' this.table.msgTaskId = sourceParam.taskId + }, + + resetPage() { + this.page = { + page: 1, + pageSize: 100, + show: 1000 + } } } } From b3145c680f70c7107c7ec21a60b156aeffc2a7e2 Mon Sep 17 00:00:00 2001 From: junjie Date: Tue, 27 Jul 2021 18:39:38 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E6=95=B0=E6=8D=AE=E9=9B=86=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E6=9D=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/service/dataset/DataSetTableService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java index f0507b0148..38c8241995 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -433,7 +433,7 @@ public class DataSetTableService { } try { datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow()))); - dataSetPreviewPage.setTotal(Integer.valueOf(jdbcProvider.getData(datasourceRequest).get(0)[0])); + dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size()); } catch (Exception e) { e.printStackTrace(); } @@ -480,7 +480,7 @@ public class DataSetTableService { try { datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow()))); - dataSetPreviewPage.setTotal(Integer.valueOf(jdbcProvider.getData(datasourceRequest).get(0)[0])); + dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size()); } catch (Exception e) { e.printStackTrace(); }