泰国项目调整

This commit is contained in:
fan 2023-07-05 10:32:21 +08:00
parent b898aee79a
commit 03be9f8f75
4 changed files with 281 additions and 84 deletions

View File

@ -5,6 +5,8 @@
<station-control-convert ref="stationControlConvert" :work="'localWork'" /> <station-control-convert ref="stationControlConvert" :work="'localWork'" />
<view-name ref="viewName" /> <view-name ref="viewName" />
<train-operation ref="trainOperation" /> <train-operation ref="trainOperation" />
<switch-control ref="switchControl" />
<signal-control ref="signalControl" />
</div> </div>
</template> </template>
<script> <script>
@ -18,6 +20,8 @@ import ViewName from './menuDialog/viewName';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import StationControlConvert from './menuDialog/stationControlConvert'; import StationControlConvert from './menuDialog/stationControlConvert';
import TrainOperation from './menuDialog/trainOperation'; import TrainOperation from './menuDialog/trainOperation';
import SwitchControl from './menuDialog/switchControl';
import SignalControl from './menuDialog/signalControl';
export default { export default {
name: 'CtcWorkMenuBar', name: 'CtcWorkMenuBar',
@ -26,7 +30,9 @@ export default {
TrainFixedPathPane, TrainFixedPathPane,
ViewName, ViewName,
StationControlConvert, StationControlConvert,
TrainOperation TrainOperation,
SwitchControl,
SignalControl
}, },
data() { data() {
return { return {
@ -143,11 +149,27 @@ export default {
EventBus.$emit('bottomTableShowOrHidden', false); EventBus.$emit('bottomTableShowOrHidden', false);
}, },
methods: { methods: {
handleSignalOperate(operate) { handleSignalOperate(order) {
const operate = {
operation: order.operation
};
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.signalControl.doShow(operate);
}
});
}, },
handleSwitchOperate(operate) { handleSwitchOperate(order) {
const operate = {
operation: order.operation
};
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.switchControl.doShow(operate);
}
});
}, },
turnToStationControl(order) { turnToStationControl(order) {
const operate = { const operate = {

View File

@ -777,6 +777,9 @@ export default {
// CHANGE_DIRECTION // CHANGE_DIRECTION
selectedChange() { selectedChange() {
// //
if (!this.selected) {
return;
}
const model = this.selected; // const model = this.selected; //
if (this.selected._event !== MouseEvent.Left || (!model._type && !model._code)) { if (this.selected._event !== MouseEvent.Left || (!model._type && !model._code)) {
return; return;

View File

@ -0,0 +1,177 @@
<template>
<el-dialog
v-dialogDrag
style="pointer-events: none"
z-index="2008"
class="chengdou-03__systerm switch-control __menuButton"
:title="title"
:visible.sync="show"
width="350px"
:before-close="doClose"
:modal="false"
append-to-body
:close-on-click-modal="false"
>
<el-row class="header">
<el-col :span="4"><span>Signal</span></el-col>
<el-col :span="18" :offset="2">
<el-select v-model="selected" disabled filterable placeholder="Please select">
<el-option
v-for="item in signalList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-col>
</el-row>
<el-row style="margin-top: 10px;">
<el-col :span="11">
<el-radio v-model="closeRadio" label="1" :disabled="closeRadio == 2" style="display: block; text-align: center;">
Signal close</el-radio>
</el-col>
<el-col :span="11" :offset="2">
<el-radio v-model="closeRadio" label="2" :disabled="closeRadio == 1" style="display: block; text-align: center;">
Signal reopen</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" :disabled="!selected" @click="commit">Confirm</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel">Cancel</el-button>
</el-col>
</el-row>
<notice-info ref="noticeInfo" :pop-class="'chengdou-03__systerm'" />
</el-dialog>
</template>
<script>
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import OperationHandler from '@/scripts/cmdPlugin/OperationHandler';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import {mapGetters} from 'vuex';
export default {
name: 'SwitchControl',
components: {
NoticeInfo
},
data() {
return {
dialogShow: false,
loading: false,
selected: null,
operation: '',
closeRadio: '1'
};
},
computed: {
...mapGetters('map', [
'signalList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationHandler.getDomIdByOperation(this.operation) : '';
},
title() {
if (this.operation == OperationEvent.Signal.signalClose.mbar.operation) {
return 'Signal close';
} else if (this.operation == OperationEvent.Signal.reopenSignal.mbar.operation) {
return 'Signal reopen';
}
return '';
}
},
watch: {
'$store.state.menuOperation.selectedCount':function(em) {
const device = this.$store.state.menuOperation.selected;
if (device && device.code && device._type === 'Signal' && this.show) {
this.selected = device.code;
}
}
},
methods: {
doShow(operate) {
this.selected = null;
if (!this.dialogShow) {
this.operation = operate.operation;
if (this.operation == OperationEvent.Signal.signalClose.mbar.operation) {
this.closeRadio = '1';
} else if (this.operation == OperationEvent.Signal.reopenSignal.mbar.operation) {
this.closeRadio = '2';
}
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
},
commit() {
if (this.operation == OperationEvent.Signal.signalClose.mbar.operation) {
this.signalClose();
} else if (this.operation == OperationEvent.Signal.reopenSignal.mbar.operation) {
this.reopenSignal();
}
},
signalClose() {
this.sendCommand(menuOperate.Signal.signalClose);
},
reopenSignal() {
this.sendCommand(menuOperate.Signal.reopenSignal);
},
sendCommand(operate) {
this.loading = true;
commitOperate(operate, {signalCode: this.selected}, 2).then(({valid})=>{
this.loading = false;
if (valid) {
this.doClose();
}
}).catch((error) => {
this.loading = false;
this.doClose();
console.error(error);
this.$refs.noticeInfo.doShow();
});
},
cancel() {
const operate = {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
});
}
}
};
</script>
<style lang="scss">
.__menuButton {
.el-dialog,
.el-dialog__wrapper {
pointer-events: none !important;
}
.el-dialog__header,
.el-dialog__body {
pointer-events: all !important;
}
}
</style>

View File

@ -1,89 +1,90 @@
<template> <template>
<el-dialog <el-dialog
v-dialogDrag v-dialogDrag
class="switch-control" style="pointer-events: none"
:class="popClass" z-index="2008"
class="chengdou-03__systerm switch-control __menuButton"
:title="title" :title="title"
:visible.sync="show" :visible.sync="show"
width="300px" width="350px"
:before-close="doClose" :before-close="doClose"
:z-index="2000"
:modal="false" :modal="false"
append-to-body
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-row class="header"> <el-row class="header">
<el-col :span="11"><span>道岔</span></el-col> <el-col :span="4"><span>Turnout</span></el-col>
<el-col :span="11" :offset="2"> <el-col :span="18" :offset="2">
<el-input v-model="switchName" size="small" disabled /> <el-select v-model="selected" disabled filterable placeholder="Please select">
<el-option
v-for="item in switchList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-if="isLock" style="margin-top: 10px;"> <el-row v-if="isLock" style="margin-top: 10px;">
<el-col :span="11"> <el-col :span="11">
<el-radio v-model="lockRadio" label="1" style="display: block; text-align: center;"> <el-radio v-model="lockRadio" label="1" :disabled="lockRadio == 2" style="display: block; text-align: center;">
道岔单锁</el-radio> Turnout lock</el-radio>
</el-col> </el-col>
<el-col :span="11" :offset="2"> <el-col :span="11" :offset="2">
<el-radio v-model="lockRadio" label="2" disabled style="display: block; text-align: center;"> <el-radio v-model="lockRadio" label="2" :disabled="lockRadio == 1" style="display: block; text-align: center;">
道岔解单锁</el-radio> Turnout unlock</el-radio>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-if="isTurnBlock" style="margin-top: 10px;"> <el-row v-if="isTurnBlock" style="margin-top: 10px;">
<el-col :span="11"> <el-col :span="11">
<el-radio v-model="turnRadio" label="1" :disabled="turnRadio == 2" style="display: block; text-align: center;"> <el-radio v-model="turnRadio" label="1" :disabled="turnRadio == 2" style="display: block; text-align: center;">
道岔定位</el-radio> Turnout normal</el-radio>
</el-col> </el-col>
<el-col :span="11" :offset="2"> <el-col :span="11" :offset="2">
<el-radio v-model="turnRadio" label="2" :disabled="turnRadio == 1" style="display: block; text-align: center;"> <el-radio v-model="turnRadio" label="2" :disabled="turnRadio == 1" style="display: block; text-align: center;">
道岔反位</el-radio> Turnout reverse</el-radio>
</el-col> </el-col>
</el-row> </el-row>
<el-row justify="center" class="button-group"> <el-row justify="center" class="button-group">
<el-col :span="10" :offset="2"> <el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button> <el-button :id="domIdConfirm" type="primary" :loading="loading" :disabled="!selected" @click="commit">Confirm</el-button>
</el-col> </el-col>
<el-col :span="8" :offset="4"> <el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"></el-button> <el-button :id="domIdCancel" @click="cancel">Cancel</el-button>
</el-col> </el-col>
</el-row> </el-row>
<notice-info ref="noticeInfo" :pop-class="popClass" /> <notice-info ref="noticeInfo" :pop-class="'chengdou-03__systerm'" />
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import NoticeInfo from '@/jmapNew/theme/components/menus/dialog/childDialog/noticeInfo'; import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import {mouseCancelState} from '@/jmapNew/theme/components/utils/menuItemStatus';
import OperationHandler from '@/scripts/cmdPlugin/OperationHandler'; import OperationHandler from '@/scripts/cmdPlugin/OperationHandler';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate'; import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import {mapGetters} from 'vuex';
export default { export default {
name: 'SwitchControl', name: 'SwitchControl',
components: { components: {
NoticeInfo NoticeInfo
}, },
props: {
popClass: {
type: String,
default: ''
}
},
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
selected: null, selected: null,
operation: '', operation: '',
stationName: '',
switchName: '',
isLock: false, isLock: false,
isTurnBlock: false, isTurnBlock: false,
isActive: false,
turnRadio: '1', turnRadio: '1',
lockRadio: '1', lockRadio: '1'
activeRadio: '1'
}; };
}, },
computed: { computed: {
...mapGetters('map', [
'switchList'
]),
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break; return this.dialogShow && !this.$store.state.menuOperation.break;
}, },
@ -94,44 +95,45 @@ export default {
return this.dialogShow ? OperationHandler.getDomIdByOperation(this.operation) : ''; return this.dialogShow ? OperationHandler.getDomIdByOperation(this.operation) : '';
}, },
title() { title() {
if (this.operation == OperationEvent.Switch.lock.menu.operation) { if (this.operation == OperationEvent.Switch.lock.mBar.operation) {
return 'Turnout lock'; return 'Turnout lock';
} else if (this.operation == OperationEvent.Switch.unlock.menu.operation) { } else if (this.operation == OperationEvent.Switch.unlock.mbar.operation) {
return 'Turnout unlock'; return 'Turnout unlock';
} else if (this.operation == OperationEvent.Switch.locate.menu.operation) { } else if (this.operation == OperationEvent.Switch.locate.mbar.operation) {
return 'Turnout locate'; return 'Turnout normal';
} else if (this.operation == OperationEvent.Switch.reverse.menu.operation) { } else if (this.operation == OperationEvent.Switch.reverse.mbar.operation) {
return 'Turnout reverse'; return 'Turnout reverse';
} }
return ''; return '';
} }
}, },
watch: {
'$store.state.menuOperation.selectedCount':function(em) {
const device = this.$store.state.menuOperation.selected;
if (device && device.code && device._type === 'Switch' && this.show) {
this.selected = device.code;
}
}
},
methods: { methods: {
doShow(operate, selected) { doShow(operate) {
this.$root.$emit('dialogOpen', selected); this.selected = null;
this.selected = selected;
if (!this.dialogShow) { if (!this.dialogShow) {
this.switchName = '';
this.stationName = '';
if (selected && selected._type.toUpperCase() === 'Switch'.toUpperCase()) {
this.switchName = selected.name;
const station = this.$store.getters['map/getDeviceByCode'](selected.stationCode);
if (station) {
this.stationName = station.name;
}
}
this.operation = operate.operation; this.operation = operate.operation;
this.isLock = false; this.isLock = false;
this.isTurnBlock = false; this.isTurnBlock = false;
this.isActive = false; if (this.operation == OperationEvent.Switch.locate.mbar.operation) {
if (this.operation == OperationEvent.Switch.locate.menu.operation) {
this.isTurnBlock = true; this.isTurnBlock = true;
this.turnRadio = '1'; this.turnRadio = '1';
} else if (this.operation == OperationEvent.Switch.reverse.menu.operation) { } else if (this.operation == OperationEvent.Switch.reverse.mbar.operation) {
this.isTurnBlock = true; this.isTurnBlock = true;
this.turnRadio = '2'; this.turnRadio = '2';
} else if (this.operation == OperationEvent.Switch.lock.menu.operation) { } else if (this.operation == OperationEvent.Switch.lock.mBar.operation) {
this.isLock = true; this.isLock = true;
this.lockRadio = '1';
} else if (this.operation == OperationEvent.Switch.unlock.mbar.operation) {
this.isLock = true;
this.lockRadio = '2';
} }
} }
this.dialogShow = true; this.dialogShow = true;
@ -142,18 +144,16 @@ export default {
doClose() { doClose() {
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
this.$root.$emit('dialogClose', this.selected);
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
mouseCancelState(this.selected);
}, },
commit() { commit() {
if (this.operation == OperationEvent.Switch.lock.menu.operation) { if (this.operation == OperationEvent.Switch.lock.mBar.operation) {
this.lock(); // this.lock(); //
} else if (this.operation == OperationEvent.Switch.block.menu.operation) { } else if (this.operation == OperationEvent.Switch.unlock.mbar.operation) {
this.block(); // this.unlock(); //
} else if (this.operation == OperationEvent.Switch.locate.menu.operation) { } else if (this.operation == OperationEvent.Switch.locate.mbar.operation) {
this.locate(); // this.locate(); //
} else if (this.operation == OperationEvent.Switch.reverse.menu.operation) { } else if (this.operation == OperationEvent.Switch.reverse.mbar.operation) {
this.reverse(); // this.reverse(); //
} }
}, },
@ -161,9 +161,9 @@ export default {
lock() { lock() {
this.sendCommand(menuOperate.Switch.lock); this.sendCommand(menuOperate.Switch.lock);
}, },
// //
block() { unlock() {
this.sendCommand(menuOperate.Switch.block); this.sendCommand(menuOperate.Switch.unlock);
}, },
// //
locate() { locate() {
@ -176,7 +176,7 @@ export default {
sendCommand(operate) { sendCommand(operate) {
this.loading = true; this.loading = true;
commitOperate(operate, {}, 2).then(({valid})=>{ commitOperate(operate, {switchCode: this.selected}, 2).then(({valid})=>{
this.loading = false; this.loading = false;
if (valid) { if (valid) {
this.doClose(); this.doClose();
@ -188,24 +188,6 @@ export default {
this.$refs.noticeInfo.doShow(); this.$refs.noticeInfo.doShow();
}); });
}, },
sendCommandNext(operate) {
const that = this;
return new Promise(function(resolve, reject) {
that.loading = true;
commitOperate(operate, {}, 1).then(({valid})=>{
that.loading = false;
if (valid) {
that.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
resolve({...operate});
}
}).catch((error) => {
that.loading = false;
that.doClose();
console.error(error);
that.$refs.noticeInfo.doShow();
});
});
},
cancel() { cancel() {
const operate = { const operate = {
operation: OperationEvent.Command.cancel.menu.operation operation: OperationEvent.Command.cancel.menu.operation
@ -221,3 +203,16 @@ export default {
} }
}; };
</script> </script>
<style lang="scss">
.__menuButton {
.el-dialog,
.el-dialog__wrapper {
pointer-events: none !important;
}
.el-dialog__header,
.el-dialog__body {
pointer-events: all !important;
}
}
</style>