From bd2b587d47b3a17392246f2b691ef01859ae9ea7 Mon Sep 17 00:00:00 2001 From: Wangjiahao <1522128093@qq.com> Date: Tue, 23 May 2023 20:29:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BB=AA=E8=A1=A8=E6=9D=BF=E5=A4=8D=E7=94=A8=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E4=BD=8D=E7=BD=AE=E5=B1=9E=E6=80=A7=E4=B8=8E?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E4=BB=AA=E8=A1=A8=E6=9D=BF=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4=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/store/copy.js | 4 ++-- frontend/src/components/canvas/utils/style.js | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/canvas/store/copy.js b/frontend/src/components/canvas/store/copy.js index 08c8bef204..bdeadc74bf 100644 --- a/frontend/src/components/canvas/store/copy.js +++ b/frontend/src/components/canvas/store/copy.js @@ -150,13 +150,13 @@ export default { } }) chartBatchCopy({ 'sourceAndTargetIds': sourceAndTargetIds }, state.panel.panelInfo.id).then((rsp) => { - needAdaptor && adaptCurThemeCommonStyle(newCop) + needAdaptor && adaptCurThemeCommonStyle(newCop,'copy') store.commit('addComponent', { component: newCop }) }) } else { const newCop = deepCopy(data) newCop.id = uuid.v1() - needAdaptor && adaptCurThemeCommonStyle(newCop) + needAdaptor && adaptCurThemeCommonStyle(newCop,'copy') store.commit('addComponent', { component: newCop }) } if (state.isCut) { diff --git a/frontend/src/components/canvas/utils/style.js b/frontend/src/components/canvas/utils/style.js index 84d3f7c5b4..1d1ac320e8 100644 --- a/frontend/src/components/canvas/utils/style.js +++ b/frontend/src/components/canvas/utils/style.js @@ -375,7 +375,7 @@ export function adaptCurTheme(customStyle, customAttr, chartType) { } } -export function adaptCurThemeCommonStyle(component) { +export function adaptCurThemeCommonStyle(component,adaptFrom = 'them') { const commonStyle = store.state.canvasStyleData.chartInfo.chartCommonStyle for (const key in commonStyle) { Vue.set(component.commonBackground, key, commonStyle[key]) @@ -383,8 +383,10 @@ export function adaptCurThemeCommonStyle(component) { if (isFilterComponent(component.component)) { const filterStyle = store.state.canvasStyleData.chartInfo.filterStyle for (const styleKey in filterStyle) { - // 位置属性不修改 - if (styleKey !== 'horizontal' && styleKey !== 'vertical') { + if(adaptFrom === 'copy'){ + Vue.set(component.style, styleKey, filterStyle[styleKey]) + }else if (adaptFrom === 'them' && styleKey !== 'horizontal' && styleKey !== 'vertical') { + // 主题变化位置属性不修改 Vue.set(component.style, styleKey, filterStyle[styleKey]) } }