Merge pull request #5292 from dataease/pr@dev@fix_panel-filter

fix(仪表板): 修复仪表板复用组件,位置属性与目标仪表板设置不一致问题
This commit is contained in:
王嘉豪 2023-05-23 20:30:28 +08:00 committed by GitHub
commit cb9e54d9d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -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) {

View File

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