-
+
@@ -1444,11 +1444,11 @@ 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))
@@ -1513,18 +1513,85 @@ export default {
chartClick(param) {
if (this.drillClickDimensionList.length < this.view.drillFields.length - 1) {
+ this.chart.type === 'map' && this.sendToChildren(param)
this.drillClickDimensionList.push({ dimensionList: param.data.dimensionList })
this.getData(this.param.id)
}
},
resetDrill() {
+ const length = this.drillClickDimensionList.length
this.drillClickDimensionList = []
+
+ this.backToParent(0, length)
+ this.currentAcreaNode = null
},
drillJump(index) {
+ const length = this.drillClickDimensionList.length
this.drillClickDimensionList = this.drillClickDimensionList.slice(0, index)
+ if (this.chart.type === 'map') {
+ this.backToParent(index, length)
+ }
+
this.getData(this.param.id)
+ },
+ // 回到父级地图
+ backToParent(index, length) {
+ if (length <= 0) return
+ const times = length - 1 - index
+
+ let temp = times
+ let tempNode = this.currentAcreaNode
+ while (temp >= 0) {
+ tempNode = this.findEntityByCode(tempNode.pcode, this.places)
+ temp--
+ }
+
+ this.currentAcreaNode = tempNode
+ this.$refs.dynamicChart && this.$refs.dynamicChart.registerDynamicMap && this.$refs.dynamicChart.registerDynamicMap(this.currentAcreaNode.code)
+ },
+
+ // 切换下一级地图
+ sendToChildren(param) {
+ const length = param.data.dimensionList.length
+ const name = param.data.dimensionList[length - 1].value
+ let aCode = null
+ if (this.currentAcreaNode) {
+ aCode = this.currentAcreaNode.code
+ }
+ // const aCode = this.currentAcreaNode ? this.currentAcreaNode.code : null
+ const currentNode = this.findEntityByCode(aCode || this.view.customAttr.areaCode, this.places)
+ if (currentNode && currentNode.children && currentNode.children.length > 0) {
+ const nextNode = currentNode.children.find(item => item.name === name)
+ // this.view.customAttr.areaCode = nextNode.code
+ this.currentAcreaNode = nextNode
+ this.$refs.dynamicChart && this.$refs.dynamicChart.registerDynamicMap && this.$refs.dynamicChart.registerDynamicMap(nextNode.code)
+ }
+ },
+ // 根据地名获取areaCode
+ // findEntityByname(name, array) {
+ // if (array === null || array.length === 0) array = this.places
+ // for (let index = 0; index < array.length; index++) {
+ // const node = array[index]
+ // if (node.name === name) return node
+ // if (node.children && node.children.length > 0) {
+ // const temp = this.findEntityByname(name, node.children)
+ // if (temp) return temp
+ // }
+ // }
+ // }
+ findEntityByCode(code, array) {
+ if (array === null || array.length === 0) array = this.places
+ for (let index = 0; index < array.length; index++) {
+ const node = array[index]
+ if (node.code === code) return node
+ if (node.children && node.children.length > 0) {
+ const temp = this.findEntityByCode(code, node.children)
+ if (temp) return temp
+ }
+ }
}
+
}
}
From a8cd74434b17f3c0043dad81debd74dae1c19e20 Mon Sep 17 00:00:00 2001
From: junjie
Date: Thu, 12 Aug 2021 14:18:04 +0800
Subject: [PATCH 04/32] =?UTF-8?q?feat:=20=E8=A7=86=E5=9B=BE=E4=B8=8B?=
=?UTF-8?q?=E9=92=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/components/canvas/custom-component/UserView.vue | 3 ---
frontend/src/views/chart/view/ChartEdit.vue | 4 ++--
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue
index f0ef6e4f13..e89b31708f 100644
--- a/frontend/src/components/canvas/custom-component/UserView.vue
+++ b/frontend/src/components/canvas/custom-component/UserView.vue
@@ -266,9 +266,6 @@ export default {
}
},
- resetDrill() {
- this.drillClickDimensionList = []
- },
drillJump(index) {
this.drillClickDimensionList = this.drillClickDimensionList.slice(0, index)
this.getData(this.element.propValue.viewId)
diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue
index 555e744fa2..9ce904ffea 100644
--- a/frontend/src/views/chart/view/ChartEdit.vue
+++ b/frontend/src/views/chart/view/ChartEdit.vue
@@ -757,10 +757,10 @@ export default {
},
watch: {
'param': function() {
- this.resetDrill()
if (this.param.optType === 'new') {
//
} else {
+ this.resetDrill()
this.getData(this.param.id)
}
},
@@ -909,8 +909,8 @@ export default {
// this.get(response.data.id);
// this.getData(response.data.id)
- this.resetDrill()
if (getData) {
+ this.resetDrill()
this.getData(response.data.id)
} else {
this.getChart(response.data.id)
From b2718c6c1419e23aa0c3de1305c36e0ada30c247 Mon Sep 17 00:00:00 2001
From: junjie
Date: Thu, 12 Aug 2021 15:11:54 +0800
Subject: [PATCH 05/32] =?UTF-8?q?feat:=20=E5=A0=86=E5=8F=A0=E5=9B=BE?=
=?UTF-8?q?=E4=B8=8B=E9=92=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../dataease/service/chart/ChartViewService.java | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java
index 3ab743ceb9..206eaf5eee 100644
--- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java
+++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java
@@ -696,11 +696,15 @@ public class ChartViewService {
String stackColumn = row[xAxis.size()];
if (StringUtils.equals(ss.getName(), stackColumn)) {
StringBuilder a = new StringBuilder();
- for (int j = 0; j < xAxis.size(); j++) {
- if (j == xAxis.size() - 1) {
- a.append(row[j]);
- } else {
- a.append(row[j]).append("\n");
+ if (isDrill) {
+ a.append(row[xAxis.size() - 1]);
+ } else {
+ for (int j = 0; j < xAxis.size(); j++) {
+ if (j == xAxis.size() - 1) {
+ a.append(row[j]);
+ } else {
+ a.append(row[j]).append("\n");
+ }
}
}
if (StringUtils.equals(a.toString(), x.get(i))) {
From 2c5be327b61194cb5181d8c7d82a07cf562c68ec Mon Sep 17 00:00:00 2001
From: fit2cloud-chenyw
Date: Thu, 12 Aug 2021 15:11:57 +0800
Subject: [PATCH 06/32] =?UTF-8?q?feat:=20=E4=BB=AA=E8=A1=A8=E6=9D=BF?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9C=B0=E5=9B=BE=E4=B8=8B=E9=92=BB=E4=B8=8A?=
=?UTF-8?q?=E5=8D=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../canvas/custom-component/UserView.vue | 92 +++++++++++++++++--
frontend/src/views/chart/view/ChartEdit.vue | 17 ++--
2 files changed, 95 insertions(+), 14 deletions(-)
diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue
index f0ef6e4f13..3c617c39a2 100644
--- a/frontend/src/components/canvas/custom-component/UserView.vue
+++ b/frontend/src/components/canvas/custom-component/UserView.vue
@@ -16,7 +16,8 @@
{{ $t('chart.chart_error_tips') }}
-
+
+
@@ -41,7 +42,7 @@ import eventBus from '@/components/canvas/utils/eventBus'
import { deepCopy } from '@/components/canvas/utils/utils'
import { getToken, getLinkToken } from '@/utils/auth'
import DrillPath from '@/views/chart/view/DrillPath'
-
+import { areaMapping } from '@/api/map/map'
export default {
name: 'UserView',
components: { ChartComponent, TableNormal, LabelNormal, DrillPath },
@@ -85,7 +86,8 @@ export default {
message: null,
drillClickDimensionList: [],
drillFilters: [],
- drillFields: []
+ drillFields: [],
+ places: []
}
},
computed: {
@@ -135,7 +137,6 @@ export default {
},
linkageFilters: {
handler(newVal, oldVal) {
- debugger
isChange(newVal, oldVal) && this.getData(this.element.propValue.viewId)
},
deep: true
@@ -169,6 +170,7 @@ export default {
this.refId = uuid.v1
// this.filter.filter = this.$store.getters.conditions
this.getData(this.element.propValue.viewId)
+ this.initAreas()
},
mounted() {
},
@@ -216,7 +218,6 @@ export default {
if (response.success) {
this.chart = response.data
this.chart.drillFields = this.chart.drillFields ? JSON.parse(this.chart.drillFields) : []
- debugger
if (!response.data.drill) {
this.drillClickDimensionList.splice(this.drillClickDimensionList.length - 1, 1)
}
@@ -259,19 +260,98 @@ export default {
},
chartClick(param) {
- debugger
if (this.drillClickDimensionList.length < this.chart.drillFields.length - 1) {
+ this.chart.type === 'map' && this.sendToChildren(param)
this.drillClickDimensionList.push({ dimensionList: param.data.dimensionList })
this.getData(this.element.propValue.viewId)
}
},
resetDrill() {
+ const length = this.drillClickDimensionList.length
this.drillClickDimensionList = []
+ if (this.chart.type === 'map') {
+ this.backToParent(0, length)
+ }
},
drillJump(index) {
+ const length = this.drillClickDimensionList.length
this.drillClickDimensionList = this.drillClickDimensionList.slice(0, index)
+ if (this.chart.type === 'map') {
+ this.backToParent(index, length)
+ }
this.getData(this.element.propValue.viewId)
+ },
+ // 回到父级地图
+ backToParent(index, length) {
+ if (length <= 0) return
+ const times = length - 1 - index
+
+ let temp = times
+ let tempNode = this.currentAcreaNode
+ while (temp >= 0) {
+ tempNode = this.findEntityByCode(tempNode.pcode, this.places)
+ temp--
+ }
+
+ this.currentAcreaNode = tempNode
+ const current = this.$refs[this.element.propValue.id]
+ current && current.registerDynamicMap && current.registerDynamicMap(this.currentAcreaNode.code)
+ // this.$refs.dynamicChart && this.$refs.dynamicChart.registerDynamicMap && this.$refs.dynamicChart.registerDynamicMap(this.currentAcreaNode.code)
+ },
+
+ // 切换下一级地图
+ sendToChildren(param) {
+ const length = param.data.dimensionList.length
+ const name = param.data.dimensionList[length - 1].value
+ let aCode = null
+ if (this.currentAcreaNode) {
+ aCode = this.currentAcreaNode.code
+ }
+ // const aCode = this.currentAcreaNode ? this.currentAcreaNode.code : null
+ const customAttr = JSON.parse(this.chart.customAttr)
+ const currentNode = this.findEntityByCode(aCode || customAttr.areaCode, this.places)
+ if (currentNode && currentNode.children && currentNode.children.length > 0) {
+ const nextNode = currentNode.children.find(item => item.name === name)
+ // this.view.customAttr.areaCode = nextNode.code
+ this.currentAcreaNode = nextNode
+ const current = this.$refs[this.element.propValue.id]
+ current && current.registerDynamicMap && current.registerDynamicMap(nextNode.code)
+ }
+ },
+ // 根据地名获取areaCode
+ // findEntityByname(name, array) {
+ // if (array === null || array.length === 0) array = this.places
+ // for (let index = 0; index < array.length; index++) {
+ // const node = array[index]
+ // if (node.name === name) return node
+ // if (node.children && node.children.length > 0) {
+ // const temp = this.findEntityByname(name, node.children)
+ // if (temp) return temp
+ // }
+ // }
+ // }
+ findEntityByCode(code, array) {
+ if (array === null || array.length === 0) array = this.places
+ for (let index = 0; index < array.length; index++) {
+ const node = array[index]
+ if (node.code === code) return node
+ if (node.children && node.children.length > 0) {
+ const temp = this.findEntityByCode(code, node.children)
+ if (temp) return temp
+ }
+ }
+ },
+ initAreas() {
+ 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))
+ })
}
}
}
diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue
index 555e744fa2..9b44803d6a 100644
--- a/frontend/src/views/chart/view/ChartEdit.vue
+++ b/frontend/src/views/chart/view/ChartEdit.vue
@@ -1444,11 +1444,11 @@ 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))
@@ -1522,9 +1522,10 @@ export default {
resetDrill() {
const length = this.drillClickDimensionList.length
this.drillClickDimensionList = []
-
- this.backToParent(0, length)
- this.currentAcreaNode = null
+ if (this.chart.type === 'map') {
+ this.backToParent(0, length)
+ this.currentAcreaNode = null
+ }
},
drillJump(index) {
const length = this.drillClickDimensionList.length
From 18e8854afa69db0040f890d6363c32213bc8ac9a Mon Sep 17 00:00:00 2001
From: wangjiahao <1522128093@qq.com>
Date: Thu, 12 Aug 2021 16:45:21 +0800
Subject: [PATCH 07/32] =?UTF-8?q?fix:=E5=89=8D=E7=AB=AFcosole=E6=8A=A5?=
=?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/components/canvas/custom-component/UserView.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue
index 4e91e732eb..f10b816f10 100644
--- a/frontend/src/components/canvas/custom-component/UserView.vue
+++ b/frontend/src/components/canvas/custom-component/UserView.vue
@@ -113,7 +113,7 @@ export default {
trackMenu() {
const trackMenuInfo = []
let linkageCount = 0
- this.chart.data.fields && this.chart.data.fields.forEach(item => {
+ this.chart.data && this.chart.data.fields && this.chart.data.fields.forEach(item => {
const sourceInfo = this.chart.id + '#' + item.id
if (this.nowPanelTrackInfo[sourceInfo]) {
linkageCount++
From 1a5cc7cc71570ba4a35024821608d5bf34d367a8 Mon Sep 17 00:00:00 2001
From: wangjiahao <1522128093@qq.com>
Date: Thu, 12 Aug 2021 17:19:26 +0800
Subject: [PATCH 08/32] =?UTF-8?q?refacotr:=E4=BB=AA=E8=A1=A8=E6=9D=BF?=
=?UTF-8?q?=E8=81=94=E5=8A=A8=E4=B8=8B=E9=92=BB=E7=AD=89=EF=BC=8C=E6=97=A0?=
=?UTF-8?q?=E9=9C=80=E9=87=8D=E6=96=B0=E5=8A=A0=E8=BD=BD=E8=A7=86=E5=9B=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../canvas/custom-component/UserView.vue | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue
index f10b816f10..c39624a67d 100644
--- a/frontend/src/components/canvas/custom-component/UserView.vue
+++ b/frontend/src/components/canvas/custom-component/UserView.vue
@@ -16,10 +16,10 @@
{{ $t('chart.chart_error_tips') }}
-
-
-
-
+
+
+
+
@@ -87,7 +87,11 @@ export default {
drillClickDimensionList: [],
drillFilters: [],
drillFields: [],
- places: []
+ places: [],
+ httpRequest: {
+ status: true,
+ msg: ''
+ }
}
},
computed: {
@@ -226,12 +230,15 @@ export default {
this.requestStatus = 'merging'
this.mergeStyle()
this.requestStatus = 'success'
+ this.httpRequest.status = true
} else {
this.requestStatus = 'error'
this.message = response.message
}
return true
}).catch(err => {
+ this.httpRequest.status = err.response.data.success
+ this.httpRequest.msg = err.response.data.message
this.requestStatus = 'error'
if (err && err.response && err.response.data) {
this.message = err.response.data.message
@@ -267,7 +274,6 @@ export default {
}
},
-
resetDrill() {
const length = this.drillClickDimensionList.length
this.drillClickDimensionList = []
From 49441ace631ed834da009bc89745643eb74ea475 Mon Sep 17 00:00:00 2001
From: fit2cloud-chenyw
Date: Thu, 12 Aug 2021 18:18:37 +0800
Subject: [PATCH 09/32] =?UTF-8?q?feat:=20=E5=9C=B0=E5=9B=BE=E7=BC=93?=
=?UTF-8?q?=E5=AD=98=20=E5=9C=B0=E5=9B=BE=E8=81=94=E5=8A=A8=E9=A2=84?=
=?UTF-8?q?=E7=95=99=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../canvas/custom-component/UserView.vue | 45 +++++++++++++------
.../views/chart/components/ChartComponent.vue | 25 ++++++-----
2 files changed, 46 insertions(+), 24 deletions(-)
diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue
index 4e91e732eb..bbf26ac74c 100644
--- a/frontend/src/components/canvas/custom-component/UserView.vue
+++ b/frontend/src/components/canvas/custom-component/UserView.vue
@@ -137,7 +137,13 @@ export default {
},
linkageFilters: {
handler(newVal, oldVal) {
- isChange(newVal, oldVal) && this.getData(this.element.propValue.viewId)
+ // isChange(newVal, oldVal) && this.getData(this.element.propValue.viewId)
+ if (isChange(newVal, oldVal)) {
+ // if (this.chart.type === 'map') {
+ // this.doMapLink(newVal)
+ // }
+ this.getData(this.element.propValue.viewId)
+ }
},
deep: true
},
@@ -267,7 +273,6 @@ export default {
}
},
-
resetDrill() {
const length = this.drillClickDimensionList.length
this.drillClickDimensionList = []
@@ -321,18 +326,7 @@ export default {
current && current.registerDynamicMap && current.registerDynamicMap(nextNode.code)
}
},
- // 根据地名获取areaCode
- // findEntityByname(name, array) {
- // if (array === null || array.length === 0) array = this.places
- // for (let index = 0; index < array.length; index++) {
- // const node = array[index]
- // if (node.name === name) return node
- // if (node.children && node.children.length > 0) {
- // const temp = this.findEntityByname(name, node.children)
- // if (temp) return temp
- // }
- // }
- // }
+
findEntityByCode(code, array) {
if (array === null || array.length === 0) array = this.places
for (let index = 0; index < array.length; index++) {
@@ -354,6 +348,29 @@ export default {
this.places = res.data
localStorage.setItem('areaMapping', JSON.stringify(res.data))
})
+ },
+ doMapLink(linkFilters) {
+ if (!linkFilters && linkFilters.length === 0) return
+ const value = linkFilters[0].value
+ if (!value && value.length === 0) return
+ const name = value[0]
+ if (!name) return
+ const areaNode = this.findEntityByname(name, [])
+ if (!areaNode) return
+ const current = this.$refs[this.element.propValue.id]
+ current && current.registerDynamicMap && current.registerDynamicMap(areaNode.code)
+ },
+ // 根据地名获取areaCode
+ findEntityByname(name, array) {
+ if (array === null || array.length === 0) array = this.places
+ for (let index = 0; index < array.length; index++) {
+ const node = array[index]
+ if (node.name === name) return node
+ if (node.children && node.children.length > 0) {
+ const temp = this.findEntityByname(name, node.children)
+ if (temp) return temp
+ }
+ }
}
}
}
diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue
index fa5728b0f4..e0b487b5f7 100644
--- a/frontend/src/views/chart/components/ChartComponent.vue
+++ b/frontend/src/views/chart/components/ChartComponent.vue
@@ -145,16 +145,11 @@ export default {
const customAttr = JSON.parse(chart.customAttr)
if (!customAttr.areaCode) return
- // 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
- // }
+ if (this.$store.getters.geoMap[customAttr.areaCode]) {
+ const json = this.$store.getters.geoMap[customAttr.areaCode]
+ this.initMapChart(json, chart)
+ return
+ }
geoJson(customAttr.areaCode).then(res => {
this.initMapChart(res, chart)
@@ -171,9 +166,19 @@ export default {
this.myEcharts(chart_option)
},
registerDynamicMap(areaCode) {
+ if (this.$store.getters.geoMap[areaCode]) {
+ this.downOrUp = true
+ const json = this.$store.getters.geoMap[areaCode]
+ this.$echarts.registerMap('MAP', json)
+ return
+ }
geoJson(areaCode).then(res => {
this.downOrUp = true
this.$echarts.registerMap('MAP', res)
+ this.$store.dispatch('map/setGeo', {
+ key: areaCode,
+ value: res
+ })
})
},
From 4a9009dee11dbf10550b52fb68648081bf6695bd Mon Sep 17 00:00:00 2001
From: taojinlong
Date: Thu, 12 Aug 2021 19:23:01 +0800
Subject: [PATCH 10/32] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E5=90=8C?=
=?UTF-8?q?=E6=97=B6=E5=AF=BC=E5=85=A5excel=E7=9A=84=E5=A4=9Asheet?=
=?UTF-8?q?=E9=A1=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../commons/utils/ExcelReaderUtil.java | 10 +-
.../commons/utils/ExcelXlsReader.java | 10 +-
.../commons/utils/ExcelXlsxReader.java | 2 +-
.../dataset/DataSetTableController.java | 13 +-
.../request/dataset/DataSetTableRequest.java | 3 +
.../dto/dataset/DataTableInfoDTO.java | 2 +-
.../dataease/dto/dataset/ExcelSheetData.java | 10 +-
.../service/dataset/DataSetTableService.java | 268 +++++++++----
.../service/dataset/ExtractDataService.java | 28 +-
frontend/src/lang/en.js | 3 +-
frontend/src/lang/tw.js | 3 +-
frontend/src/lang/zh.js | 3 +-
frontend/src/views/dataset/add/AddExcel.vue | 373 +++++++++++-------
13 files changed, 480 insertions(+), 248 deletions(-)
diff --git a/backend/src/main/java/io/dataease/commons/utils/ExcelReaderUtil.java b/backend/src/main/java/io/dataease/commons/utils/ExcelReaderUtil.java
index 2bfddcf3de..0881531648 100644
--- a/backend/src/main/java/io/dataease/commons/utils/ExcelReaderUtil.java
+++ b/backend/src/main/java/io/dataease/commons/utils/ExcelReaderUtil.java
@@ -1,8 +1,6 @@
package io.dataease.commons.utils;
import com.google.gson.Gson;
import io.dataease.datasource.dto.TableFiled;
-
-import java.io.FileInputStream;
import java.io.InputStream;
import java.util.List;
@@ -46,7 +44,7 @@ public class ExcelReaderUtil {
ExcelXlsReader excelXls=new ExcelXlsReader();
excelXls.process(inputStream);
System.out.println(excelXls.totalSheets.size());
- System.out.println(excelXls.totalSheets.get(0).getSheetName());
+ System.out.println(excelXls.totalSheets.get(0).getExcelLable());
for (TableFiled field : excelXls.totalSheets.get(0).getFields()) {
System.out.println(new Gson().toJson(field));
}
@@ -56,7 +54,7 @@ public class ExcelReaderUtil {
ExcelXlsxReader excelXlsxReader = new ExcelXlsxReader();
excelXlsxReader.process(inputStream);
System.out.println(excelXlsxReader.totalSheets.size());
- System.out.println(excelXlsxReader.totalSheets.get(0).getSheetName());
+ System.out.println(excelXlsxReader.totalSheets.get(0).getExcelLable());
for (TableFiled field : excelXlsxReader.totalSheets.get(0).getFields()) {
System.out.println(new Gson().toJson(field));
}
@@ -68,7 +66,7 @@ public class ExcelReaderUtil {
}
public static void main(String[] args) throws Exception {
- String file ="下单渠道.xlsx";
- ExcelReaderUtil.readExcel(file, new FileInputStream("/Users/taojinlong/Desktop/" + file));
+// String file ="下单渠道.xlsx";
+// ExcelReaderUtil.readExcel(file, new FileInputStream("/Users/taojinlong/Desktop/" + file));
}
}
diff --git a/backend/src/main/java/io/dataease/commons/utils/ExcelXlsReader.java b/backend/src/main/java/io/dataease/commons/utils/ExcelXlsReader.java
index 8d7d6050f3..c97c8d4c4c 100644
--- a/backend/src/main/java/io/dataease/commons/utils/ExcelXlsReader.java
+++ b/backend/src/main/java/io/dataease/commons/utils/ExcelXlsReader.java
@@ -300,9 +300,9 @@ public class ExcelXlsReader implements HSSFListener {
}
lastColumnNumber = -1;
- if(!totalSheets.stream().map(ExcelSheetData::getSheetName).collect(Collectors.toList()).contains(sheetName)){
+ if(!totalSheets.stream().map(ExcelSheetData::getExcelLable).collect(Collectors.toList()).contains(sheetName)){
ExcelSheetData excelSheetData = new ExcelSheetData();
- excelSheetData.setSheetName(sheetName);
+ excelSheetData.setExcelLable(sheetName);
excelSheetData.setData(new ArrayList<>());
excelSheetData.setFields(new ArrayList<>());
totalSheets.add(excelSheetData);
@@ -322,10 +322,10 @@ public class ExcelXlsReader implements HSSFListener {
if (flag && curRow != 0) { //该行不为空行且该行不是第一行,发送(第一行为列名,不需要)
- if(!totalSheets.stream().map(ExcelSheetData::getSheetName).collect(Collectors.toList()).contains(sheetName)){
+ if(!totalSheets.stream().map(ExcelSheetData::getExcelLable).collect(Collectors.toList()).contains(sheetName)){
ExcelSheetData excelSheetData = new ExcelSheetData();
excelSheetData.setData(new ArrayList<>(data));
- excelSheetData.setSheetName(sheetName);
+ excelSheetData.setExcelLable(sheetName);
excelSheetData.setFields(new ArrayList<>(fields));
List tmp = new ArrayList<>(cellList);
excelSheetData.getData().add(tmp);
@@ -333,7 +333,7 @@ public class ExcelXlsReader implements HSSFListener {
totalSheets.add(excelSheetData);
}else {
List tmp = new ArrayList<>(cellList);
- totalSheets.stream().filter(s->s.getSheetName().equalsIgnoreCase(sheetName)).collect(Collectors.toList()).get(0).getData().add(tmp);
+ totalSheets.stream().filter(s->s.getExcelLable().equalsIgnoreCase(sheetName)).collect(Collectors.toList()).get(0).getData().add(tmp);
totalRows++;
}
}
diff --git a/backend/src/main/java/io/dataease/commons/utils/ExcelXlsxReader.java b/backend/src/main/java/io/dataease/commons/utils/ExcelXlsxReader.java
index 63448318e1..8751a7c203 100644
--- a/backend/src/main/java/io/dataease/commons/utils/ExcelXlsxReader.java
+++ b/backend/src/main/java/io/dataease/commons/utils/ExcelXlsxReader.java
@@ -157,7 +157,7 @@ public class ExcelXlsxReader extends DefaultHandler {
ExcelSheetData excelSheetData = new ExcelSheetData();
excelSheetData.setData(new ArrayList<>(data));
- excelSheetData.setSheetName(sheets.getSheetName());
+ excelSheetData.setExcelLable(sheets.getSheetName());
excelSheetData.setFields(new ArrayList<>(fields));
totalSheets.add(excelSheetData);
diff --git a/backend/src/main/java/io/dataease/controller/dataset/DataSetTableController.java b/backend/src/main/java/io/dataease/controller/dataset/DataSetTableController.java
index 0d952442be..ab6c300345 100644
--- a/backend/src/main/java/io/dataease/controller/dataset/DataSetTableController.java
+++ b/backend/src/main/java/io/dataease/controller/dataset/DataSetTableController.java
@@ -7,6 +7,7 @@ import io.dataease.base.domain.DatasetTableIncrementalConfig;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.datasource.dto.TableFiled;
import io.dataease.dto.dataset.DataSetTableDTO;
+import io.dataease.dto.dataset.ExcelFileData;
import io.dataease.service.dataset.DataSetTableService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -37,8 +38,12 @@ public class DataSetTableController {
@ApiOperation("更新")
@PostMapping("update")
- public DatasetTable save(@RequestBody DataSetTableRequest datasetTable) throws Exception {
- return dataSetTableService.save(datasetTable);
+ public void save(@RequestBody DataSetTableRequest datasetTable) throws Exception {
+ if(datasetTable.getType().equalsIgnoreCase("excel")){
+ dataSetTableService.saveExcel(datasetTable);
+ }else {
+ dataSetTableService.save(datasetTable);
+ }
}
@ApiOperation("删除")
@@ -121,8 +126,8 @@ public class DataSetTableController {
@ApiOperation("excel上传")
@PostMapping("excel/upload")
- public Map excelUpload(@RequestParam("file") MultipartFile file, @RequestParam("tableId") String tableId) throws Exception {
- return dataSetTableService.excelSaveAndParse(file, tableId);
+ public ExcelFileData excelUpload(@RequestParam("file") MultipartFile file, @RequestParam("tableId") String tableId, @RequestParam("editType") Integer editType ) throws Exception {
+ return dataSetTableService.excelSaveAndParse(file, tableId, editType);
}
@ApiOperation("检测doris")
diff --git a/backend/src/main/java/io/dataease/controller/request/dataset/DataSetTableRequest.java b/backend/src/main/java/io/dataease/controller/request/dataset/DataSetTableRequest.java
index df05e2cdc7..432969290b 100644
--- a/backend/src/main/java/io/dataease/controller/request/dataset/DataSetTableRequest.java
+++ b/backend/src/main/java/io/dataease/controller/request/dataset/DataSetTableRequest.java
@@ -2,6 +2,7 @@ package io.dataease.controller.request.dataset;
import io.dataease.base.domain.DatasetTable;
import io.dataease.datasource.dto.TableFiled;
+import io.dataease.dto.dataset.ExcelSheetData;
import lombok.Getter;
import lombok.Setter;
@@ -23,4 +24,6 @@ public class DataSetTableRequest extends DatasetTable {
private Boolean isRename;
private List typeFilter;
private List fields;
+ private List sheets;
+ private boolean mergeSheet = false;
}
diff --git a/backend/src/main/java/io/dataease/dto/dataset/DataTableInfoDTO.java b/backend/src/main/java/io/dataease/dto/dataset/DataTableInfoDTO.java
index a75f12dbba..1eed9391d1 100644
--- a/backend/src/main/java/io/dataease/dto/dataset/DataTableInfoDTO.java
+++ b/backend/src/main/java/io/dataease/dto/dataset/DataTableInfoDTO.java
@@ -14,7 +14,7 @@ import java.util.List;
public class DataTableInfoDTO {
private String table;
private String sql;
- private List sheets;
+ private List excelSheetDataList;
private String data;// file path
private List list;
}
diff --git a/backend/src/main/java/io/dataease/dto/dataset/ExcelSheetData.java b/backend/src/main/java/io/dataease/dto/dataset/ExcelSheetData.java
index 7e81d0fefd..10340dff3a 100644
--- a/backend/src/main/java/io/dataease/dto/dataset/ExcelSheetData.java
+++ b/backend/src/main/java/io/dataease/dto/dataset/ExcelSheetData.java
@@ -4,10 +4,18 @@ import io.dataease.datasource.dto.TableFiled;
import lombok.Data;
import java.util.List;
+import java.util.Map;
@Data
public class ExcelSheetData {
- private String sheetName;
+ private String excelLable;
private List> data;
private List fields;
+ private boolean isSheet = true;
+ private List