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]) } }