From 704cb29d197a4471543f18e9e3d41364c2eb850d Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 20 May 2022 12:34:47 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=89=B9=E9=87=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/panel/PanelGroupService.java | 2 +- .../canvas/components/Editor/EditBar.vue | 2 +- .../canvas/custom-component/UserView.vue | 5 +- .../component-style/TitleSelector.vue | 32 +- .../component-style/TitleSelectorAntV.vue | 33 +- frontend/src/views/chart/view/ChartStyle.vue | 9 +- .../src/views/chart/view/ChartStyleBack.vue | 609 ------------------ 7 files changed, 54 insertions(+), 638 deletions(-) delete mode 100644 frontend/src/views/chart/view/ChartStyleBack.vue diff --git a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java index 27479de489..bb7b734cce 100644 --- a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java +++ b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java @@ -124,7 +124,7 @@ public class PanelGroupService { if (StringUtils.isEmpty(panelId)) { // 新建 checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, null, request.getNodeType()); panelId = newPanel(request); - panelGroupMapper.insert(request); + panelGroupMapper.insertSelective(request); // 清理权限缓存 clearPermissionCache(); sysAuthService.copyAuth(panelId, SysAuthConstants.AUTH_SOURCE_TYPE_PANEL); diff --git a/frontend/src/components/canvas/components/Editor/EditBar.vue b/frontend/src/components/canvas/components/Editor/EditBar.vue index 4522f94a23..765458d7a2 100644 --- a/frontend/src/components/canvas/components/Editor/EditBar.vue +++ b/frontend/src/components/canvas/components/Editor/EditBar.vue @@ -91,7 +91,7 @@ export default { }, // batch operation area batchOptAreaShow() { - return this.batchOptStatus && this.element.type === 'view' + return this.batchOptStatus && this.element.type === 'view' && !this.element.isPlugin }, // 联动区域按钮显示 linkageAreaShow() { diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index b27f4ad796..ebc89f8173 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -412,8 +412,11 @@ export default { this.chart.customAttr = this.sourceCustomAttrStr updateParams['customAttr'] = this.sourceCustomAttrStr } else if (param.custom === 'customStyle') { - this.sourceCustomStyleStr = this.chart.customStyle const sourceCustomStyle = JSON.parse(this.sourceCustomStyleStr) + // view's title use history + if (param.property === 'text') { + param.value.title = sourceCustomStyle.text.title + } sourceCustomStyle[param.property] = param.value this.sourceCustomStyleStr = JSON.stringify(sourceCustomStyle) this.chart.customStyle = this.sourceCustomStyleStr diff --git a/frontend/src/views/chart/components/component-style/TitleSelector.vue b/frontend/src/views/chart/components/component-style/TitleSelector.vue index a3ae0d42f7..7afa56d139 100644 --- a/frontend/src/views/chart/components/component-style/TitleSelector.vue +++ b/frontend/src/views/chart/components/component-style/TitleSelector.vue @@ -6,7 +6,7 @@ {{ $t('chart.show') }}
- + import { COLOR_PANEL, DEFAULT_TITLE_STYLE } from '../../chart/chart' import { checkViewTitle } from '@/components/canvas/utils/utils' +import { mapState } from 'vuex' export default { name: 'TitleSelector', @@ -79,6 +80,11 @@ export default { } } }, + computed: { + ...mapState([ + 'batchOptStatus' + ]) + }, mounted() { this.init() this.initData() @@ -96,7 +102,9 @@ export default { if (customStyle.text) { this.titleForm = customStyle.text } - this.titleForm.title = this.chart.title + if (!this.batchOptStatus) { + this.titleForm.title = this.chart.title + } } }, init() { @@ -110,15 +118,17 @@ export default { this.fontSize = arr }, changeTitleStyle() { - if (this.titleForm.title.length < 1) { - this.$error(this.$t('chart.title_cannot_empty')) - this.titleForm.title = this.chart.title - return - } - if (checkViewTitle('update', this.chart.id, this.titleForm.title)) { - this.$error(this.$t('chart.title_repeat')) - this.titleForm.title = this.chart.title - return + if (!this.batchOptStatus) { + if (this.titleForm.title.length < 1) { + this.$error(this.$t('chart.title_cannot_empty')) + this.titleForm.title = this.chart.title + return + } + if (checkViewTitle('update', this.chart.id, this.titleForm.title)) { + this.$error(this.$t('chart.title_repeat')) + this.titleForm.title = this.chart.title + return + } } if (!this.titleForm.show) { this.isSetting = false diff --git a/frontend/src/views/chart/components/component-style/TitleSelectorAntV.vue b/frontend/src/views/chart/components/component-style/TitleSelectorAntV.vue index a7cb50f3a2..6d0d320d64 100644 --- a/frontend/src/views/chart/components/component-style/TitleSelectorAntV.vue +++ b/frontend/src/views/chart/components/component-style/TitleSelectorAntV.vue @@ -6,7 +6,7 @@ {{ $t('chart.show') }}
- + import { COLOR_PANEL, DEFAULT_TITLE_STYLE } from '../../chart/chart' -import { checkTitle } from '@/api/chart/chart' import { checkViewTitle } from '@/components/canvas/utils/utils' +import { mapState } from 'vuex' export default { name: 'TitleSelectorAntV', @@ -66,6 +66,11 @@ export default { predefineColors: COLOR_PANEL } }, + computed: { + ...mapState([ + 'batchOptStatus' + ]) + }, watch: { 'chart': { handler: function() { @@ -90,7 +95,9 @@ export default { if (customStyle.text) { this.titleForm = customStyle.text } - this.titleForm.title = this.chart.title + if (!this.batchOptStatus) { + this.titleForm.title = this.chart.title + } } }, init() { @@ -104,15 +111,17 @@ export default { this.fontSize = arr }, changeTitleStyle() { - if (this.titleForm.title.length < 1) { - this.$error(this.$t('chart.title_cannot_empty')) - this.titleForm.title = this.chart.title - return - } - if (checkViewTitle('update', this.chart.id, this.titleForm.title)) { - this.$error(this.$t('chart.title_repeat')) - this.titleForm.title = this.chart.title - return + if (!this.batchOptStatus) { + if (this.titleForm.title.length < 1) { + this.$error(this.$t('chart.title_cannot_empty')) + this.titleForm.title = this.chart.title + return + } + if (checkViewTitle('update', this.chart.id, this.titleForm.title)) { + this.$error(this.$t('chart.title_repeat')) + this.titleForm.title = this.chart.title + return + } } this.$emit('onTextChange', this.titleForm) }, diff --git a/frontend/src/views/chart/view/ChartStyle.vue b/frontend/src/views/chart/view/ChartStyle.vue index 81ff79bcb3..c82b0c6b0a 100644 --- a/frontend/src/views/chart/view/ChartStyle.vue +++ b/frontend/src/views/chart/view/ChartStyle.vue @@ -12,8 +12,8 @@ style="overflow:auto;border-right: 1px solid #e6e6e6;height: 100%;width: 100%;padding-right: 6px" class="attr-style theme-border-class" > - - {{ $t('chart.style_priority') }} + + {{ $t('chart.style_priority') }} batchOptStatus-{{ batchOptStatus }} - - -
- - {{ $t('chart.style_priority') }} -
- {{ view.render }} -
- {{ view.type }} - - - {{ $t('chart.chart') }} - {{ $t('chart.dashboard') }} - - -
- - {{ $t('chart.shape_attr') }} - - - {{ 'color-selector' }} - - - - {{ 'size-selector' }} - - - - {{ 'size-selector-ant-v' }} - - - - - {{ 'label-selector' }} - - - {{ 'label-selector-ant-v' }} - - - - - - - - {{ 'tooltip-selector' }} - - - {{ 'tooltip-selector-ant-v' }} - - - - - - {{ 'total-cfg' }} - - - - - - {{ $t('chart.module_style') }} - - - - {{ 'x-axis-selector' }} - - - {{ 'x-axis-selector-ant-v' }} - - - - - - - {{ 'y-axis-selector' }} - - - {{ 'y-axis-selector-ant-v' }} - - - - - - - - {{ 'y-axis-ext-selector' }} - - - {{ 'y-axis-ext-selector-ant-v' }} - - - - - - - - {{ 'split-selector' }} - - - {{ 'split-selector-ant-v' }} - - - - - - - {{ 'title-selector' }} - - - {{ 'title-selector-ant-v' }} - - - - - - - {{ 'legend-selector' }} - - - {{ 'legend-selector-ant-v' }} - - - - - - - {{ background-color-selector }} - - - - -
-
- - - -