fix 场景步骤删除后,右边的页面没有清空

This commit is contained in:
2025-06-13 15:09:59 +08:00
parent 7161354894
commit 614aa05b42
2 changed files with 25 additions and 1 deletions

View File

@@ -163,7 +163,6 @@ export default {
}
}).catch(err => {
loading.close();
this.$modal.msgError("执行失败");
});
},
// 分页

View File

@@ -150,6 +150,31 @@ export default {
deleteStep(index) {
this.$modal.confirm('确认删除该步骤' + '').then(() => {
this.informationForm.uiSceneStepsVOList.splice(index, 1);
// 如果删除后没有步骤了,清空右侧面板
if (this.informationForm.uiSceneStepsVOList.length === 0) {
this.defaultActive = 0;
this.changeStep = { operateType: null };
return;
}
// 如果删除的是当前选中的步骤
if (this.defaultActive - 1 === index) {
// 如果有下一个步骤,选择下一个
if (index < this.informationForm.uiSceneStepsVOList.length) {
this.defaultActive = index + 1;
this.changeStep = this.informationForm.uiSceneStepsVOList[index];
}
// 如果有上一个步骤,选择上一个
else if (index > 0) {
this.defaultActive = index;
this.changeStep = this.informationForm.uiSceneStepsVOList[index - 1];
}
}
// 如果删除的步骤在当前选中步骤之前需要更新defaultActive
else if (this.defaultActive - 1 > index) {
this.defaultActive--;
}
}).catch(() => { })
},
// 场景步骤