From 904c55570c214479f5a4df11b2dd6fbcbaaf1fd3 Mon Sep 17 00:00:00 2001 From: junjun Date: Thu, 8 Dec 2022 10:12:47 +0800 Subject: [PATCH 01/11] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE):=20=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E5=8D=A1=E6=94=AF=E6=8C=81=E9=98=88=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/chart/chart.js | 3 +- .../views/chart/components/dragItem/utils.js | 12 + .../components/normal/LabelNormalText.vue | 56 ++++- .../chart/components/senior/Threshold.vue | 135 ++++++++++- .../senior/dialog/TextLabelThresholdEdit.vue | 209 ++++++++++++++++++ frontend/src/views/chart/view/ChartEdit.vue | 6 +- 6 files changed, 413 insertions(+), 8 deletions(-) create mode 100644 frontend/src/views/chart/components/senior/dialog/TextLabelThresholdEdit.vue diff --git a/frontend/src/views/chart/chart/chart.js b/frontend/src/views/chart/chart/chart.js index 728f7469d4..98cf7ed868 100644 --- a/frontend/src/views/chart/chart/chart.js +++ b/frontend/src/views/chart/chart/chart.js @@ -449,7 +449,8 @@ export const DEFAULT_FUNCTION_CFG = { export const DEFAULT_THRESHOLD = { gaugeThreshold: '', labelThreshold: [], - tableThreshold: [] + tableThreshold: [], + textLabelThreshold: [] } export const DEFAULT_SCROLL = { open: false, diff --git a/frontend/src/views/chart/components/dragItem/utils.js b/frontend/src/views/chart/components/dragItem/utils.js index 2fb419f6f8..f7395b33fa 100644 --- a/frontend/src/views/chart/components/dragItem/utils.js +++ b/frontend/src/views/chart/components/dragItem/utils.js @@ -69,3 +69,15 @@ export function getOriginFieldName(dimensionList, quotaList, field) { } return originName } + +export function resetValueFormatter(item) { + if (item) { + item.formatterCfg = { + type: 'auto', // auto,value,percent + unit: 1, // 换算单位 + suffix: '', // 单位后缀 + decimalCount: 2, // 小数位数 + thousandSeparator: true// 千分符 + } + } +} diff --git a/frontend/src/views/chart/components/normal/LabelNormalText.vue b/frontend/src/views/chart/components/normal/LabelNormalText.vue index 1e133d08d0..eb9a6967b4 100644 --- a/frontend/src/views/chart/components/normal/LabelNormalText.vue +++ b/frontend/src/views/chart/components/normal/LabelNormalText.vue @@ -184,7 +184,7 @@ export default { this.$nextTick(function() { if (that.$refs.tableContainer) { const currentHeight = that.$refs.tableContainer.offsetHeight - const contentHeight = currentHeight - that.$refs.title.offsetHeight - 16 + const contentHeight = currentHeight - that.$refs.title.offsetHeight - 8 that.height = contentHeight + 'px' that.content_class.height = that.height } @@ -195,7 +195,8 @@ export default { const customAttr = JSON.parse(this.chart.customAttr) if (customAttr.color) { this.label_class.color = customAttr.color.dimensionColor - this.label_content_class.color = customAttr.color.quotaColor + // color threshold + this.colorThreshold(customAttr.color.quotaColor) } if (customAttr.size) { this.dimensionShow = customAttr.size.dimensionShow @@ -303,6 +304,57 @@ export default { }, initRemark() { this.remarkCfg = getRemark(this.chart) + }, + colorThreshold(valueColor) { + if (this.chart.senior) { + const senior = JSON.parse(this.chart.senior) + if (senior.threshold && senior.threshold.textLabelThreshold && senior.threshold.textLabelThreshold.length > 0) { + const value = this.chart.data.series[0].data[0] + for (let i = 0; i < senior.threshold.textLabelThreshold.length; i++) { + let flag = false + const t = senior.threshold.textLabelThreshold[i] + const tv = t.value + if (t.term === 'eq') { + if (value === tv) { + this.label_content_class.color = t.color + flag = true + } + } else if (t.term === 'not_eq') { + if (value !== tv) { + this.label_content_class.color = t.color + flag = true + } + } else if (t.term === 'like') { + if (value.includes(tv)) { + this.label_content_class.color = t.color + flag = true + } + } else if (t.term === 'not like') { + if (!value.includes(tv)) { + this.label_content_class.color = t.color + flag = true + } + } else if (t.term === 'null') { + if (value === null || value === undefined || value === '') { + this.label_content_class.color = t.color + flag = true + } + } else if (t.term === 'not_null') { + if (value !== null && value !== undefined && value !== '') { + this.label_content_class.color = t.color + flag = true + } + } + if (flag) { + break + } else if (i === senior.threshold.textLabelThreshold.length - 1) { + this.label_content_class.color = valueColor + } + } + } else { + this.label_content_class.color = valueColor + } + } } } } diff --git a/frontend/src/views/chart/components/senior/Threshold.vue b/frontend/src/views/chart/components/senior/Threshold.vue index a9f7b7958b..3d7e0a5bf3 100644 --- a/frontend/src/views/chart/components/senior/Threshold.vue +++ b/frontend/src/views/chart/components/senior/Threshold.vue @@ -41,6 +41,64 @@ + + + + + + + + {{ $t('chart.filter_eq') }} + {{ $t('chart.filter_not_eq') }} + {{ $t('chart.filter_like') }} + {{ $t('chart.filter_not_like') }} + {{ $t('chart.filter_null') }} + {{ $t('chart.filter_not_null') }} + + + {{ item.value }} +   + + + + + + + + + @@ -236,6 +294,37 @@ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + + + + diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 46db1c4479..8e65f66030 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -998,7 +998,7 @@ >
@@ -1037,7 +1037,7 @@ {{ $t('chart.analyse_cfg') }} From ffb86ed94f2460b21ae0178ff78b4dfe9b89e83f Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 8 Dec 2022 10:59:12 +0800 Subject: [PATCH 02/11] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BF=94=E5=9B=9E=E4=B8=8A=E7=BA=A7=E7=AD=89?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E7=9A=84=E6=98=BE=E7=A4=BA=EF=BC=8C=E5=8F=AA?= =?UTF-8?q?=E5=9C=A8=E4=B8=BB=E7=94=BB=E5=B8=83=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/canvas/components/editor/Preview.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/components/canvas/components/editor/Preview.vue b/frontend/src/components/canvas/components/editor/Preview.vue index 04d33ce7ef..9e1b6dd97d 100644 --- a/frontend/src/components/canvas/components/editor/Preview.vue +++ b/frontend/src/components/canvas/components/editor/Preview.vue @@ -6,6 +6,7 @@ @scroll="canvasScroll" > Date: Thu, 8 Dec 2022 11:19:20 +0800 Subject: [PATCH 03/11] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=AA=E8=A1=A8=E6=9D=BF=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=97=B6=E6=8F=90=E7=A4=BA=E7=AD=89=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/lang/en.js | 1 + frontend/src/lang/tw.js | 1 + frontend/src/lang/zh.js | 1 + .../src/views/panel/list/PanelViewShow.vue | 18 ++++++++++++++---- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 62968c5caf..3be0f103d3 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -1930,6 +1930,7 @@ export default { back_parent: 'Back to previous' }, panel: { + unpublished_tips: 'After unpublishing, the panel cannot be viewed. Are you sure you want to cancel publishing? ', position_adjust_component: 'Position adjust', active_font_size: 'Selected font size', carousel: 'Carousel', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 69a3d2c1f9..011e4a1b94 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -1924,6 +1924,7 @@ export default { back_parent: '返回上一級' }, panel: { + unpublished_tips: '取消發布後,該儀表板不能被查看。確定要取消發布?', position_adjust_component: '位置調整', active_font_size: '选中字體大小', carousel: '輪播', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index f0971cd637..1c06274057 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -1924,6 +1924,7 @@ export default { back_parent: '返回上一级' }, panel: { + unpublished_tips: '取消发布后,该仪表板不能被查看。确定要取消发布?', position_adjust_component: '位置调整', active_font_size: '选中字体大小', carousel: '轮播', diff --git a/frontend/src/views/panel/list/PanelViewShow.vue b/frontend/src/views/panel/list/PanelViewShow.vue index 48118c3784..97cf615766 100644 --- a/frontend/src/views/panel/list/PanelViewShow.vue +++ b/frontend/src/views/panel/list/PanelViewShow.vue @@ -17,7 +17,7 @@ style="border-bottom: 1px solid;border-bottom-color:#E6E6E6;" >
- +
- + this.updatePublishStatus('unpublished') + } + this.handlerConfirm(options, this.$t('commons.confirm')) } else { - this.panelInfo.status = 'publish' + this.updatePublishStatus('publish') } + }, + updatePublishStatus(newStatus) { + this.panelInfo.status = newStatus updatePanelStatus(this.panelInfo.id, { 'status': this.panelInfo.status }) this.$emit('editPanelBashInfo', { 'operation': 'status', From 8b0ca97d4de6d47cfc4682d33b03c2a7b0d55b80 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 8 Dec 2022 14:53:45 +0800 Subject: [PATCH 04/11] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=A8=E5=B1=8F=E9=A2=84=E8=A7=88=E9=83=A8?= =?UTF-8?q?=E5=88=86Tab=E7=BB=84=E4=BB=B6=E5=86=85=E7=9A=84=E4=B8=8B?= =?UTF-8?q?=E6=9D=A5=E6=A1=86=E6=97=A0=E6=B3=95=E5=B1=95=E5=BC=80=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/widget/deWidget/DeTabs.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/widget/deWidget/DeTabs.vue b/frontend/src/components/widget/deWidget/DeTabs.vue index 9440cd6056..fa9c821dfc 100644 --- a/frontend/src/components/widget/deWidget/DeTabs.vue +++ b/frontend/src/components/widget/deWidget/DeTabs.vue @@ -79,7 +79,7 @@ :canvas-style-data="canvasStyleData" :canvas-id="element.id+'-'+item.name" :panel-info="panelInfo" - :in-screen="true" + :in-screen="inScreen" :show-position="showPosition" />
@@ -232,6 +232,11 @@ export default { name: 'DeTabs', components: { TextAttr, Preview, DeCanvasTab, TabUseList, ViewSelect, DataeaseTabs }, props: { + inScreen: { + type: Boolean, + required: false, + default: true + }, canvasId: { type: String, default: 'canvas-main' From fd48e55021c4920a1c5a2129ede186b15a41beb4 Mon Sep 17 00:00:00 2001 From: junjun Date: Mon, 12 Dec 2022 10:21:48 +0800 Subject: [PATCH 05/11] =?UTF-8?q?fix(=E8=A7=86=E5=9B=BE):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=8C=87=E6=A0=87=E5=8D=A1=E3=80=81=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E5=8D=A1=E6=B2=A1=E6=9C=89=E5=9E=82=E7=9B=B4=E5=B1=85=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/components/normal/LabelNormal.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/chart/components/normal/LabelNormal.vue b/frontend/src/views/chart/components/normal/LabelNormal.vue index 6723b15d8f..52aab307f2 100644 --- a/frontend/src/views/chart/components/normal/LabelNormal.vue +++ b/frontend/src/views/chart/components/normal/LabelNormal.vue @@ -157,7 +157,7 @@ export default { this.$nextTick(function() { if (that.$refs.tableContainer) { const currentHeight = that.$refs.tableContainer.offsetHeight - const contentHeight = currentHeight - that.$refs.title.offsetHeight - 16 + const contentHeight = currentHeight - that.$refs.title.offsetHeight - 8 that.height = contentHeight + 'px' that.content_class.height = that.height } From b93a9bdf8f6ced3ad58e8e30cd9ca7adc9f4f49f Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 12 Dec 2022 13:29:26 +0800 Subject: [PATCH 06/11] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AC=AC=E4=B8=80=E6=AC=A1=E6=89=93=E5=BC=80?= =?UTF-8?q?=E4=BB=AA=E8=A1=A8=E6=9D=BF=EF=BC=8C=E8=BF=87=E6=BB=A4=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=97=A0=E6=B3=95=E8=BF=87=E6=BB=A4=20Tab=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=86=85=E7=9A=84=E8=A7=86=E5=9B=BE=20#4011?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/utils/conditionUtil.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/utils/conditionUtil.js b/frontend/src/utils/conditionUtil.js index 5cbd3ecbea..3b3e0f1240 100644 --- a/frontend/src/utils/conditionUtil.js +++ b/frontend/src/utils/conditionUtil.js @@ -1,6 +1,6 @@ - import { Condition } from '@/components/widget/bean/Condition' import { ApplicationContext } from '@/utils/ApplicationContext' +import store from '@/store' /** * 判断两个conditions数组是否相同 @@ -70,7 +70,11 @@ export const buildViewKeyMap = panelItems => { } export const buildViewKeyFilters = (panelItems, result) => { - panelItems.forEach((element, index) => { + if (!(panelItems && panelItems.length > 0)) { + return result + } + const buildItems = panelItems[0].canvasId === 'canvas-main' ? panelItems : store.state.componentData + buildItems.forEach((element, index) => { if (element.type !== 'custom') { return true } From 8988eab268a62cfc5123fb1fa88ac341af3cf15e Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 12 Dec 2022 15:59:12 +0800 Subject: [PATCH 07/11] =?UTF-8?q?feat(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=8A=B6=E6=80=81=E6=8B=96=E6=8B=BD=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E5=93=8D=E5=BA=94=E5=8C=BA=E5=9F=9F=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E4=B8=BA=E8=BE=B9=E7=BC=98=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/chart/chart.js | 6 ++- frontend/src/components/deDrag/index.vue | 60 ++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/frontend/src/api/chart/chart.js b/frontend/src/api/chart/chart.js index a10bb2534a..c58409d9cc 100644 --- a/frontend/src/api/chart/chart.js +++ b/frontend/src/api/chart/chart.js @@ -8,11 +8,12 @@ export function post(url, data, loading = false) { data }) } + export function tableField(id) { return request({ url: '/dataset/table/getWithPermission/' + id, method: 'post', - loading: true, + loading: false, hideMsg: true, timeout: 60000 }) @@ -34,6 +35,7 @@ export function chartCopy(id, panelId) { loading: false }) } + export function chartBatchCopy(params, panelId) { return request({ url: '/chart/view/chartBatchCopy/' + panelId, @@ -42,6 +44,7 @@ export function chartBatchCopy(params, panelId) { loading: false }) } + export function chartGroupTree(data) { return request({ url: '/chart/group/tree', @@ -116,6 +119,7 @@ export function resetViewCacheCallBack(viewId, panelId, callback) { callback(rep) }) } + export function resetViewCache(viewId, panelId) { return request({ url: '/chart/view/resetViewCache/' + viewId + '/' + panelId, diff --git a/frontend/src/components/deDrag/index.vue b/frontend/src/components/deDrag/index.vue index 3ec4ea4362..44cd7a11b2 100644 --- a/frontend/src/components/deDrag/index.vue +++ b/frontend/src/components/deDrag/index.vue @@ -17,8 +17,8 @@ }, className ]" - @mousedown="elementMouseDown" @touchstart="elementTouchDown" + @mousedown="outerElementMouseDown" @mouseenter="enter" @mouseleave="leave" > @@ -66,20 +66,24 @@ @mousedown.stop.prevent="handleDown(handlei, $event)" @touchstart.stop.prevent="handleTouchDown(handlei, $event)" > - +
+
+
+
+
- +
@@ -863,6 +867,18 @@ export default { eventsFor = events.touch this.elementDown(e) }, + outerElementMouseDown(e) { + // private 设置当前组件数据及状态 + this.$store.commit('setClickComponentStatus', true) + if (this.element.component !== 'user-view' && this.element.component !== 'de-frame' && this.element.component !== 'v-text' && this.element.component !== 'de-rich-text' && this.element.component !== 'rect-shape' && this.element.component !== 'de-input-search' && this.element.component !== 'de-select-grid' && this.element.component !== 'de-number-range' && this.element.component !== 'de-date') { + e.preventDefault() + } + // 阻止冒泡事件 + e.stopPropagation() + this.$nextTick(() => { + this.$store.commit('setCurComponent', { component: this.element, index: this.index }) + }) + }, elementMouseDown(e) { // private 设置当前组件数据及状态 this.$store.commit('setClickComponentStatus', true) @@ -2131,4 +2147,42 @@ export default { .drag-on-tab-collision { z-index: 1000 !important; } + +.de-drag-area { + position: absolute; + z-index: 10; +} + +.de-drag-area:hover { + cursor: move; +} + +.de-drag-top { + left: 0; + top: 0; + height: 12px; + width: 100%; +} + +.de-drag-right { + right: 0; + top: 0; + width: 16px; + height: 100%; +} + +.de-drag-bottom { + left: 0; + bottom: 0; + height: 12px; + width: 100%; +} + +.de-drag-left { + left: 0; + top: 0; + width: 16px; + height: 100%; +} + From 5a04c47b4baad8a842f9897be584eab3b1862330 Mon Sep 17 00:00:00 2001 From: junjun Date: Mon, 12 Dec 2022 17:16:30 +0800 Subject: [PATCH 08/11] =?UTF-8?q?fix(=E8=A7=86=E5=9B=BE):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=A4=8D=E5=88=B6=E4=BB=AA=E8=A1=A8=E6=9D=BF=E5=90=8E?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E8=AE=A1=E7=AE=97=E5=AD=97=E6=AE=B5=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE=E5=BC=8F=E4=B8=BA=E7=A9=BA=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20#4062?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/io/dataease/ext/ExtChartViewMapper.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/src/main/java/io/dataease/ext/ExtChartViewMapper.xml b/backend/src/main/java/io/dataease/ext/ExtChartViewMapper.xml index 2a12627b5e..c4d4d4ad46 100644 --- a/backend/src/main/java/io/dataease/ext/ExtChartViewMapper.xml +++ b/backend/src/main/java/io/dataease/ext/ExtChartViewMapper.xml @@ -608,6 +608,7 @@ id, table_id, chart_id, + origin_name, `name`, dataease_name, group_type, @@ -624,6 +625,7 @@ uuid() AS id, chart_view_field.table_id, chart_view_field.pv_copy.chart_view_id AS chart_id, + chart_view_field.origin_name, chart_view_field.`name`, chart_view_field.dataease_name, chart_view_field.group_type, From 214c5f1a84278e7b3369b5809ebac2ca0abcec19 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Mon, 12 Dec 2022 17:17:55 +0800 Subject: [PATCH 09/11] =?UTF-8?q?feat(=E6=95=B0=E6=8D=AE=E6=BA=90):=20?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=BA=90=E6=95=8F=E6=84=9F=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=8A=A0=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datasource/DatasourceController.java | 1 - .../java/io/dataease/dto/DatasourceDTO.java | 1 + .../service/chart/util/ChartDataBuild.java | 2 +- .../service/datasource/DatasourceService.java | 13 ++++++++- .../src/views/system/datasource/DsAppForm.vue | 5 ++-- .../views/system/datasource/DsFormContent.vue | 28 +++++++++++++------ .../src/views/system/datasource/DsTree.vue | 10 +++++-- 7 files changed, 44 insertions(+), 16 deletions(-) diff --git a/backend/src/main/java/io/dataease/controller/datasource/DatasourceController.java b/backend/src/main/java/io/dataease/controller/datasource/DatasourceController.java index 4de2848a3e..d6fc4ca263 100644 --- a/backend/src/main/java/io/dataease/controller/datasource/DatasourceController.java +++ b/backend/src/main/java/io/dataease/controller/datasource/DatasourceController.java @@ -19,7 +19,6 @@ import io.dataease.plugins.common.base.domain.Datasource; import io.dataease.service.datasource.DatasourceService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.web.bind.annotation.*; diff --git a/backend/src/main/java/io/dataease/dto/DatasourceDTO.java b/backend/src/main/java/io/dataease/dto/DatasourceDTO.java index 47d39bd4cf..8b3c8dcf30 100644 --- a/backend/src/main/java/io/dataease/dto/DatasourceDTO.java +++ b/backend/src/main/java/io/dataease/dto/DatasourceDTO.java @@ -19,6 +19,7 @@ public class DatasourceDTO extends Datasource { @ApiModelProperty("权限") private String privileges; private List apiConfiguration; + private String apiConfigurationStr; private String typeDesc; private DatasourceCalculationMode calculationMode; } diff --git a/backend/src/main/java/io/dataease/service/chart/util/ChartDataBuild.java b/backend/src/main/java/io/dataease/service/chart/util/ChartDataBuild.java index 71e32cb73f..31a1b0511f 100644 --- a/backend/src/main/java/io/dataease/service/chart/util/ChartDataBuild.java +++ b/backend/src/main/java/io/dataease/service/chart/util/ChartDataBuild.java @@ -1014,7 +1014,7 @@ public class ChartDataBuild { if (StringUtils.isEmpty(originStr) || originStr.length() <= columnPermissionItem.getDesensitizationRule().getM() + columnPermissionItem.getDesensitizationRule().getN() + 1) { desensitizationStr = String.join("", Collections.nCopies(columnPermissionItem.getDesensitizationRule().getM(), "X")) + "***" + String.join("", Collections.nCopies(columnPermissionItem.getDesensitizationRule().getN(), "X")); } else { - desensitizationStr = StringUtils.substring(originStr, 0, columnPermissionItem.getDesensitizationRule().getM() - 1) + "***" + StringUtils.substring(originStr, originStr.length() - columnPermissionItem.getDesensitizationRule().getN(), originStr.length() - 1); + desensitizationStr = StringUtils.substring(originStr, 0, columnPermissionItem.getDesensitizationRule().getM()) + "***" + StringUtils.substring(originStr, originStr.length() - columnPermissionItem.getDesensitizationRule().getN() - 1, originStr.length() - 1); } break; case RetainMToN: diff --git a/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java b/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java index c60c17f22a..585a5a085f 100644 --- a/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java +++ b/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java @@ -108,7 +108,7 @@ public class DatasourceService { if (!types().stream().map(DataSourceType::getType).collect(Collectors.toList()).contains(datasource.getType())) { throw new Exception("Datasource type not supported."); } - + datasource.setConfiguration(new String(java.util.Base64.getDecoder().decode(datasource.getConfiguration()))); Provider datasourceProvider = ProviderFactory.getProvider(datasource.getType()); datasourceProvider.checkConfiguration(datasource); @@ -212,6 +212,14 @@ public class DatasourceService { } } } + if(StringUtils.isNotEmpty(datasourceDTO.getConfiguration())){ + datasourceDTO.setConfiguration(new String(java.util.Base64.getEncoder().encode(datasourceDTO.getConfiguration().getBytes()))); + } + if(CollectionUtils.isNotEmpty(datasourceDTO.getApiConfiguration())){ + String config = new Gson().toJson(datasourceDTO.getApiConfiguration()); + datasourceDTO.setApiConfigurationStr(new String(java.util.Base64.getEncoder().encode(config.getBytes()))); + datasourceDTO.setApiConfiguration(null); + } } public DatasourceDTO getDataSourceDetails(String datasourceId){ @@ -253,6 +261,7 @@ public class DatasourceService { if (!types().stream().map(DataSourceType::getType).collect(Collectors.toList()).contains(updataDsRequest.getType())) { throw new Exception("Datasource type not supported."); } + updataDsRequest.setConfiguration(new String(java.util.Base64.getDecoder().decode(updataDsRequest.getConfiguration()))); checkName(updataDsRequest.getName(), updataDsRequest.getType(), updataDsRequest.getId()); Datasource datasource = new Datasource(); datasource.setName(updataDsRequest.getName()); @@ -284,6 +293,7 @@ public class DatasourceService { } public ResultHolder validate(Datasource datasource) throws Exception { + datasource.setConfiguration(new String(java.util.Base64.getDecoder().decode(datasource.getConfiguration()))); DatasourceDTO datasourceDTO = new DatasourceDTO(); BeanUtils.copyBean(datasourceDTO, datasource); try { @@ -372,6 +382,7 @@ public class DatasourceService { } public List getSchema(Datasource datasource) throws Exception { + datasource.setConfiguration(new String(java.util.Base64.getDecoder().decode(datasource.getConfiguration()))); Provider datasourceProvider = ProviderFactory.getProvider(datasource.getType()); DatasourceRequest datasourceRequest = new DatasourceRequest(); datasourceRequest.setDatasource(datasource); diff --git a/frontend/src/views/system/datasource/DsAppForm.vue b/frontend/src/views/system/datasource/DsAppForm.vue index 01a5af6a2c..accd44632f 100644 --- a/frontend/src/views/system/datasource/DsAppForm.vue +++ b/frontend/src/views/system/datasource/DsAppForm.vue @@ -216,6 +216,7 @@ import PluginCom from '@/views/system/plugin/PluginCom' import { groupTree, appApply } from '@/api/panel/panel' import { dsGroupTree } from '@/api/dataset/dataset' import { deepCopy } from '@/components/canvas/utils/utils' +import { Base64 } from 'js-base64' export default { name: 'DsForm', components: { @@ -707,9 +708,9 @@ export default { if (valid) { const data = JSON.parse(JSON.stringify(this.form)) if (data.type === 'api') { - data.configuration = JSON.stringify(data.apiConfiguration) + data.configuration = Base64.encode(JSON.stringify(data.apiConfiguration)) } else { - data.configuration = JSON.stringify(data.configuration) + data.configuration = Base64.encode(JSON.stringify(data.configuration)) } if (data.showModel === 'show' && !this.canEdit) { validateDsById(data.id).then(res => { diff --git a/frontend/src/views/system/datasource/DsFormContent.vue b/frontend/src/views/system/datasource/DsFormContent.vue index cd3634b941..1c61d82349 100644 --- a/frontend/src/views/system/datasource/DsFormContent.vue +++ b/frontend/src/views/system/datasource/DsFormContent.vue @@ -226,10 +226,7 @@ >{{ $t('commons.cancel') }} {{ $t('commons.validate') }} @@ -307,6 +304,7 @@ import { dsGroupTree } from '@/api/dataset/dataset' import { appApply, appEdit, groupTree } from '@/api/panel/panel' import { deepCopy } from '@/components/canvas/utils/utils' import { hasDataPermission } from '@/utils/permission' +import { Base64 } from 'js-base64' export default { name: 'DsForm', @@ -710,6 +708,12 @@ export default { getDatasourceDetail(id, showModel) { this.$emit('update:formLoading', true) return getDatasourceDetail(id).then((res) => { + if(res.data.configuration){ + res.data.configuration = Base64.decode(res.data.configuration) + } + if(res.data.apiConfigurationStr){ + res.data.apiConfiguration = JSON.parse(Base64.decode(res.data.apiConfigurationStr)) + } this.params = { ...res.data, showModel } this.$emit('setParams', { ...this.params }) }).finally(() => { @@ -729,6 +733,12 @@ export default { const newArr = [] for (let index = 0; index < array.length; index++) { const element = array[index] + if(element.configuration){ + element.configuration = Base64.decode(element.configuration) + } + if(element.apiConfigurationStr){ + element.apiConfiguration = Base64.decode(element.apiConfigurationStr) + } if (this.msgNodeId) { if (element.id === this.msgNodeId) { element.msgNode = true @@ -967,9 +977,9 @@ export default { form.apiConfiguration.forEach((item) => { delete item.status }) - form.configuration = JSON.stringify(form.apiConfiguration) + form.configuration = Base64.encode(JSON.stringify(form.apiConfiguration)) } else { - form.configuration = JSON.stringify(form.configuration) + form.configuration = Base64.encode(JSON.stringify(form.configuration)) } const isAppMarket = this.positionCheck('appMarket') let appApplyForm @@ -1051,7 +1061,7 @@ export default { this.$refs.dsForm.validate((valid) => { if (valid) { const data = JSON.parse(JSON.stringify(this.form)) - data.configuration = JSON.stringify(data.configuration) + data.configuration = Base64.encode(JSON.stringify(data.configuration)) getSchema(data).then((res) => { this.schemas = res.data this.openMessageSuccess('commons.success') @@ -1102,9 +1112,9 @@ export default { if (valid) { const data = JSON.parse(JSON.stringify(this.form)) if (data.type === 'api') { - data.configuration = JSON.stringify(data.apiConfiguration) + data.configuration = Base64.encode(JSON.stringify(data.apiConfiguration)) } else { - data.configuration = JSON.stringify(data.configuration) + data.configuration = Base64.encode(JSON.stringify(data.configuration)) } if (data.showModel === 'show' && !this.canEdit) { validateDsById(data.id).then((res) => { diff --git a/frontend/src/views/system/datasource/DsTree.vue b/frontend/src/views/system/datasource/DsTree.vue index 23c25f6675..de2a068049 100644 --- a/frontend/src/views/system/datasource/DsTree.vue +++ b/frontend/src/views/system/datasource/DsTree.vue @@ -316,6 +316,7 @@