修复:调整延时解锁创建校验规则(仅当延续保护线路存在时,进行解锁区段解锁时间校验,否则直接放弃创建或删除延续保护)

This commit is contained in:
fan 2019-12-23 13:32:11 +08:00
parent 065a3ba72e
commit 663d43c5d2

View File

@ -277,40 +277,40 @@ export default {
this.createProtect('saveProtectSuccess'); this.createProtect('saveProtectSuccess');
}, },
update() { update() {
if (this.addModel.code && this.addModel.unlockSectionCode && this.addModel.relSectionSwitchList.length) { if (this.addModel.code && this.addModel.unlockSectionCode && this.addModel.relSectionSwitchList.length && this.addModel.unlockTime) {
const model = this.buildModel(); const model = this.buildModel();
putContinueProtect(model).then(resp => { putContinueProtect(model).then(resp => {
this.$emit('updateProtectSuccess', model.code); this.$emit('updateProtectSuccess', model.code);
}).catch(() => { }).catch(() => {
this.$messageBox('更新延续保护失败!'); this.$messageBox('更新延续保护失败!');
}); });
} else if (this.addModel.code && !this.addModel.unlockSectionCode && !this.addModel.relSectionSwitchList.length) { } else if (this.addModel.code && !this.addModel.relSectionSwitchList.length) {
delContinueProtect(this.addModel.id).then(resp => { delContinueProtect(this.addModel.id).then(resp => {
this.$emit('updateProtectSuccess', ''); this.$emit('updateProtectSuccess', '');
}); });
} else if (this.addModel.code && !this.addModel.unlockSectionCode && this.addModel.relSectionSwitchList.length) { } else if (this.addModel.code && !this.addModel.unlockSectionCode) {
this.$messageBox('请填写延续保护解锁区段或清除延续保护相关数据!'); this.$messageBox('请填写延续保护解锁区段或清除延续保护线路相关数据!');
} else if (this.addModel.code && this.addModel.unlockSectionCode && !this.addModel.relSectionSwitchList.length) { } else if (this.addModel.code && this.addModel.unlockTime) {
this.$messageBox('请生成延续保护线路或清除延续保护相关数据!'); this.$messageBox('请填写延续保护解锁时间或清除延续保护线路相关数据!');
} else { } else {
this.createProtect('updateProtectSuccess'); this.createProtect('updateProtectSuccess');
} }
}, },
createProtect(parentFunction) { createProtect(parentFunction) {
if (this.addModel.unlockSectionCode && this.addModel.relSectionSwitchList.length) { if (this.addModel.unlockSectionCode && this.addModel.relSectionSwitchList.length && this.addModel.unlockTime) {
const model = this.buildModel(setUID('Protect')); const model = this.buildModel(setUID('Protect'));
postContinueProtect(model).then(resp => { postContinueProtect(model).then(resp => {
this.$emit(parentFunction, model.code); this.$emit(parentFunction, model.code);
}).catch(() => { }).catch(() => {
this.$messageBox('创建延续保护失败!'); this.$messageBox('创建延续保护失败!');
}); });
} else if (!this.addModel.unlockSectionCode && !this.addModel.relSectionSwitchList.length) { } else if (!this.addModel.relSectionSwitchList.length) {
this.$emit(parentFunction, ''); this.$emit(parentFunction, '');
} else { } else {
if (!this.addModel.unlockSectionCode) { if (!this.addModel.unlockSectionCode) {
this.$messageBox('请填写延续保护解锁区段或清除延续保护相关数据!'); this.$messageBox('请填写延续保护解锁区段或清除延续保护线路相关数据!');
} else if (!this.addModel.relSectionSwitchList.length) { } else if (!this.addModel.unlockTime.length) {
this.$messageBox('请生成延续保护线路或清除延续保护相关数据!'); this.$messageBox('请填写延续保护解锁时间或清除延续保护线路相关数据!');
} }
} }
}, },