forked from github/dataease
Merge pull request #4134 from dataease/pr@dev@fix_tab-delete
fix(仪表板): 删除Tab画布时同时清理对应画布的组件
This commit is contained in:
commit
886b69b77b
@ -640,7 +640,7 @@ export default {
|
|||||||
while (len--) {
|
while (len--) {
|
||||||
if (this.element.options.tabList[len].name === param.name) {
|
if (this.element.options.tabList[len].name === param.name) {
|
||||||
this.element.options.tabList.splice(len, 1)
|
this.element.options.tabList.splice(len, 1)
|
||||||
|
this.$store.commit('deleteComponentsWithCanvasId', this.element.id + '-' + param.name)
|
||||||
const activeIndex = (len - 1 + this.element.options.tabList.length) % this.element.options.tabList.length
|
const activeIndex = (len - 1 + this.element.options.tabList.length) % this.element.options.tabList.length
|
||||||
this.activeTabName = this.element.options.tabList[activeIndex].name
|
this.activeTabName = this.element.options.tabList[activeIndex].name
|
||||||
}
|
}
|
||||||
|
@ -503,6 +503,9 @@ const data = {
|
|||||||
const element = state.componentData[index]
|
const element = state.componentData[index]
|
||||||
if (element.id && element.id === id) {
|
if (element.id && element.id === id) {
|
||||||
state.componentData.splice(index, 1)
|
state.componentData.splice(index, 1)
|
||||||
|
if (element.type === 'de-tabs') {
|
||||||
|
this.commit('deleteComponentsWithCanvasId', element.id)
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -811,6 +814,16 @@ const data = {
|
|||||||
state.mousePointShadowMap.mouseY = mousePoint.mouseY
|
state.mousePointShadowMap.mouseY = mousePoint.mouseY
|
||||||
state.mousePointShadowMap.width = mousePoint.width
|
state.mousePointShadowMap.width = mousePoint.width
|
||||||
state.mousePointShadowMap.height = mousePoint.height
|
state.mousePointShadowMap.height = mousePoint.height
|
||||||
|
},
|
||||||
|
deleteComponentsWithCanvasId(state, canvasId) {
|
||||||
|
if (canvasId && canvasId.length > 10) {
|
||||||
|
for (let index = 0; index < state.componentData.length; index++) {
|
||||||
|
const element = state.componentData[index]
|
||||||
|
if (element.canvasId && element.canvasId.includes(canvasId)) {
|
||||||
|
state.componentData.splice(index, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modules: {
|
modules: {
|
||||||
|
Loading…
Reference in New Issue
Block a user