运行图代码调整

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({
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'
});
}

View File

@ -14,13 +14,13 @@
<div v-if="isModifyServiceNumber">
<div class="ModifyServiceName">计划号:</div>
<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 v-else>
<div class="ModifyServiceName">车次号:</div>
<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>
<span slot="footer" class="dialog-footer">
@ -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('请输入正确的车次号(两位以上数字)');
}
}
}
}