调整取消进路指令&调整导出试卷参数&公共菜单

This commit is contained in:
fan 2020-05-28 09:54:47 +08:00
parent fe1fcdbcf3
commit bf1bbbe948
7 changed files with 515 additions and 2 deletions

View File

@ -60,7 +60,7 @@ export const menuOperate = {
cancelTrainRoute:{
// 取消进路
operation: OperationEvent.Signal.cancelTrainRoute.menu.operation,
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE
cmdType: CMD.Signal.CMD_SIGNAL_FORCE_CANCEL_ROUTE
},
lock:{
// 信号封锁

View File

@ -78,6 +78,8 @@ export default {
CMD_SIGNAL_SET_ROUTE: {value:'Signal_Set_Route', label: '排列进路'},
/** 取消进路 */
CMD_SIGNAL_CANCEL_ROUTE: {value:'Signal_Cancel_Route', label: '取消进路'},
/** 强制取消进路 */
CMD_SIGNAL_FORCE_CANCEL_ROUTE: {value: 'Signal_Force_Cancel_Route', label: '强制取消进路'},
/** 人解进路 */
CMD_SIGNAL_HUMAN_RELEASE_ROUTE: {value:'Signal_Human_Release_Route', label: '人解进路'},
/** 信号关灯 */

View File

@ -75,7 +75,7 @@ export default {
theoryQuestions: this.theoryQuestionList,
competitionId: this.$route.query.raceId,
theoryExamTime: this.form.theoryExamTime,
operateExamTime: this.form.operateExamTime
practicalExamTime: this.form.operateExamTime
};
const content = new Blob([JSON.stringify(exportData)]);
const urlObject = window.URL || window.webkitURL || window;

View File

@ -0,0 +1,22 @@
<template>
<div class="menus" :style="{width: width + 'px'}">
<set-fault ref="setFault" />
</div>
</template>
<script>
import SetFault from './menus/setFault';
export default {
name: 'CommonMenu',
components: {
SetFault
},
props: {},
computed: {},
watch: {}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,84 @@
<template>
<el-dialog
v-dialogDrag
class="xian-01__systerm notice-info"
:title="title"
:visible.sync="show"
width="360px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
append-to-body
>
<div class="context">
<template v-for="(message,index) in messages">
<div :key="index">{{ message }}</div>
</template>
</div>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="8">
<el-button :id="domIdSure" type="primary" @click="commit">{{ $t('global.confirm') }}</el-button>
</el-col>
</el-row>
</el-dialog>
</template>
<script>
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
export default {
name: 'NoticeInfo',
data() {
return {
dialogShow: false,
messages: [this.$t('tip.commandFailed')]
};
},
computed: {
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
title() {
return this.$t('tip.hint');
},
domIdSure() {
return this.dialogShow ? OperationEvent.Command.close.notice.domId : '';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
doShow(messages) {
this.dialogShow = true;
this.messages = [this.$t('tip.commandFailed')];
if (messages && messages != 'null') {
this.messages.push(messages);
}
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
},
commit() {
this.doClose();
},
cancel() {
this.doClose();
}
}
};
</script>
<style>
.notice-info .context {
padding-bottom: 40px !important;
border: 1px solid lightgray;
}
</style>

View File

@ -0,0 +1,189 @@
<template>
<el-dialog v-dialogDrag :class="className" :title="title" :visible.sync="show" width="350px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<el-row class="header">
<el-col :span="11"><span>设备:</span></el-col>
<el-col :span="11" :offset="2"><span>故障类型:</span></el-col>
</el-row>
<el-row>
<el-form ref="form" :model="form" :rules="rules">
<el-col :span="11">
<el-form-item>
<el-input v-model="deviceName" size="small" disabled />
</el-form-item>
</el-col>
<el-col :span="11" :offset="2">
<el-form-item prop="faultType">
<el-select v-model="form.faultType" size="small" style="height: 28px;" placeholder="请选择">
<el-option
v-for="item in faultList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-form>
</el-row>
<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 { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import OperationHandler from '@/scripts/cmdPlugin/OperationHandler';
import { deviceFaultType, deviceType} from '@/scripts/cmdPlugin/Config';
export default {
name: 'SwitchControl',
data() {
return {
dialogShow: false,
loading: false,
operation: '',
stationName: '',
switchName: '',
activeShow: false,
deviceName: '',
faultList: [],
className: '',
form: { faultType: ''},
rules: {
faultType: [
{ required: true, message: '请选择故障类型', trigger: 'change'}
]
}
};
},
computed: {
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationHandler.getDomIdByOperation(this.operation) : '';
},
title() {
if (this.operation === OperationEvent.Section.stoppage.menu.operation) {
return '设置故障';
} else if (this.operation === OperationEvent.Section.cancelStoppage.menu.operation) {
return '取消故障';
}
return '';
}
},
created() {
switch (this.$route.query.lineCode) {
case '02':
case '05':
this.className = 'fuzhou-01__systerm';
break;
case '03':
this.className = 'beijing-01__systerm';
break;
case '04':
this.className = 'chengdou-03__systerm';
break;
case '06':
this.className = 'ningbo-01__systerm';
break;
case '07':
this.className = 'haerbin-01__systerm';
break;
case '08':
this.className = 'foshan-01__systerm';
break;
case '09':
this.className = 'xian-02__system';
break;
case '10':
case '11':
this.className = 'xian-01__systerm';
break;
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
doShow(operate, selected) {
if (!this.dialogShow) {
this.switchName = '';
this.stationName = '';
this.operation = operate.operation;
this.cmdType = operate.cmdType;
this.deviceName = deviceType[selected._type] + '-' + selected.name;
this.faultList = deviceFaultType[selected._type];
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.form.faultType = '';
this.$refs.form.resetFields();
this.$store.dispatch('training/emitTipFresh');
},
commit() {
this.$refs.form.validate((valid) => {
if (valid) {
this.sendCommand();
}
});
},
sendCommand() { //
this.loading = true;
const setp = {
over: true,
operation: this.operation,
cmdType: this.cmdType,
param: {
faultType: this.form.faultType
}
};
this.$store.dispatch('training/nextNew', setp).then(({ valid }) => {
this.loading = false;
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.doClose();
} else {
this.doClose();
this.$messageBox('设置或取消故障操作失败!');
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$messageBox(error.message || '设置或取消故障操作失败!');
});
},
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

@ -0,0 +1,216 @@
<template>
<el-dialog
v-dialogDrag
class="xian-01__systerm stand-stop-time"
:title="title"
:visible.sync="show"
width="340px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-form ref="form" size="small" label-width="80px" :model="addModel" :rules="rules">
<div style="width: 96%;">
<el-form-item label="车 次 号:" label-width="95px" prop="tripNumber">
<el-select v-model="addModel.tripNumber" filterable @change="tripNumberChange">
<el-option
v-for="tripNum in tripNumberList"
:key="tripNum"
:label="tripNum"
:value="tripNum"
/>
</el-select>
</el-form-item>
<el-form-item label="服 务 号:" label-width="95px" 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>
</div>
</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">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<notice-info ref="noticeInfo" />
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { getTripNumberList, getServiceNumbersByTripNum } from '@/api/simulation';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import NoticeInfo from './noticeInfo';
export default {
name: 'TrainAddPlan',
components: {
NoticeInfo
},
data() {
return {
trainNoList: [],
selected: null,
tripNumberList: [],
serviceNumberList: [],
addModel: {
serviceNumber: '', //
tripNumber: '' //
},
rules: {
serviceNumber: [
{ required: true, message: '请输入服务号', trigger: 'blur' }
],
tripNumber: [
{ required: true, message: '请输入车次号', trigger: 'change' }
]
},
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 = [];
if (typeof resp.data == 'string') {
this.serviceNumberList.push(resp.data);
} else {
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;
//
// if (!this.dialogShow) {
// }
this.addModel = {
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 => {
console.log(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.Section.CMD_Train_Init_Plan,
param: {
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(() => {
this.loading = false;
this.$refs.noticeInfo.doShow();
this.doClose();
});
} 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>
<style scoped>
.foshan-01__systerm .el-dialog .base-label {
background: rgba(0, 0, 0, x);
position: relative;
left: -5px;
top: -18px;
padding: 0 5px;
background-color: #F0F0F0;
}
</style>