forked from github/dataease
refactor(视图-批量操作): 优化批量操作逻辑
批量操作时将第一个添加的视图或最后一个视图的属性作为默认属性 https://www.tapd.cn/55578866/bugtrace/bugs/view/1155578866001019214
This commit is contained in:
parent
957fc2896a
commit
10dd44d3ce
@ -552,12 +552,22 @@ export default {
|
|||||||
sourceCustomAttr[param.property][param.value.modifyName] = param.value[param.value.modifyName]
|
sourceCustomAttr[param.property][param.value.modifyName] = param.value[param.value.modifyName]
|
||||||
this.sourceCustomAttrStr = JSON.stringify(sourceCustomAttr)
|
this.sourceCustomAttrStr = JSON.stringify(sourceCustomAttr)
|
||||||
this.chart.customAttr = this.sourceCustomAttrStr
|
this.chart.customAttr = this.sourceCustomAttrStr
|
||||||
|
this.$store.commit('updateComponentViewsData', {
|
||||||
|
viewId: this.chart.id,
|
||||||
|
propertyKey: 'customAttr',
|
||||||
|
propertyValue: this.sourceCustomAttrStr
|
||||||
|
})
|
||||||
updateParams['customAttr'] = this.sourceCustomAttrStr
|
updateParams['customAttr'] = this.sourceCustomAttrStr
|
||||||
} else if (param.custom === 'customStyle') {
|
} else if (param.custom === 'customStyle') {
|
||||||
const sourceCustomStyle = JSON.parse(this.sourceCustomStyleStr)
|
const sourceCustomStyle = JSON.parse(this.sourceCustomStyleStr)
|
||||||
sourceCustomStyle[param.property][param.value.modifyName] = param.value[param.value.modifyName]
|
sourceCustomStyle[param.property][param.value.modifyName] = param.value[param.value.modifyName]
|
||||||
this.sourceCustomStyleStr = JSON.stringify(sourceCustomStyle)
|
this.sourceCustomStyleStr = JSON.stringify(sourceCustomStyle)
|
||||||
this.chart.customStyle = this.sourceCustomStyleStr
|
this.chart.customStyle = this.sourceCustomStyleStr
|
||||||
|
this.$store.commit('updateComponentViewsData', {
|
||||||
|
viewId: this.chart.id,
|
||||||
|
propertyKey: 'customStyle',
|
||||||
|
propertyValue: this.sourceCustomStyleStr
|
||||||
|
})
|
||||||
updateParams['customStyle'] = this.sourceCustomStyleStr
|
updateParams['customStyle'] = this.sourceCustomStyleStr
|
||||||
}
|
}
|
||||||
viewPropsSave(this.panelInfo.id, updateParams).then(rsp => {
|
viewPropsSave(this.panelInfo.id, updateParams).then(rsp => {
|
||||||
|
@ -597,10 +597,22 @@ const data = {
|
|||||||
if (element === id) {
|
if (element === id) {
|
||||||
delete state.batchOptViews[id]
|
delete state.batchOptViews[id]
|
||||||
state.curBatchOptComponents.splice(index, 1)
|
state.curBatchOptComponents.splice(index, 1)
|
||||||
this.commit('setBatchOptChartInfo')
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (state.curBatchOptComponents.length === 1) {
|
||||||
|
const lastViewId = state.curBatchOptComponents[0]
|
||||||
|
const viewBaseInfo = state.componentViewsData[lastViewId]
|
||||||
|
state.changeProperties.customAttr = JSON.parse(viewBaseInfo.customAttr)
|
||||||
|
state.changeProperties.customStyle = JSON.parse(viewBaseInfo.customStyle)
|
||||||
|
}
|
||||||
|
if (state.curBatchOptComponents.length === 0) {
|
||||||
|
state.changeProperties = {
|
||||||
|
customStyle: {},
|
||||||
|
customAttr: {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.commit('setBatchOptChartInfo')
|
||||||
},
|
},
|
||||||
addCurBatchComponent(state, id) {
|
addCurBatchComponent(state, id) {
|
||||||
if (id) {
|
if (id) {
|
||||||
@ -610,11 +622,18 @@ const data = {
|
|||||||
// get properties
|
// get properties
|
||||||
const viewConfig = state.allViewRender.filter(item => item.render === viewBaseInfo.render && item.value === viewBaseInfo.type)
|
const viewConfig = state.allViewRender.filter(item => item.render === viewBaseInfo.render && item.value === viewBaseInfo.type)
|
||||||
if (viewConfig && viewConfig.length > 0) {
|
if (viewConfig && viewConfig.length > 0) {
|
||||||
|
if (state.curBatchOptComponents.length === 1) {
|
||||||
|
state.changeProperties.customAttr = JSON.parse(viewBaseInfo.customAttr)
|
||||||
|
state.changeProperties.customStyle = JSON.parse(viewBaseInfo.customStyle)
|
||||||
|
}
|
||||||
state.batchOptViews[id] = viewConfig[0]
|
state.batchOptViews[id] = viewConfig[0]
|
||||||
this.commit('setBatchOptChartInfo')
|
this.commit('setBatchOptChartInfo')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
updateComponentViewsData(state, { viewId, propertyKey, propertyValue }) {
|
||||||
|
state.componentViewsData[viewId][propertyKey] = propertyValue
|
||||||
|
},
|
||||||
removeCurMultiplexingComponentWithId(state, id) {
|
removeCurMultiplexingComponentWithId(state, id) {
|
||||||
delete state.curMultiplexingComponents[id]
|
delete state.curMultiplexingComponents[id]
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user