diff --git a/src/views/scriptManage/conditionManage.vue b/src/views/scriptManage/conditionManage.vue index b2d3bd4a3..6ce89986d 100644 --- a/src/views/scriptManage/conditionManage.vue +++ b/src/views/scriptManage/conditionManage.vue @@ -178,7 +178,11 @@ export default { handleDelete(index, row) { const data = [...this.tableData]; data.splice(index, 1); - updateActionCondition(this.$route.query.group, this.actionId, {trainStatuses: data, delay: this.delay * 1000}).then(resp => { + const param = { trainStatuses: data }; + if (this.delay) { + param.delay = this.delay * 1000; + } + updateActionCondition(this.$route.query.group, this.actionId, param).then(resp => { this.tableData = data; this.initData(); this.$message.success('删除条件成功'); @@ -191,7 +195,11 @@ export default { if (valid) { const data = [...this.tableData]; data[this.updateIndex] = {code: this.formModel.code, physicalCode: this.formModel.physicalCode, stop: this.formModel.stop}; - updateActionCondition(this.$route.query.group, this.actionId, {trainStatuses: data, delay: this.delay * 1000}).then(resp => { + const param = { trainStatuses: data }; + if (this.delay) { + param.delay = this.delay * 1000; + } + updateActionCondition(this.$route.query.group, this.actionId, param).then(resp => { this.tableData = data; this.initData(); this.$message.success('修改条件成功'); @@ -202,7 +210,11 @@ export default { }); }, onUpdateDelay() { - updateActionCondition(this.$route.query.group, this.actionId, {trainStatuses: this.tableData, delay: this.delay * 1000}).then(resp => { + const param = { trainStatuses: this.tableData }; + if (this.delay) { + param.delay = this.delay * 1000; + } + updateActionCondition(this.$route.query.group, this.actionId, param).then(resp => { this.initData(); this.$message.success('修改条件成功'); }).catch(()=>{ @@ -210,11 +222,6 @@ export default { }); }, initData() { - // this.formModel = { - // code: '', - // physicalCode: '', - // stop: '' - // }; this.update = false; this.updateIndex = ''; this.$refs.form && this.$refs.form.resetFields(); @@ -224,7 +231,11 @@ export default { if (valid) { const data = [...this.tableData]; data.push({code: this.formModel.code, physicalCode: this.formModel.physicalCode, stop: this.formModel.stop}); - updateActionCondition(this.$route.query.group, this.actionId, {trainStatuses: data, delay: this.delay * 1000}).then(resp => { + const param = { trainStatuses: data }; + if (this.delay) { + param.delay = this.delay * 1000; + } + updateActionCondition(this.$route.query.group, this.actionId, param).then(resp => { this.tableData = data; this.initData(); this.$message.success('添加条件成功');