diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index 39268cf1c8..393dd0f0f5 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -206,7 +206,6 @@ export default { changeIndex: 0, changeScaleIndex: 0, pre: null, - preCanvasPanel: null, // string sourceCustomAttrStr: null, // obj @@ -315,6 +314,9 @@ export default { resultCount() { return this.canvasStyleData.panel && this.canvasStyleData.panel.resultCount || null }, + gap() { + return this.canvasStyleData.panel && this.canvasStyleData.panel.gap || null + }, innerPadding() { return this.element.commonBackground && this.element.commonBackground.innerPadding || 0 }, @@ -353,21 +355,14 @@ export default { }, deep: true }, - // deep监听panel 如果改变 提交到 store - canvasStyleData: { - handler(newVal, oldVla) { - // this.mergeStyle() - // 如果视图结果模式模式 或者 视图结果获取数量改变 刷新视图 - if (!this.preCanvasPanel || this.preCanvasPanel.resultCount !== newVal.panel.resultCount || this.preCanvasPanel.resultMode !== newVal.panel.resultMode) { - this.getData(this.element.propValue.viewId, false) - } - // 如果gap有变化刷新 - if (this.preCanvasPanel && this.preCanvasPanel.gap !== newVal.panel.gap) { - this.resizeChart() - } - this.preCanvasPanel = deepCopy(newVal.panel) - }, - deep: true + resultCount: function() { + this.getData(this.element.propValue.viewId, false) + }, + resultMode: function() { + this.getData(this.element.propValue.viewId, false) + }, + gap: function() { + this.resizeChart() }, // 监听外部的样式变化 (非实时性要求) 'hw': { diff --git a/frontend/src/components/canvas/utils/style.js b/frontend/src/components/canvas/utils/style.js index 7aaf7cc246..88e7defa3e 100644 --- a/frontend/src/components/canvas/utils/style.js +++ b/frontend/src/components/canvas/utils/style.js @@ -344,7 +344,7 @@ export function adaptCurThemeCommonStyle(component) { } if (isFilterComponent(component.component)) { const filterStyle = store.state.canvasStyleData.chartInfo.filterStyle - for (const styleKey in component.style) { + for (const styleKey in filterStyle) { component.style[styleKey] = filterStyle[styleKey] } } @@ -366,6 +366,7 @@ export function adaptCurThemeFilterStyleAll(styleKey) { item.style[styleKey] = filterStyle[styleKey] } }) + console.log('componentData=' + JSON.stringify(componentData)) } export function isFilterComponent(component) { diff --git a/frontend/src/components/canvas/utils/utils.js b/frontend/src/components/canvas/utils/utils.js index 71bf73e6e8..97a233fbf1 100644 --- a/frontend/src/components/canvas/utils/utils.js +++ b/frontend/src/components/canvas/utils/utils.js @@ -8,7 +8,7 @@ import { } from '@/utils/ApplicationContext' import { uuid } from 'vue-uuid' import store from '@/store' -import { AIDED_DESIGN, FILTER_COMMON_STYLE, PANEL_CHART_INFO } from '@/views/panel/panel' +import { AIDED_DESIGN, PANEL_CHART_INFO } from '@/views/panel/panel' import html2canvas from 'html2canvasde' export function deepCopy(target) { diff --git a/frontend/src/views/panel/SubjectSetting/PanelStyle/ComponentStyle.vue b/frontend/src/views/panel/SubjectSetting/PanelStyle/ComponentStyle.vue index a5c6413ed4..c9120b89b0 100644 --- a/frontend/src/views/panel/SubjectSetting/PanelStyle/ComponentStyle.vue +++ b/frontend/src/views/panel/SubjectSetting/PanelStyle/ComponentStyle.vue @@ -25,6 +25,7 @@ import { mapState } from 'vuex' import { COLOR_PANEL } from '@/views/chart/chart/chart' +import bus from '@/utils/bus' export default { name: 'ComponentStyle', data() { @@ -37,10 +38,11 @@ export default { 'canvasStyleData', 'componentData' ]), - watch: { - }, created() { this.initForm() + bus.$on('onThemeColorChange', () => { + this.initForm() + }) }, methods: { initForm() { diff --git a/frontend/src/views/panel/SubjectSetting/PanelStyle/FilterStyleSelector.vue b/frontend/src/views/panel/SubjectSetting/PanelStyle/FilterStyleSelector.vue index 9715d0340d..ece0914936 100644 --- a/frontend/src/views/panel/SubjectSetting/PanelStyle/FilterStyleSelector.vue +++ b/frontend/src/views/panel/SubjectSetting/PanelStyle/FilterStyleSelector.vue @@ -6,14 +6,14 @@ {{ $t('chart.text_pos_left') }} - {{ $t('chart.text_pos_center') }} + {{ $t('chart.text_pos_center') }} {{ $t('chart.text_pos_right') }} {{ $t('chart.text_pos_top') }} - {{ $t('chart.text_pos_center') }} + {{ $t('chart.text_pos_center') }} @@ -25,19 +25,19 @@ 边框 - + 文字 - + 背景 - + @@ -50,6 +50,7 @@ import { COLOR_PANEL } from '@/views/chart/chart/chart' import { adaptCurThemeFilterStyleAll } from '@/components/canvas/utils/style' import { mapState } from 'vuex' +import bus from '@/utils/bus' export default { name: 'FilterStyleSelector', @@ -68,10 +69,13 @@ export default { 'canvasStyleData' ]) }, - watch: { + created() { + this.initForm() + bus.$on('onThemeColorChange', () => { + this.initForm() + }) }, mounted() { - this.initForm() }, methods: { initForm() { diff --git a/frontend/src/views/panel/SubjectSetting/PanelStyle/OverallSetting.vue b/frontend/src/views/panel/SubjectSetting/PanelStyle/OverallSetting.vue index 6d2e690fdc..694edac30b 100644 --- a/frontend/src/views/panel/SubjectSetting/PanelStyle/OverallSetting.vue +++ b/frontend/src/views/panel/SubjectSetting/PanelStyle/OverallSetting.vue @@ -16,7 +16,7 @@ - + @@ -67,6 +67,8 @@ import { import bus from '@/utils/bus' import { DEFAULT_COLOR_CASE_DARK, DEFAULT_TITLE_STYLE_DARK, DEFAULT_COLOR_CASE, DEFAULT_TITLE_STYLE } from '@/views/chart/chart/chart' import { FILTER_COMMON_STYLE, FILTER_COMMON_STYLE_DARK } from '@/views/panel/panel' +import { deepCopy } from '@/components/canvas/utils/utils' + export default { name: 'OverallSetting', data() { @@ -95,17 +97,17 @@ export default { this.canvasStyleData.chartInfo.chartCommonStyle.backgroundColorSelect = true this.canvasStyleData.panel.backgroundType = 'color' if (this.overallSettingForm.panel.themeColor === 'light') { - this.canvasStyleData.panel.color = LIGHT_THEME_PANEL_BACKGROUND - this.canvasStyleData.chartInfo.chartCommonStyle.color = LIGHT_THEME_COMPONENT_BACKGROUND - this.canvasStyleData.chartInfo.chartTitle = DEFAULT_TITLE_STYLE - this.canvasStyleData.chartInfo.chartColor = DEFAULT_COLOR_CASE - this.canvasStyleData.chartInfo.filterStyle = FILTER_COMMON_STYLE + this.canvasStyleData.panel.color = deepCopy(LIGHT_THEME_PANEL_BACKGROUND) + this.canvasStyleData.chartInfo.chartCommonStyle.color = deepCopy(LIGHT_THEME_COMPONENT_BACKGROUND) + this.canvasStyleData.chartInfo.chartTitle = deepCopy(DEFAULT_TITLE_STYLE) + this.canvasStyleData.chartInfo.chartColor = deepCopy(DEFAULT_COLOR_CASE) + this.canvasStyleData.chartInfo.filterStyle = deepCopy(FILTER_COMMON_STYLE) } else { - this.canvasStyleData.panel.color = DARK_THEME_PANEL_BACKGROUND - this.canvasStyleData.chartInfo.chartCommonStyle.color = DARK_THEME_COMPONENT_BACKGROUND - this.canvasStyleData.chartInfo.chartTitle = DEFAULT_TITLE_STYLE_DARK - this.canvasStyleData.chartInfo.chartColor = DEFAULT_COLOR_CASE_DARK - this.canvasStyleData.chartInfo.filterStyle = FILTER_COMMON_STYLE_DARK + this.canvasStyleData.panel.color = deepCopy(DARK_THEME_PANEL_BACKGROUND) + this.canvasStyleData.chartInfo.chartCommonStyle.color = deepCopy(DARK_THEME_COMPONENT_BACKGROUND) + this.canvasStyleData.chartInfo.chartTitle = deepCopy(DEFAULT_TITLE_STYLE_DARK) + this.canvasStyleData.chartInfo.chartColor = deepCopy(DEFAULT_COLOR_CASE_DARK) + this.canvasStyleData.chartInfo.filterStyle = deepCopy(FILTER_COMMON_STYLE_DARK) } adaptCurThemeCommonStyleAll() bus.$emit('onThemeColorChange') @@ -127,9 +129,12 @@ export default { } .el-input-refresh-loading{ - margin-left: 5px; + margin-left: 4px; font-size: 12px; } +.margin-left4{ + margin-left: 4px; +} ::v-deep .el-input__inner{ padding: 0px 5px!important; } diff --git a/frontend/src/views/panel/SubjectSetting/PanelStyle/PanelColorSelector.vue b/frontend/src/views/panel/SubjectSetting/PanelStyle/PanelColorSelector.vue index c6dfb85dfd..c6f3ea228e 100644 --- a/frontend/src/views/panel/SubjectSetting/PanelStyle/PanelColorSelector.vue +++ b/frontend/src/views/panel/SubjectSetting/PanelStyle/PanelColorSelector.vue @@ -82,6 +82,7 @@ - - diff --git a/frontend/src/views/panel/SubjectSetting/PanelStyle/PanelViewResult.vue b/frontend/src/views/panel/SubjectSetting/PanelStyle/PanelViewResult.vue deleted file mode 100644 index 076aa90d20..0000000000 --- a/frontend/src/views/panel/SubjectSetting/PanelStyle/PanelViewResult.vue +++ /dev/null @@ -1,135 +0,0 @@ - - - - - diff --git a/frontend/src/views/panel/SubjectSetting/PanelStyle/ViewTitle.vue b/frontend/src/views/panel/SubjectSetting/PanelStyle/ViewTitle.vue index 866f680c50..1df809ffae 100644 --- a/frontend/src/views/panel/SubjectSetting/PanelStyle/ViewTitle.vue +++ b/frontend/src/views/panel/SubjectSetting/PanelStyle/ViewTitle.vue @@ -39,7 +39,9 @@