修改代码

This commit is contained in:
ival 2019-11-18 18:47:02 +08:00
parent 5a9099aa35
commit f26275e03c
41 changed files with 1155 additions and 641 deletions

View File

@ -1,355 +1,365 @@
<template>
<el-dialog class="batong-01__systerm confirm-control" :title="title" :visible.sync="show" width="360px" :before-close="doClose"
:zIndex="2000" :modal="false" :close-on-click-modal="false" append-to-body v-dialogDrag>
<div class="context">
<template v-for="message in messages">
<span>{{message}}</span>
</template>
</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>
<notice-info ref="noticeInfo"></notice-info>
</el-dialog>
<el-dialog
class="batong-01__systerm confirm-control"
v-dialogDrag
: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 in messages">
<span>{{ message }}</span>
</template>
</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>
<notice-info ref="noticeInfo" />
</el-dialog>
</template>
<script>
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import NoticeInfo from './childDialog/noticeInfo'
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import NoticeInfo from './childDialog/noticeInfo';
export default {
name: 'ConfirmControl',
data() {
return {
dialogShow: false,
loading: false,
operate: {},
messages: '',
operation: null
export default {
name: 'ConfirmControl',
components: {
NoticeInfo
},
data() {
return {
dialogShow: false,
loading: false,
operate: {},
messages: '',
operation: null
};
},
computed: {
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
title() {
if (this.operation === OperationEvent.Signal.arrangementRoute.menu.operation) {
return '进路设置';
} else if (this.operation === OperationEvent.Signal.signalClose.menu.operation) {
return '信号关灯';
} else if (this.operation === OperationEvent.Signal.reopenSignal.menu.operation) {
return '信号重开';
} else if (this.operation === OperationEvent.Signal.cancelTrainRoute.menu.operation) {
return '取消进路';
} else if (this.operation === OperationEvent.Signal.humanControl.menu.operation) {
return '确认操作';//
} else if (this.operation === OperationEvent.Signal.atsAutoControl.menu.operation) {
return '确认操作'; // ATS
} else if (this.operation === OperationEvent.StationStand.setRunLevel.menu.operation) {
return '设置运行等级';
} else if (this.operation === OperationEvent.StationStand.setStopTime.menu.operation) {
return '停站时间';
} else if (this.operation === OperationEvent.StationStand.setBackStrategy.menu.operation) {
return '设置折返策略';
}
},
components: {
NoticeInfo
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
computed: {
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
title() {
if (this.operation === OperationEvent.Signal.arrangementRoute.menu.operation) {
return '进路设置';
} else if (this.operation === OperationEvent.Signal.signalClose.menu.operation) {
return '信号关灯';
} else if (this.operation === OperationEvent.Signal.reopenSignal.menu.operation) {
return '信号重开';
} else if (this.operation === OperationEvent.Signal.cancelTrainRoute.menu.operation) {
return '取消进路';
} else if (this.operation === OperationEvent.Signal.humanControl.menu.operation) {
return '确认操作';//
} else if (this.operation === OperationEvent.Signal.atsAutoControl.menu.operation) {
return '确认操作' // ATS
} else if (this.operation === OperationEvent.StationStand.setRunLevel.menu.operation) {
return '设置运行等级';
} else if (this.operation === OperationEvent.StationStand.setStopTime.menu.operation) {
return '停站时间';
} else if (this.operation === OperationEvent.StationStand.setBackStrategy.menu.operation) {
return '设置折返策略';
}
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
if (this.dialogShow) {
if (this.operation === OperationEvent.Signal.arrangementRoute.menu.operation) {
/** 进路设置*/
return OperationEvent.Signal.arrangementRoute.confirm.domId
} else if (this.operation === OperationEvent.Signal.signalClose.menu.operation) {
/** 信号关灯*/
return OperationEvent.Signal.signalClose.confirm.domId;
} else if (this.operation === OperationEvent.Signal.reopenSignal.menu.operation) {
/** 信号重开*/
return OperationEvent.Signal.reopenSignal.confirm.domId;
} else if (this.operation === OperationEvent.Signal.cancelTrainRoute.menu.operation) {
/** 取消进路*/
return OperationEvent.Signal.cancelTrainRoute.confirm.domId;
} else if (this.operation === OperationEvent.Signal.humanControl.menu.operation) {
/** 进路交人工控*/
return OperationEvent.Signal.humanControl.confirm.domId;
} else if (this.operation === OperationEvent.Signal.atsAutoControl.menu.operation) {
/** 进路交ATS自动控*/
return OperationEvent.Signal.atsAutoControl.confirm.domId;
} else if (this.operation === OperationEvent.StationStand.setRunLevel.menu.operation) {
/** 设置运行等级*/
return OperationEvent.StationStand.setRunLevel.confirm.domId;
} else if (this.operation === OperationEvent.StationStand.setStopTime.menu.operation) {
/** 设置停战时间*/
return OperationEvent.StationStand.setStopTime.confirm.domId;
} else if (this.operation === OperationEvent.StationStand.setBackStrategy.menu.operation) {
/** 设置折返策略*/
return OperationEvent.StationStand.setBackStrategy.confirm.domId;
}
}
},
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
},
methods: {
doShow(operate) {
if (!this.dialogShow) {
this.loading = false;
this.operate = operate || {};
this.messages = operate.messages;
this.operation = operate.operation;
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
},
commit() {
domIdConfirm() {
if (this.dialogShow) {
if (this.operation === OperationEvent.Signal.arrangementRoute.menu.operation) {
/** 进路设置*/
this.routeSetting();
return OperationEvent.Signal.arrangementRoute.confirm.domId;
} else if (this.operation === OperationEvent.Signal.signalClose.menu.operation) {
/** 信号关灯*/
this.signalClose();
return OperationEvent.Signal.signalClose.confirm.domId;
} else if (this.operation === OperationEvent.Signal.reopenSignal.menu.operation) {
/** 信号重开*/
this.reopenSignal();
return OperationEvent.Signal.reopenSignal.confirm.domId;
} else if (this.operation === OperationEvent.Signal.cancelTrainRoute.menu.operation) {
/** 取消进路*/
this.cancelTrainRoute();
return OperationEvent.Signal.cancelTrainRoute.confirm.domId;
} else if (this.operation === OperationEvent.Signal.humanControl.menu.operation) {
/** 进路交人工控*/
this.humanControl();
return OperationEvent.Signal.humanControl.confirm.domId;
} else if (this.operation === OperationEvent.Signal.atsAutoControl.menu.operation) {
/** 进路交ATS自动控*/
this.atsAutoControl();
return OperationEvent.Signal.atsAutoControl.confirm.domId;
} else if (this.operation === OperationEvent.StationStand.setRunLevel.menu.operation) {
/** 设置运行等级*/
this.setRunLevel();
return OperationEvent.StationStand.setRunLevel.confirm.domId;
} else if (this.operation === OperationEvent.StationStand.setStopTime.menu.operation) {
/** 停站时间*/
this.setStopTime();
/** 设置停战时间*/
return OperationEvent.StationStand.setStopTime.confirm.domId;
} else if (this.operation === OperationEvent.StationStand.setBackStrategy.menu.operation) {
/** 设置折返策略*/
this.setBackStrategy();
return OperationEvent.StationStand.setBackStrategy.confirm.domId;
}
},
//
routeSetting() {
let operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.Signal.arrangementRoute.confirm.operation,
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
})
},
//
signalClose() {
let operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.Signal.signalClose.confirm.operation
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
})
},
//
reopenSignal() {
let operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.Signal.reopenSignal.confirm.operation
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
})
},
//
cancelTrainRoute() {
let operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.Signal.cancelTrainRoute.confirm.operation
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
})
},
//
humanControl() {
let operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.humanControl.confirm.operation,
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(error => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
//ATS
atsAutoControl() {
let operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.atsAutoControl.confirm.operation,
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(error => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
//
setRunLevel() {
let operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.StationStand.setRunLevel.confirm.operation,
val: this.operate.val
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
})
},
//
setStopTime() {
let operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.StationStand.setStopTime.confirm.operation,
val: this.operate.val,
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
})
},
//
setBackStrategy() {
let operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.StationStand.setBackStrategy.confirm.operation,
val: this.operate.val,
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
})
},
cancel() {
let operate = {
type: this.operate.type,
operation: OperationEvent.Command.cancel.menu.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(error => {
this.doClose();
});
}
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
doShow(operate) {
if (!this.dialogShow) {
this.loading = false;
this.operate = operate || {};
this.messages = operate.messages;
this.operation = operate.operation;
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
},
commit() {
if (this.operation === OperationEvent.Signal.arrangementRoute.menu.operation) {
/** 进路设置*/
this.routeSetting();
} else if (this.operation === OperationEvent.Signal.signalClose.menu.operation) {
/** 信号关灯*/
this.signalClose();
} else if (this.operation === OperationEvent.Signal.reopenSignal.menu.operation) {
/** 信号重开*/
this.reopenSignal();
} else if (this.operation === OperationEvent.Signal.cancelTrainRoute.menu.operation) {
/** 取消进路*/
this.cancelTrainRoute();
} else if (this.operation === OperationEvent.Signal.humanControl.menu.operation) {
/** 进路交人工控*/
this.humanControl();
} else if (this.operation === OperationEvent.Signal.atsAutoControl.menu.operation) {
/** 进路交ATS自动控*/
this.atsAutoControl();
} else if (this.operation === OperationEvent.StationStand.setRunLevel.menu.operation) {
/** 设置运行等级*/
this.setRunLevel();
} else if (this.operation === OperationEvent.StationStand.setStopTime.menu.operation) {
/** 停站时间*/
this.setStopTime();
} else if (this.operation === OperationEvent.StationStand.setBackStrategy.menu.operation) {
/** 设置折返策略*/
this.setBackStrategy();
}
},
//
routeSetting() {
const operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.Signal.arrangementRoute.confirm.operation
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
//
signalClose() {
const operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.Signal.signalClose.confirm.operation
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
//
reopenSignal() {
const operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.Signal.reopenSignal.confirm.operation
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
//
cancelTrainRoute() {
const operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.Signal.cancelTrainRoute.confirm.operation
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
//
humanControl() {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.humanControl.confirm.operation
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(error => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
// ATS
atsAutoControl() {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.atsAutoControl.confirm.operation
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(error => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
//
setRunLevel() {
const operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.StationStand.setRunLevel.confirm.operation,
val: this.operate.val
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
//
setStopTime() {
const operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.StationStand.setStopTime.confirm.operation,
val: this.operate.val
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
//
setBackStrategy() {
const operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.StationStand.setBackStrategy.confirm.operation,
val: this.operate.val
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
cancel() {
const operate = {
type: this.operate.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(error => {
this.doClose();
});
}
}
};
</script>
<style>

View File

@ -37,54 +37,54 @@ import PassiveContorl from './passiveDialog/control';
import PassiveTimeout from './passiveDialog/timeout';
export default {
name: 'Menus',
components: {
MenuBar,
MenuButton,
MenuCancel,
MenuSignal,
MenuSwitch,
MenuSection,
MenuStationControl,
MenuStationStand,
MenuStation,
MenuTrain,
MenuLimit,
PassiveAlarm,
PassiveContorl,
PassiveTimeout
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
computed: {
...mapGetters('config', [
'width'
]),
isShowAll() {
return this.$route.params.mode !== 'dp' &&
name: 'Menus',
components: {
MenuBar,
MenuButton,
MenuCancel,
MenuSignal,
MenuSwitch,
MenuSection,
MenuStationControl,
MenuStationStand,
MenuStation,
MenuTrain,
MenuLimit,
PassiveAlarm,
PassiveContorl,
PassiveTimeout
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
computed: {
...mapGetters('config', [
'width'
]),
isShowAll() {
return this.$route.params.mode !== 'dp' &&
this.$route.params.mode !== 'plan' &&
this.$store.state.training.roles != 'BigScreen';
},
isShowBar() {
return this.$store.state.training.prdType;
}
},
watch: {
isShowBar(val) {
val && this.$store.dispatch('config/updateMenuBar');
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('config/updateMenuBar');
});
}
},
isShowBar() {
return this.$store.state.training.prdType;
}
},
watch: {
isShowBar(val) {
val && this.$store.dispatch('config/updateMenuBar');
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('config/updateMenuBar');
});
}
};
</script>

View File

@ -30,6 +30,7 @@
<script>
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import Commands from '@/scripts/plugin/Commands';
import NoticeInfo from './childDialog/noticeInfo';
export default {
@ -168,7 +169,8 @@ export default {
const operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.Signal.arrangementRoute.confirm.operation
operation: OperationEvent.Signal.arrangementRoute.confirm.operation,
commandType: Commands.Signal.arrangementRoute
};
this.loading = true;
@ -188,7 +190,8 @@ export default {
const operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.Signal.signalClose.confirm.operation
operation: OperationEvent.Signal.signalClose.confirm.operation,
commandType: Commands.Signal.signalClose
};
this.loading = true;
@ -208,7 +211,8 @@ export default {
const operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.Signal.reopenSignal.confirm.operation
operation: OperationEvent.Signal.reopenSignal.confirm.operation,
commandType: Commands.Signal.reopenSignal
};
this.loading = true;
@ -228,7 +232,8 @@ export default {
const operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.Signal.cancelTrainRoute.confirm.operation
operation: OperationEvent.Signal.cancelTrainRoute.confirm.operation,
commandType: Commands.Signal.cancelTrainRoute
};
this.loading = true;
@ -248,7 +253,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.humanControl.menu.operation
operation: OperationEvent.Signal.humanControl.menu.operation,
commandType: Commands.Signal.humanControl
};
this.loading = true;
@ -268,7 +274,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.atsAutoControl.menu.operation
operation: OperationEvent.Signal.atsAutoControl.menu.operation,
commandType: Commands.Signal.atsAutoControl
};
this.loading = true;
@ -289,6 +296,7 @@ export default {
send: true,
type: this.operate.type,
operation: OperationEvent.StationStand.setRunLevel.confirm.operation,
commandType: Commands.StationStand.setRunLevel,
val: this.operate.val
};
@ -310,6 +318,7 @@ export default {
send: true,
type: this.operate.type,
operation: OperationEvent.StationStand.setStopTime.confirm.operation,
commandType: Commands.StationStand.setStopTime,
val: this.operate.val
};
@ -331,6 +340,7 @@ export default {
send: true,
type: this.operate.type,
operation: OperationEvent.StationStand.setBackStrategy.confirm.operation,
commandType: Commands.StationStand.setBackStrategy,
val: this.operate.val
};

View File

@ -31,6 +31,7 @@
<script>
import { OperationEvent } from '@/scripts/ConstDic';
import NoticeInfo from './childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'ConfirmTrain',
@ -139,7 +140,8 @@ export default {
const operate = {
send: true,
type: this.operate.type,
operation: OperationEvent.Train.addTrainId.confirm.operation
operation: OperationEvent.Train.addTrainId.confirm.operation,
commandType: Commands.Train.addTrainId
};
this.loading = true;

View File

@ -86,6 +86,7 @@
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { now } from '@/utils/date';
import ConfirmSignalUnlock from './childDialog/confirmSignalUnlock';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'RouteCmdControl',
@ -350,9 +351,11 @@ export default {
if (this.operation == OperationEvent.Signal.unlock.menu.operation) {
/** 信号解封*/
operate.operation = OperationEvent.Signal.unlock.confirm2.operation;
operate.commandType = Commands.Signal.unlock;
} else if (this.operation == OperationEvent.Signal.guide.menu.operation) {
/** 办理引导进路*/
operate.operation = OperationEvent.Signal.guide.confirm2.operation;
operate.commandType = Commands.Signal.guide;
}
this.setMessage('');
this.writeRecord({ order: ++this.order, date: now(), context: this.$t('menu.clickSecondConfirm'), result: '' });

View File

@ -39,6 +39,7 @@
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
import ConfirmControl from './childDialog/confirmControl';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'RouteControl',
@ -155,7 +156,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.cancelTrainRoute.menu.operation
operation: OperationEvent.Signal.cancelTrainRoute.menu.operation,
commandType: Commands.Signal.cancelTrainRoute
};
this.loading = true;
@ -235,7 +237,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.setAutoInterlock.menu.operation
operation: OperationEvent.Signal.setAutoInterlock.menu.operation,
commandType: Commands.Signal.setAutoInterlock
};
this.loading = true;
@ -255,7 +258,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.cancelAutoInterlock.menu.operation
operation: OperationEvent.Signal.cancelAutoInterlock.menu.operation,
commandType: Commands.Signal.cancelAutoInterlock
};
this.loading = true;
@ -275,7 +279,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.setAutoTrigger.menu.operation
operation: OperationEvent.Signal.setAutoTrigger.menu.operation,
commandType: Commands.Signal.setAutoTrigger
};
this.loading = true;
@ -295,7 +300,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.cancelAutoTrigger.menu.operation
operation: OperationEvent.Signal.cancelAutoTrigger.menu.operation,
commandType: Commands.Signal.cancelAutoTrigger
};
this.doClose();

View File

@ -64,6 +64,7 @@
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'RouteDetail',
@ -131,7 +132,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.detail.menu.operation
operation: OperationEvent.Signal.detail.menu.operation,
commandType: Commands.Signal.detail
};
this.loading = true;

View File

@ -82,6 +82,7 @@ import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
import ConfirmControl from './childDialog/confirmControl';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'RouteHandControl',
@ -263,7 +264,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.humanControl.menu.operation
operation: OperationEvent.Signal.humanControl.menu.operation,
commandType: Commands.Signal.humanControl
};
this.loading = true;
@ -283,7 +285,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.atsAutoControl.menu.operation
operation: OperationEvent.Signal.atsAutoControl.menu.operation,
commandType: Commands.Signal.atsAutoControl
};
this.loading = true;

View File

@ -55,6 +55,7 @@
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'RouteLock',
@ -133,7 +134,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.lock.menu.operation
operation: OperationEvent.Signal.lock.menu.operation,
commandType: Commands.Signal.lock
};
this.loading = true;

View File

@ -84,6 +84,7 @@
<script>
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { now } from '@/utils/date';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'SectionCmdControl',
@ -359,12 +360,15 @@ export default {
if (this.operation == OperationEvent.Section.unlock.menu.operation) {
/** 区段解封*/
operate.operation = OperationEvent.Section.unlock.confirm2.operation;
operate.commandType = Commands.Section.unlock;
} else if (this.operation == OperationEvent.Section.fault.menu.operation) {
/** 区段故障解锁*/
operate.operation = OperationEvent.Section.fault.confirm2.operation;
operate.commandType = Commands.Section.fault;
} else if (this.operation == OperationEvent.Section.axlePreReset.menu.operation) {
/** 区段计轴预复位*/
operate.operation = OperationEvent.Section.axlePreReset.confirm2.operation;
operate.commandType = Commands.Section.axlePreReset;
}
this.setMessage('');
this.writeRecord({ order: ++this.order, date: now(), context: this.$t('menu.clickSecondConfirm'), result: '' });

View File

@ -37,6 +37,7 @@
<script>
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'SectionControl',
@ -126,7 +127,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Section.type,
operation: OperationEvent.Section.lock.menu.operation
operation: OperationEvent.Section.lock.menu.operation,
commandType: Commands.Section.lock
};
this.loading = true;
@ -146,7 +148,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Section.type,
operation: OperationEvent.Section.split.menu.operation
operation: OperationEvent.Section.split.menu.operation,
commandType: Commands.Section.split
};
this.loading = true;
@ -166,7 +169,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Section.type,
operation: OperationEvent.Section.active.menu.operation
operation: OperationEvent.Section.active.menu.operation,
commandType: Commands.Section.active
};
this.loading = true;

View File

@ -99,6 +99,7 @@
import { OperationEvent } from '@/scripts/ConstDic';
import ConfirmControlSpeed from './childDialog/confirmControlSpeed';
import { now } from '@/utils/date';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'SectionCmdSpeed',
@ -476,15 +477,19 @@ export default {
if (this.operation == OperationEvent.Section.setSpeed.menu.operation) {
/** 区段设置限速*/
operate.operation = OperationEvent.Section.setSpeed.confirm2.operation;
operate.commandType = Commands.Section.setSpeed;
} else if (this.operation == OperationEvent.Section.cancelSpeed.menu.operation) {
/** 区段取消限速*/
operate.operation = OperationEvent.Section.cancelSpeed.confirm2.operation;
operate.commandType = Commands.Section.cancelSpeed;
} else if (this.operation == OperationEvent.Switch.setSpeed.menu.operation) {
/** 道岔设置限速*/
operate.operation = OperationEvent.Switch.setSpeed.confirm2.operation;
operate.commandType = Commands.Switch.setSpeed;
} else if (this.operation == OperationEvent.Switch.cancelSpeed.menu.operation) {
/** 道岔取消限速*/
operate.operation = OperationEvent.Switch.cancelSpeed.confirm2.operation;
operate.commandType = Commands.Switch.cancelSpeed;
}
this.setMessage('');

View File

@ -82,6 +82,7 @@
<script>
import ConfirmControl from './childDialog/confirmControl';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { mapGetters } from 'vuex';
@ -214,6 +215,7 @@ export default {
send: true,
type: MapDeviceType.StationStand.type,
operation: OperationEvent.StationStand.setBackStrategy.menu.operation,
commandType: Commands.StationStand.setBackStrategy,
val: `${this.strategy}`
};

View File

@ -28,6 +28,7 @@
<script>
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'StandDetainTrain',
@ -125,7 +126,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.StationStand.type,
operation: OperationEvent.StationStand.setDetainTrain.menu.operation
operation: OperationEvent.StationStand.setDetainTrain.menu.operation,
commandType: Commands.StationStand.setDetainTrain
};
this.loading = true;
@ -146,7 +148,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.StationStand.type,
operation: OperationEvent.StationStand.cancelDetainTrain.menu.operation
operation: OperationEvent.StationStand.cancelDetainTrain.menu.operation,
commandType: Commands.StationStand.cancelDetainTrain
};
this.loading = true;
@ -167,7 +170,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.StationStand.type,
operation: OperationEvent.StationStand.cancelDetainTrainForce.menu.operation
operation: OperationEvent.StationStand.cancelDetainTrainForce.menu.operation,
commandType: Commands.StationStand.cancelDetainTrainForce
};
this.loading = true;
@ -188,7 +192,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.StationStand.type,
operation: OperationEvent.StationStand.earlyDeparture.menu.operation
operation: OperationEvent.StationStand.earlyDeparture.menu.operation,
commandType: Commands.StationStand.earlyDeparture
};
this.loading = true;
@ -209,6 +214,7 @@ export default {
send: true,
type: MapDeviceType.StationStand.type,
operation: OperationEvent.StationStand.setJumpStop.menu.operation,
commandType: Commands.StationStand.setJumpStop,
val: this.selected.direction // , 01: /02:
};
@ -230,6 +236,7 @@ export default {
send: true,
type: MapDeviceType.StationStand.type,
operation: OperationEvent.StationStand.cancelJumpStop.menu.operation,
commandType: Commands.StationStand.cancelJumpStop,
val: this.selected.direction // , 01: /02:
};

View File

@ -57,6 +57,7 @@
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'StandDetainTrainAll',
@ -157,6 +158,7 @@ export default {
send: true,
type: MapDeviceType.StationStand.type,
operation: OperationEvent.StationStand.cancelDetainTrainAll.menu.operation,
commandType: Commands.StationStand.cancelDetainTrainAll,
val: this.upDown
};

View File

@ -79,6 +79,7 @@
<script>
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { now } from '@/utils/date';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'StationCmdControl',
@ -316,9 +317,11 @@ export default {
if (this.operation == OperationEvent.Station.powerUnLock.menu.operation) {
/** 上电解锁*/
operate.operation = OperationEvent.Station.powerUnLock.confirm2.operation;
operate.commandType = Commands.Station.powerUnLock;
} else if (this.operation == OperationEvent.Station.execKeyOperationTest.menu.operation) {
/** 执行关键操作测试*/
operate.operation = OperationEvent.Station.execKeyOperationTest.confirm2.operation;
operate.commandType = Commands.Station.execKeyOperationTest;
}
this.setMessage('');

View File

@ -29,6 +29,7 @@
<script>
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'StationHumanControlAll',
@ -83,7 +84,8 @@ export default {
send: true,
type: MapDeviceType.Station.type,
label: MapDeviceType.Station.label,
operation: OperationEvent.Station.humanControlALL.menu.operation
operation: OperationEvent.Station.humanControlALL.menu.operation,
commandType: Commands.Station.humanControlALL
};
this.loading = true;

View File

@ -41,6 +41,7 @@
<script>
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'StationSetRouteControlAll',
@ -102,6 +103,7 @@ export default {
type: MapDeviceType.Station.type,
label: MapDeviceType.Station.label,
operation: OperationEvent.Station.atsAutoControlALL.menu.operation,
commandType: Commands.Station.atsAutoControlALL,
val: this.mode
};

View File

@ -84,6 +84,7 @@
<script>
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { now } from '@/utils/date';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'SwitchCmdControl',
@ -376,15 +377,19 @@ export default {
if (this.operation == OperationEvent.Switch.unlock.menu.operation) {
/** 道岔单解*/
operate.operation = OperationEvent.Switch.unlock.confirm2.operation;
operate.commandType = Commands.Switch.unlock;
} else if (this.operation == OperationEvent.Switch.unblock.menu.operation) {
/** 道岔解封*/
operate.operation = OperationEvent.Switch.unblock.confirm2.operation;
operate.commandType = Commands.Switch.unblock;
} else if (this.operation == OperationEvent.Switch.fault.menu.operation) {
/** 道岔故障解锁*/
operate.operation = OperationEvent.Switch.fault.confirm2.operation;
operate.commandType = Commands.Switch.fault;
} else if (this.operation == OperationEvent.Switch.axlePreReset.menu.operation) {
/** 道岔计轴复位*/
operate.operation = OperationEvent.Switch.axlePreReset.confirm2.operation;
operate.commandType = Commands.Switch.axlePreReset;
}
this.setMessage('');

View File

@ -47,6 +47,7 @@
<script>
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'SwitchControl',
@ -154,7 +155,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Switch.type,
operation: OperationEvent.Switch.lock.menu.operation
operation: OperationEvent.Switch.lock.menu.operation,
commandType: Commands.Switch.lock
};
this.loading = true;
@ -174,7 +176,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Switch.type,
operation: OperationEvent.Switch.block.menu.operation
operation: OperationEvent.Switch.block.menu.operation,
commandType: Commands.Switch.block
};
this.loading = true;
@ -194,7 +197,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Switch.type,
operation: OperationEvent.Switch.turnout.menu.operation
operation: OperationEvent.Switch.turnout.menu.operation,
commandType: Commands.Switch.turnout
};
this.loading = true;
@ -214,7 +218,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Switch.type,
operation: OperationEvent.Switch.turnoutForce.menu.operation
operation: OperationEvent.Switch.turnoutForce.menu.operation,
commandType: Commands.Switch.turnoutForce
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
@ -233,7 +238,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Switch.type,
operation: OperationEvent.Switch.split.menu.operation
operation: OperationEvent.Switch.split.menu.operation,
commandType: Commands.Switch.split
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
@ -252,7 +258,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Switch.type,
operation: OperationEvent.Switch.active.menu.operation
operation: OperationEvent.Switch.active.menu.operation,
commandType: Commands.Switch.active
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {

View File

@ -84,6 +84,7 @@
<script>
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import Commands from '@/scripts/plugin/Commands';
import ConfirmTrain from './childDialog/confirmTrain';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import OperateHandler from '@/scripts/plugin/OperateHandler';
@ -349,8 +350,10 @@ export default {
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNoChange.operation;
operate.commandType = Commands.Train.addTrainId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainNoChange.operation;
operate.commandType = Commands.Train.editTrainId;
}
OperateHandler.backStep(1);
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
@ -396,6 +399,7 @@ export default {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.addTrainId.menu.operation,
commandType: Commands.Train.addTrainId,
messages: [this.$t('tip.addTrainIdTip')],
val: `${model.groupNumber}::${model.trainType}::${model.serviceNumber}::${model.tripNumber}::${model.targetCode}`
};
@ -426,6 +430,7 @@ export default {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.editTrainId.menu.operation,
commandType: Commands.Train.editTrainId,
messages: [this.$t('tip.editTrainIdTip')],
val: `${this.formModel.trainType}::${this.formModel.tripNumber}`
};

View File

@ -40,6 +40,7 @@
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'RouteCreate',
@ -120,6 +121,7 @@ export default {
send: true,
type: MapDeviceType.Section.type,
operation: OperationEvent.Section.newtrain.menu.operation,
commandType: Commands.Section.newtrain,
val: '' + this.direction + '::' + this.trainCode
};
this.loading = true;

View File

@ -34,6 +34,7 @@ import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
// import { getPublishMapTrainNos } from '@/api/runplan';
import ConfirmControl from './childDialog/confirmControl';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'TrainDelete',
@ -129,6 +130,7 @@ export default {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.delTrainId.menu.operation,
commandType: Commands.Train.delTrainId,
val: this.formModel.groupNumber
};

View File

@ -29,6 +29,7 @@
<script>
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'TrainMove',
@ -91,7 +92,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.editTrainNo.menu.operation
operation: OperationEvent.Train.editTrainNo.menu.operation,
commandType: Commands.Train.editTrainNo
};
this.loading = true;

View File

@ -75,6 +75,7 @@
<script>
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'TrainMove',
@ -153,7 +154,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.moveTrainId.menu.operation
operation: OperationEvent.Train.moveTrainId.menu.operation,
commandType: Commands.Train.moveTrainId
};
this.loading = true;

View File

@ -76,6 +76,7 @@
<script>
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'TrainSwitch',
@ -158,7 +159,8 @@ export default {
const operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.moveTrainId.menu.operation
operation: OperationEvent.Train.moveTrainId.menu.operation,
commandType: Commands.Train.moveTrainId
};
this.loading = true;

View File

@ -32,6 +32,7 @@
<script>
import { OperationEvent, checkOperationIsCurrentOperate } from '@/scripts/ConstDic';
import NoticeInfo from '../../dialog/childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'TwoConfirmation',
@ -118,10 +119,13 @@ export default {
if (checkOperationIsCurrentOperate(this.operate.operation, OperationEvent.StationControl.forcedStationControl)) {
operate.operation = OperationEvent.StationControl.forcedStationControl.confirm.operation;
operate.commandType = Commands.StationControl.forcedStationControl;
} else if (checkOperationIsCurrentOperate(this.operate.operation, OperationEvent.StationControl.requestStationControl)) {
operate.operation = OperationEvent.StationControl.requestStationControl.confirm.operation;
operate.commandType = Commands.StationControl.requestStationControl;
} else if (checkOperationIsCurrentOperate(this.operate.operation, OperationEvent.StationControl.requestCentralControl)) {
operate.operation = OperationEvent.StationControl.requestCentralControl.confirm.operation;
operate.commandType = Commands.StationControl.requestCentralControl;
}
this.doClose();

View File

@ -16,6 +16,7 @@ import SectionCmdControl from './dialog/sectionCmdControl';
import SpeedCmdControl from './dialog/speedCmdControl';
import TrainCreate from './dialog/trainCreate';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
@ -224,7 +225,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.stoppage.menu.operation
operation: OperationEvent.Section.stoppage.menu.operation,
commandType: Commands.Section.stoppage
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
@ -244,7 +246,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.cancelStoppage.menu.operation
operation: OperationEvent.Section.cancelStoppage.menu.operation,
commandType: Commands.Section.cancelStoppage
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
@ -376,7 +379,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.cancelSpeed.menu.operation
operation: OperationEvent.Section.cancelSpeed.menu.operation,
commandType: Commands.Section.query
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {

View File

@ -20,6 +20,7 @@ import RouteCmdControl from './dialog/routeCmdControl';
import RouteHandControl from './dialog/routeHandControl';
import RouteDetail from './dialog/routeDetail';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
@ -254,7 +255,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.stoppage.menu.operation
operation: OperationEvent.Signal.stoppage.menu.operation,
commandType: Commands.Signal.stoppage
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
@ -274,7 +276,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.cancelStoppage.menu.operation
operation: OperationEvent.Signal.cancelStoppage.menu.operation,
commandType: Commands.Signal.cancelStoppage
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
@ -294,7 +297,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.arrangementRoute.menu.operation
operation: OperationEvent.Signal.arrangementRoute.menu.operation,
commandType: Commands.Signal.query
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
@ -334,7 +338,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.lock.menu.operation
operation: OperationEvent.Signal.lock.menu.operation,
commandType: Commands.Signal.lock
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
@ -482,7 +487,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.humanControl.menu.operation
operation: OperationEvent.Signal.humanControl.menu.operation,
commandType: Commands.Signal.query
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
@ -503,7 +509,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.atsAutoControl.menu.operation
operation: OperationEvent.Signal.atsAutoControl.menu.operation,
commandType: Commands.Signal.query
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
@ -524,7 +531,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.detail.menu.operation
operation: OperationEvent.Signal.detail.menu.operation,
commandType: Commands.Signal.query
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {

View File

@ -18,6 +18,7 @@ import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, menuFiltration } from './utils/menuItemStatus';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'StationMenu',
@ -165,7 +166,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Station.type,
label: MapDeviceType.Station.label,
operation: OperationEvent.Station.stoppage.menu.operation
operation: OperationEvent.Station.stoppage.menu.operation,
commandType: Commands.Station.stoppage
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
@ -185,7 +187,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Station.type,
label: MapDeviceType.Station.label,
operation: OperationEvent.Station.cancelStoppage.menu.operation
operation: OperationEvent.Station.cancelStoppage.menu.operation,
commandType: Commands.Station.cancelStoppage
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
@ -205,7 +208,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Station.type,
label: MapDeviceType.Station.label,
operation: OperationEvent.Station.setAutoTrigger.menu.operation
operation: OperationEvent.Station.setAutoTrigger.menu.operation,
commandType: Commands.Station.setAutoTrigger
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
@ -223,7 +227,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Station.type,
label: MapDeviceType.Station.label,
operation: OperationEvent.Station.cancelAutoTrigger.menu.operation
operation: OperationEvent.Station.cancelAutoTrigger.menu.operation,
commandType: Commands.Station.cancelAutoTrigger
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {

View File

@ -24,6 +24,7 @@ import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, menuFiltration } from './utils/menuItemStatus';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'StationStandMenu',
@ -247,7 +248,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.stoppage.menu.operation
operation: OperationEvent.StationStand.stoppage.menu.operation,
commandType: Commands.StationStand.query
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
@ -267,7 +269,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.cancelStoppage.menu.operation
operation: OperationEvent.StationStand.cancelStoppage.menu.operation,
commandType: Commands.StationStand.cancelStoppage
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
@ -384,7 +387,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.setStopTime.menu.operation
operation: OperationEvent.StationStand.setStopTime.menu.operation,
commandType: Commands.StationStand.query
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
@ -407,7 +411,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.setRunLevel.menu.operation
operation: OperationEvent.StationStand.setRunLevel.menu.operation,
commandType: Commands.StationStand.query
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
@ -444,7 +449,8 @@ export default {
send: true,
code: this.selected.code,
type: MapDeviceType.StationStand.type,
operation: OperationEvent.StationStand.setBackStrategy.menu.operation
operation: OperationEvent.StationStand.setBackStrategy.menu.operation,
commandType: Commands.StationStand.query
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
@ -468,7 +474,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.StationStand.type,
label: MapDeviceType.StationStand.label,
operation: OperationEvent.StationStand.detail.menu.operation
operation: OperationEvent.StationStand.detail.menu.operation,
commandType: Commands.StationStand.detail
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {

View File

@ -14,6 +14,7 @@ import SwitchControl from './dialog/switchControl';
import SwitchCmdControl from './dialog/switchCmdControl';
import SpeedCmdControl from './dialog/speedCmdControl';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
@ -250,7 +251,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.stoppage.menu.operation
operation: OperationEvent.Switch.stoppage.menu.operation,
commandType: Commands.Switch.stoppage
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
@ -270,7 +272,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.cancelStoppage.menu.operation
operation: OperationEvent.Switch.cancelStoppage.menu.operation,
commandType: Commands.Switch.cancelStoppage
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
@ -469,7 +472,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.cancelSpeed.menu.operation
operation: OperationEvent.Switch.cancelSpeed.menu.operation,
commandType: Commands.Switch.cancelSpeed
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {

View File

@ -17,6 +17,7 @@ import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, trainMenuFiltration } from './utils/menuItemStatus';
import Commands from '@/scripts/plugin/Commands';
import TrainControl from './dialog/trainControl';
import TrainDelete from './dialog/trainDelete';
import TrainMove from './dialog/trainMove';
@ -168,7 +169,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.stoppage.menu.operation
operation: OperationEvent.Train.stoppage.menu.operation,
commandType: Commands.Train.stoppage
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
@ -188,7 +190,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.cancelStoppage.menu.operation
operation: OperationEvent.Train.cancelStoppage.menu.operation,
commandType: Commands.Train.cancelStoppage
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
@ -208,7 +211,8 @@ export default {
code: this.selected.code,
type: MapDeviceType.Train.type,
label: MapDeviceType.Train.label,
operation: OperationEvent.Train.limitSpeed.menu.operation
operation: OperationEvent.Train.limitSpeed.menu.operation,
commandType: Commands.Train.limitSpeed
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {

View File

@ -61,6 +61,7 @@
<script>
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import NoticeInfo from '../dialog/childDialog/childDialog/noticeInfo';
import Commands from '@/scripts/plugin/Commands';
export default {
name: 'RequestControl',
@ -261,6 +262,7 @@ export default {
over: true,
type: MapDeviceType.StationControl.type,
operation: OperationEvent.StationControl.controlResponse.agree.operation,
commandType: this.$store.state.training.prdType == '01' ? Commands.StationControl.stationAgree : Commands.StationControl.centralAgree,
code: this.selection[0].code,
val: this.commandId,
prdType: this.$store.state.training.prdType
@ -283,6 +285,7 @@ export default {
over: true,
type: MapDeviceType.StationControl.type,
operation: OperationEvent.StationControl.controlResponse.refuse.operation,
commandType: this.$store.state.training.prdType == '01' ? Commands.StationControl.stationRefuse : Commands.StationControl.centralRefuse,
code: this.selection.length ? this.selection[0].code : '',
val: this.commandId,
prdType: this.$store.state.training.prdType

View File

@ -43,4 +43,3 @@ new Vue({
i18n,
render: h => h(App)
});

View File

@ -7,18 +7,23 @@ class CommandHandle {
this.instructionMap = {};
}
getInstruction(type) {
return this.instructionMap[type] || {};
getInstruction(operation) {
return this.instructionMap[operation] || {};
}
getCommand(operates) {
const operate = operates[operates.length - 1];
const instruction = this.getInstruction(operate.type);
if (operate && operate.send && instruction) {
return {
type: instruction.type,
params: operates
};
const operate = operates[operates.length - 1] || {};
if (operate && operate.instructionType) {
const instruction = this.getInstruction(operate.instructionType);
if (instruction) {
return {
...instruction,
paramList: this.getParamsList(operates),
over: operate.over
};
} else {
return { error: true };
}
}
return null;

View File

@ -0,0 +1,243 @@
export default {
Switch: {
// 取消故障
cancelStoppage: 999,
// 道岔故障
stoppage: 0,
// 道岔总定/定位操作
locate: 1,
// 道岔总反/反位操作
reverse: 2,
// 道岔单锁
lock: 3,
// 道岔解锁
unlock: 4,
// 道岔封闭
block: 5,
// 道岔解封
unblock: 6,
// 转动
turnout: 7,
// 强制扳动
turnoutForce: 8,
// 道岔故障解锁
fault: 9,
// 计轴预复位
axlePreReset: 10,
// 切除
split: 11,
// 激活
active: 12,
// 设置速度
setSpeed: 13,
// 取消速度
cancelSpeed: 14,
// 查询区段详情
query: 15,
// 设置限速
setLimitSpeed: 16,
// 确认计轴有效
alxeEffective: 17,
// 引导总锁
guideLock: 18
},
// 控制模式操作
StationControl: {
// 取消故障
cancelStoppage: 999,
// 故障
stoppage: 0,
// 紧急站控
emergencyStationControl: 1,
// 请求站控
requestStationControl: 2,
// 强行站控
forcedStationControl: 3,
// 请求中控
requestCentralControl: 4,
// 中心控同意
centralAgree: 5,
// 中心控拒绝
centralRefuse: 6,
// 车站控同意
stationAgree: 7,
// 车站控拒绝
stationRefuse: 8
},
// 信号机操作
Signal: {
// 取消故障
cancelStoppage: 999,
// 故障
stoppage: 0,
// 查询进路
query: 1,
// 排列进路
arrangementRoute: 2,
// 取消进路
cancelTrainRoute: 3,
// 信号重开
reopenSignal: 4,
// 人解列车进路 (总人解)
humanTrainRoute: 5,
// 封锁
lock: 6,
// 解锁
unlock: 7,
// 引导
guide: 8,
// 设置联锁自动进路
setAutoInterlock: 9,
// 取消联锁自动进路
cancelAutoInterlock: 10,
// 设置联锁自动触发
setAutoTrigger: 11,
// 取消联锁自动触发
cancelAutoTrigger: 12,
// 信号关灯
signalClose: 13,
// 进路交人工控
humanControl: 14,
// 进路交自动控
atsAutoControl: 15,
// 查询进路状态
detail: 16
},
// 物理区段操作
Section: {
// 取消故障
cancelStoppage: 999,
// 故障
stoppage: 0,
// 设置计轴失效
alxeFailure: 1,
// 查询区段详情
query: 1,
// 区故解
fault: 2,
// 封锁
lock: 3,
// 解锁
unlock: 4,
// 切除
split: 5,
// 激活
active: 6,
// 设置速度
setSpeed: 7,
// 取消速度
cancelSpeed: 8,
// 计轴预复位
axlePreReset: 9,
// 设备状态
detail: 10,
// 新建列车
newtrain: 11,
// 确认计轴有效
alxeEffective: 12,
// 设置临时限速
setLimitSpeed: 13,
// 确认临时限速
confirmLimit: 14
// 区段详情
// detail: 15
},
// 站台
StationStand: {
// 取消故障
cancelStoppage: 999,
// 故障
stoppage: 0,
// 提前发车
earlyDeparture: 1,
// 设置跳停
setJumpStop: 2,
// 取消跳停
cancelJumpStop: 3,
// 设置扣车
setDetainTrain: 4,
// 取消扣车
cancelDetainTrain: 5,
// 强制取消扣车
cancelDetainTrainForce: 6,
// 站台详细信息
detail: 7,
// 全线取消扣车
cancelDetainTrainAll: 8,
// 设置停站时间
setStopTime: 9,
// 设置运行等级
setRunLevel: 10,
// 设置折返策略
setBackStrategy: 11,
// 设置全线扣车
setDetainTrainAll: 12,
cancelUpDetainTrainAll: 13,
cancelDownDetainTrainAll: 14
},
Station: {
// 取消故障
cancelStoppage: 999,
// 故障
stoppage: 0,
// 全站设置联锁自动触发
setAutoTrigger: 1,
// 全站取消联锁自动触发
cancelAutoTrigger: 2,
// 上电解锁
powerUnLock: 3,
// 执行关键操作测试
execKeyOperationTest: 4,
// 所有进路自排关
humanControlALL: 5,
// 所有进路自排开
atsAutoControlALL: 6,
split: 7,
active: 8
},
// 列车
Train: {
// 取消故障
cancelStoppage: 999,
// 故障
stoppage: 0,
// 添加列车识别号
addTrainId: 1,
// 修改列车识别号
editTrainId: 2,
// 删除列车识别号
delTrainId: 3,
// 移动列车识别号
moveTrainId: 4,
// 交换列车识别号
switchTrainId: 5,
// 修改车组号
editTrainNo: 6,
// 限速行驶
limitSpeed: 7,
// 设置计划车
setPlanTrainId: 8,
// 添加计划车
addPlanTrainId: 9,
// 平移计划车
movetypelyTrainId: 10,
// 删除计划车
deletePlanTrainId: 11,
// 设目的地车
destinationTrainId: 12,
// 设人工车
artificialTrainId: 13
},
// 取消全线临时限速
LimitControl: {
CancelAllLimit: 1
}
};

View File

@ -1,203 +1,8 @@
import store from '@/store';
import router from '@/router';
import OperateConverter from '@/scripts/plugin/OperateConvert2Command';
import CommandHandler from './CommandHandler.js';
import { TrainingMode } from '@/scripts/ConstDic';
import { getConverter } from '@/scripts/plugin/Converter/manager';
import { sendTrainingNextStep } from '@/api/jmap/training';
import { Message } from 'element-ui';
import { OperationEvent } from '@/scripts/ConstDic';
import LangStorage from '@/utils/lang';
import OperateHandler1 from './OperateHandler1.js';
import OperateHandler2 from './OperateHandler2.js';
import Cookies from 'js-cookie';
const isNewCmd = false;
class OperateHandler {
constructor() {
this.operates = []; // 操作数据
this.command = {}; // 命令对象
}
const OPERATEHANDLER_KEY = 'OperateHandler';
Cookies.set(OPERATEHANDLER_KEY, 1);
/** 操作组 */
backStep(num) {
this.operates = this.operates.slice(0, num);
}
/** 清空操作组 */
cleanOperates() {
this.operates.splice(0, this.operates.length);
}
/** 判断操作步骤是否正确 */
judge (operate) {
const steps = this.getSteps();
const order = this.getOrder();
let valid = false;
if (order < steps.length) {
const standard = steps[order];
if (operate && standard && operate.code == standard.code && operate.type == standard.type &&
operate.operation == standard.operation &&
operate.val == standard.val) {
valid = true;
}
}
return valid;
}
getCommand(operate) {
let command = null;
if (operate.send) {
command = CommandHandler.getCommand(this.operates);
if (command && command.error) {
this.operates.pop();
store.dispatch('training/setTempStep', null);
command = null;
} else if (command && command.over) {
OperateHandler.cleanOperates();
store.dispatch('menuOperation/setButtonOperation', null);
}
this.command = command;
} else {
if (operate.operation === OperationEvent.Command.cancel.menu.operation || operate.over) {
OperateHandler.cleanOperates();
}
}
return command;
}
commandConvert(operate) {
const converter = getConverter(this.operates);
if (converter && converter.preHandle instanceof Function) {
Object.assign(operate, converter.preHandle(this.operates) || {});
}
}
/** 步骤前处理*/
preProcessor(operate) {
// 按钮操作之后,第二步错误操作菜单的情况,需要直接返回
if ((this.operates.length && operate.start === true) && (this.operates[0].type === 'mbm')) {
return false;
}
// 如果是正常的第一步操作需要清空operates数组
if (operate.type === 'mbm' || operate.type === 'bar' || operate.start === true) {
this.cleanOperates();
}
// 记录步骤数据
this.operates.push(operate);
// 构造命令
if (isNewCmd) {
this.command = this.getCommand(operate);
} else {
this.commandConvert(operate);
}
}
/** 步骤后处理*/
postProcessor(operate, valid) {
const basicInfo = store.getters['training/basicInfo'];
if (basicInfo.id && valid) {
// 发送记录步骤数据
const group = router.currentRoute.query.group;
sendTrainingNextStep({ trainingId: basicInfo.id, operate: operate }, group);
}
if (!valid) {
this.operates.pop();
} else {
if (operate.cancel === true) {
this.cleanOperates();
}
}
}
/** 根据模式验证操作步骤 */
validate(operate) {
this.preProcessor(operate);
let valid = true;
if (TrainingMode.EDIT === this.getTrainingMode()) {
// 编辑制作模式
if (this.getOperateBreakStatus()) {
valid = false;
const tip = LangStorage.getLang() == 'en' ? 'Please enter a hint and click next' : '请输入提示并点击下一步';
Message.error(tip);
this.operates.pop();
return valid;
}
if (this.getTrainingStart()) {
store.dispatch('training/setTempStep', operate);
}
} else if (TrainingMode.TEACH === this.getTrainingMode() || TrainingMode.PRACTICE === this.getTrainingMode()) {
// 教学模式/练习模式
if (this.getTrainingStart()) {
valid = this.judge(operate);
} else {
this.cleanOperates();
valid = false;
}
}
this.postProcessor(operate, valid);
return valid;
}
handle(operate) {
return new Promise((resolve, reject) => {
const rtn = { valid: false, response: null };
const valid = this.validate(operate);
rtn.valid = valid;
if (valid) {
if (isNewCmd) {
CommandHandler.execute(this.command).then(response => {
rtn.response = response;
resolve(rtn);
}).catch(error => {
reject(error);
});
} else {
OperateConverter.convertAndSend(operate).then(response => {
rtn.response = response;
resolve(rtn);
}).catch(error => {
reject(error);
});
}
} else {
resolve(rtn);
}
});
}
getTrainingMode () {
return store.state.training.mode;
}
getSteps() {
return store.state.training.steps;
}
getOrder() {
return store.state.training.order;
}
getTrainingStart() {
return store.state.training.started;
}
getOperateBreakStatus () {
return store.state.menuOperation.break;
}
}
export default new OperateHandler();
export default Cookies.get(OPERATEHANDLER_KEY) ? OperateHandler1 : OperateHandler2;

View File

@ -0,0 +1,147 @@
import store from '@/store';
import router from '@/router';
import OperateConverter from '@/scripts/plugin/OperateConvert2Command';
import { TrainingMode } from '@/scripts/ConstDic';
import { getConverter } from '@/scripts/plugin/Converter/manager';
import { sendTrainingNextStep } from '@/api/jmap/training';
import { Message } from 'element-ui';
import LangStorage from '@/utils/lang';
var OperateHandler = function () {
};
OperateHandler.prototype = {
/** 操作组 */
operates: [],
backStep: function(num) {
this.operates = this.operates.slice(0, num);
},
/** 清空操作组 */
cleanOperates: function () {
this.operates.splice(0, this.operates.length);
},
/**
* 判断操作步骤是否正确
*/
judge: function (operate) {
let valid = false;
const steps = this.getSteps();
const order = this.getOrder();
if (order >= steps) {
return valid;
}
// debugger;
const standard = steps[order];
if (operate && standard && operate.code == standard.code && operate.type == standard.type &&
operate.operation == standard.operation &&
operate.val == standard.val) {
valid = true;
}
return valid;
},
/**
* 根据模式验证操作步骤
*/
validate: function (operate) {
// 按钮操作之后,第二步错误操作菜单的情况,需要直接返回
if ((this.operates.length && operate.start === true) && (this.operates[0].type === 'mbm')) {
return false;
}
// 如果是正常的第一步操作需要清空operates数组
if (operate.type === 'mbm' || operate.type === 'bar' || operate.start === true) {
this.cleanOperates();
}
this.operates.push(operate);
// 预处理
const converter = getConverter(this.operates);
if (converter && converter.preHandle instanceof Function) {
operate = converter.preHandle(this.operates);
}
let valid = true;
const mode = this.getTrainingMode();
if (TrainingMode.EDIT === mode) {
// 编辑制作模式
if (this.getOperateBreakStatus()) {
valid = false;
const tip = LangStorage.getLang() == 'en' ? 'Please enter a hint and click next' : '请输入提示并点击下一步';
Message.error(tip);
this.operates.pop();
return valid;
}
if (this.getTrainingStart()) {
store.dispatch('training/setTempStep', operate);
}
} else if (TrainingMode.TEACH === mode || TrainingMode.PRACTICE === mode) {
// 教学模式/练习模式
if (this.getTrainingStart()) {
valid = this.judge(operate);
} else {
this.cleanOperates();
valid = false;
}
}
// 发送每一步的步骤数据;
const basicInfo = store.getters['training/basicInfo'];
if (basicInfo.id && valid) {
const group = router.currentRoute.query.group;
sendTrainingNextStep({ trainingId: basicInfo.id, operate: operate }, group);
}
if (!valid) {
// 如果操作校验不正确,回退
this.operates.pop();
} else {
if (operate.cancel === true) {
this.cleanOperates();
}
}
return valid;
},
handle: function (operate) {
return new Promise((resolve, reject) => {
const rtn = { valid: false, response: null };
const valid = this.validate(operate);
rtn.valid = valid;
if (valid) {
// 改变状态开始请求
OperateConverter.convertAndSend(operate).then(response => {
rtn.response = response;
resolve(rtn);
}).catch(error => {
reject(error);
});
} else {
resolve(rtn);
}
});
},
getTrainingMode: function () {
return store.state.training.mode;
},
getSteps: function () {
return store.state.training.steps;
},
getOrder: function () {
return store.state.training.order;
},
getTrainingStart: function () {
return store.state.training.started;
},
getOperateBreakStatus: function () {
return store.state.menuOperation.break;
}
};
export default new OperateHandler();

View File

@ -0,0 +1,179 @@
import store from '@/store';
import router from '@/router';
import CommandHandler from './CommandHandler.js';
import { TrainingMode } from '@/scripts/ConstDic';
import { sendTrainingNextStep } from '@/api/jmap/training';
import { Message } from 'element-ui';
import { OperationEvent } from '@/scripts/ConstDic';
import LangStorage from '@/utils/lang';
class OperateHandler {
constructor() {
this.operates = []; // 操作数据
this.command = {}; // 命令对象
}
/** 操作组 */
backStep(num) {
this.operates = this.operates.slice(0, num);
}
/** 清空操作组 */
cleanOperates() {
this.operates.splice(0, this.operates.length);
}
/** 判断操作步骤是否正确 */
judge (operate) {
const steps = this.getSteps();
const order = this.getOrder();
let valid = false;
if (order < steps.length) {
const standard = steps[order];
if (operate && standard && operate.code == standard.code && operate.type == standard.type &&
operate.operation == standard.operation &&
operate.val == standard.val) {
valid = true;
}
}
return valid;
}
getCommand(operate) {
let command = null;
if (operate.send) {
command = CommandHandler.getCommand(this.operates);
if (command && command.error) {
this.operates.pop();
store.dispatch('training/setTempStep', null);
command = null;
} else if (command && command.over) {
this.cleanOperates();
store.dispatch('menuOperation/setButtonOperation', null);
}
this.command = command;
} else {
if (operate.operation === OperationEvent.Command.cancel.menu.operation || operate.over) {
this.cleanOperates();
}
}
return command;
}
/** 步骤前处理*/
preProcessor(operate) {
// 按钮操作之后,第二步错误操作菜单的情况,需要直接返回
if ((this.operates.length && operate.start === true) && (this.operates[0].type === 'mbm')) {
return false;
}
// 如果是正常的第一步操作需要清空operates数组
if (['mbm', 'bar'].includes(operate.type) || operate.start === true) {
this.cleanOperates();
}
// 记录步骤数据
this.operates.push(operate);
// 构造命令
this.command = this.getCommand(operate);
}
/** 步骤后处理*/
postProcessor(operate, valid) {
const basicInfo = store.getters['training/basicInfo'];
if (basicInfo.id && valid) {
// 发送记录步骤数据
const group = router.currentRoute.query.group;
sendTrainingNextStep({ trainingId: basicInfo.id, operate: operate }, group);
}
if (!valid) {
this.operates.pop();
} else {
if (operate.cancel === true) {
this.cleanOperates();
}
}
}
/** 根据模式验证操作步骤 */
validate(operate) {
this.preProcessor(operate);
let valid = true;
if (TrainingMode.EDIT === this.getTrainingMode()) {
// 编辑制作模式
if (this.getOperateBreakStatus()) {
valid = false;
const tip = LangStorage.getLang() == 'en' ? 'Please enter a hint and click next' : '请输入提示并点击下一步';
Message.error(tip);
this.operates.pop();
return valid;
}
if (this.getTrainingStart()) {
store.dispatch('training/setTempStep', operate);
}
} else if (TrainingMode.TEACH === this.getTrainingMode() || TrainingMode.PRACTICE === this.getTrainingMode()) {
// 教学模式/练习模式
if (this.getTrainingStart()) {
valid = this.judge(operate);
} else {
this.cleanOperates();
valid = false;
}
}
this.postProcessor(operate, valid);
return valid;
}
handle(operate) {
return new Promise((resolve, reject) => {
const rtn = { valid: false, response: null };
const valid = this.validate(operate);
rtn.valid = valid;
if (valid) {
CommandHandler.execute(this.command).then(response => {
rtn.response = response;
resolve(rtn);
}).catch(error => {
reject(error);
});
} else {
resolve(rtn);
}
});
}
getTrainingMode () {
return store.state.training.mode;
}
getSteps() {
return store.state.training.steps;
}
getOrder() {
return store.state.training.order;
}
getTrainingStart() {
return store.state.training.started;
}
getOperateBreakStatus () {
return store.state.menuOperation.break;
}
}
export default new OperateHandler();

View File

@ -3,10 +3,11 @@ import { TrainingMode } from '@/scripts/ConstDic';
import OperateHandler from '@/scripts/plugin/OperateHandler';
import deviceType from '../../jmap/constant/deviceType';
import LangStorage from '@/utils/lang';
// const lang = LangStorage.getLang();
/**
* 实训状态数据
*/
const training = {
namespaced: true,