diff --git a/src/api/runplan.js b/src/api/runplan.js index 2c2fe6248..c5fe586f0 100644 --- a/src/api/runplan.js +++ b/src/api/runplan.js @@ -253,20 +253,18 @@ export function getRoutingBySDTNumber(params) { } /** 修改计划号*/ -export function updateServiceNumber(planId, serviceNumber, data) { +export function updateServiceNumber(planId, serviceNumber, newServiceNumber) { return request({ - url: `/api/runPlan/draft/${planId}/service/${serviceNumber}/serviceNumber`, - method: 'put', - data: data + url: `/api/runPlan/draft/${planId}/service/${serviceNumber}/serviceNumber?newServiceNumber=${newServiceNumber}`, + method: 'put' }); } /** 修改任务车次号*/ -export function updateTripNumber(planId, SDTNumber, data) { +export function updateTripNumber(planId, SDTNumber, tripNumber) { return request({ - url: `/api/runPlan/draft/${planId}/trip/${SDTNumber}/tripNumber`, - method: 'put', - data: data + url: `/api/runPlan/draft/${planId}/trip/${SDTNumber}/tripNumber?tripNumber=${tripNumber}`, + method: 'put' }); } diff --git a/src/views/planMonitor/editTool/menus/modifyService.vue b/src/views/planMonitor/editTool/menus/modifyService.vue index a9534557f..c3a040a33 100644 --- a/src/views/planMonitor/editTool/menus/modifyService.vue +++ b/src/views/planMonitor/editTool/menus/modifyService.vue @@ -14,13 +14,13 @@
计划号:
- +
车次号:
- +
@@ -51,10 +51,12 @@ export default { this.oldTripNumber = data.tripNumber; this.isModifyServiceNumber = false; this.title = '修改车次号'; + // this.tripNumber = data.tripNumber; } else { this.oldServiceNumber = data.serviceNumber; this.isModifyServiceNumber = true; this.title = '修改计划号'; + this.serviceNumber = data.serviceNumber; } this.dialogShow = true; }, @@ -63,25 +65,36 @@ export default { }, handleCommit() { if (this.isModifyServiceNumber) { - // - const model = {newServiceNumber:this.serviceNumber}; - updateServiceNumber(this.$route.query.planId, this.oldServiceNumber, model).then(res=>{ - this.$message.success('修改计划号成功'); - // this.$emit('refresh'); - this.$store.dispatch('runPlan/refresh'); - }).catch(()=>{ - this.$message.error('修改计划号失败'); - }); + const result = /^\d{2,}$/.test(this.serviceNumber); + if (this.serviceNumber && result) { + updateServiceNumber(this.$route.query.planId, this.oldServiceNumber, this.serviceNumber).then(res=>{ + this.$message.success('修改计划号成功'); + // this.$emit('refresh'); + this.dialogShow = false; + this.$store.dispatch('runPlan/refresh'); + }).catch(()=>{ + this.$message.error('修改计划号失败'); + }); + } else { + this.$message.error('请输入正确的计划号(两位以上数字)'); + } + } else { - const model = {tripNumber:this.tripNumber}; - const SDTNumber = this.oldServiceNumber + this.oldTripNumber; - updateTripNumber(this.$route.query.planId, SDTNumber, model).then(res=>{ - this.$message.success('修改车次号成功'); - // this.$emit('refresh'); - this.$store.dispatch('runPlan/refresh'); - }).catch(()=>{ - this.$message.error('修改车次号失败'); - }); + const result = /^\d{2,}$/.test(this.tripNumber); + if (this.tripNumber && result) { + const SDTNumber = this.oldServiceNumber + this.oldTripNumber; + updateTripNumber(this.$route.query.planId, SDTNumber, this.tripNumber).then(res=>{ + this.$message.success('修改车次号成功'); + // this.$emit('refresh'); + this.dialogShow = false; + this.$store.dispatch('runPlan/refresh'); + }).catch(()=>{ + this.$message.error('修改车次号失败'); + }); + } else { + this.$message.error('请输入正确的车次号(两位以上数字)'); + } + } } }