运行图添加 修改计划号 和 修改任务车次号

This commit is contained in:
joylink_cuiweidong 2020-10-21 14:03:25 +08:00
parent 181a1491da
commit cc196d9696
5 changed files with 147 additions and 3 deletions

View File

@ -252,6 +252,24 @@ export function getRoutingBySDTNumber(params) {
});
}
/** 修改计划号*/
export function updateServiceNumber(planId, serviceNumber, data) {
return request({
url: `/api/runPlan/draft/${planId}/service/${serviceNumber}/serviceNumber`,
method: 'put',
data: data
});
}
/** 修改任务车次号*/
export function updateTripNumber(planId, SDTNumber, data) {
return request({
url: `/api/runPlan/draft/${planId}/trip/${SDTNumber}/tripNumber`,
method: 'put',
data: data
});
}
/** 运行图仿真测试*/
export function runPlanNotify({ planId }) {
return request({

View File

@ -215,7 +215,6 @@ export default {
},
methods: {
loadInitData(params) {
debugger;
this.isPlan = params.isPlan;
// this.addModel.taskIndex = getUID('task_');
this.addModel.serviceNumber = params.serviceNumber;
@ -392,7 +391,6 @@ export default {
this.addModel.routingCode = row.code;
},
handleCommit() {
debugger;
if (this.isPlan) {
//
this.$emit('dispatchOperate', { dialogName: 'editPlanningTrain', operate: 'handleConfirmAddTask', params: Object.assign({}, this.addModel) });

View File

@ -14,6 +14,7 @@
:show-header="config.showHeader"
border
@current-change="handleChange"
@cell-dblclick="handleModify"
>
<template v-for="(item,index) in config.columns">
<el-table-column :key="index" :prop="item.prop" :label="item.label" :width="item.width" />
@ -55,6 +56,11 @@ export default {
this.config.handleChange(row);
}
},
handleModify(row) {
if (this.config.handleModify) {
this.config.handleModify(row);
}
},
setCurrentRow(row) {
this.$refs.table.setCurrentRow(row);
},

View File

@ -0,0 +1,107 @@
<template>
<el-dialog
v-dialogDrag
class="planEdit__tool modify-service"
:title="title"
:visible.sync="dialogShow"
width="400px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
append-to-body
>
<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" />
</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" />
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="medium" @click="doClose">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" size="medium" @click="handleCommit">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { updateTripNumber, updateServiceNumber } from '@/api/runplan';
export default {
name:'ModifyService',
data() {
return {
dialogShow:false,
isModifyServiceNumber:false,
serviceNumber:'',
tripNumber:'',
title:'',
oldServiceNumber:'',
oldTripNumber:''
};
},
methods:{
doShow(data) {
if (data.tripNumber) {
this.oldServiceNumber = data.serviceNumber;
this.oldTripNumber = data.tripNumber;
this.isModifyServiceNumber = false;
this.title = '修改车次号';
} else {
this.oldServiceNumber = data.serviceNumber;
this.isModifyServiceNumber = true;
this.title = '修改计划号';
}
this.dialogShow = true;
},
doClose() {
this.dialogShow = false;
},
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('修改计划号失败');
});
} 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('修改车次号失败');
});
}
}
}
};
</script>
<style lang="scss" scoped>
.ModifyServiceName{
width: 100px;
display: inline-block;
float: left;
text-align: right;
padding-right: 15px;
vertical-align: top;
margin-top: 11px;
font-size: 15px;
margin-left: 20px;
}
.ModifyServiceInput{
width: 180px;
display: inline-block;
vertical-align: middle;
}
</style>

View File

@ -17,10 +17,12 @@
@touch="trainNumTouch"
/>
</div>
<modify-service ref="modifyService" />
</div>
</template>
<script>
import ModifyService from './menus/modifyService';
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { getStationList, queryRunPlan } from '@/api/runplan';
@ -34,7 +36,8 @@ import echarts from 'echarts';
export default {
name: 'PlanSchedule',
components: {
DataTable
DataTable,
ModifyService
},
props: {
planConvert: {
@ -76,6 +79,7 @@ export default {
showHeader: false,
highlightCurrentRow: true,
handleChange: this.serviceNumberChange,
handleModify:this.serviceNumberModify,
showClose: false,
columns: [
{
@ -90,6 +94,7 @@ export default {
showHeader: false,
highlightCurrentRow: true,
handleChange: this.tripNumberChange,
handleModify:this.tripNumberModify,
showClose: false,
columns: [
{
@ -265,6 +270,16 @@ export default {
displayTrain() {
this.showTrain = !this.showTrain;
},
serviceNumberModify(row) {
if (row) {
this.$refs.modifyService.doShow({serviceNumber:row.serviceNumber});
}
},
tripNumberModify(row) {
if (row) {
this.$refs.modifyService.doShow({serviceNumber:this.$store.state.runPlan.selected.serviceNumber, tripNumber:row.tripNumber});
}
},
serviceNumberChange(row) {
let serviceNumber = null;
let serviceObj = {};