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/DeDrag/index.vue b/frontend/src/components/DeDrag/index.vue index 2063bc28f1..b47cb117ca 100644 --- a/frontend/src/components/DeDrag/index.vue +++ b/frontend/src/components/DeDrag/index.vue @@ -1155,7 +1155,9 @@ export default { this.resizing = false await this.conflictCheck() this.$emit('refLineParams', refLine) - this.$emit('resizestop', this.left, this.top, this.width, this.height) + // this.$emit('resizestop', this.left, this.top, this.width, this.height) + // private + // this.$emit('resizestop') } if (this.dragging) { this.dragging = false @@ -1484,6 +1486,12 @@ export default { style.rotate = this.rotate // this.hasMove = true this.$store.commit('setShapeStyle', style) + + // resize + const self = this + setTimeout(function() { + self.$emit('resizestop') + }, 200) }, mountedFunction() { // private 冲突检测 和水平设计值保持一致 diff --git a/frontend/src/components/canvas/components/Editor/PreviewEject.vue b/frontend/src/components/canvas/components/Editor/PreviewEject.vue index b290d689bd..d79ca08a0e 100644 --- a/frontend/src/components/canvas/components/Editor/PreviewEject.vue +++ b/frontend/src/components/canvas/components/Editor/PreviewEject.vue @@ -7,6 +7,8 @@ import Preview from './Preview' import { uuid } from 'vue-uuid' import { findOne } from '@/api/panel/panel' +import { getPanelAllLinkageInfo } from '@/api/panel/linkage' + export default { components: { Preview }, @@ -24,6 +26,10 @@ export default { id: response.data.id, name: response.data.name } + // 刷新联动信息 + getPanelAllLinkageInfo(this.panelId).then(rsp => { + this.$store.commit('setNowPanelTrackInfo', rsp.data) + }) this.$store.dispatch('panel/setPanelInfo', data) }) }, diff --git a/frontend/src/components/canvas/components/Editor/index.vue b/frontend/src/components/canvas/components/Editor/index.vue index f988791ad4..57b2a8de21 100644 --- a/frontend/src/components/canvas/components/Editor/index.vue +++ b/frontend/src/components/canvas/components/Editor/index.vue @@ -37,6 +37,7 @@ :linkage-active="linkageSettingStatus&&item===curLinkageView" @refLineParams="getRefLineParams" @showViewDetails="showViewDetails(index)" + @resizestop="resizestop(index,item)" > 0) { this.getData(this.element.propValue.viewId) } + }, + 'chartType': function(newVal, oldVal) { + if (newVal === 'map' && newVal !== oldVal) { + this.initAreas() + } } }, @@ -180,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() { }, @@ -219,7 +228,9 @@ export default { // 增加判断 仪表板公共连接中使用viewInfo 正常使用viewData let method = viewData - if (!getToken() && getLinkToken()) { + const token = this.$store.getters.token || getToken() + const linkToken = this.$store.getters.linkToken || getLinkToken() + if (!token && linkToken) { method = viewInfo } @@ -346,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) { @@ -378,6 +389,12 @@ export default { if (temp) return temp } } + }, + // chart + chartResize() { + if (this.$refs[this.element.propValue.id]) { + this.$refs[this.element.propValue.id].chartResize() + } } } } diff --git a/frontend/src/store/getters.js b/frontend/src/store/getters.js index ada150bc49..cb814086c2 100644 --- a/frontend/src/store/getters.js +++ b/frontend/src/store/getters.js @@ -4,6 +4,7 @@ const getters = { size: state => state.app.size, device: state => state.app.device, token: state => state.user.token, + linkToken: state => state.user.linkToken, avatar: state => state.user.avatar, name: state => state.user.name, introduction: state => state.user.introduction, diff --git a/frontend/src/store/modules/user.js b/frontend/src/store/modules/user.js index e67c16c1d3..edf18a7091 100644 --- a/frontend/src/store/modules/user.js +++ b/frontend/src/store/modules/user.js @@ -18,7 +18,8 @@ const getDefaultState = () => { // 当前用户拥有哪些资源权限 permissions: [], language: getLanguage(), - uiInfo: null + uiInfo: null, + linkToken: null } } @@ -31,6 +32,9 @@ const mutations = { SET_TOKEN: (state, token) => { state.token = token }, + SET_LINK_TOKEN: (state, linkToken) => { + state.linkToken = linkToken + }, SET_NAME: (state, name) => { state.name = name }, @@ -165,6 +169,9 @@ const actions = { commit('SET_LANGUAGE', language) router.go(0) }) + }, + setLinkToken({ commit }, linkToken) { + commit('SET_LINK_TOKEN', linkToken) } } diff --git a/frontend/src/utils/request.js b/frontend/src/utils/request.js index 77623de695..b0dcabba45 100644 --- a/frontend/src/utils/request.js +++ b/frontend/src/utils/request.js @@ -34,6 +34,10 @@ service.interceptors.request.use( if ((linkToken = getLinkToken()) !== null) { config.headers[LinkTokenKey] = linkToken } + if (!linkToken) { + linkToken = store.getters.linkToken + config.headers[LinkTokenKey] = linkToken + } if (i18n.locale) { const lang = i18n.locale.replace('_', '-') @@ -92,6 +96,7 @@ const checkAuth = response => { if (response.headers[LinkTokenKey.toLocaleLowerCase()] || (response.config.headers && response.config.headers[LinkTokenKey.toLocaleLowerCase()])) { const linkToken = response.headers[LinkTokenKey.toLocaleLowerCase()] || response.config.headers[LinkTokenKey.toLocaleLowerCase()] setLinkToken(linkToken) + store.dispatch('user/setLinkToken', linkToken) } // 许可状态改变 刷新页面 // if (response.headers['lic-status']) { diff --git a/frontend/src/views/chart/chart/map/map.js b/frontend/src/views/chart/chart/map/map.js index e945d23c31..6c003a0fd2 100644 --- a/frontend/src/views/chart/chart/map/map.js +++ b/frontend/src/views/chart/chart/map/map.js @@ -33,18 +33,24 @@ export function baseMapOption(chart_option, chart) { } // visualMap const valueArr = chart.data.series[0].data - const values = [] - valueArr.forEach(function(ele) { - values.push(ele.value) - }) - chart_option.visualMap.min = Math.min(...values) - chart_option.visualMap.max = Math.max(...values) - if (chart_option.visualMap.min === chart_option.visualMap.max) { + if (valueArr && valueArr.length > 0) { + const values = [] + valueArr.forEach(function(ele) { + values.push(ele.value) + }) + chart_option.visualMap.min = Math.min(...values) + chart_option.visualMap.max = Math.max(...values) + if (chart_option.visualMap.min === chart_option.visualMap.max) { + chart_option.visualMap.min = 0 + } + } else { chart_option.visualMap.min = 0 + chart_option.visualMap.max = 0 } - + // color if (customAttr.color && customAttr.color.colors) { chart_option.visualMap.inRange.color = customAttr.color.colors + chart_option.visualMap.inRange.colorAlpha = customAttr.color.alpha / 100 } for (let i = 0; i < valueArr.length; i++) { // const y = { diff --git a/frontend/src/views/chart/components/component-style/BackgroundColorSelector.vue b/frontend/src/views/chart/components/component-style/BackgroundColorSelector.vue index 7e76673d54..d2a2f566f8 100644 --- a/frontend/src/views/chart/components/component-style/BackgroundColorSelector.vue +++ b/frontend/src/views/chart/components/component-style/BackgroundColorSelector.vue @@ -10,26 +10,6 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/frontend/src/views/chart/components/component-style/LegendSelector.vue b/frontend/src/views/chart/components/component-style/LegendSelector.vue index 02aa399ba2..271bf5e6dd 100644 --- a/frontend/src/views/chart/components/component-style/LegendSelector.vue +++ b/frontend/src/views/chart/components/component-style/LegendSelector.vue @@ -47,71 +47,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/frontend/src/views/chart/components/component-style/SplitSelector.vue b/frontend/src/views/chart/components/component-style/SplitSelector.vue index b828660cb5..a2cef6e5b7 100644 --- a/frontend/src/views/chart/components/component-style/SplitSelector.vue +++ b/frontend/src/views/chart/components/component-style/SplitSelector.vue @@ -41,59 +41,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/frontend/src/views/chart/components/component-style/TitleSelector.vue b/frontend/src/views/chart/components/component-style/TitleSelector.vue index c2e25ee0d5..c9e31d4181 100644 --- a/frontend/src/views/chart/components/component-style/TitleSelector.vue +++ b/frontend/src/views/chart/components/component-style/TitleSelector.vue @@ -45,69 +45,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/frontend/src/views/chart/components/component-style/XAxisSelector.vue b/frontend/src/views/chart/components/component-style/XAxisSelector.vue index 21cdf2fbf6..c42e732e4c 100644 --- a/frontend/src/views/chart/components/component-style/XAxisSelector.vue +++ b/frontend/src/views/chart/components/component-style/XAxisSelector.vue @@ -66,90 +66,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/frontend/src/views/chart/components/component-style/YAxisSelector.vue b/frontend/src/views/chart/components/component-style/YAxisSelector.vue index ef52af5636..ca6ef455d4 100644 --- a/frontend/src/views/chart/components/component-style/YAxisSelector.vue +++ b/frontend/src/views/chart/components/component-style/YAxisSelector.vue @@ -66,90 +66,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/frontend/src/views/chart/components/shape-attr/ColorSelector.vue b/frontend/src/views/chart/components/shape-attr/ColorSelector.vue index bc7a5b2629..f397633982 100644 --- a/frontend/src/views/chart/components/shape-attr/ColorSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/ColorSelector.vue @@ -42,58 +42,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/frontend/src/views/chart/components/shape-attr/LabelSelector.vue b/frontend/src/views/chart/components/shape-attr/LabelSelector.vue index a6f2fc4f72..2ee0a55909 100644 --- a/frontend/src/views/chart/components/shape-attr/LabelSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/LabelSelector.vue @@ -61,85 +61,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue index 0295369719..1dd5a77237 100644 --- a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue @@ -161,150 +161,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/frontend/src/views/chart/components/shape-attr/TooltipSelector.vue b/frontend/src/views/chart/components/shape-attr/TooltipSelector.vue index 2e0fc50367..d56d8df48d 100644 --- a/frontend/src/views/chart/components/shape-attr/TooltipSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/TooltipSelector.vue @@ -49,73 +49,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index ca061f74fd..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); @@ -821,6 +830,9 @@ export default { return } view.tableId = this.view.tableId + if (view.type === 'map' && view.xaxis.length > 1) { + view.xaxis = [view.xaxis[0]] + } view.xaxis.forEach(function(ele) { // if (!ele.summary || ele.summary === '') { // ele.summary = 'sum' @@ -838,6 +850,9 @@ export default { ele.filter = [] } }) + if (view.type === 'map' && view.yaxis.length > 1) { + view.yaxis = [view.yaxis[0]] + } view.yaxis.forEach(function(ele) { if (!ele.summary || ele.summary === '') { if (ele.id === 'count' || ele.deType === 0 || ele.deType === 1) { @@ -925,67 +940,6 @@ export default { }) }, - // saveSnapshot() { - // if (this.view.title && this.view.title.length > 50) { - // this.$warning(this.$t('chart.title_limit')) - // return - // } - // if (this.loading) { - // return - // } - // this.loading = true - // html2canvas(this.$refs.imageWrapper).then(canvas => { - // const snapshot = canvas.toDataURL('image/jpeg', 0.1) // 0.1是图片质量 - // if (snapshot !== '') { - // const view = JSON.parse(JSON.stringify(this.view)) - // view.id = this.view.id - // view.sceneId = this.view.sceneId - // view.name = this.view.name ? this.view.name : this.table.name - // view.tableId = this.view.tableId - // view.xaxis.forEach(function(ele) { - // // if (!ele.summary || ele.summary === '') { - // // ele.summary = 'sum' - // // } - // if (!ele.sort || ele.sort === '') { - // ele.sort = 'none' - // } - // if (!ele.filter) { - // ele.filter = [] - // } - // }) - // view.yaxis.forEach(function(ele) { - // if (!ele.summary || ele.summary === '') { - // if (ele.id === 'count') { - // ele.summary = 'count' - // } else { - // ele.summary = 'sum' - // } - // } - // if (!ele.sort || ele.sort === '') { - // ele.sort = 'none' - // } - // if (!ele.filter) { - // ele.filter = [] - // } - // }) - // if (view.type.startsWith('pie') || view.type.startsWith('funnel') || view.type.startsWith('gauge')) { - // if (view.yaxis.length > 1) { - // view.yaxis.splice(1, view.yaxis.length) - // } - // } - // view.xaxis = JSON.stringify(view.xaxis) - // view.yaxis = JSON.stringify(view.yaxis) - // view.customAttr = JSON.stringify(view.customAttr) - // view.customStyle = JSON.stringify(view.customStyle) - // view.customFilter = JSON.stringify(view.customFilter) - // view.snapshot = snapshot - // post('/chart/view/save', view).then(response => { - // this.loading = false - // this.$success(this.$t('commons.save_success')) - // }) - // } - // }) - // }, closeEdit() { if (this.view.title && this.view.title.length > 50) { this.$warning(this.$t('chart.title_limit')) @@ -1067,74 +1021,6 @@ export default { } }, - // 左边往右边拖动时的事件 - // start1(e) { - // // console.log(e) - // e.clone.className = 'item' - // e.item.className = 'item' - // }, - // end1(e) { - // // console.log(e) - // e.clone.className = 'item' - // e.item.className = 'item' - // this.refuseMove(e) - // this.removeCheckedKey(e) - // this.save(true) - // }, - // 右边往左边拖动时的事件 - // start2(e) { - // console.log(e) - // }, - // end2(e) { - // // console.log(e) - // this.removeDuplicateKey(e) - // this.save(true) - // }, - // removeCheckedKey(e) { - // const that = this - // const xItems = this.view.xaxis.filter(function(m) { - // return m.id === that.moveId - // }) - // const yItems = this.view.yaxis.filter(function(m) { - // return m.id === that.moveId - // }) - // if (xItems && xItems.length > 1) { - // this.view.xaxis.splice(e.newDraggableIndex, 1) - // } - // if (yItems && yItems.length > 1) { - // this.view.yaxis.splice(e.newDraggableIndex, 1) - // } - // }, - // refuseMove(e) { - // const that = this - // const xItems = this.dimension.filter(function(m) { - // return m.id === that.moveId - // }) - // const yItems = this.quota.filter(function(m) { - // return m.id === that.moveId - // }) - // if (xItems && xItems.length > 1) { - // this.dimension.splice(e.newDraggableIndex, 1) - // } - // if (yItems && yItems.length > 1) { - // this.quota.splice(e.newDraggableIndex, 1) - // } - // }, - // removeDuplicateKey(e) { - // const that = this - // const xItems = this.dimension.filter(function(m) { - // return m.id === that.moveId - // }) - // const yItems = this.quota.filter(function(m) { - // return m.id === that.moveId - // }) - // if (xItems && xItems.length > 1) { - // this.dimension.splice(e.newDraggableIndex, 1) - // } - // if (yItems && yItems.length > 1) { - // this.quota.splice(e.newDraggableIndex, 1) - // } - // }, // move回调方法 onMove(e, originalEvent) { // console.log(e) @@ -1411,11 +1297,17 @@ export default { } }, addXaxis(e) { + if (this.view.type === 'map' && this.view.xaxis.length > 1) { + this.view.xaxis = [this.view.xaxis[0]] + } this.dragCheckType(this.view.xaxis, 'd') this.dragMoveDuplicate(this.view.xaxis, e) this.save(true) }, addYaxis(e) { + if (this.view.type === 'map' && this.view.yaxis.length > 1) { + this.view.yaxis = [this.view.yaxis[0]] + } this.dragCheckType(this.view.yaxis, 'q') this.dragMoveDuplicate(this.view.yaxis, e) this.save(true) @@ -1444,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)) }) }, diff --git a/frontend/src/views/link/index.vue b/frontend/src/views/link/index.vue index e88b771fa8..85a6502241 100644 --- a/frontend/src/views/link/index.vue +++ b/frontend/src/views/link/index.vue @@ -1,7 +1,7 @@ @@ -49,6 +49,9 @@ export default { this.showError() }) }, + refreshToken() { + this.loadInit() + }, // 显示无效链接 showError() { diff --git a/frontend/src/views/link/pwd/index.vue b/frontend/src/views/link/pwd/index.vue index f1e01a4673..47c4b2769b 100644 --- a/frontend/src/views/link/pwd/index.vue +++ b/frontend/src/views/link/pwd/index.vue @@ -96,7 +96,8 @@ export default { if (!res.data) { this.msg = this.$t('pblink.pwd_error') } else { - window.location.reload() + // window.location.reload() + this.$emit('fresh-token') } }) }) diff --git a/frontend/src/views/link/view/index.vue b/frontend/src/views/link/view/index.vue index c92b5fc478..b2b1a1cbf4 100644 --- a/frontend/src/views/link/view/index.vue +++ b/frontend/src/views/link/view/index.vue @@ -8,6 +8,8 @@ import { loadResource } from '@/api/link' import { uuid } from 'vue-uuid' import Preview from '@/components/canvas/components/Editor/Preview' +import { getPanelAllLinkageInfo } from '@/api/panel/linkage' + export default { name: 'LinkView', components: { Preview }, @@ -29,6 +31,10 @@ export default { methods: { setPanelInfo() { loadResource(this.resourceId).then(res => { + // 刷新联动信息 + getPanelAllLinkageInfo(this.resourceId).then(rsp => { + this.$store.commit('setNowPanelTrackInfo', rsp.data) + }) this.$store.commit('setComponentData', this.resetID(JSON.parse(res.data.panelData))) // this.$store.commit('setComponentData', JSON.parse(res.data.panelData)) this.$store.commit('setCanvasStyle', JSON.parse(res.data.panelStyle))