This commit is contained in:
lVAL 2021-02-23 12:17:04 +08:00
commit 420f67693d
13 changed files with 201 additions and 1473 deletions

View File

@ -1,159 +0,0 @@
<template>
<el-dialog
v-dialogDrag
class="ningbo-01__systerm section-control"
:title="title"
:visible.sync="show"
width="300px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row class="header">
<el-col :span="24">
<span style="margin-right: 10px;">区段:</span>
<el-select
:id="domIdChoose"
v-model="sectionCode"
filterable
size="mini"
@change="sectionSelectChange"
>
<el-option v-for="(option,index) in switchAndPhySicalSectionList" :key="index" :label="option.name" :value="option.name" />
</el-select>
</el-col>
</el-row>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<notice-info ref="noticeInfo" pop-class="ningbo-01__systerm" />
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import OperationHandler from '@/scripts/cmdPlugin/OperationHandler';
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
export default {
name: 'SectionControl',
components: {
NoticeInfo
},
data() {
return {
dialogShow: false,
loading: false,
operation: '',
sectionCode: ''
};
},
computed: {
...mapGetters('map', [
'sectionList'
]),
switchAndPhySicalSectionList() {
let list = [];
if (this.sectionList && this.sectionList.length) {
list = this.sectionList.filter(elem => { return elem.type === '01' || elem.type === '03'; });
}
return list;
},
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdChoose() {
return this.dialogShow ? OperationEvent.AxleReset.SetAxleReset.choose.domId : '';
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationHandler.getDomIdByOperation(this.operation) : '';
},
title() {
return '计轴复位';
}
},
watch: {
'$store.state.map.keyboardEnterCount': function (val) {
if (this.show && !this.loading) {
this.commit();
}
}
},
methods: {
doShow(operate) {
if (!this.dialogShow) {
this.sectionCode = '';
this.operation = operate.operation || '';
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
},
sectionSelectChange() {
const operate = {
operation: OperationEvent.AxleReset.SetAxleReset.choose.operation,
val: this.sectionCode
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
});
},
commit() {
const operate = {
over: true,
operation: this.operation,
cmdType: CMD.Section.CMD_SECTION_AXIS_PRE_RESET,
param: {
sectionCode: this.sectionCode
}
};
this.sendCommand(operate);
},
sendCommand(operate) {
this.loading = true;
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow();
});
},
cancel() {
const operate = {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
});
}
}
};
</script>

View File

@ -1,181 +0,0 @@
<template>
<el-dialog
v-dialogDrag
class="ningbo-01__systerm stand-run-level"
:title="title"
:visible.sync="show"
width="320px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<div style="font-size: 16px; margin-bottom: 5px;">变通节点</div>
<div style="margin-bottom: 5px;">
<el-input v-model="stationName" size="mini" disabled />
</div>
<div style="font-size: 16px; margin-bottom: 5px;">当前变通策略</div>
<div style="margin-bottom: 5px;">
<el-input v-model="stationStrategy" size="mini" disabled />
</div>
<div style="font-size: 16px; margin-bottom: 5px;">变通策略选项</div>
<el-table
ref="table"
:data="strategyList"
border
:cell-style="tableStyle"
style="width: 100%; margin-top:10px"
size="mini"
height="180"
highlight-current-row
:show-header="false"
@row-click="clickEvent"
>
<el-table-column :id="domIdChoose" prop="label" style="margin-left:30px" />
</el-table>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" :disabled="!isConfirm" @click="commit">
确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<notice-info ref="noticeInfo" pop-class="ningbo-01__systerm" />
</el-dialog>
</template>
<script>
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import { mapGetters } from 'vuex';
export default {
name: 'StandBackStrategy',
components: {
NoticeInfo
},
data() {
return {
dialogShow: false,
loading: false,
strategyList: [],
stationName: '',
stationStrategy: '',
selection: [],
isConfirm: false,
strategyId: '',
tableStyle: {
'border-bottom': 'none'
}
};
},
computed: {
...mapGetters('map', [
'stationList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Station.setBackStrategy.menu.domId : '';
},
domIdChoose() {
return this.dialogShow ? OperationEvent.Station.setBackStrategy.choose.domId : '';
},
title() {
return '策略选择';
}
},
watch: {
'$store.state.map.keyboardEnterCount': function (val) {
if (this.show && !this.loading && this.isConfirm) {
this.commit();
}
}
},
methods: {
doShow(operate, selected) {
this.selected = selected;
if (!this.dialogShow) {
const name = selected.optionList.find(ele => ele.id == selected.tbStrategyId).label;
this.stationName = selected.name || '';
this.stationStrategy = selected.tbStrategyId ? name : '无策略折返'; //
this.strategyList = selected.optionList; //
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
clickEvent(row, column, event) {
const operate = {
operation: OperationEvent.Station.setBackStrategy.choose.operation
};
this.strategyId = row.id;
this.isConfirm = true;
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
checkTableDataSelction(data) {
const selection = [];
if (data && data.length > 0) {
data.forEach(row => {
if (row.check && !row.disabled) {
selection.push(row);
}
});
}
this.disabledSend = !selection.length;
if (JSON.stringify(selection) !== JSON.stringify(this.selection)) {
this.selection = selection;
}
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
},
commit() {
if (this.isConfirm) {
this.loading = true;
commitOperate(menuOperate.StationControl.setBackStrategy, {id: this.strategyId}, 2).then(({valid})=>{
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow();
});
} else {
this.doClose();
}
},
cancel() {
const operate = {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
});
}
}
};
</script>

View File

@ -1,308 +0,0 @@
<template>
<el-dialog v-dialogDrag class="ningbo-01__systerm route-setting" :title="title" :visible.sync="show" width="540px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<el-row style="margin-bottom: 10px;">
<el-col :span="17">
<el-table ref="table" :data="stationLists" border style="width: 100%;" size="mini" height="260" highlight-current-row @row-click="clickEvent">
<el-table-column label="选择" width="50">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.checked" :disabled="scope.row.disable" />
</template>
</el-table-column>
<el-table-column label="车站名">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="当前状态">
<template slot-scope="scope">
<span v-if="scope.row.controlMode == 'Center'">遥控</span>
<span v-else-if="scope.row.controlMode == 'Local'">站控</span>
<!-- <span v-else-if="scope.row.controlMode == 'Local' && $route.query.prdType == '02'">中心请求站控</span>
<span v-else-if="scope.row.controlMode == 'Center' && $route.query.prdType == '01'">现地请求遥控</span> -->
<span v-else>获取状态中...</span>
</template>
</el-table-column>
</el-table>
</el-col>
<el-col :span="6" :offset="1">
<el-radio v-model="controlMode" label="center" :disabled="disabledAll" style="margin-bottom: 8px;">请求站控</el-radio>
<el-radio v-model="controlMode" label="local" :disabled="disabledAll">请求遥控</el-radio>
</el-col>
</el-row>
<el-row style="margin-bottom: 15px;">
<el-col :span="17">
<el-col :span="11" style="text-align: center;"><el-checkbox v-model="checkedAll" size="medium" :disabled="disabledAll" @change="selectAll">全部选择</el-checkbox></el-col>
<el-col :span="11" :offset="2"><el-checkbox v-model="checked2" :disabled="disabledAll" size="medium">全部确认</el-checkbox></el-col>
</el-col>
<el-col :span="5" :offset="1" style="margin-top: -56px;">
<el-button :id="domIdConfirm" type="primary" :disabled="commitDisabled" :loading="loading" style="margin-left: 0; margin-bottom: 10px; width: 100%;" @click="commit"> </el-button>
<el-button :id="domIdCancel" style="margin-left: 0; width: 100%;" @click="cancel"> </el-button>
</el-col>
</el-row>
<notice-info ref="noticeInfo" pop-class="ningbo-01__systerm" />
</el-dialog>
</template>
<script>
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import {mouseCancelState} from '@/jmapNew/theme/components/utils/menuItemStatus';
import { mapGetters } from 'vuex';
export default {
name: 'StationControl',
components: {
NoticeInfo
},
data() {
return {
controlMode: 'center',
beforeSectionList: [],
checkedAll: false,
dialogShow: false,
loading: false,
selected: null,
row: null,
operation: '',
stationLists: [],
disabledAll: false,
checked2: false,
commitDisabled:false
};
},
computed: {
...mapGetters('map', [
'stationList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdChoose() {
if (this.operation == OperationEvent.StationControl.requestCentralControl.menu.operation) {
return OperationEvent.StationControl.requestCentralControl.choose.domId;
} else if (this.operation == OperationEvent.StationControl.requestStationControl.menu.operation) {
return OperationEvent.StationControl.requestStationControl.choose.domId;
}
return '';
},
domIdConfirm() {
if (this.operation == OperationEvent.StationControl.requestCentralControl.menu.operation) {
return OperationEvent.StationControl.requestCentralControl.confirm.domId;
} else if (this.operation == OperationEvent.StationControl.requestStationControl.menu.operation) {
return OperationEvent.StationControl.requestStationControl.confirm.domId;
}
return '';
},
title() {
return '站遥控转换';
}
},
watch: {
'$store.state.map.controlTransfer':function (controlTransferList) {
controlTransferList.forEach(controlTransfer=>{
this.updateTableValue(controlTransfer);
});
},
'$store.state.map.keyboardEnterCount': function (val) {
if (this.show && !this.loading) {
this.commit();
}
}
},
methods: {
getStationList(disable) {
this.stationLists = [];
if (this.stationList && this.stationList.length) {
this.stationList.forEach(item => {
if (item.centralized) {
const station = this.$store.getters['map/getDeviceByCode'](item.code);
let checked = false;
if (station.code == this.selected.code) {
checked = true;
}
const param = {
checked: checked,
disable: disable,
code: item.code,
name: item.name,
controlMode: station.controlMode
};
this.stationLists.push(param);
}
});
}
},
updateTableValue(controlTransfer) {
this.stationLists.forEach((row, index) => {
if (row.code == controlTransfer.code) {
if (controlTransfer.applicantId) {
this.commitDisabled = true;
} else {
this.commitDisabled = false;
}
}
});
// this.tableData.forEach((row, index) => {
// if (row.code == controlTransfer.code) {
// if (controlTransfer.applicantId) {
// row.result = this.$t('menu.menuDialog.senedMessageOne') + controlTransfer.validDuration + this.$t('menu.menuDialog.senedMessageTwo');
// row.disabled = true;
// row.check = false;
// } else {
// if (row.control != this.controlProps[controlTransfer.controlMode]) {
// row.result = this.$t('menu.menuDialog.controlModeTransfersuccees');
// row.control = this.controlProps[controlTransfer.controlMode];
// this.removeSelection(controlTransfer.code);
// row.disabled = true;
// row.check = false;
// } else {
// row.result = this.$t('menu.menuDialog.controlModeTransferFailed');
// this.removeSelection(controlTransfer.code);
// row.disabled = false;
// row.check = false;
// }
// this.disabledClose = false;
// this.disabledSure = false;
// }
// }
// });
},
getProtectedSectionName(row) {
let name = '';
if (row &&
row.overlapSectionList &&
row.overlapSectionList &&
row.overlapSectionList.length > 0) {
const protect = row.overlapSectionList[0];
name = `${protect.name}`;
const station = this.$store.getters['map/getDeviceByCode'](protect.stationCode);
if (station) {
name = `${name}(${station.name})`;
}
}
return name;
},
doShow(operate, selected) {
this.selected = selected;
//
if (!this.dialogShow) {
this.operation = operate.operation;
if (selected) {
this.getStationList(true);
this.disabledAll = true;
} else {
this.getStationList(false);
this.disabledAll = false;
}
if (this.operation == OperationEvent.StationControl.requestCentralControl.menu.operation) {
this.controlMode = 'local';
} else if (this.operation == OperationEvent.StationControl.requestStationControl.menu.operation) {
this.controlMode = 'center';
}
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.restoreBeforeDevices();
this.$refs.table.setCurrentRow();
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('socket/shiftMsgQueue');
mouseCancelState(this.selected);
},
restoreBeforeDevices() {
//
if (this.beforeSectionList && this.beforeSectionList.length) {
this.beforeSectionList.forEach(elem => {
elem.cutOff = false;
});
}
this.$store.dispatch('training/updateMapState', [...this.beforeSectionList]);
this.beforeSectionList = [];
},
selectAll() {
this.stationLists.forEach(row => {
if (this.checkedAll) {
row.checked = true;
} else {
row.checked = false;
}
});
},
clickEvent(row, event, column) {
this.row = row;
if (row) {
//
const operate = {
operation: OperationEvent.Signal.arrangementRoute.choose.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
}
},
commit() {
const list = [];
this.stationLists.forEach(row => {
if (row.checked) {
list.push(row.code);
}
});
if (list && list.length) {
const operate = {
over: true,
operation: '',
cmdType: '',
param: {
stationCodes: list
}
};
if (this.controlMode == 'center') {
operate.cmdType = CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_STATION_CONTROL;
operate.operation = OperationEvent.StationControl.requestStationControl.confirm.operation;
} else if (this.controlMode == 'local') {
operate.cmdType = CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_CENTER_CONTROL;
operate.operation = OperationEvent.StationControl.requestCentralControl.confirm.operation;
}
this.loading = true;
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow();
});
}
},
cancel() {
const operate = {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
});
}
}
};
</script>

View File

@ -1,176 +0,0 @@
<template>
<el-dialog
v-dialogDrag
class="ningbo-01__systerm signal-control"
:title="title"
:visible.sync="show"
width="300px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row class="header">
<el-col :span="11"><span>集中站</span></el-col>
<el-col :span="11" :offset="2"><span>折返</span></el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-input v-model="stationName" size="small" disabled />
</el-col>
<el-col :span="11" :offset="2">
<el-input v-model="signalName" size="small" disabled />
</el-col>
</el-row>
<el-row style="margin: 12px 0;">
<el-col :span="11">
<el-radio v-model="passRadio" label="1" style="display: block; padding-left: 10px; margin-bottom: 10px;" :disabled="passRadio == '2'">设置</el-radio>
</el-col>
<el-col :span="11" :offset="2">
<el-radio v-model="passRadio" label="2" style="display: block; padding-left: 10px;" :disabled="passRadio == '1'">取消</el-radio>
</el-col>
</el-row>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<confirm-control ref="confirmControl" />
<notice-info ref="noticeInfo" pop-class="ningbo-01__systerm" />
</el-dialog>
</template>
<script>
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import ConfirmControl from './childDialog/confirmControl';
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import {mouseCancelState} from '@/jmapNew/theme/components/utils/menuItemStatus';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
export default {
name: 'RouteControl',
components: {
ConfirmControl,
NoticeInfo
},
data() {
return {
dialogShow: false,
loading: false,
selected: null,
operation: null,
stationName: '',
signalName: '',
passRadio: '1'
};
},
computed: {
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.close.menu.domId : '';
},
domIdConfirm() {
if (this.dialogShow) {
if (this.operation == OperationEvent.AutoTurnBack.SetAutoTurnBackButton.menu.operation) {
return OperationEvent.AutoTurnBack.SetAutoTurnBackButton.menu.domId;
} else if (this.operation == OperationEvent.AutoTurnBack.CancelAutoTurnBackButton.menu.operation) {
return OperationEvent.AutoTurnBack.CancelAutoTurnBackButton.menu.domId;
} else {
return '';
}
} else {
return '';
}
},
title() {
return '自动折返';
}
},
watch: {
'$store.state.map.keyboardEnterCount': function (val) {
if (this.show && !this.loading) {
this.commit();
}
}
},
methods: {
doShow(operate, selected) {
this.selected = selected;
if (!this.dialogShow) {
this.signalName = '';
this.stationName = '';
if (selected && selected._type.toUpperCase() === 'AutoTurnBack'.toUpperCase()) {
const autoReentryData = this.$store.getters['map/autoReentryData'];
this.signalName = autoReentryData[selected.cycleCode].name;
const station = this.$store.getters['map/getDeviceByCode'](selected.stationCode);
if (station) {
this.stationName = station.name;
}
}
this.operation = operate.operation;
if (this.operation == OperationEvent.AutoTurnBack.SetAutoTurnBackButton.menu.operation) {
this.passRadio = '1';
} else if (this.operation == OperationEvent.AutoTurnBack.CancelAutoTurnBackButton.menu.operation) {
this.passRadio = '2';
}
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
mouseCancelState(this.selected);
},
commit() {
if (this.operation == OperationEvent.AutoTurnBack.SetAutoTurnBackButton.menu.operation) {
this.singalPassModel(); //
} else if (this.operation == OperationEvent.AutoTurnBack.CancelAutoTurnBackButton.menu.operation) {
this.singalCancelPassModel(); //
}
},
//
singalPassModel() {
this.sendCommand(menuOperate.Signal.setAutoTurnBack);
},
//
singalCancelPassModel() {
this.sendCommand(menuOperate.Signal.cancelAutoTurnBack);
},
sendCommand(operate) {
this.loading = true;
commitOperate(operate, {}, 2).then((data)=>{
this.loading = false;
this.doClose();
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow();
});
},
//
cancel() {
const operate = {
operation: OperationEvent.Command.close.menu.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
this.$refs.noticeInfo.doShow();
});
}
}
};
</script>

View File

@ -1,11 +1,7 @@
<template> <template>
<div class="menus" :style="{width: width + 'px'}"> <div class="menus" :style="{width: width + 'px'}">
<menu-bar v-show="isShowBar" ref="menuBar" :selected="selected" /> <menu-bar v-show="isShowBar" ref="menuBar" :selected="selected" />
<menu-axle-reset ref="menuAxleReset" :selected="selected" />
<menu-auto-trun-route ref="menuAutoTrunRoute" :selected="selected" />
<menu-station-stand ref="menuStationStand" :selected="selected" /> <menu-station-stand ref="menuStationStand" :selected="selected" />
<menu-station-control ref="menuStationControl" />
<menu-station-turn-back ref="menuStationTurnBack" :selected="selected" />
<menu-switch ref="menuSwitch" :selected="selected" /> <menu-switch ref="menuSwitch" :selected="selected" />
<menu-signal ref="menuSignal" :selected="selected" /> <menu-signal ref="menuSignal" :selected="selected" />
<menu-section ref="menuSection" :selected="selected" /> <menu-section ref="menuSection" :selected="selected" />
@ -21,17 +17,13 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import MenuSignal from './menuSignal'; import MenuSignal from './menuSignal';
import MenuAxleReset from './menuAxleReset';
import MenuAutoTrunRoute from './menuAutoTrunRoute';
import MenuStationStand from './menuStationStand'; import MenuStationStand from './menuStationStand';
import MenuStationControl from './menuStationControl';
import MenuSwitch from './menuSwitch'; import MenuSwitch from './menuSwitch';
import MenuSection from './menuSection'; import MenuSection from './menuSection';
import MenuTrain from './menuTrain'; import MenuTrain from './menuTrain';
import MenuStation from './menuStation'; import MenuStation from './menuStation';
import MenuBar from './menuBar'; import MenuBar from './menuBar';
import MenuLimit from './menuLimit'; import MenuLimit from './menuLimit';
import MenuStationTurnBack from './menuStationTurnBack';
// import PassiveAlarm from './passiveDialog/alarm'; // import PassiveAlarm from './passiveDialog/alarm';
import PassiveContorl from '@/jmapNew/theme/components/menus/passiveDialog/control'; import PassiveContorl from '@/jmapNew/theme/components/menus/passiveDialog/control';
// import PassiveTimeout from './passiveDialog/timeout'; // import PassiveTimeout from './passiveDialog/timeout';
@ -40,16 +32,12 @@ export default {
name: 'Menus', name: 'Menus',
components: { components: {
MenuBar, MenuBar,
MenuAxleReset,
MenuAutoTrunRoute,
MenuSignal, MenuSignal,
MenuSwitch, MenuSwitch,
MenuSection, MenuSection,
MenuStationStand, MenuStationStand,
MenuStationControl,
MenuStation, MenuStation,
MenuTrain, MenuTrain,
MenuStationTurnBack,
MenuLimit, MenuLimit,
// PassiveAlarm, // PassiveAlarm,
PassiveContorl PassiveContorl

View File

@ -1,125 +0,0 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<turn-back-control ref="turnBackControl" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import TurnBackControl from './dialog/turnBackControl';
import { mapGetters } from 'vuex';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
export default {
name: 'MenuLimit',
components: {
PopMenu,
TurnBackControl
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
menu: [],
menuNormal: {
Local: [
{
label: '设置自动折返',
handler: this.handlerTurnBack,
cmdType: CMD.Signal.CMD_SIGNAL_SET_AUTO_TURN_BACK
},
{
label: '取消自动折返',
handler: this.cancelTurnBack,
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_AUTO_TURN_BACK
}
],
Center: [
{
label: '设置自动折返',
handler: this.handlerTurnBack,
cmdType: CMD.Signal.CMD_SIGNAL_SET_AUTO_TURN_BACK
},
{
label: '取消自动折返',
handler: this.cancelTurnBack,
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_AUTO_TURN_BACK
}
]
}
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.AutoTurnBack) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
this.menu = MenuContextHandler.covert(this.menuNormal);
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce;
}
},
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();
}
},
//
handlerTurnBack() {
commitOperate(menuOperate.Signal.setAutoTurnBack, {cycleCode:this.selected.cycleCode}, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.turnBackControl.doShow(operate, this.selected);
}
});
},
//
cancelTurnBack() {
commitOperate(menuOperate.Signal.cancelAutoTurnBack, {cycleCode:this.selected.cycleCode, cancelRoute:false}, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.turnBackControl.doShow(operate, this.selected);
}
});
}
}
};
</script>

View File

@ -1,103 +0,0 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<section-alxe-reset ref="sectionAlxeReset" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import SectionAlxeReset from './dialog/sectionAlxeReset';
import { mapGetters } from 'vuex';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
export default {
name: 'MenuLimit',
components: {
PopMenu,
SectionAlxeReset
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
menu: [],
menuNormal: {
Local: [
{
label: '计轴复位',
handler: this.handleAxleReset,
cmdType: CMD.Section.CMD_SECTION_AXIS_PRE_RESET
}
],
Center: [
]
}
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.AxleReset) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
this.menu = MenuContextHandler.covert(this.menuNormal);
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce;
}
},
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();
}
},
//
handleAxleReset() {
commitOperate(menuOperate.AxleReset.SetAxleReset, {}, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.sectionAlxeReset.doShow(operate);
}
});
}
}
};
</script>

View File

@ -745,17 +745,17 @@ export default {
title: '授权转移', title: '授权转移',
click: this.authorizeTransfer, click: this.authorizeTransfer,
operate: OperationEvent.Command.commandNingBo3.line_user_transfer operate: OperationEvent.Command.commandNingBo3.line_user_transfer
},
{
title: '下放站控',
click: this.authorizeDevolution,
operate: OperationEvent.Command.commandNingBo3.line_user_devolution
},
{
title: '收回站控',
click: this.authorizeReclaim,
operate: OperationEvent.Command.commandNingBo3.line_user_reclaim
} }
// {
// title: '',
// click: this.authorizeDevolution,
// operate: OperationEvent.Command.commandNingBo3.line_user_devolution
// },
// {
// title: '',
// click: this.authorizeReclaim,
// operate: OperationEvent.Command.commandNingBo3.line_user_reclaim
// }
] ]
} }
] ]

View File

@ -105,7 +105,7 @@ export default {
'selected': function(val) { 'selected': function(val) {
if (val) { if (val) {
const stationEle = this.$store.getters['map/getDeviceByCode'](val.code); const stationEle = this.$store.getters['map/getDeviceByCode'](val.code);
if (stationEle) { if (stationEle && this.$store.state.training.prdType == '02') {
if (stationEle.controller) { if (stationEle.controller) {
const memberData = this.$store.state.training.memberData; const memberData = this.$store.state.training.memberData;
if (memberData[stationEle.controller].userId == this.$store.state.user.id) { if (memberData[stationEle.controller].userId == this.$store.state.user.id) {
@ -116,6 +116,8 @@ export default {
} else { } else {
this.status = true; this.status = true;
} }
} else {
this.status = true;
} }
} }
} }
@ -171,7 +173,7 @@ export default {
const steps = { const steps = {
operation: isClose ? OperationEvent.Command.common.confirm.operation : OperationEvent.Command.common.apply.operation, operation: isClose ? OperationEvent.Command.common.confirm.operation : OperationEvent.Command.common.apply.operation,
over: true, over: true,
param: {stationCode:val.code} param: {stationCodes:[val.code]}
}; };
// steps.cmdType = this.status ? CMD.ControlConvertMenu.CMD_CM_RECEIVE_CONTROL : CMD.ControlConvertMenu.CMD_CM_SURRENDER_CONTROL; // steps.cmdType = this.status ? CMD.ControlConvertMenu.CMD_CM_RECEIVE_CONTROL : CMD.ControlConvertMenu.CMD_CM_SURRENDER_CONTROL;
@ -182,7 +184,7 @@ export default {
isClose && this.doClose(); isClose && this.doClose();
this.$emit('commandSuccess', val.code); this.$emit('commandSuccess', val.code);
} }
}).catch((error) => { }).catch(() => {
isClose && this.doClose(); isClose && this.doClose();
this.$refs.noticeInfo.doShow(); this.$refs.noticeInfo.doShow();
}); });

View File

@ -35,14 +35,14 @@
<el-col :span="4" :offset="1"> <el-col :span="4" :offset="1">
<el-button <el-button
:id="domIdConfirm" :id="domIdConfirm"
:disabled="status"
type="primary" type="primary"
:loading="loading" :loading="loading"
@click="commit(true)" @click="commit(true)"
>确定(O)</el-button >确定(O)</el-button>
>
</el-col> </el-col>
<el-col :span="4" :offset="2"> <el-col :span="4" :offset="2">
<el-button :id="domIdApply" @click="commit(false)">应用(A)</el-button> <el-button :id="domIdApply" :disabled="status" @click="commit(false)">应用(A)</el-button>
</el-col> </el-col>
<el-col :span="4" :offset="2"> <el-col :span="4" :offset="2">
<el-button :id="domIdClose" @click="cancel">关闭(C)</el-button> <el-button :id="domIdClose" @click="cancel">关闭(C)</el-button>
@ -56,157 +56,169 @@
</template> </template>
<script> <script>
import { mapGetters } from "vuex"; import { mapGetters } from 'vuex';
import { OperationEvent } from "@/scripts/cmdPlugin/OperationHandler"; import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import NoticeInfo from "@/jmapNew/theme/components/menus/childDialog/noticeInfo"; import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import CMD from "@/scripts/cmdPlugin/CommandEnum"; import CMD from '@/scripts/cmdPlugin/CommandEnum';
export default { export default {
name: "StationControl", name: 'StationControl',
components: { components: {
NoticeInfo, NoticeInfo
},
data() {
return {
status: true,
operate: null,
loading: false,
dialogShow: false,
allChecked: false,
station: {},
message: "",
};
},
computed: {
...mapGetters("map", ["stationList"]),
...mapGetters("training", ["mode", "started"]),
centralizedStaionList() {
const list = [];
this.stationList.forEach((item) => {
if (item.centralized) {
list.push(this.$store.getters["map/getDeviceByCode"](item.code));
}
});
return list;
}, },
show() { data() {
return this.dialogShow && !this.$store.state.menuOperation.break; return {
status: true,
operate: null,
loading: false,
dialogShow: false,
allChecked: false,
station: {},
message: ''
};
}, },
selected() { computed: {
return this.$store.state.menuOperation.selected; ...mapGetters('map', ['stationList']),
}, ...mapGetters('training', ['mode', 'started']),
domIdChoose() { centralizedStaionList() {
return this.dialogShow ? OperationEvent.Command.common.choose.domId : ""; const list = [];
}, this.stationList.forEach((item) => {
domIdConfirm() { if (item.centralized) {
return this.dialogShow ? OperationEvent.Command.common.confirm.domId : ""; list.push(this.$store.getters['map/getDeviceByCode'](item.code));
}, }
domIdClose() {
return this.dialogShow ? OperationEvent.Command.common.close.domId : "";
},
domIdApply() {
return this.dialogShow ? OperationEvent.Command.common.apply.domId : "";
},
prdType() {
return this.$store.state.training.prdType;
},
concertrateStationList() {
return this.stationList.filter((station) => {
return station.centralized;
});
},
},
watch: {
selected: function (val) {
if (val) {
const sationEle = this.$store.getters["map/getDeviceByCode"](val.code);
if (this.prdType == "02") {
this.status = sationEle && sationEle.controlMode != "Center";
} else {
this.status = sationEle && sationEle.controlMode == "Center";
}
}
},
},
methods: {
doShow() {
this.message = "";
this.dialogShow = true;
this.$nextTick((e) => {
this.$refs.table.setCurrentRow();
this.$store.dispatch("training/emitTipFresh");
});
},
doClose() {
this.dialogShow = false;
this.$refs.table.setCurrentRow();
this.$store.dispatch("training/emitTipFresh");
this.$store.dispatch("socket/shiftMsgQueue");
},
cancel() {
const operate = {
type: "bar",
operation: OperationEvent.Command.common.close.operation,
};
this.$store.dispatch("training/nextNew", operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
});
},
handleCurrentChange(val) {
if (!val) {
return;
}
const step = {
code: val.code,
operation: OperationEvent.Command.common.choose.operation,
val: val.code,
};
this.$store
.dispatch("training/nextNew", step)
.then(({ valid }) => {
if (valid) {
this.$store.dispatch("menuOperation/handleBreakFlag", {
break: true,
}); });
this.$store.dispatch("menuOperation/setSelected", { device: val }); return list;
} },
}) show() {
.catch(() => { return this.dialogShow && !this.$store.state.menuOperation.break;
this.$refs.noticeInfo.doShow(); },
}); selected() {
return this.$store.state.menuOperation.selected;
},
domIdChoose() {
return this.dialogShow ? OperationEvent.Command.common.choose.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Command.common.confirm.domId : '';
},
domIdClose() {
return this.dialogShow ? OperationEvent.Command.common.close.domId : '';
},
domIdApply() {
return this.dialogShow ? OperationEvent.Command.common.apply.domId : '';
},
prdType() {
return this.$store.state.training.prdType;
},
concertrateStationList() {
return this.stationList.filter((station) => {
return station.centralized;
});
}
}, },
commit(isClose = true) { watch: {
const val = this.selected || {}; 'selected': function(val) {
const steps = { if (val) {
operation: isClose const stationEle = this.$store.getters['map/getDeviceByCode'](val.code);
? OperationEvent.Command.common.confirm.operation if (stationEle && this.$store.state.training.prdType == '02') {
: OperationEvent.Command.common.apply.operation, if (stationEle.controller) {
over: true, const memberData = this.$store.state.training.memberData;
param: { stationCode: val.code }, if (memberData[stationEle.controller].userId == this.$store.state.user.id) {
}; this.status = true;
} else {
steps.cmdType = this.status this.status = false;
? CMD.ControlConvertMenu.CMD_CM_RECEIVE_CONTROL }
: CMD.ControlConvertMenu.CMD_CM_SURRENDER_CONTROL; } else {
this.status = true;
this.$store }
.dispatch("training/nextNew", steps) } else {
.then(({ valid }) => { this.status = true;
if (valid) { }
isClose && this.doClose(); }
this.$emit("commandSuccess", val.code); }
}
})
.catch((error) => {
isClose && this.doClose();
this.$refs.noticeInfo.doShow();
});
}, },
}, methods: {
doShow() {
this.message = '';
this.dialogShow = true;
this.$nextTick((e) => {
this.$refs.table.setCurrentRow();
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.dialogShow = false;
this.status = true;
this.$store.dispatch('menuOperation/setSelected', {device: {}});
this.$refs.table.setCurrentRow();
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('socket/shiftMsgQueue');
},
cancel() {
const operate = {
type: 'bar',
operation: OperationEvent.Command.common.close.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
});
},
handleCurrentChange(val) {
if (!val) {
return;
}
const step = {
code: val.code,
operation: OperationEvent.Command.common.choose.operation,
val: val.code
};
this.$store
.dispatch('training/nextNew', step)
.then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', {
break: true
});
this.$store.dispatch('menuOperation/setSelected', { device: val });
}
})
.catch(() => {
this.$refs.noticeInfo.doShow();
});
},
commit(isClose = true) {
const val = this.selected || {};
const steps = {
operation: isClose
? OperationEvent.Command.common.confirm.operation
: OperationEvent.Command.common.apply.operation,
over: true,
param: {stationCodes:[val.code]}
};
// steps.cmdType = this.status
// ? CMD.ControlConvertMenu.CMD_CM_RECEIVE_CONTROL
// : CMD.ControlConvertMenu.CMD_CM_SURRENDER_CONTROL;
steps.cmdType = CMD.Station.CMD_STATION_CONTROL_REVOKE;
this.$store
.dispatch('training/nextNew', steps)
.then(({ valid }) => {
if (valid) {
isClose && this.doClose();
this.$emit('commandSuccess', val.code);
}
})
.catch(() => {
isClose && this.doClose();
this.$refs.noticeInfo.doShow();
});
}
}
}; };
</script> </script>
<style scoped rel="stylesheet/scss" lang="scss"> <style scoped rel="stylesheet/scss" lang="scss">

View File

@ -108,16 +108,30 @@ export default {
if (val) { if (val) {
const stationEle = this.$store.getters['map/getDeviceByCode'](val.code); const stationEle = this.$store.getters['map/getDeviceByCode'](val.code);
if (stationEle) { if (stationEle) {
if (stationEle.controller) { if (this.$store.state.training.prdType == '02') {
const memberData = this.$store.state.training.memberData; if (stationEle.controller) {
if (memberData[stationEle.controller].userId == this.$store.state.user.id) { const memberData = this.$store.state.training.memberData;
this.status = true; if (memberData[stationEle.controller].userId == this.$store.state.user.id) {
this.status = true;
} else {
this.status = false;
}
} else { } else {
this.status = false; this.status = false;
} }
} else { } else if (this.$store.state.training.prdType == '01') {
this.status = false; if (stationEle.controller) {
const memberData = this.$store.state.training.memberData;
if (memberData[stationEle.controller].userId == this.$store.state.user.id) {
this.status = true;
} else {
this.isCurrentStation(stationEle);
}
} else {
this.isCurrentStation(stationEle);
}
} }
} }
} }
} }
@ -131,6 +145,13 @@ export default {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
}); });
}, },
isCurrentStation(stationEle) {
if (this.$store.state.map.showCentralizedStationCode == stationEle.code) {
this.status = false;
} else {
this.status = true;
}
},
doClose() { doClose() {
this.dialogShow = false; this.dialogShow = false;
this.status = true; this.status = true;
@ -176,7 +197,6 @@ export default {
param: {stationCodes:[val.code]} param: {stationCodes:[val.code]}
}; };
// CMD_STATION_CONTROL_TRANSFER // CMD_STATION_CONTROL_TRANSFER
// CMD_STATION_CONTROL_REVOKE
// steps.cmdType = this.status ? CMD.ControlConvertMenu.CMD_CM_RECEIVE_CONTROL : CMD.ControlConvertMenu.CMD_CM_SURRENDER_CONTROL; // steps.cmdType = this.status ? CMD.ControlConvertMenu.CMD_CM_RECEIVE_CONTROL : CMD.ControlConvertMenu.CMD_CM_SURRENDER_CONTROL;
steps.cmdType = CMD.Station.CMD_STATION_CONTROL_APPLY; steps.cmdType = CMD.Station.CMD_STATION_CONTROL_APPLY;

View File

@ -1,131 +0,0 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<station-control ref="stationControl" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import StationControl from './dialog/stationControl';
import { mapGetters } from 'vuex';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
export default {
name: 'StationControlMenu',
components: {
PopMenu,
StationControl
},
// props: {
// selected: {
// type: Object,
// default() {
// return null;
// }
// }
// },
data() {
return {
menu: [],
menuNormal: {
Local: [
// {
// label: '',
// handler: this.setStationControl,
// cmdType: CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_STATION_CONTROL
// },
// {
// label: '',
// handler: this.setCenterControl,
// cmdType: CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_CENTER_CONTROL
// }
],
Center: [
// {
// label: '',
// handler: this.setStationControl,
// cmdType: CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_STATION_CONTROL
// },
// {
// label: '',
// handler: this.setCenterControl,
// cmdType: CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_CENTER_CONTROL
// }
]
},
menuForce: [
]
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.StationControl) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
this.menu = MenuContextHandler.covert(this.menuNormal);
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce;
}
this.getCurrentStateObject();
},
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();
}
},
getCurrentStateObject() {
this.selected = this.$store.getters['menuOperation/selected'];
},
setCenterControl() {
//
commitOperate(menuOperate.StationControl.requestCentralControl, {standCode:this.selected.code}, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.stationControl.doShow(operate, this.selected);
}
});
},
setStationControl() {
//
commitOperate(menuOperate.StationControl.requestStationControl, {standCode:this.selected.code}, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.stationControl.doShow(operate, this.selected);
}
});
}
}
};
</script>

View File

@ -1,111 +0,0 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<station-back-strategy ref="stationBackStrategy" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import StationBackStrategy from './dialog/stationBackStrategy';
import { mapGetters } from 'vuex';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
export default {
name: 'MenuStationTurnBack',
components: {
PopMenu,
StationBackStrategy
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
menu: [],
menuNormal: {
Local: [
{
label: '设置折返策略',
handler: this.setBackStrategy,
cmdType: CMD.Station.CMD_STATION_SET_TURN_BACK_STRATEGY
}
],
Center: [
{
label: '设置折返策略',
handler: this.setBackStrategy,
cmdType: CMD.Station.CMD_STATION_SET_TURN_BACK_STRATEGY
}
]
},
menuForce: [
]
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.StationTurnBack) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
this.menu = MenuContextHandler.covert(this.menuNormal);
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce;
}
},
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();
}
},
//
setBackStrategy() {
commitOperate(menuOperate.StationControl.setBackStrategy, {stationCode: this.selected.stationCode}, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.stationBackStrategy.doShow(operate, this.selected);
}
});
}
}
};
</script>