This commit is contained in:
zyy 2020-06-23 13:52:47 +08:00
commit 293a9b0204
5 changed files with 2 additions and 413 deletions

View File

@ -1,254 +0,0 @@
<template>
<el-dialog v-dialogDrag class="foshan-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" :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="foshan-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 { 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
};
},
computed: {
...mapGetters('map', [
'stationList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdChoose() {
return this.dialogShow ? OperationEvent.Signal.arrangementRoute.choose.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Signal.arrangementRoute.menu.domId : '';
},
title() {
return '站遥控转换';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
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);
}
});
}
},
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.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.menu.operation;
} else if (this.controlMode == 'local') {
operate.cmdType = CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_CENTER_CONTROL;
operate.operation = OperationEvent.StationControl.requestCentralControl.menu.operation;
}
this.loading = true;
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate, error.message);
});
}
},
cancel() {
const operate = {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
});
}
}
};
</script>

View File

@ -6,7 +6,6 @@
<menu-axle-reset ref="menuAxleReset" :selected="selected" />
<menu-auto-trun-route ref="menuAutoTrunRoute" :selected="selected" />
<menu-station-stand ref="menuStationStand" :selected="selected" />
<menu-station-control ref="menuStationControl" :selected="selected" />>
<menu-switch ref="menuSwitch" :selected="selected" />
<menu-signal ref="menuSignal" :selected="selected" />
<menu-section ref="menuSection" :selected="selected" />
@ -27,7 +26,6 @@ import MenuButton from './menuButton';
import MenuAxleReset from './menuAxleReset';
import MenuAutoTrunRoute from './menuAutoTrunRoute';
import MenuStationStand from './menuStationStand';
import MenuStationControl from './menuStationControl';
import MenuSwitch from './menuSwitch';
import MenuSection from './menuSection';
import MenuTrain from './menuTrain';
@ -50,7 +48,6 @@ export default {
MenuSwitch,
MenuSection,
MenuStationStand,
MenuStationControl,
MenuStation,
MenuTrain,
MenuLimit,

View File

@ -19,7 +19,6 @@ import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
export default {
name: 'SectionMenu',
@ -148,19 +147,9 @@ export default {
},
// ()
addPlanTrain() {
const step = {
start: true,
code: this.selected.code,
operation: OperationEvent.Train.createPlanTrain.menu.operation,
param: {
sectionCode: this.selected.code
}
};
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
commitOperate(menuOperate.Train.createPlanTrain, {sectionCode:this.selected.code}, 0).then(({valid, operate})=>{
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('training/setCommonMenuStep', step);
this.$store.dispatch('training/setCommonMenuStep', operate);
}
});
},

View File

@ -1,142 +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 { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
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() {
const step = {
start: true,
code: this.selected.code,
operation: OperationEvent.StationControl.requestCentralControl.menu.operation
};
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.stationControl.doShow(step, this.selected);
}
});
},
setStationControl() {
const step = {
start: true,
code: this.selected.code,
operation: OperationEvent.StationControl.requestStationControl.menu.operation
};
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.stationControl.doShow(step, this.selected);
}
});
}
}
};
</script>

View File

@ -23,7 +23,6 @@ import StandStopTime from '@/jmapNew/theme/components/menus/dialog/standStopTime
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import StandDetainTrainAll from './dialog/standDetainTrainAll';
import { mapGetters } from 'vuex';
// import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';