fix 场景步骤删除后,右边的页面没有清空
This commit is contained in:
@@ -163,7 +163,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
loading.close();
|
loading.close();
|
||||||
this.$modal.msgError("执行失败");
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 分页
|
// 分页
|
||||||
|
|||||||
@@ -150,6 +150,31 @@ export default {
|
|||||||
deleteStep(index) {
|
deleteStep(index) {
|
||||||
this.$modal.confirm('确认删除该步骤' + '?').then(() => {
|
this.$modal.confirm('确认删除该步骤' + '?').then(() => {
|
||||||
this.informationForm.uiSceneStepsVOList.splice(index, 1);
|
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(() => { })
|
}).catch(() => { })
|
||||||
},
|
},
|
||||||
// 场景步骤
|
// 场景步骤
|
||||||
|
|||||||
Reference in New Issue
Block a user