哈尔滨创建计划车

This commit is contained in:
joylink_fanyuhong 2020-03-07 18:32:51 +08:00
parent 3745815a5b
commit 2ca260d502
2 changed files with 259 additions and 38 deletions

View File

@ -0,0 +1,226 @@
<template>
<el-dialog
v-dialogDrag
class="haerbin-01__systerm stand-stop-time"
:title="title"
:visible.sync="show"
width="300px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<div class="el-dialog-div">
<el-form ref="form" size="small" label-width="100px" :model="addModel" :rules="rules" label-position="left">
<el-form-item prop="trainCode" label="车组号:">
<!--<el-input v-model="addModel.trainCode"/>-->
<el-select v-model="addModel.trainCode" filterable>
<el-option
v-for="train in trainList"
:key="train.groupNumber"
:label="train.groupNumber"
:value="train.code"
/>
</el-select>
</el-form-item>
<el-form-item label="车次号:" prop="tripNumber">
<!--<el-input v-model="addModel.tripNumber"/>-->
<el-select v-model="addModel.tripNumber" @change="tripNumberChange" filterable>
<el-option
v-for="tripNum in tripNumberList"
:key="tripNum"
:label="tripNum"
:value="tripNum"
/>
</el-select>
</el-form-item>
<el-form-item label="服务号:" prop="serviceNumber">
<el-select v-model="addModel.serviceNumber" filterable>
<el-option
v-for="serviceNumber in serviceNumberList"
:key="serviceNumber"
:label="serviceNumber"
:value="serviceNumber"
/>
</el-select>
</el-form-item>
</el-form>
</div>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import CancelMouseState from '@/mixin/CancelMouseState';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { getTripNumberList, getServiceNumbersByTripNum } from '@/api/simulation';
export default {
name: 'TrainCreateNumber',
mixins: [
CancelMouseState
],
data() {
return {
trainNoList: [],
selected: null,
sectionName: '',
tripNumberList: [],
serviceNumberList: [],
addModel: {
trainCode:'',
tripNumber:'',
serviceNumber: ''
},
rules: {
trainCode: [
{ required: true, message: '请输入列车编码', trigger: 'blur'}
],
serviceNumber: [
{ required: true, message: '请输入服务号', trigger: 'change'}
],
tripNumber: [
{ required: true, message: '请输入车次号', trigger: 'blur'}
]
},
dialogShow: false,
loading: false
};
},
computed: {
...mapGetters('map', [
'trainList',
'stationStandList',
'trainWindowSectionCode'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.createPlanTrain.menu.domId : '';
},
title() {
return '新建计划车';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
tripNumberChange(tripNumber) {
getServiceNumbersByTripNum(this.$route.query.group, tripNumber).then(resp => {
this.serviceNumberList = [];
resp.data.forEach(item => {
if (!this.serviceNumberList.includes(item)) {
this.serviceNumberList.push(item);
}
});
});
if (this.serviceNumberList.length === 1) {
this.addModel.serviceNumber = this.serviceNumberList[0];
}
},
doShow(operate, selected) {
this.selected = selected;
//
this.addModel = {
trainCode:'',
tripNumber:'',
serviceNumber: ''
};
getTripNumberList(this.$route.query.group).then(resp => {
this.tripNumberList = [];
resp.data.forEach(item => {
if (!this.tripNumberList.includes(item)) {
this.tripNumberList.push(item);
}
});
}).catch(error => {
this.$messageBox(error.message);
});
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false);
this.mouseCancelState(this.selected);
},
commit() {
this.$refs['form'].validate((valid) => {
if (valid) {
const operate = {
over: true,
operation: OperationEvent.Train.createPlanTrain.menu.operation,
cmdType: CMD.TrainWindow.CMD_Train_Init_Plan,
param: {
sectionCode: this.trainWindowSectionCode,
trainCode: this.addModel.trainCode, //
serviceNumber: this.addModel.serviceNumber, //
tripNumber: this.addModel.tripNumber //
}
};
this.loading = true;
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(error => {
this.loading = false;
this.doClose();
// this.$refs.noticeInfo.doShow(operate);
this.$messageBox(error.message);
});
} else {
return false;
}
});
},
cancel() {
const operate = {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(error => { this.doClose(); });
}
}
};
</script>
<style scoped>
.chengdou-03__systerm .el-dialog .base-label {
background: rgba(0, 0, 0, x);
position: relative;
left: -5px;
top: -18px;
padding: 0 5px;
background-color: #F0F0F0;
}
.el-dialog-div {
height: 200px;
overflow: auto;
}
</style>

View File

@ -7,6 +7,7 @@
<train-move ref="trainMove" /> <train-move ref="trainMove" />
<train-switch ref="trainSwitch" /> <train-switch ref="trainSwitch" />
<train-edit-number ref="trainEditNumber" /> <train-edit-number ref="trainEditNumber" />
<train-init-plan ref="trainInitPlan"/>
</div> </div>
</template> </template>
@ -22,6 +23,7 @@ import TrainDelete from './dialog/trainDelete';
import TrainMove from './dialog/trainMove'; import TrainMove from './dialog/trainMove';
import TrainSwitch from './dialog/trainSwitch'; import TrainSwitch from './dialog/trainSwitch';
import TrainEditNumber from './dialog/trainEditNumber'; import TrainEditNumber from './dialog/trainEditNumber';
import TrainInitPlan from './dialog/trainInitPlan';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler'; import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
export default { export default {
@ -33,7 +35,8 @@ export default {
TrainDelete, TrainDelete,
TrainMove, TrainMove,
TrainSwitch, TrainSwitch,
TrainEditNumber TrainEditNumber,
TrainInitPlan
}, },
props: { props: {
selected: { selected: {
@ -47,44 +50,19 @@ export default {
return { return {
menu: [], menu: [],
menuNormal: { menuNormal: {
Local: [], Local: [
{
label: '新建计划列车',
handler: this.createPlanTrain,
cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
}
],
Center: [ Center: [
// { {
// label: this.$t('menu.menuTrain.addTrainId'), label: '新建计划列车',
// handler: this.addTrainId, handler: this.createPlanTrain,
// auth: { station: true, center: true }, cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// cmdType:CMD.Train.CMD_SWITCH_REMOVE_FAULT }
// },
// {
// label: this.$t('menu.menuTrain.deleteTrainId'),
// handler: this.delTrainId,
// auth: { station: true, center: true },
// cmdType:CMD.Train.CMD_SWITCH_REMOVE_FAULT
// },
// {
// label: this.$t('menu.menuTrain.editTrainId'),
// handler: this.editTrainId,
// auth: { station: true, center: true },
// cmdType:CMD.Train.CMD_SWITCH_REMOVE_FAULT
// },
// {
// label: this.$t('menu.menuTrain.editTrainNo'),
// handler: this.editTrainNo,
// auth: { station: true, center: true },
// cmdType:CMD.Train.CMD_SWITCH_REMOVE_FAULT
// },
// {
// label: this.$t('menu.menuTrain.moveTrainId'),
// handler: this.moveTrainId,
// auth: { station: true, center: true },
// cmdType:CMD.Train.CMD_SWITCH_REMOVE_FAULT
// },
// {
// label: this.$t('menu.menuTrain.switchTrainId'),
// handler: this.switchTrainId,
// auth: { station: true, center: true },
// cmdType:CMD.Train.CMD_SWITCH_REMOVE_FAULT
// }
] ]
}, },
menuForce: [ menuForce: [
@ -162,6 +140,23 @@ export default {
// this.$store.dispatch('map/setTrainWindowShow', false); // this.$store.dispatch('map/setTrainWindowShow', false);
} }
}, },
createPlanTrain() {
const step = {
start: true,
code: this.selected.code,
operation: OperationEvent.Train.createPlanTrain.menu.operation,
param: {
trainWindowCode: this.selected.code
}
};
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainInitPlan.doShow(step, this.selected);
}
});
},
// //
setStoppage() { setStoppage() {
const step = { const step = {