From c8986b3a4e750a39ae7d80c05e5d5e77b5efe143 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Tue, 26 Jan 2021 11:25:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E8=A1=8C=E5=9B=BE=20=E7=BB=98?= =?UTF-8?q?=E5=9B=BE=20=E7=94=9F=E6=88=90=E8=AE=A1=E5=88=92=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=AE=A1=E5=88=92=20=E4=BB=A3=E7=A0=81=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editTool/menus/addPlanningTrain.vue | 6 +++-- .../editTool/menus/gernaratePlanTrain.vue | 26 +++++++++++++++---- .../newEditTool/menus/addPlanningTrain.vue | 6 +++-- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/views/planMonitor/editTool/menus/addPlanningTrain.vue b/src/views/planMonitor/editTool/menus/addPlanningTrain.vue index 2abf77187..b532d7a5d 100644 --- a/src/views/planMonitor/editTool/menus/addPlanningTrain.vue +++ b/src/views/planMonitor/editTool/menus/addPlanningTrain.vue @@ -71,7 +71,8 @@ export default { } else { const serviceNumberList = Object.keys(this.$store.state.runPlan.editData); if (serviceNumberList.includes(value)) { - return callback(new Error('该服务号已存在')); + // new Error('该服务号已存在') + return callback(); } else { return callback(); } @@ -91,7 +92,8 @@ export default { this.formModel.serviceNumber = newValue; const serviceNumberList = Object.keys(this.$store.state.runPlan.editData); if (serviceNumberList.includes(value)) { - return callback(new Error('该服务号已存在')); + // new Error('该服务号已存在') + return callback(); } else { return callback(); } diff --git a/src/views/planMonitor/editTool/menus/gernaratePlanTrain.vue b/src/views/planMonitor/editTool/menus/gernaratePlanTrain.vue index 4e287186f..3b790f25b 100644 --- a/src/views/planMonitor/editTool/menus/gernaratePlanTrain.vue +++ b/src/views/planMonitor/editTool/menus/gernaratePlanTrain.vue @@ -59,7 +59,8 @@ export default { rules: { serviceNumber:[ {required: true, validator: this.validateServiceNumber, trigger: 'blur'}, - {required: true, validator: this.validateServiceNumber, trigger: 'change'} + // {required: true, validator: this.validateServiceNumber, trigger: 'change'} + {required: true, validator: this.validateServiceNo, trigger: 'change'} ], beginTime: [ { required: true, message: '请填写开始时间', trigger: 'blur' } @@ -138,14 +139,17 @@ export default { if (typeof value == 'string' && value.trim().length == 0) { return callback(new Error('请填写服务号')); } else { - const newValue = parseInt(value); + let newValue = parseInt(value); if (newValue) { - if (newValue.toString() != value) { - this.formModel.serviceNumber = newValue; + if (newValue > 0 & newValue < 9) { + newValue = '00' + newValue; + } else if (newValue > 10 & newValue < 99) { + newValue = '0' + newValue; } + this.formModel.serviceNumber = newValue; const serviceNumberList = Object.keys(this.$store.state.runPlan.editData); if (serviceNumberList.includes(value)) { - return callback(new Error('该服务号已存在,请重新填写')); + return callback(new Error('该服务号已存在')); } else { return callback(); } @@ -155,6 +159,18 @@ export default { } }, + validateServiceNo(rule, value, callback) { + if (typeof value == 'string' && value.trim().length == 0) { + return callback(new Error('请填写服务号')); + } else { + const serviceNumberList = Object.keys(this.$store.state.runPlan.editData); + if (serviceNumberList.includes(value)) { + return callback(new Error('该服务号已存在')); + } else { + return callback(); + } + } + }, validateRunningRouting(rule, value, callback) { if (value.trim().length == 0) { return callback(new Error('请选择环路')); diff --git a/src/views/planMonitor/newEditTool/menus/addPlanningTrain.vue b/src/views/planMonitor/newEditTool/menus/addPlanningTrain.vue index 6c362121f..6c40c368e 100644 --- a/src/views/planMonitor/newEditTool/menus/addPlanningTrain.vue +++ b/src/views/planMonitor/newEditTool/menus/addPlanningTrain.vue @@ -77,7 +77,8 @@ export default { } else { const serviceNumberList = Object.keys(this.$store.state.runPlan.editData); if (serviceNumberList.includes(value)) { - return callback(new Error('该服务号已存在')); + // new Error('该服务号已存在'); + return callback(); } else { return callback(); } @@ -97,7 +98,8 @@ export default { this.formModel.serviceNumber = newValue; const serviceNumberList = Object.keys(this.$store.state.runPlan.editData); if (serviceNumberList.includes(value)) { - return callback(new Error('该服务号已存在')); + // new Error('该服务号已存在') + return callback(); } else { return callback(); }