运行图代码调整

This commit is contained in:
joylink_cuiweidong 2020-10-21 16:12:19 +08:00
parent 103c306313
commit 14f54eeb85
2 changed files with 39 additions and 28 deletions

View File

@ -253,20 +253,18 @@ export function getRoutingBySDTNumber(params) {
} }
/** 修改计划号*/ /** 修改计划号*/
export function updateServiceNumber(planId, serviceNumber, data) { export function updateServiceNumber(planId, serviceNumber, newServiceNumber) {
return request({ return request({
url: `/api/runPlan/draft/${planId}/service/${serviceNumber}/serviceNumber`, url: `/api/runPlan/draft/${planId}/service/${serviceNumber}/serviceNumber?newServiceNumber=${newServiceNumber}`,
method: 'put', method: 'put'
data: data
}); });
} }
/** 修改任务车次号*/ /** 修改任务车次号*/
export function updateTripNumber(planId, SDTNumber, data) { export function updateTripNumber(planId, SDTNumber, tripNumber) {
return request({ return request({
url: `/api/runPlan/draft/${planId}/trip/${SDTNumber}/tripNumber`, url: `/api/runPlan/draft/${planId}/trip/${SDTNumber}/tripNumber?tripNumber=${tripNumber}`,
method: 'put', method: 'put'
data: data
}); });
} }

View File

@ -14,13 +14,13 @@
<div v-if="isModifyServiceNumber"> <div v-if="isModifyServiceNumber">
<div class="ModifyServiceName">计划号:</div> <div class="ModifyServiceName">计划号:</div>
<div class="ModifyServiceInput"> <div class="ModifyServiceInput">
<el-input-number v-model="serviceNumber" type="text" :style="{width: '80%'}" :minlength="2" :maxlength="3" :controls="false" /> <el-input v-model="serviceNumber" type="text" :style="{width: '80%'}" :minlength="2" :maxlength="3" />
</div> </div>
</div> </div>
<div v-else> <div v-else>
<div class="ModifyServiceName">车次号:</div> <div class="ModifyServiceName">车次号:</div>
<div class="ModifyServiceInput"> <div class="ModifyServiceInput">
<el-input-number v-model="tripNumber" type="text" :style="{width: '80%'}" :maxlength="80" :controls="false" /> <el-input v-model="tripNumber" type="text" :style="{width: '80%'}" :maxlength="10" />
</div> </div>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -51,10 +51,12 @@ export default {
this.oldTripNumber = data.tripNumber; this.oldTripNumber = data.tripNumber;
this.isModifyServiceNumber = false; this.isModifyServiceNumber = false;
this.title = '修改车次号'; this.title = '修改车次号';
// this.tripNumber = data.tripNumber;
} else { } else {
this.oldServiceNumber = data.serviceNumber; this.oldServiceNumber = data.serviceNumber;
this.isModifyServiceNumber = true; this.isModifyServiceNumber = true;
this.title = '修改计划号'; this.title = '修改计划号';
this.serviceNumber = data.serviceNumber;
} }
this.dialogShow = true; this.dialogShow = true;
}, },
@ -63,25 +65,36 @@ export default {
}, },
handleCommit() { handleCommit() {
if (this.isModifyServiceNumber) { if (this.isModifyServiceNumber) {
// const result = /^\d{2,}$/.test(this.serviceNumber);
const model = {newServiceNumber:this.serviceNumber}; if (this.serviceNumber && result) {
updateServiceNumber(this.$route.query.planId, this.oldServiceNumber, model).then(res=>{ updateServiceNumber(this.$route.query.planId, this.oldServiceNumber, this.serviceNumber).then(res=>{
this.$message.success('修改计划号成功'); this.$message.success('修改计划号成功');
// this.$emit('refresh'); // this.$emit('refresh');
this.$store.dispatch('runPlan/refresh'); this.dialogShow = false;
}).catch(()=>{ this.$store.dispatch('runPlan/refresh');
this.$message.error('修改计划号失败'); }).catch(()=>{
}); this.$message.error('修改计划号失败');
});
} else {
this.$message.error('请输入正确的计划号(两位以上数字)');
}
} else { } else {
const model = {tripNumber:this.tripNumber}; const result = /^\d{2,}$/.test(this.tripNumber);
const SDTNumber = this.oldServiceNumber + this.oldTripNumber; if (this.tripNumber && result) {
updateTripNumber(this.$route.query.planId, SDTNumber, model).then(res=>{ const SDTNumber = this.oldServiceNumber + this.oldTripNumber;
this.$message.success('修改车次号成功'); updateTripNumber(this.$route.query.planId, SDTNumber, this.tripNumber).then(res=>{
// this.$emit('refresh'); this.$message.success('修改车次号成功');
this.$store.dispatch('runPlan/refresh'); // this.$emit('refresh');
}).catch(()=>{ this.dialogShow = false;
this.$message.error('修改车次号失败'); this.$store.dispatch('runPlan/refresh');
}); }).catch(()=>{
this.$message.error('修改车次号失败');
});
} else {
this.$message.error('请输入正确的车次号(两位以上数字)');
}
} }
} }
} }