This commit is contained in:
joylink_cuiweidong 2020-06-30 14:41:56 +08:00
commit b934ee7edb
5 changed files with 23 additions and 457 deletions

View File

@ -1,5 +1,5 @@
<template>
<el-dialog v-dialogDrag class="xian-01__systerm train-control" :title="title" :visible.sync="show" width="370px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<el-dialog v-dialogDrag :class="popClass + ' train-control'" :title="title" :visible.sync="show" width="370px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<el-form ref="form" size="small" label-width="120px" :model="formModel" :rules="rules">
<el-form-item :label="this.$t('menu.groupNumber')+this.$t('global.colon')" prop="groupNumber">
<el-select
@ -75,26 +75,31 @@
<el-button :id="domIdCancel" @click="cancel">{{ $t('global.cancel') }}</el-button>
</el-col>
</el-row>
<confirm-train ref="confirmTrain" />
<notice-info ref="noticeInfo" pop-class="xian-01__systerm" />
<notice-info ref="noticeInfo" :pop-class="popClass" />
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import ConfirmTrain from './childDialog/confirmTrain';
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import Handler from '@/scripts/cmdPlugin/Handler';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import {getTrainDetailBytripNumber} from '@/api/simulation';
import NoticeInfo from '../childDialog/noticeInfo';
export default {
name: 'TrainControl',
components: {
ConfirmTrain,
NoticeInfo
},
props: {
popClass: {
type: String,
default() {
return '';
}
}
},
data() {
return {
trainList: [],
@ -112,16 +117,16 @@ export default {
],
rules: {
groupNumber: [
{ required: true, message: this.$t('rules.selectGroupNumber'), trigger: 'change' }
{ required: true, message: '请选择车组号', trigger: 'change' }
],
type: [
{ required: true, message: this.$t('rules.selectATrainType'), trigger: 'change' }
{ required: true, message: '请选择列车类型', trigger: 'change' }
],
tripNumber: [
{ required: true, message: this.$t('rules.enterTheTripNumber'), trigger: 'blur' }
{ required: true, message: '请输入车次号', trigger: 'blur' }
],
destinationCode: [
{ required: true, message: this.$t('rules.enterTheTargetCode'), trigger: 'blur' }
{ required: true, message: '请输入目的地号', trigger: 'blur' }
]
},
operation: null,
@ -223,9 +228,9 @@ export default {
},
title() {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
return this.$t('menu.menuTrain.addTrainId');
return '添加列车识别号';
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
return this.$t('menu.menuTrain.editTrainId');
return '修改列车识别号';
}
return '';
}
@ -425,7 +430,6 @@ export default {
const operate = {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.doClose();

View File

@ -1,440 +0,0 @@
<template>
<el-dialog v-dialogDrag class="fuzhou-01__systerm train-control" :title="title" :visible.sync="show" width="370px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<el-form ref="form" size="small" label-width="120px" :model="formModel" :rules="rules">
<el-form-item :label="this.$t('menu.groupNumber')+this.$t('global.colon')" prop="groupNumber">
<el-select
:id="domIdTrainNumber"
v-model="formModel.groupNumber"
filterable
:disabled="trainNumberIsDisabled"
@change="trainNumberChange"
>
<el-option
v-for="train in trainList"
:key="train.groupNumber"
:label="train.groupNumber"
:value="train.groupNumber"
/>
</el-select>
</el-form-item>
<el-form-item prop="type" label-width="0px">
<el-radio-group
:id="domIdTrainType"
v-model="formModel.type"
style="margin-left: 45px;"
@change="trainTypeChange"
>
<el-radio :label="'PLAN'">{{ $t('menu.planTrain') }}</el-radio>
<el-radio :label="'HEAD'">{{ $t('menu.headCodeTrain') }}</el-radio>
<el-radio :label="'MANUAL'" style="margin-top:5px;">{{ $t('menu.artificialTrain') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="formModel.type == 'PLAN'|| formModel.type == 'HEAD'" prop="serviceNumber">
<span slot="label">{{ $t('menu.serviceNumber') + '' }}</span>
<el-input
:id="domIdServerNo"
v-model="formModel.serviceNumber"
:disabled="serverNoIsDisabled"
/>
</el-form-item>
<el-form-item v-if="formModel.type == 'PLAN'" :label="this.$t('menu.tripNumber')+this.$t('global.colon')" prop="tripNumber">
<el-input
:id="domIdTrainNo"
v-model="formModel.tripNumber"
maxlength="4"
/>
</el-form-item>
<el-form-item v-if="formModel.type == 'PLAN' || formModel.type == 'HEAD'" :label="this.$t('menu.targetCode')+this.$t('global.colon')" prop="destinationCode">
<el-input
:id="domIdTargetCode"
v-model="formModel.destinationCode"
:disabled="formModel.type !== 'HEAD'"
/>
</el-form-item>
<el-form-item v-if="formModel.type == 'MANUAL'" :label="this.$t('menu.category')+this.$t('global.colon')" prop="category">
<el-select
:id="domIdTrainNumber"
v-model="formModel.category"
filterable
:disabled="true"
>
<el-option
v-for="item in categoryList"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">{{ $t('global.confirm') }}</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel">{{ $t('global.cancel') }}</el-button>
</el-col>
</el-row>
<confirm-train ref="confirmTrain" />
<notice-info ref="noticeInfo" pop-class="fuzhou-01__systerm" />
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import ConfirmTrain from './childDialog/confirmTrain';
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import Handler from '@/scripts/cmdPlugin/Handler';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import {getTrainDetailBytripNumber} from '@/api/simulation';
export default {
name: 'TrainControl',
components: {
ConfirmTrain,
NoticeInfo
},
data() {
return {
trainList: [],
serviceNumber:'',
formModel: {
tripNumber: '',
groupNumber: '',
type: 'PLAN',
serviceNumber: '',
destinationCode: '',
category: 'MM'
},
categoryList: [
{ name: 'MM', value: '01' }
],
rules: {
groupNumber: [
{ required: true, message: this.$t('rules.selectGroupNumber'), trigger: 'change' }
],
type: [
{ required: true, message: this.$t('rules.selectATrainType'), trigger: 'change' }
],
tripNumber: [
{ required: true, message: this.$t('rules.enterTheTripNumber'), trigger: 'blur' }
],
destinationCode: [
{ required: true, message: this.$t('rules.enterTheTargetCode'), trigger: 'blur' }
]
},
operation: null,
dialogShow: false,
loading: false,
direction: 0
};
},
computed: {
...mapGetters('map', [
'map'
]),
serverNoIsDisabled() {
return true;
},
trainNumberIsDisabled() {
if (this.operation != OperationEvent.Train.addTrainId.menu.operation) {
return true;
}
return '';
},
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdTrainNumber() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.trainNumberChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.trainNumberChange.domId;
}
}
return '';
},
domIdTrainNo() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.trainNoChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.trainNoChange.domId;
}
}
return '';
},
domIdTrainType() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.trainTypeChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.trainTypeChange.domId;
}
}
return '';
},
domIdServerNo() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.serverNoChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.serverNoChange.domId;
}
}
return '';
},
domIdTargetCode() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.targetCodeChange.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.targetCodeChange.domId;
}
}
return '';
},
domIdConfirm() {
if (this.dialogShow) {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 添加列车识别号*/
return OperationEvent.Train.addTrainId.menu.domId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
return OperationEvent.Train.editTrainId.menu.domId;
}
}
return '';
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
title() {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
return this.$t('menu.menuTrain.addTrainId');
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
return this.$t('menu.menuTrain.editTrainId');
}
return '';
}
},
watch: {
'formModel.tripNumber': function(val) {
if (val.length == 4) {
this.trainNoChange(val);
} else {
this.formModel = {
groupNumber: this.formModel.groupNumber,
tripNumber: val,
type: this.formModel.type,
serviceNumber: '',
targetCode: '',
category: 'MM'
};
}
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
loadInitData(map) {},
doShow(operate, selected) {
//
if (!this.dialogShow) {
this.operation = operate.operation;
}
const model = this.$store.getters['map/getDeviceByCode'](selected.code);
this.serviceNumber = model.serviceNumber;
this.formModel = {
groupNumber: model.groupNumber,
tripNumber: model.tripNumber,
type: model.type ? model.type : 'PLAN',
serviceNumber: model.serviceNumber,
destinationCode: model.destinationCode,
category: 'MM'
};
/** 加载列车数据*/
this.loadInitData(this.map);
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);
},
trainNumberChange(groupNumber) {
const operate = {
groupNumber: groupNumber,
operation: ''
};
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNumberChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainNumberChange.operation;
}
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
trainTypeChange(trainType) {
if (trainType === 'HEAD') {
this.formModel.serviceNumber = '';
} else if (trainType === 'PLAN' && this.serviceNumber) {
this.formModel.serviceNumber = this.serviceNumber;
}
const operate = {
type: trainType,
operation: ''
};
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainTypeChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainTypeChange.operation;
}
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
trainNoChange(tripNumber) {
const operate = {
tripNumber: tripNumber,
operation: ''
};
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNoChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainNoChange.operation;
}
Handler.undo(1);
getTrainDetailBytripNumber(this.$route.query.group, {tripNumber:tripNumber}).then(resp => {
if (resp.data) {
this.formModel.serviceNumber = resp.data.serviceNumber;
this.formModel.destinationCode = resp.data.destinationCode;
}
}).catch(() => {
this.$message.error('获取列车信息失败!');
});
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
commit() {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
/** 增加列车识别号*/
this.addTrainId();
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
/** 修改列车识别号*/
this.editTrainId();
}
},
//
addTrainId() {
this.$refs['form'].validate((valid) => {
if (valid) {
const params = {
groupNumber: this.formModel.groupNumber,
type: this.formModel.type,
serviceNumber: '',
tripNumber: '',
destinationCode: ''
};
if (this.formModel.type === 'PLAN') {
params.serviceNumber = this.formModel.serviceNumber;
params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode;
} else if (this.formModel.type === 'HEAD') {
params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode;
}
commitOperate(menuOperate.TrainWindow.addTrainId, params, 2).then(({valid})=>{
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow();
});
} else {
return false;
}
});
},
//
editTrainId() {
this.$refs['form'].validate((valid) => {
if (valid) {
const params = {
groupNumber: this.formModel.groupNumber,
type: this.formModel.type,
serviceNumber: '',
tripNumber: '',
destinationCode: ''
};
if (this.formModel.type === 'PLAN') {
params.serviceNumber = this.formModel.serviceNumber;
params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode;
} else if (this.formModel.type === 'HEAD') {
params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode;
}
commitOperate(menuOperate.TrainWindow.editTrainId, params, 2).then(({valid})=>{
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow();
});
} 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(() => {
this.doClose();
});
}
}
};
</script>

View File

@ -2,7 +2,7 @@
<div>
<pop-menu ref="popMenu" :menu="menu" />
<notice-info ref="noticeInfo" pop-class="fuzhou-01__systerm" />
<train-control ref="trainControl" />
<train-control ref="trainControl" pop-class="fuzhou-01__systerm" />
<train-delete ref="trainDelete" />
<train-move ref="trainMove" />
<train-switch ref="trainSwitch" />
@ -17,7 +17,7 @@ import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import TrainControl from './dialog/trainControl';
import TrainControl from '@/jmapNew/theme/components/menus/dialog/trainControl';
import TrainDelete from './dialog/trainDelete';
import TrainMove from './dialog/trainMove';
import TrainSwitch from './dialog/trainSwitch';

View File

@ -2,7 +2,7 @@
<div>
<pop-menu ref="popMenu" :menu="menu" pop-menu-class="xian-01__systerm" />
<notice-info ref="noticeInfo" pop-class="xian-01__systerm" />
<train-control ref="trainControl" />
<train-control ref="trainControl" pop-class="xian-01__systerm" />
<train-delete ref="trainDelete" />
<train-move ref="trainMove" />
<train-switch ref="trainSwitch" />
@ -18,7 +18,7 @@ import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import TrainControl from './dialog/trainControl';
import TrainControl from '@/jmapNew/theme/components/menus/dialog/trainControl';
import TrainDelete from './dialog/trainDelete';
import TrainMove from './dialog/trainMove';
import TrainSwitch from './dialog/trainSwitch';

View File

@ -65,6 +65,8 @@ export default {
getSubSystemDetail(this.$route.params.subSystem).then(resp =>{
if (resp.data) {
this.tableData = resp.data.lessonList;
} else {
this.tableData = [];
}
}).catch((error)=>{
if (error.code == 30001) {