修改代码格式

This commit is contained in:
zyy 2019-08-08 16:47:34 +08:00
parent a250833772
commit 6c5469ec90
16 changed files with 2235 additions and 2202 deletions

View File

@ -63,7 +63,8 @@ export default {
},
props: {
selected: {
type: Object
type: Object,
required: true
}
},
computed: {

View File

@ -99,7 +99,6 @@
<script>
import { mapGetters } from 'vuex';
import { TrainingMode, OperationEvent } from '@/scripts/ConstDic';
// import { OperateMode, checkOperationIsCurrentOperate } from '@/scripts/ConstDic';
import { menuBarConvert, SystemType } from './utils/menuItemStatus';
import StationControl from './menuDialog/stationControl';
import DetainTrainContorl from './menuDialog/detainTrainContorl';
@ -133,7 +132,8 @@ export default {
},
props: {
selected: {
type: Object
type: Object,
required: true
}
},
data() {

View File

@ -1,325 +1,368 @@
<template>
<div class="menu" style="height: 45px;" :style="{left: point.x+'px', top: point.y+'px' }" v-if="isShowBtn">
<button :style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
:id='Signal.arrangementRoute.button.domId' @click="buttonDown(Signal.arrangementRoute.button.operation)">
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button :style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
:id="Signal.cancelTrainRoute.button.domId" @click="buttonDown(Signal.cancelTrainRoute.button.operation)">
<span style="color: black">
<center>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button :style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
:id="Signal.humanTrainRoute.button.domId" @click="buttonDown(Signal.humanTrainRoute.button.operation)">
<span style="color: red">
<center>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button :style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
:id="Signal.reopenSignal.button.domId" @click="buttonDown(Signal.reopenSignal.button.operation)">
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button :style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
:id="Signal.guide.button.domId" @click="buttonDown(Signal.guide.button.operation)">
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button :style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}" id="mbm_06"
@click="buttonDown('mbm_06')">
<span style="color: red">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button :style="{display: 'block', float: 'left', width: width+'px',backgroundColor:buttonUpColor}"
:id="Switch.locate.button.domId" @click="buttonDown(Switch.locate.button.operation)">
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button :style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
:id="Switch.reverse.button.domId" @click="buttonDown(Switch.reverse.button.operation)">
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button :style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
:id="Switch.lock.button.domId" @click="buttonDown(Switch.lock.button.operation)">
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button :style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
:id="Switch.unlock.button.domId" @click="buttonDown(Switch.unlock.button.operation)">
<span style="color: red">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button :style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
:id="Signal.setAutoInterlock.button.domId" @click="buttonDown(Signal.setAutoInterlock.button.operation)">
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button :style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
:id="Section.fault.button.domId" @click="buttonDown(Section.fault.button.operation)">
<span style="color: black">
<center>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button :style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
:id="Section.axlePreReset.button.domId" @click="buttonDown(Section.axlePreReset.button.operation)">
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button :style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}" id="mbm_11"
@click="buttonDown('mbm_11')">
<span style="color: black">
<center>
<b style="color:deepskyblue"></b>
<b style="color:burlywood"></b>
</center>
<center>
<b style="color: red"></b>
<b style="color:forestgreen"></b>
</center>
</span>
</button>
<button :style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}" id="mbm_12"
@click="buttonDown('mbm_12')">
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
</div>
<div v-if="isShowBtn" class="menu" style="height: 45px;" :style="{left: point.x+'px', top: point.y+'px' }">
<button
:id="Signal.arrangementRoute.button.domId"
:style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
@click="buttonDown(Signal.arrangementRoute.button.operation)"
>
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button
:id="Signal.cancelTrainRoute.button.domId"
:style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
@click="buttonDown(Signal.cancelTrainRoute.button.operation)"
>
<span style="color: black">
<center>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button
:id="Signal.humanTrainRoute.button.domId"
:style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
@click="buttonDown(Signal.humanTrainRoute.button.operation)"
>
<span style="color: red">
<center>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button
:id="Signal.reopenSignal.button.domId"
:style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
@click="buttonDown(Signal.reopenSignal.button.operation)"
>
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button
:id="Signal.guide.button.domId"
:style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
@click="buttonDown(Signal.guide.button.operation)"
>
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button
id="mbm_06"
:style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
@click="buttonDown('mbm_06')"
>
<span style="color: red">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button
:id="Switch.locate.button.domId"
:style="{display: 'block', float: 'left', width: width+'px',backgroundColor:buttonUpColor}"
@click="buttonDown(Switch.locate.button.operation)"
>
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button
:id="Switch.reverse.button.domId"
:style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
@click="buttonDown(Switch.reverse.button.operation)"
>
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button
:id="Switch.lock.button.domId"
:style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
@click="buttonDown(Switch.lock.button.operation)"
>
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button
:id="Switch.unlock.button.domId"
:style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
@click="buttonDown(Switch.unlock.button.operation)"
>
<span style="color: red">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button
:id="Signal.setAutoInterlock.button.domId"
:style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
@click="buttonDown(Signal.setAutoInterlock.button.operation)"
>
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button
:id="Section.fault.button.domId"
:style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
@click="buttonDown(Section.fault.button.operation)"
>
<span style="color: black">
<center>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button
:id="Section.axlePreReset.button.domId"
:style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
@click="buttonDown(Section.axlePreReset.button.operation)"
>
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
<button
id="mbm_11"
:style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
@click="buttonDown('mbm_11')"
>
<span style="color: black">
<center>
<b style="color:deepskyblue"></b>
<b style="color:burlywood"></b>
</center>
<center>
<b style="color: red"></b>
<b style="color:forestgreen"></b>
</center>
</span>
</button>
<button
id="mbm_12"
:style="{display: 'block', float: 'left', width: width+'px', backgroundColor:buttonUpColor}"
@click="buttonDown('mbm_12')"
>
<span style="color: black">
<center>
<b></b>
<b></b>
</center>
<center>
<b></b>
<b></b>
</center>
</span>
</button>
</div>
</template>
<script>
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
import { getDomOffset } from '@/utils/index';
import OperateHandler from '@/scripts/plugin/trainingOperateHandler';
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
import OperateHandler from '@/scripts/plugin/trainingOperateHandler';
export default {
name: 'MapButtonMenu',
data() {
return {
__type: 'mbm',
point: {
x: -1000,
y: -1000
},
operation: '0',
buttonName: '',
buttonDownColor: '#A8A8A8',
buttonUpColor: '#DCDCDC',
width: 58,
tempData: null,
offset: {},
}
},
computed: {
Switch() {
return OperationEvent.Switch;
},
Section() {
return OperationEvent.Section;
},
Signal() {
return OperationEvent.Signal;
},
isShowBtn() {
return this.$store.state.training.prdType == '01';
}
},
watch: {
'$store.state.config.canvasOffsetCount': function (val) {
this.resetPosition();
},
'$store.state.menuOperation.buttonOperation': function (val, old) {
this.updateButtonShow(val, old);
},
'$store.state.menuOperation.selectedCount': function (val) {
this.selectedChange();
},
},
mounted() {
this.resetPosition();
},
methods: {
resetPosition() {
this.$nextTick(() => {
let canvasOffset = this.$store.state.config.canvasOffset;
this.point = {
x: canvasOffset.x + 20,
y: canvasOffset.y + this.$store.state.config.height - 65
}
this.$store.dispatch('training/tipReload');
})
},
updateButtonShow(val, old) {
if (old) {
//
let domId = getDomIdByOperation(old);
let dom = document.getElementById(domId);
if (dom) {
dom.disabled = false;
dom.style.backgroundColor = this.buttonUpColor;
}
}
if (val) {
//
let domId = getDomIdByOperation(val);
let dom = document.getElementById(domId);
if (dom) {
dom.disabled = true;
dom.style.backgroundColor = this.buttonDownColor;
}
}
},
buttonDown(operation) {
let operate = {
type: 'mbm',
operation: operation
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/setButtonOperation', operation); //
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('training/emitTipFresh');
}
});
},
selectedChange() {
//
if (this.$store.state.menuOperation.buttonOperation) {
let model = this.$store.state.menuOperation.selected;
if (model) {
let deviceType = MapDeviceType[model._type];
let operate = {
send: true,
model: model,
code: model.code,
type: deviceType.type,
operation: this.$store.state.menuOperation.buttonOperation,
tempData: this.tempData
}
export default {
name: 'MapButtonMenu',
data() {
return {
point: {
x: -1000,
y: -1000
},
operation: '0',
buttonName: '',
buttonDownColor: '#A8A8A8',
buttonUpColor: '#DCDCDC',
width: 58,
tempData: null,
offset: {}
};
},
computed: {
Switch() {
return OperationEvent.Switch;
},
Section() {
return OperationEvent.Section;
},
Signal() {
return OperationEvent.Signal;
},
isShowBtn() {
return this.$store.state.training.prdType == '01';
}
},
watch: {
'$store.state.config.canvasOffsetCount': function (val) {
this.resetPosition();
},
'$store.state.menuOperation.buttonOperation': function (val, old) {
this.updateButtonShow(val, old);
},
'$store.state.menuOperation.selectedCount': function (val) {
this.selectedChange();
}
},
mounted() {
this.resetPosition();
},
methods: {
resetPosition() {
this.$nextTick(() => {
const canvasOffset = this.$store.state.config.canvasOffset;
this.point = {
x: canvasOffset.x + 20,
y: canvasOffset.y + this.$store.state.config.height - 65
};
this.$store.dispatch('training/tipReload');
});
},
updateButtonShow(val, old) {
if (old) {
//
const domId = getDomIdByOperation(old);
const dom = document.getElementById(domId);
if (dom) {
dom.disabled = false;
dom.style.backgroundColor = this.buttonUpColor;
}
}
if (val) {
//
const domId = getDomIdByOperation(val);
const dom = document.getElementById(domId);
if (dom) {
dom.disabled = true;
dom.style.backgroundColor = this.buttonDownColor;
}
}
},
buttonDown(operation) {
const operate = {
type: 'mbm',
operation: operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/setButtonOperation', operation); //
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('training/emitTipFresh');
}
});
},
selectedChange() {
//
if (this.$store.state.menuOperation.buttonOperation) {
const model = this.$store.state.menuOperation.selected;
if (model) {
const deviceType = MapDeviceType[model._type];
const operate = {
send: true,
model: model,
code: model.code,
type: deviceType.type,
operation: this.$store.state.menuOperation.buttonOperation,
tempData: this.tempData
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
if (response) {
this.tempData = response.data;
}
}
});
} else {
OperateHandler.cleanOperates();
this.$store.dispatch('menuOperation/setButtonOperation', null);
}
}
}
}
}
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
if (response) {
this.tempData = response.data;
}
}
});
} else {
OperateHandler.cleanOperates();
this.$store.dispatch('menuOperation/setButtonOperation', null);
}
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
$bg: #fff;
@ -343,4 +386,4 @@
background-color: $hoverBg;
}
}
</style>
</style>

View File

@ -6,12 +6,10 @@
<script>
import PopMenu from '@/components/PopMenu';
// import OperateHandler from '@/scripts/plugin/trainingOperateHandler';
import { mapGetters } from 'vuex';
import { DeviceMenu } from '@/scripts/ConstDic';
import { exitFullscreen } from '@/utils/screen';
import { runDiagramQuit } from '@/api/simulation';
// import { screenTopic, clearSubscribe } from '@/utils/stomp';
import { EventBus } from '@/scripts/event-bus';
export default {
@ -56,7 +54,7 @@ export default {
watch: {
'$store.state.menuOperation.buttonOperation': function (val, old) {
if (!this.isScreen && this.menu && this.menu.length > 1) {
this.menu[0].disabled = (this.menu[0] && val) ? true : true;
this.menu[0].disabled = true;
this.menu[1].disabled = !((this.menu[1] && val));
}
},

View File

@ -1,118 +1,118 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu"></pop-menu>
<cancel-all-limit ref="cancelAllLimit"></cancel-all-limit>
</div>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<cancel-all-limit ref="cancelAllLimit" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import CancelAllLimit from './dialog/cancelAllLimit';
import { mapGetters } from 'vuex';
import { TrainingMode, OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, menuFiltration } from './utils/menuItemStatus';
import { mouseCancelState } from './utils/menuItemStatus';
import PopMenu from '@/components/PopMenu';
import CancelAllLimit from './dialog/cancelAllLimit';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState } from './utils/menuItemStatus';
export default {
name: 'MenuLimit',
components: {
PopMenu,
CancelAllLimit,
},
props: {
selected: {
type: Object
}
},
data() {
return {
menu: [{
label: '取消全线临时限速',
handler: this.cancelSpeed,
disabledCallback: '',
auth: { station: true, center: false }
}],
menuNormal: {
local: [
{
label: '取消全线临时限速',
handler: this.cancelSpeed,
disabledCallback: MenuDisabledState.Section.cancelSpeed,
auth: { station: true, center: false }
}
],
central: [
{
label: '取消全线临时限速',
handler: this.cancelSpeed,
disabledCallback: MenuDisabledState.Section.cancelSpeed,
auth: { station: false, center: true }
}
]
},
}
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.LimitControl) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
methods: {
clickEvent() {
let self = this;
window.onclick = function (e) {
self.doClose();
}
},
initMenu() {
//
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu]
}
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
cancelSpeed() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.LimitControl.type,
label: MapDeviceType.LimitControl.label,
operation: OperationEvent.LimitControl.CancelAllLimit.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.cancelAllLimit.doShow(operate, this.selected);
}
});
},
}
}
</script>
export default {
name: 'MenuLimit',
components: {
PopMenu,
CancelAllLimit
},
props: {
selected: {
type: Object,
required: true
}
},
data() {
return {
menu: [{
label: '取消全线临时限速',
handler: this.cancelSpeed,
disabledCallback: '',
auth: { station: true, center: false }
}],
menuNormal: {
local: [
{
label: '取消全线临时限速',
handler: this.cancelSpeed,
disabledCallback: MenuDisabledState.Section.cancelSpeed,
auth: { station: true, center: false }
}
],
central: [
{
label: '取消全线临时限速',
handler: this.cancelSpeed,
disabledCallback: MenuDisabledState.Section.cancelSpeed,
auth: { station: false, center: true }
}
]
}
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.LimitControl) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu];
}
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
cancelSpeed() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.LimitControl.type,
label: MapDeviceType.LimitControl.label,
operation: OperationEvent.LimitControl.CancelAllLimit.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.cancelAllLimit.doShow(operate, this.selected);
}
});
}
}
};
</script>

View File

@ -1,410 +1,411 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu"></pop-menu>
<section-control ref="sectionControl"></section-control>
<section-cmd-control ref="sectionCmdControl"></section-cmd-control>
<speed-limit-control ref="speedLimitControl"></speed-limit-control>
<speed-cmd-control ref="speedCmdControl"></speed-cmd-control>
<train-create ref="trainCreate"></train-create>
<alxe-effective ref="alxeEffective"></alxe-effective>
<notice-info ref="noticeInfo"></notice-info>
</div>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<section-control ref="sectionControl" />
<section-cmd-control ref="sectionCmdControl" />
<speed-limit-control ref="speedLimitControl" />
<speed-cmd-control ref="speedCmdControl" />
<train-create ref="trainCreate" />
<alxe-effective ref="alxeEffective" />
<notice-info ref="noticeInfo" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import SectionControl from './dialog/sectionControl';
import SectionCmdControl from './dialog/sectionCmdControl';
import SpeedCmdControl from './dialog/speedCmdControl';
import SpeedLimitControl from './dialog/speedLimitControl';
import TrainCreate from './dialog/trainCreate';
import AlxeEffective from './dialog/alxeEffective';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo'
import { mapGetters } from 'vuex';
import { TrainingMode, OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, menuFiltration } from './utils/menuItemStatus';
import { mouseCancelState } from './utils/menuItemStatus';
import PopMenu from '@/components/PopMenu';
import SectionControl from './dialog/sectionControl';
import SectionCmdControl from './dialog/sectionCmdControl';
import SpeedCmdControl from './dialog/speedCmdControl';
import SpeedLimitControl from './dialog/speedLimitControl';
import TrainCreate from './dialog/trainCreate';
import AlxeEffective from './dialog/alxeEffective';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, menuFiltration } from './utils/menuItemStatus';
import { mouseCancelState } from './utils/menuItemStatus';
export default {
name: 'SectionMenu',
components: {
PopMenu,
SectionControl,
SectionCmdControl,
SpeedLimitControl,
SpeedCmdControl,
TrainCreate,
AlxeEffective,
NoticeInfo
},
props: {
selected: {
type: Object
}
},
data() {
return {
menu: [],
menuNormal: {
local: [
{
label: '区段故障解锁',
handler: this.fault,
disabledCallback: MenuDisabledState.Section.fault,
auth: { station: true, center: false }
},
{
label: '区段激活',
handler: this.active,
disabledCallback: MenuDisabledState.Section.active,
auth: { station: true, center: false }
},
{
label: '区段切除',
handler: this.split,
disabledCallback: MenuDisabledState.Section.split,
auth: { station: true, center: false }
},
{
label: '区段计轴预复位',
handler: this.axlePreReset,
disabledCallback: MenuDisabledState.Section.axlePreReset,
auth: { station: true, center: false }
},
{
label: '区段封锁',
handler: this.lock,
disabledCallback: MenuDisabledState.Section.lock,
auth: { station: true, center: false }
},
{
label: '区段解封',
handler: this.unlock,
disabledCallback: MenuDisabledState.Section.unlock,
auth: { station: true, center: false }
},
{
label: '区段设置限速',
handler: this.setSpeed,
disabledCallback: MenuDisabledState.Section.setSpeed,
auth: { station: true, center: false }
}
],
central: [
{
label: '轨道激活',
handler: this.active,
disabledCallback: MenuDisabledState.Section.active,
auth: { station: false, center: true }
},
{
label: '轨道切除',
handler: this.split,
disabledCallback: MenuDisabledState.Section.split,
auth: { station: false, center: true }
},
{
type: 'separator'
},
{
label: '确认计轴有效',
handler: this.alxeEffective,
disabledCallback: MenuDisabledState.Section.alxeEffective,
auth: { station: false, center: true }
},
{
type: 'separator'
},
{
label: '设置临时限速',
handler: this.setSpeed,
disabledCallback: MenuDisabledState.Section.setSpeed,
auth: { station: false, center: true }
},
{
type: 'separator'
},
{
label: '查看站场设备状态',
handler: this.undeveloped,
disabledCallback: MenuDisabledState.Section.setSpeed,
auth: { station: false, center: true }
},
]
},
menuTrain: [
{
label: '新建列车',
handler: this.newTrain,
disabledCallback: MenuDisabledState.Section.newTrain
},
],
menuForce: [
{
label: '设置计轴失效',
handler: this.alxeFailure,
disabledCallback: MenuDisabledState.Section.alxeFailure
}
]
}
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Section) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
methods: {
clickEvent() {
let self = this;
window.onclick = function (e) {
self.doClose();
}
},
initMenu() {
//
this.menu = menuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce, ...this.menuTrain]
}
export default {
name: 'SectionMenu',
components: {
PopMenu,
SectionControl,
SectionCmdControl,
SpeedLimitControl,
SpeedCmdControl,
TrainCreate,
AlxeEffective,
NoticeInfo
},
props: {
selected: {
type: Object,
required: true
}
},
data() {
return {
menu: [],
menuNormal: {
local: [
{
label: '区段故障解锁',
handler: this.fault,
disabledCallback: MenuDisabledState.Section.fault,
auth: { station: true, center: false }
},
{
label: '区段激活',
handler: this.active,
disabledCallback: MenuDisabledState.Section.active,
auth: { station: true, center: false }
},
{
label: '区段切除',
handler: this.split,
disabledCallback: MenuDisabledState.Section.split,
auth: { station: true, center: false }
},
{
label: '区段计轴预复位',
handler: this.axlePreReset,
disabledCallback: MenuDisabledState.Section.axlePreReset,
auth: { station: true, center: false }
},
{
label: '区段封锁',
handler: this.lock,
disabledCallback: MenuDisabledState.Section.lock,
auth: { station: true, center: false }
},
{
label: '区段解封',
handler: this.unlock,
disabledCallback: MenuDisabledState.Section.unlock,
auth: { station: true, center: false }
},
{
label: '区段设置限速',
handler: this.setSpeed,
disabledCallback: MenuDisabledState.Section.setSpeed,
auth: { station: true, center: false }
}
],
central: [
{
label: '轨道激活',
handler: this.active,
disabledCallback: MenuDisabledState.Section.active,
auth: { station: false, center: true }
},
{
label: '轨道切除',
handler: this.split,
disabledCallback: MenuDisabledState.Section.split,
auth: { station: false, center: true }
},
{
type: 'separator'
},
{
label: '确认计轴有效',
handler: this.alxeEffective,
disabledCallback: MenuDisabledState.Section.alxeEffective,
auth: { station: false, center: true }
},
{
type: 'separator'
},
{
label: '设置临时限速',
handler: this.setSpeed,
disabledCallback: MenuDisabledState.Section.setSpeed,
auth: { station: false, center: true }
},
{
type: 'separator'
},
{
label: '查看站场设备状态',
handler: this.undeveloped,
disabledCallback: MenuDisabledState.Section.setSpeed,
auth: { station: false, center: true }
}
]
},
menuTrain: [
{
label: '新建列车',
handler: this.newTrain,
disabledCallback: MenuDisabledState.Section.newTrain
}
],
menuForce: [
{
label: '设置计轴失效',
handler: this.alxeFailure,
disabledCallback: MenuDisabledState.Section.alxeFailure
}
]
};
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Section) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
this.menu = menuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce, ...this.menuTrain];
}
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce
}
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce;
}
this.menu = menuConvert(this.menu);
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
alxeFailure() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.alxeFailure.menu.operation
};
this.menu = menuConvert(this.menu);
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
alxeFailure() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.alxeFailure.menu.operation
};
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//
fault() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.fault.menu.operation
};
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
fault() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.fault.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionCmdControl.doShow(operate, this.selected);
}
});
},
undeveloped() {
this.doClose();
this.$alert('实现中......', '提示', {
confirmButtonText: '确定',
callback: action => {
}
});
},
//
split() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.split.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionControl.doShow(operate, this.selected);
}
});
},
alxeEffective() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.alxeEffective.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.alxeEffective.doShow(operate, this.selected);
}
});
},
//
active() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.active.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionControl.doShow(operate, this.selected);
}
});
},
//
axlePreReset() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.axlePreReset.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionCmdControl.doShow(operate, this.selected);
}
});
},
//
lock() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.lock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionControl.doShow(operate, this.selected);
}
});
},
//
unlock() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.unlock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionCmdControl.doShow(operate, this.selected);
}
});
},
//
setSpeed() {
// let operate = {
// start: true,
// code: this.selected.code,
// type: MapDeviceType.Section.type,
// label: MapDeviceType.Section.label,
// operation: OperationEvent.Section.setLimitSpeed.menu.operation
// };
// this.$store.dispatch('training/next', operate).then(({ valid }) => {
// if (valid) {
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// this.$refs.speedCmdControl.doShow(operate, this.selected);
// }
// });
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.setSpeed.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.speedLimitControl.doShow(operate, this.selected);
}
});
},
//
// cancelSpeed() {
// let operate = {
// start: true,
// send: true,
// code: this.selected.code,
// type: MapDeviceType.Section.type,
// label: MapDeviceType.Section.label,
// operation: OperationEvent.Section.cancelSpeed.menu.operation
// };
// this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
// if (valid) {
// let tempData = response.data;
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// this.$refs.speedCmdControl.doShow(operate, this.selected, tempData);
// }
// });
// },
//
newTrain() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.newtrain.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainCreate.doShow(operate, this.selected);
}
})
}
}
}
</script>
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionCmdControl.doShow(operate, this.selected);
}
});
},
undeveloped() {
this.doClose();
this.$alert('实现中......', '提示', {
confirmButtonText: '确定',
callback: action => {
}
});
},
//
split() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.split.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionControl.doShow(operate, this.selected);
}
});
},
alxeEffective() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.alxeEffective.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.alxeEffective.doShow(operate, this.selected);
}
});
},
//
active() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.active.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionControl.doShow(operate, this.selected);
}
});
},
//
axlePreReset() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.axlePreReset.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionCmdControl.doShow(operate, this.selected);
}
});
},
//
lock() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.lock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionControl.doShow(operate, this.selected);
}
});
},
//
unlock() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.unlock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.sectionCmdControl.doShow(operate, this.selected);
}
});
},
//
setSpeed() {
// let operate = {
// start: true,
// code: this.selected.code,
// type: MapDeviceType.Section.type,
// label: MapDeviceType.Section.label,
// operation: OperationEvent.Section.setLimitSpeed.menu.operation
// };
// this.$store.dispatch('training/next', operate).then(({ valid }) => {
// if (valid) {
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// this.$refs.speedCmdControl.doShow(operate, this.selected);
// }
// });
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.setSpeed.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.speedLimitControl.doShow(operate, this.selected);
}
});
},
//
// cancelSpeed() {
// let operate = {
// start: true,
// send: true,
// code: this.selected.code,
// type: MapDeviceType.Section.type,
// label: MapDeviceType.Section.label,
// operation: OperationEvent.Section.cancelSpeed.menu.operation
// };
// this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
// if (valid) {
// let tempData = response.data;
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// this.$refs.speedCmdControl.doShow(operate, this.selected, tempData);
// }
// });
// },
//
newTrain() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Section.type,
label: MapDeviceType.Section.label,
operation: OperationEvent.Section.newtrain.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainCreate.doShow(operate, this.selected);
}
});
}
}
};
</script>

View File

@ -1,498 +1,499 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu"></pop-menu>
<route-selection ref="routeSelection"></route-selection>
<route-lock ref="routeLock"></route-lock>
<route-control ref="routeControl"></route-control>
<route-cmd-control ref="routeCmdControl"></route-cmd-control>
<route-hand-control ref="routeHandControl"></route-hand-control>
<route-detail ref="routeDetail"></route-detail>
<notice-info ref="noticeInfo"></notice-info>
</div>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<route-selection ref="routeSelection" />
<route-lock ref="routeLock" />
<route-control ref="routeControl" />
<route-cmd-control ref="routeCmdControl" />
<route-hand-control ref="routeHandControl" />
<route-detail ref="routeDetail" />
<notice-info ref="noticeInfo" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import RouteControl from './dialog/routeControl';
import RouteSelection from './dialog/routeSelection';
import RouteLock from './dialog/routeLock';
import RouteCmdControl from './dialog/routeCmdControl';
import RouteHandControl from './dialog/routeHandControl';
import RouteDetail from './dialog/routeDetail';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo'
import { mapGetters } from 'vuex';
import { TrainingMode, OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, menuFiltration } from './utils/menuItemStatus';
import { mouseCancelState } from './utils/menuItemStatus';
import PopMenu from '@/components/PopMenu';
import RouteControl from './dialog/routeControl';
import RouteSelection from './dialog/routeSelection';
import RouteLock from './dialog/routeLock';
import RouteCmdControl from './dialog/routeCmdControl';
import RouteHandControl from './dialog/routeHandControl';
import RouteDetail from './dialog/routeDetail';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, menuFiltration } from './utils/menuItemStatus';
import { mouseCancelState } from './utils/menuItemStatus';
export default {
name: 'SignalMenu',
components: {
PopMenu,
RouteControl,
RouteSelection,
RouteLock,
RouteCmdControl,
RouteHandControl,
RouteDetail,
NoticeInfo
},
props: {
selected: {
type: Object
}
},
data() {
return {
menu: [],
menuNormal: {
local: [
{
label: '排列进路',
handler: this.arrangementRoute,
disabledCallback: MenuDisabledState.Signal.arrangementRoute,
auth: { station: false, center: true },
},
{
label: '取消进路',
handler: this.cancelTrainRoute,
disabledCallback: MenuDisabledState.Signal.cancelTrainRoute,
auth: { station: false, center: true },
},
{
label: '信号重开',
handler: this.reopenSignal,
disabledCallback: MenuDisabledState.Signal.reopenSignal,
auth: { station: false, center: true },
},
{
type: 'separator'
},
{
label: '进路交人工控',
handler: this.humanControl,
disabledCallback: MenuDisabledState.Signal.humanControl,
auth: { station: false, center: true },
},
{
label: '进路交自动控',
handler: this.atsAutoControl,
disabledCallback: MenuDisabledState.Signal.atsAutoControl,
auth: { station: false, center: true },
},
{
label: '查询进路控制状态',
handler: this.detail,
disabledCallback: MenuDisabledState.Signal.detail,
auth: { station: true, center: true },
}
],
central: [
{
label: '排列进路',
handler: this.arrangementRoute,
disabledCallback: MenuDisabledState.Signal.arrangementRoute,
auth: { station: false, center: true },
},
{
label: '取消进路',
handler: this.cancelTrainRoute,
disabledCallback: MenuDisabledState.Signal.cancelTrainRoute,
auth: { station: false, center: true },
},
{
label: '信号重开',
handler: this.reopenSignal,
disabledCallback: MenuDisabledState.Signal.reopenSignal,
auth: { station: false, center: true },
},
{
type: 'separator'
},
{
label: '进路交人工控',
handler: this.humanControl,
disabledCallback: MenuDisabledState.Signal.humanControl,
auth: { station: false, center: true },
},
{
label: '进路交自动控',
handler: this.atsAutoControl,
disabledCallback: MenuDisabledState.Signal.atsAutoControl,
auth: { station: false, center: true },
},
{
label: '查询进路控制状态',
handler: this.detail,
disabledCallback: MenuDisabledState.Signal.detail,
auth: { station: true, center: true },
}
],
},
menuForce: [
{
label: '信号关灯',
handler: this.signalClose,
disabledCallback: '',
},
{
label: '设置故障',
handler: this.setStoppage,
disabledCallback: MenuDisabledState.Signal.setStoppage
},
{
label: '取消故障',
handler: this.cancelStoppage,
disabledCallback: MenuDisabledState.Signal.cancelStoppage
}
]
}
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Signal) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
methods: {
clickEvent() {
let self = this;
window.onclick = function (e) {
self.doClose();
}
},
initMenu() {
//
this.menu = menuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce]
}
export default {
name: 'SignalMenu',
components: {
PopMenu,
RouteControl,
RouteSelection,
RouteLock,
RouteCmdControl,
RouteHandControl,
RouteDetail,
NoticeInfo
},
props: {
selected: {
type: Object,
required: true
}
},
data() {
return {
menu: [],
menuNormal: {
local: [
{
label: '排列进路',
handler: this.arrangementRoute,
disabledCallback: MenuDisabledState.Signal.arrangementRoute,
auth: { station: false, center: true }
},
{
label: '取消进路',
handler: this.cancelTrainRoute,
disabledCallback: MenuDisabledState.Signal.cancelTrainRoute,
auth: { station: false, center: true }
},
{
label: '信号重开',
handler: this.reopenSignal,
disabledCallback: MenuDisabledState.Signal.reopenSignal,
auth: { station: false, center: true }
},
{
type: 'separator'
},
{
label: '进路交人工控',
handler: this.humanControl,
disabledCallback: MenuDisabledState.Signal.humanControl,
auth: { station: false, center: true }
},
{
label: '进路交自动控',
handler: this.atsAutoControl,
disabledCallback: MenuDisabledState.Signal.atsAutoControl,
auth: { station: false, center: true }
},
{
label: '查询进路控制状态',
handler: this.detail,
disabledCallback: MenuDisabledState.Signal.detail,
auth: { station: true, center: true }
}
],
central: [
{
label: '排列进路',
handler: this.arrangementRoute,
disabledCallback: MenuDisabledState.Signal.arrangementRoute,
auth: { station: false, center: true }
},
{
label: '取消进路',
handler: this.cancelTrainRoute,
disabledCallback: MenuDisabledState.Signal.cancelTrainRoute,
auth: { station: false, center: true }
},
{
label: '信号重开',
handler: this.reopenSignal,
disabledCallback: MenuDisabledState.Signal.reopenSignal,
auth: { station: false, center: true }
},
{
type: 'separator'
},
{
label: '进路交人工控',
handler: this.humanControl,
disabledCallback: MenuDisabledState.Signal.humanControl,
auth: { station: false, center: true }
},
{
label: '进路交自动控',
handler: this.atsAutoControl,
disabledCallback: MenuDisabledState.Signal.atsAutoControl,
auth: { station: false, center: true }
},
{
label: '查询进路控制状态',
handler: this.detail,
disabledCallback: MenuDisabledState.Signal.detail,
auth: { station: true, center: true }
}
]
},
menuForce: [
{
label: '信号关灯',
handler: this.signalClose,
disabledCallback: ''
},
{
label: '设置故障',
handler: this.setStoppage,
disabledCallback: MenuDisabledState.Signal.setStoppage
},
{
label: '取消故障',
handler: this.cancelStoppage,
disabledCallback: MenuDisabledState.Signal.cancelStoppage
}
]
};
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Signal) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
this.menu = menuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce];
}
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce
}
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce;
}
this.menu = menuConvert(this.menu);
this.menu = menuConvert(this.menu);
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
setStoppage() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.stoppage.menu.operation
};
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
setStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.stoppage.menu.operation
};
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//
cancelStoppage() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.cancelStoppage.menu.operation
};
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
cancelStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.cancelStoppage.menu.operation
};
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//
arrangementRoute() {
let operate = {
start: true,
send: true,
model: this.selected,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.arrangementRoute.menu.operation
}
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
arrangementRoute() {
const operate = {
start: true,
send: true,
model: this.selected,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.arrangementRoute.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (valid) {
var tempData = null;
if (response) {
tempData = response.data;
}
this.$refs.routeSelection.doShow(operate.operation, this.selected, tempData);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//
cancelTrainRoute() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.cancelTrainRoute.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (valid) {
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//
lock() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.lock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (valid) {
var tempData = null;
if (response) {
tempData = response.data;
}
this.$refs.routeSelection.doShow(operate.operation, this.selected, tempData);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
cancelTrainRoute() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.cancelTrainRoute.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (valid) {
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//
lock() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.lock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeLock.doShow(operate.operation, this.selected);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//
unlock() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.unlock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeCmdControl.doShow(operate, this.selected);
}
});
},
//
reopenSignal() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.reopenSignal.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//
guide() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.guide.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (valid) {
this.$refs.routeCmdControl.doShow(operate, this.selected);
}
});
},
//
setAutoInterlock() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.setAutoInterlock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//
cancelAutoInterlock() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.cancelAutoInterlock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//
setAutoTrigger() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.setAutoTrigger.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//
cancelAutoTrigger() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.cancelAutoTrigger.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//
signalClose() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.signalClose.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//
humanControl() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.humanControl.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
let tempData = null;
if (response) {
tempData = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeHandControl.doShow(operate, this.selected, tempData);
}
});
},
//
atsAutoControl() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.atsAutoControl.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
let tempData = null;
if (response) {
tempData = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeHandControl.doShow(operate, this.selected, tempData);
}
});
},
//
detail() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.detail.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeDetail.doShow(operate, this.selected, response.data);
}
});
}
}
}
</script>
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeLock.doShow(operate.operation, this.selected);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
unlock() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.unlock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeCmdControl.doShow(operate, this.selected);
}
});
},
//
reopenSignal() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.reopenSignal.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//
guide() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.guide.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (valid) {
this.$refs.routeCmdControl.doShow(operate, this.selected);
}
});
},
//
setAutoInterlock() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.setAutoInterlock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//
cancelAutoInterlock() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.cancelAutoInterlock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//
setAutoTrigger() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.setAutoTrigger.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//
cancelAutoTrigger() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.cancelAutoTrigger.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//
signalClose() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.signalClose.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected);
}
});
},
//
humanControl() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.humanControl.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
let tempData = null;
if (response) {
tempData = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeHandControl.doShow(operate, this.selected, tempData);
}
});
},
//
atsAutoControl() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.atsAutoControl.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
let tempData = null;
if (response) {
tempData = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeHandControl.doShow(operate, this.selected, tempData);
}
});
},
//
detail() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Signal.type,
label: MapDeviceType.Signal.label,
operation: OperationEvent.Signal.detail.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeDetail.doShow(operate, this.selected, response.data);
}
});
}
}
};
</script>

View File

@ -31,7 +31,8 @@ export default {
},
props: {
selected: {
type: Object
type: Object,
required: true
}
},
data() {

View File

@ -5,10 +5,7 @@
<script>
import PopMenu from '@/components/PopMenu';
import { mapGetters } from 'vuex';
// import { TrainingMode, OperateMode } from '@/scripts/ConstDic';
import { DeviceMenu } from '@/scripts/ConstDic';
// import { MenuDisabledState, menuConvert } from './utils/menuItemStatus';
// import { mouseCancelState } from './utils/menuItemStatus';
export default {
name: 'StationControlMenu',
@ -17,7 +14,8 @@ export default {
},
props: {
selected: {
type: Object
type: Object,
required: true
}
},
data() {

View File

@ -43,7 +43,8 @@ export default {
},
props: {
selected: {
type: Object
type: Object,
required: true
}
},
data() {

View File

@ -1,445 +1,446 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu"></pop-menu>
<section-control ref="sectionControl"></section-control>
<switch-control ref="switchControl"></switch-control>
<switch-cmd-control ref="switchCmdControl"></switch-cmd-control>
<speed-cmd-control ref="speedCmdControl"></speed-cmd-control>
<speed-limit-control ref="speedLimitControl"></speed-limit-control>
<alxe-effective ref="alxeEffective"></alxe-effective>
<notice-info ref="noticeInfo"></notice-info>
</div>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<section-control ref="sectionControl" />
<switch-control ref="switchControl" />
<switch-cmd-control ref="switchCmdControl" />
<speed-cmd-control ref="speedCmdControl" />
<speed-limit-control ref="speedLimitControl" />
<alxe-effective ref="alxeEffective" />
<notice-info ref="noticeInfo" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import SectionControl from './dialog/sectionControl';
import SwitchControl from './dialog/switchControl';
import SwitchCmdControl from './dialog/switchCmdControl';
import SpeedCmdControl from './dialog/speedCmdControl';
import SpeedLimitControl from './dialog/speedLimitControl';
import AlxeEffective from './dialog/alxeEffective';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo'
import { mapGetters } from 'vuex';
import { TrainingMode, OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, menuFiltration } from './utils/menuItemStatus';
import { mouseCancelState } from './utils/menuItemStatus';
import PopMenu from '@/components/PopMenu';
import SectionControl from './dialog/sectionControl';
import SwitchControl from './dialog/switchControl';
import SwitchCmdControl from './dialog/switchCmdControl';
import SpeedCmdControl from './dialog/speedCmdControl';
import SpeedLimitControl from './dialog/speedLimitControl';
import AlxeEffective from './dialog/alxeEffective';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState, menuConvert, menuFiltration } from './utils/menuItemStatus';
import { mouseCancelState } from './utils/menuItemStatus';
export default {
name: 'SwitchMenu',
components: {
PopMenu,
SectionControl,
SwitchControl,
SwitchCmdControl,
SpeedLimitControl,
SpeedCmdControl,
AlxeEffective,
NoticeInfo
},
props: {
selected: {
type: Object
}
},
data() {
return {
menu: [],
menuNormal: {
local: [
{
label: '轨道切除',
handler: this.split,
disabledCallback: MenuDisabledState.Switch.split,
auth: { station: true, center: true }
},
{
label: '轨道激活',
handler: this.active,
disabledCallback: MenuDisabledState.Switch.active,
auth: { station: true, center: true }
},
],
central: [
{
label: '轨道切除',
handler: this.split,
disabledCallback: MenuDisabledState.Switch.split,
auth: { station: true, center: true }
},
{
label: '轨道激活',
handler: this.active,
disabledCallback: MenuDisabledState.Switch.active,
auth: { station: true, center: true }
},
{
type: 'separator'
},
{
label: '确认计轴有效',
handler: this.alxeEffective,
disabledCallback: MenuDisabledState.Switch.alxeEffective,
auth: { station: false, center: true }
},
{
type: 'separator'
},
{
label: '设置临时限速',
handler: this.setSpeed,
disabledCallback: MenuDisabledState.Switch.setSpeed,
auth: { station: false, center: true }
},
{
type: 'separator'
},
{
label: '查看站场设备状态',
handler: this.undeveloped,
disabledCallback: MenuDisabledState.Switch.setSpeed,
auth: { station: false, center: true }
}
]
},
menuForce: [
{
label: '设置故障',
handler: this.setStoppage,
disabledCallback: MenuDisabledState.Switch.setStoppage,
auth: {
export default {
name: 'SwitchMenu',
components: {
PopMenu,
SectionControl,
SwitchControl,
SwitchCmdControl,
SpeedLimitControl,
SpeedCmdControl,
AlxeEffective,
NoticeInfo
},
props: {
selected: {
type: Object,
required: true
}
},
data() {
return {
menu: [],
menuNormal: {
local: [
{
label: '轨道切除',
handler: this.split,
disabledCallback: MenuDisabledState.Switch.split,
auth: { station: true, center: true }
},
{
label: '轨道激活',
handler: this.active,
disabledCallback: MenuDisabledState.Switch.active,
auth: { station: true, center: true }
}
],
central: [
{
label: '轨道切除',
handler: this.split,
disabledCallback: MenuDisabledState.Switch.split,
auth: { station: true, center: true }
},
{
label: '轨道激活',
handler: this.active,
disabledCallback: MenuDisabledState.Switch.active,
auth: { station: true, center: true }
},
{
type: 'separator'
},
{
label: '确认计轴有效',
handler: this.alxeEffective,
disabledCallback: MenuDisabledState.Switch.alxeEffective,
auth: { station: false, center: true }
},
{
type: 'separator'
},
{
label: '设置临时限速',
handler: this.setSpeed,
disabledCallback: MenuDisabledState.Switch.setSpeed,
auth: { station: false, center: true }
},
{
type: 'separator'
},
{
label: '查看站场设备状态',
handler: this.undeveloped,
disabledCallback: MenuDisabledState.Switch.setSpeed,
auth: { station: false, center: true }
}
]
},
menuForce: [
{
label: '设置故障',
handler: this.setStoppage,
disabledCallback: MenuDisabledState.Switch.setStoppage,
auth: {
}
},
{
label: '取消故障',
handler: this.cancelStoppage,
disabledCallback: MenuDisabledState.Switch.cancelStoppage,
auth: {
}
},
{
label: '取消故障',
handler: this.cancelStoppage,
disabledCallback: MenuDisabledState.Switch.cancelStoppage,
auth: {
}
}
]
}
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Switch) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
methods: {
clickEvent() {
let self = this;
window.onclick = function (e) {
self.doClose();
}
},
initMenu() {
//
this.menu = menuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce]
}
}
}
]
};
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Switch) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
this.menu = menuFiltration(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce];
}
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce
}
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce;
}
this.menu = menuConvert(this.menu);
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
setStoppage() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.stoppage.menu.operation
};
this.menu = menuConvert(this.menu);
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
setStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.stoppage.menu.operation
};
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//
cancelStoppage() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.cancelStoppage.menu.operation
};
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
cancelStoppage() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.cancelStoppage.menu.operation
};
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(error => {
this.$refs.noticeInfo.doShow(operate);
})
},
//
lock() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.lock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchControl.doShow(operate, this.selected);
}
});
},
//
unlock() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.unlock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchCmdControl.doShow(operate, this.selected);
}
});
},
//
block() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.block.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchControl.doShow(operate, this.selected);
}
});
},
//
unblock() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.unblock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchCmdControl.doShow(operate, this.selected);
}
});
},
//
switchTurnoutForce() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.turnoutForce.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchControl.doShow(operate, this.selected);
}
});
},
//
switchTurnout() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.turnout.menu.operation
};
mouseCancelState(this.selected);
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.$refs.noticeInfo.doShow(operate);
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
//
lock() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.lock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchControl.doShow(operate, this.selected);
}
});
},
//
unlock() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.unlock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchCmdControl.doShow(operate, this.selected);
}
});
},
//
block() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.block.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchControl.doShow(operate, this.selected);
}
});
},
//
unblock() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.unblock.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchCmdControl.doShow(operate, this.selected);
}
});
},
//
switchTurnoutForce() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.turnoutForce.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchControl.doShow(operate, this.selected);
}
});
},
//
switchTurnout() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.turnout.menu.operation
};
if (operate.operation) {
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchControl.doShow(operate, this.selected);
}
});
}
},
//
fault() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.fault.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchCmdControl.doShow(operate, this.selected);
}
});
},
//
cancelSpeed() {
let operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.cancelSpeed.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
let tempData = response.data;
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.speedCmdControl.doShow(operate, this.selected, tempData);
}
});
},
if (operate.operation) {
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchControl.doShow(operate, this.selected);
}
});
}
},
//
fault() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.fault.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchCmdControl.doShow(operate, this.selected);
}
});
},
//
cancelSpeed() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.cancelSpeed.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
if (valid) {
const tempData = response.data;
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.speedCmdControl.doShow(operate, this.selected, tempData);
}
});
},
//
split() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.split.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchControl.doShow(operate, this.selected);
}
});
},
//
active() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.active.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchControl.doShow(operate, this.selected);
}
});
},
//
axlePreReset() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.axlePreReset.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchCmdControl.doShow(operate, this.selected);
}
});
},
//
setSpeed() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.setSpeed.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.speedLimitControl.doShow(operate, this.selected);
}
});
},
//
alxeEffective() {
let operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.alxeEffective.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.alxeEffective.doShow(operate, this.selected);
}
});
},
undeveloped() {
this.doClose();
this.$alert('实现中......', '提示', {
confirmButtonText: '确定',
callback: action => {
}
});
},
}
}
</script>
//
split() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.split.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchControl.doShow(operate, this.selected);
}
});
},
//
active() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.active.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchControl.doShow(operate, this.selected);
}
});
},
//
axlePreReset() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.axlePreReset.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchCmdControl.doShow(operate, this.selected);
}
});
},
//
setSpeed() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.setSpeed.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.speedLimitControl.doShow(operate, this.selected);
}
});
},
//
alxeEffective() {
const operate = {
start: true,
code: this.selected.code,
type: MapDeviceType.Switch.type,
label: MapDeviceType.Switch.label,
operation: OperationEvent.Switch.alxeEffective.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.alxeEffective.doShow(operate, this.selected);
}
});
},
undeveloped() {
this.doClose();
this.$alert('实现中......', '提示', {
confirmButtonText: '确定',
callback: action => {
}
});
}
}
};
</script>

View File

@ -1,148 +1,145 @@
<template>
<div id="menuTool">
<div class="nav">
<div class="tool" v-for="(item,index) in tools" :key="index">
<img :src="item.src" :alt="item.title" />
</div>
<img class="logo" :src="logoImg" />
<system-time class="time" v-if="isShowSystemTime" :time="time" :zoom="2" :width="180" :height="48" :fine="2" :top="6"></system-time>
</div>
<div id="menuTool">
<div class="nav">
<div v-for="(item,index) in tools" :key="index" class="tool">
<img :src="item.src" :alt="item.title">
</div>
<img class="logo" :src="logoImg">
<system-time v-if="isShowSystemTime" class="time" :time="time" :zoom="2" :width="180" :height="48" :fine="2" :top="6" />
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { MapDeviceType, TrainingMode, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { OperateMode } from '@/scripts/ConstDic';
import { prefixIntrger } from '@/utils/date';
import SystemTime from '@/views/components/systemTime/index';
import logo_ from '@/assets/logo_.png';
import { prefixIntrger } from '@/utils/date';
import SystemTime from '@/views/components/systemTime/index';
import logo_ from '@/assets/logo_.png';
export default {
name: 'MenuTool',
props: {
selected: {
type: Object
}
},
components: {
SystemTime
},
data() {
return {
logoImg: logo_,
time: '00:0000',
tools: [
{
title: '服务器1',
operate: '',
src: logo_,
click: this.undeveloped,
},
{
title: '服务器2',
operate: '',
src: '',
click: this.undeveloped,
},
{
title: '前置机1',
operate: '',
src: '',
click: this.undeveloped,
},
{
title: '前置机2',
operate: '',
src: '',
click: this.undeveloped,
},
{
title: '主调',
operate: '',
src: '',
click: this.undeveloped,
},
{
title: '调度台1',
operate: '',
src: '',
click: this.undeveloped,
},
{
title: '调度台2',
operate: '',
src: '',
click: this.undeveloped,
},
{
title: '调度台3',
operate: '',
src: '',
click: this.undeveloped,
},
{
title: '大屏',
operate: '',
src: '',
click: this.undeveloped,
},
{
title: '维护工作站',
operate: '',
src: '',
click: this.undeveloped,
},
{
title: '运行图显示人工站',
operate: '',
src: '',
click: this.undeveloped,
},
{
title: '跳停',
operate: '',
src: '',
click: this.undeveloped,
},
{
title: '扣车',
operate: '',
src: '',
click: this.undeveloped,
},
{
title: '列车报警',
operate: '',
src: logo_,
click: this.undeveloped,
}
]
}
},
watch: {
'$store.state.training.initTime': function (initTime) {
let date = new Date(initTime);
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`
}
},
computed: {
isShowSystemTime() {
return this.$route.params.mode == 'demon' || this.$route.params.mode === 'dp' || !this.$route.params.mode;
}
},
mounted() {
this.initTools();
},
methods: {
initTools() {
this.tools = [];
}
}
}
export default {
name: 'MenuTool',
components: {
SystemTime
},
props: {
selected: {
type: Object,
required: true
}
},
data() {
return {
logoImg: logo_,
time: '00:0000',
tools: [
{
title: '服务器1',
operate: '',
src: logo_,
click: this.undeveloped
},
{
title: '服务器2',
operate: '',
src: '',
click: this.undeveloped
},
{
title: '前置机1',
operate: '',
src: '',
click: this.undeveloped
},
{
title: '前置机2',
operate: '',
src: '',
click: this.undeveloped
},
{
title: '主调',
operate: '',
src: '',
click: this.undeveloped
},
{
title: '调度台1',
operate: '',
src: '',
click: this.undeveloped
},
{
title: '调度台2',
operate: '',
src: '',
click: this.undeveloped
},
{
title: '调度台3',
operate: '',
src: '',
click: this.undeveloped
},
{
title: '大屏',
operate: '',
src: '',
click: this.undeveloped
},
{
title: '维护工作站',
operate: '',
src: '',
click: this.undeveloped
},
{
title: '运行图显示人工站',
operate: '',
src: '',
click: this.undeveloped
},
{
title: '跳停',
operate: '',
src: '',
click: this.undeveloped
},
{
title: '扣车',
operate: '',
src: '',
click: this.undeveloped
},
{
title: '列车报警',
operate: '',
src: logo_,
click: this.undeveloped
}
]
};
},
computed: {
isShowSystemTime() {
return this.$route.params.mode == 'demon' || this.$route.params.mode === 'dp' || !this.$route.params.mode;
}
},
watch: {
'$store.state.training.initTime': function (initTime) {
const date = new Date(initTime);
this.time = `${prefixIntrger(date.getHours(), 2)}:${prefixIntrger(date.getMinutes(), 2)}${prefixIntrger(date.getSeconds(), 2)}`;
}
},
mounted() {
this.initTools();
},
methods: {
initTools() {
this.tools = [];
}
}
};
</script>
<style scoped rel="stylesheet/scss" lang="scss" scoped>
<style scoped rel="stylesheet/scss" lang="scss">
@import "src/styles/mixin.scss";
$top: 30px;
$width: 50px;
@ -186,7 +183,6 @@
}
}
.time {
position: relative;
float: right;
@ -201,4 +197,4 @@
height: $height - 4;
width: $width - 4;
}
</style>
</style>

View File

@ -55,7 +55,8 @@ export default {
},
props: {
selected: {
type: Object
type: Object,
required: true
}
},
data() {

View File

@ -1,31 +1,24 @@
<template>
<div id="statusBar"></div>
<div id="statusBar" />
</template>
<script>
export default {
name: 'StatusBar',
props: {
selected: {
type: Object
}
},
data() {
return {
}
},
mounted() {
}
}
export default {
name: 'StatusBar',
props: {
selected: {
type: Object,
required: true
}
},
data() {
return {
};
},
mounted() {
}
};
</script>
<style>
#statusBar {
z-index: 2000;
position: absolute;
height: $height;
line-height: $height;
border-radius: 0px !important;
top: 0px;
left: 0px;
}
</style>
</style>

View File

@ -1,124 +1,126 @@
<template>
<div v-show="show" class="progressShade" :style="{background: background}">
<el-progress class="progressBar"
:type="type"
:show-text="showText"
:text-inside="textInside"
:stroke-width="strokeWidth"
:percentage="percentage"
:color="color"
:status="status" ></el-progress>
</div>
<div v-show="show" class="progressShade" :style="{background: background}">
<el-progress
class="progressBar"
:type="type"
:show-text="showText"
:text-inside="textInside"
:stroke-width="strokeWidth"
:percentage="percentage"
:color="color"
:status="status"
/>
</div>
</template>
<script>
import { requestAnimationFrame, cancelRequestAnimFrame } from '@/jmap/utils/animation';
import { requestAnimationFrame, cancelRequestAnimFrame } from '@/jmap/utils/animation';
export default {
name: 'ProgressBar',
props: {
type: {
type: String,
default() {
return 'line'
}
},
showText: {
type: Boolean,
default() {
return true
}
},
textInside: {
type: Boolean,
default() {
return false
}
},
strokeWidth: {
type: Number,
default() {
return 5
}
},
background: {
type: String,
default() {
return 'rgba(0, 0, 0, 0.8)'
}
}
},
data() {
return {
color: '#8e71c7',
status: null,
show: true,
percentage: 0,
fps: 30,
then: null,
}
},
mounted() {
this.percentage = this.randomNum();
},
methods: {
randomNum() {
return Math.ceil(Math.random() * 5) + 50
},
run() {
let now = +Date.now();
let delta = now - this.then || +Date.now();
let interval = 1000 / this.fps;
export default {
name: 'ProgressBar',
props: {
type: {
type: String,
default() {
return 'line';
}
},
showText: {
type: Boolean,
default() {
return true;
}
},
textInside: {
type: Boolean,
default() {
return false;
}
},
strokeWidth: {
type: Number,
default() {
return 5;
}
},
background: {
type: String,
default() {
return 'rgba(0, 0, 0, 0.8)';
}
}
},
data() {
return {
color: '#8e71c7',
status: null,
show: true,
percentage: 0,
fps: 30,
then: null
};
},
mounted() {
this.percentage = this.randomNum();
},
methods: {
randomNum() {
return Math.ceil(Math.random() * 5) + 50;
},
run() {
const now = +Date.now();
const delta = now - this.then || +Date.now();
const interval = 1000 / this.fps;
if (delta > interval) {
this.then = now - (delta % interval);
if (this.percentage < 90) {
this.percentage = this.percentage + 5
} else {
cancelRequestAnimFrame(this.run);
}
}
if (delta > interval) {
this.then = now - (delta % interval);
if (this.percentage < 90) {
this.percentage = this.percentage + 5;
} else {
cancelRequestAnimFrame(this.run);
}
}
requestAnimationFrame(this.run);
},
start() {
if (!this.show) {
this.status = null;
this.percentage = this.randomNum();
this.show = true;
this.run();
}
},
end(isSuccess) {
cancelRequestAnimFrame(this.run);
if (this.show) {
if (isSuccess) {
this.success();
} else {
this.failed();
}
}
},
progressAt(num) {
if (num > 0 && num < 100 && num > this.percentage) {
this.percentage = num
}
},
success() {
this.status = 'success';
this.percentage = 100;
setTimeout(() => {
this.show = false;
}, 1000 / this.fps);
},
failed() {
this.status = 'exception';
setTimeout(() => {
this.show = false;
}, 1000 / this.fps);
}
}
}
requestAnimationFrame(this.run);
},
start() {
if (!this.show) {
this.status = null;
this.percentage = this.randomNum();
this.show = true;
this.run();
}
},
end(isSuccess) {
cancelRequestAnimFrame(this.run);
if (this.show) {
if (isSuccess) {
this.success();
} else {
this.failed();
}
}
},
progressAt(num) {
if (num > 0 && num < 100 && num > this.percentage) {
this.percentage = num;
}
},
success() {
this.status = 'success';
this.percentage = 100;
setTimeout(() => {
this.show = false;
}, 1000 / this.fps);
},
failed() {
this.status = 'exception';
setTimeout(() => {
this.show = false;
}, 1000 / this.fps);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";

View File

@ -1,170 +1,166 @@
<template>
<div class="reminder-drag">
<div class="reminder-box" ref="drapBox">
<div class="tip-title">
<i class="icon el-icon-minus" @click="shrink" v-show="isShrink"></i>
<i class="icon el-icon-plus" @click="shrink" v-show="!isShrink"></i>
<p style="color: #fff;" v-if="isShrink">
<span>{{ title }}</span>
</p>
<div class="reminder-drag">
<div ref="drapBox" class="reminder-box">
<div class="tip-title">
<i v-show="isShrink" class="icon el-icon-minus" @click="shrink" />
<i v-show="!isShrink" class="icon el-icon-plus" @click="shrink" />
<p v-if="isShrink" style="color: #fff;">
<span>{{ title }}</span>
</p>
</div>
<div ref="dragBody" class="tip-body-box">
<div class="tip-body">
<template v-if="displayType=='role'">
<role-condition-script :group="group" @getBehaviorList="getBehaviorList" />
</template>
<template v-if="displayType=='behavior'">
<div class="tab-pane-big">
<el-scrollbar ref="elScrollbar" wrap-class="scrollbar-wrapper">
<get-behavior ref="getBehavior" :group="group" :member-id="memberId" @backToMember="backToMember" @getActions="getActions" @backToTop="backToTop" />
</el-scrollbar>
</div>
<div class="tip-body-box" ref="dragBody">
<div class="tip-body">
<template v-if="displayType=='role'">
<role-condition-script :group="group" @getBehaviorList="getBehaviorList"></role-condition-script>
</template>
<template v-if="displayType=='behavior'">
<div class="tab-pane-big">
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elScrollbar">
<get-behavior ref="getBehavior" :group="group" :memberId="memberId" @backToMember="backToMember" @getActions="getActions" @backToTop="backToTop"></get-behavior>
</el-scrollbar>
</div>
</template>
<template v-if="displayType=='action'">
<div class="tab-pane-big">
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elActionScrollbar">
<get-action ref="getAction" :group="group" :memberId="memberId" :behaviorId="behaviorId" @backToBehavior="backToBehavior" @backToTop="backToActionTop"></get-action>
</el-scrollbar>
</div>
</template>
<el-button-group class="button-group">
<el-button type="primary" @click="saveMaplocation">更新定位</el-button>
<el-button type="primary" @click="saveScenesStage">保存背景</el-button>
<el-button type="success" @click="saveScenesData">保存数据</el-button>
<!-- <el-button type="danger" @click="dumpScenesData">重置剧本</el-button> -->
</el-button-group>
</div>
</template>
<template v-if="displayType=='action'">
<div class="tab-pane-big">
<el-scrollbar ref="elActionScrollbar" wrap-class="scrollbar-wrapper">
<get-action ref="getAction" :group="group" :member-id="memberId" :behavior-id="behaviorId" @backToBehavior="backToBehavior" @backToTop="backToActionTop" />
</el-scrollbar>
</div>
</template>
<el-button-group class="button-group">
<el-button type="primary" @click="saveMaplocation">更新定位</el-button>
<el-button type="primary" @click="saveScenesStage">保存背景</el-button>
<el-button type="success" @click="saveScenesData">保存数据</el-button>
<!-- <el-button type="danger" @click="dumpScenesData">重置剧本</el-button> -->
</el-button-group>
</div>
</div>
</div>
</div>
</template>
<script>
import GetBehavior from './scriptRecord/getBehavior';
import GetAction from './scriptRecord/getAction';
import RoleConditionScript from './scriptRecord/roleConditionScript';
import { launchFullscreen, exitFullscreen } from '@/utils/screen';
import {saveScriptScenes, saveScriptData, dumpScriptData} from '@/api/simulation';
import {updateMapLocation} from '@/api/quest';
import GetBehavior from './scriptRecord/getBehavior';
import GetAction from './scriptRecord/getAction';
import RoleConditionScript from './scriptRecord/roleConditionScript';
import {saveScriptScenes, saveScriptData, dumpScriptData} from '@/api/simulation';
export default {
name: 'TipScriptRecord',
props: {
group: {
type: String,
required: true
},
},
components: {
GetBehavior,
GetAction,
RoleConditionScript,
},
data() {
return {
title: '任务录制',
isShrink: false,
memberId:null,
behaviorId:null,
displayType:"role",
mapLocation:{},
// isSaveStage: true,
}
},
watch: {
'$store.state.map.mapViewLoadedCount': function (val) {
// debugger;
//
// this.$parent.$parent.$refs['mapCanvas'].$refs['mapCommon'].$refs['jlmapVisual'].$jlmap.setOptions({type: 'zoom', scale:this.mapLocation.scale});
}
},
created() {
},
mounted(){
this.shrink();
},
methods: {
jump(obj) {
},
shrink() {
let height = this.$refs.dragBody.offsetHeight + 40;
let top = this.$refs.drapBox.style.top;
if (this.isShrink) {
this.$refs.drapBox.style.height = '40px';
this.$refs.drapBox.style.top = '';
this.isShrink = false;
} else {
this.$refs.drapBox.style.height = height + 'px';
this.$refs.drapBox.style.top = top;
this.isShrink = true;
}
},
backToMember(){
this.displayType="role";
},
backToBehavior(){
this.displayType="behavior";
},
getActions(row){
this.displayType="action";
this.behaviorId=row.id;
this.$store.dispatch('scriptRecord/updateBehaviorName',row.description);
},
saveScenesStage() {
saveScriptScenes(this.group).then(resp => {
// this.isSaveStage = false;
this.$message.success('保存背景成功');
}).catch(error => {
this.$messageBox('保存背景失败!');
})
},
saveScenesData() {
saveScriptData(this.group).then(resp => {
this.$message.success('保存数据成功');
}).catch(error => {
this.$messageBox('保存数据失败!');
})
},
dumpScenesData() {
this.$confirm('此操作将会清除已保存的录制数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
dumpScriptData(this.scriptId).then(resp => {
// this.isSaveStage = true;
this.$message.success('清除数据成功');
}).catch(error => {
this.$messageBox('清除数据失败!');
})
}).catch(error => { })
},
getBehaviorList(id){
this.displayType="behavior";
this.memberId=id;
},
backToTop(){
var div = this.$refs['elScrollbar'].$refs['wrap'];
div.scrollTop=0;
},
backToActionTop(){
var div = this.$refs['elActionScrollbar'].$refs['wrap'];
div.scrollTop=0;
},
saveMaplocation()
{
// this.$parent.$parent.$refs['mapCanvas'].$refs['mapCommon'].$refs['jlmapVisual'].$jlmap.$options
// let dataZoom = this.$store.state.map.dataZoom;
// let scriptId=this.$route.query.scriptId;
// let data={scale:dataZoom.scaleRate,x:dataZoom.offsetX,y:dataZoom.offsetY};
// updateMapLocation(scriptId,data).then(response=>{
// this.$message.success('');
// }).catch(error => {
// this.$messageBox(`: ${error.message}`);
// });
}
}
}
export default {
name: 'TipScriptRecord',
components: {
GetBehavior,
GetAction,
RoleConditionScript
},
props: {
group: {
type: String,
required: true
}
},
data() {
return {
title: '任务录制',
isShrink: false,
memberId: null,
behaviorId: null,
displayType: 'role',
mapLocation: {}
// isSaveStage: true,
};
},
watch: {
'$store.state.map.mapViewLoadedCount': function (val) {
// debugger;
//
// this.$parent.$parent.$refs['mapCanvas'].$refs['mapCommon'].$refs['jlmapVisual'].$jlmap.setOptions({type: 'zoom', scale:this.mapLocation.scale});
}
},
created() {
},
mounted() {
this.shrink();
},
methods: {
jump(obj) {
},
shrink() {
const height = this.$refs.dragBody.offsetHeight + 40;
const top = this.$refs.drapBox.style.top;
if (this.isShrink) {
this.$refs.drapBox.style.height = '40px';
this.$refs.drapBox.style.top = '';
this.isShrink = false;
} else {
this.$refs.drapBox.style.height = height + 'px';
this.$refs.drapBox.style.top = top;
this.isShrink = true;
}
},
backToMember() {
this.displayType='role';
},
backToBehavior() {
this.displayType='behavior';
},
getActions(row) {
this.displayType='action';
this.behaviorId=row.id;
this.$store.dispatch('scriptRecord/updateBehaviorName', row.description);
},
saveScenesStage() {
saveScriptScenes(this.group).then(resp => {
// this.isSaveStage = false;
this.$message.success('保存背景成功');
}).catch(() => {
this.$messageBox('保存背景失败!');
});
},
saveScenesData() {
saveScriptData(this.group).then(resp => {
this.$message.success('保存数据成功');
}).catch(() => {
this.$messageBox('保存数据失败!');
});
},
dumpScenesData() {
this.$confirm('此操作将会清除已保存的录制数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
dumpScriptData(this.scriptId).then(resp => {
// this.isSaveStage = true;
this.$message.success('清除数据成功');
}).catch(() => {
this.$messageBox('清除数据失败!');
});
});
},
getBehaviorList(id) {
this.displayType='behavior';
this.memberId=id;
},
backToTop() {
var div = this.$refs['elScrollbar'].$refs['wrap'];
div.scrollTop=0;
},
backToActionTop() {
var div = this.$refs['elActionScrollbar'].$refs['wrap'];
div.scrollTop=0;
},
saveMaplocation() {
// this.$parent.$parent.$refs['mapCanvas'].$refs['mapCommon'].$refs['jlmapVisual'].$jlmap.$options
// let dataZoom = this.$store.state.map.dataZoom;
// let scriptId=this.$route.query.scriptId;
// let data={scale:dataZoom.scaleRate,x:dataZoom.offsetX,y:dataZoom.offsetY};
// updateMapLocation(scriptId,data).then(response=>{
// this.$message.success('');
// }).catch(error => {
// this.$messageBox(`: ${error.message}`);
// });
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
@ -218,7 +214,7 @@
margin-left: 20px;
float:right;
}
}
.icon {
@ -239,4 +235,4 @@
}
}
}
</style>
</style>