泰国运行计划

This commit is contained in:
Yuan 2023-07-07 16:25:20 +08:00
parent 51e678011c
commit 1580b0a509
4 changed files with 180 additions and 128 deletions

View File

@ -523,10 +523,26 @@ export function sandTableTrainControl(group, params) {
params params
}); });
} }
/** 设置轨道占用 */
export function setOccupy(simulationId, sectionCodes) {
return request({
url: `/api/sandTable/${simulationId}/occupy`,
method: 'put',
params: { sectionCodes, occupy: true }
})
}
/** 按计划运行 */
export function sandTableRunAsPlan(simulationId, data) {
return request({
url: `/api/sandTable/${simulationId}/runAsPlan`,
method: 'put',
data,
})
}
/** 获取运行计划详情 */ /** 获取运行计划详情 */
export function getSandTableRunPlanDetail(simulationId) { export function getSandTableRunPlanDetail(simulationId) {
return request({ return request({
url: `http://192.168.3.233:9000/api/sandTable/${simulationId}/runPlanDetail`, url: `/api/sandTable/${simulationId}/runPlanDetail`,
method: 'get', method: 'get',
}); });
} }

View File

@ -1,26 +1,27 @@
<template> <template>
<div id="menuBarDatie"> <div id="menuBarDatie">
<menu-bar ref="menuBar" :menu-normal="menuNormal" style="width:100%;" /> <menu-bar ref="menuBar" :menu-normal="menuNormal" style="width:100%;" />
<SetOperationPlan ref="setOperationPlan" /> <set-operation-plan ref="setOperationPlan" />
<OperationPlanDetail ref="operationPlanDetail" /> <operation-plan-detail ref="operationPlanDetail" />
<station-control-convert ref="stationControlConvert" :work="'dispatchWork'" /> <station-control-convert ref="stationControlConvert" :work="'dispatchWork'" />
<view-name ref="viewName" /> <view-name ref="viewName" />
<train-operation ref="trainOperation" /> <train-operation ref="trainOperation" />
<switch-control ref="switchControl" /> <switch-control ref="switchControl" />
<signal-control ref="signalControl" /> <signal-control ref="signalControl" />
</div> </div>
</template> </template>
<script> <script>
import MenuBar from '@/jmapNew/theme/components/menus/menuBarNew'; import MenuBar from '@/jmapNew/theme/components/menus/menuBarNew'
import { destroySimulationByAdmin, exitSimulation } from '@/api/simulation'; import { destroySimulationByAdmin, exitSimulation } from '@/api/simulation'
import SetOperationPlan from './menuDialog/setOperationPlan.vue'; import SetOperationPlan from './menuDialog/setOperationPlan.vue'
import ViewName from './menuDialog/viewName'; import OperationPlanDetail from './menuDialog/operationPlanDetail.vue'
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import ViewName from './menuDialog/viewName'
import StationControlConvert from './menuDialog/stationControlConvert'; import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'
import TrainOperation from './menuDialog/trainOperation'; import StationControlConvert from './menuDialog/stationControlConvert'
import SwitchControl from './menuDialog/switchControl'; import TrainOperation from './menuDialog/trainOperation'
import SignalControl from './menuDialog/signalControl'; import SwitchControl from './menuDialog/switchControl'
import {mapGetters} from 'vuex'; import SignalControl from './menuDialog/signalControl'
import { mapGetters } from 'vuex'
export default { export default {
name: 'DispatchWorkMenuBar', name: 'DispatchWorkMenuBar',
@ -32,7 +33,7 @@ export default {
StationControlConvert, StationControlConvert,
TrainOperation, TrainOperation,
SwitchControl, SwitchControl,
SignalControl SignalControl,
}, },
data() { data() {
return { return {
@ -43,19 +44,19 @@ export default {
children: [ children: [
{ {
title: 'Exit', title: 'Exit',
click: this.handleExit click: this.handleExit,
} },
] ],
}, },
{ {
title: 'UI Control', title: 'UI Control',
operate: '', operate: '',
click: this.uiControl click: this.uiControl,
}, },
{ {
title: 'Station', title: 'Station',
operate: '', operate: '',
children: [] children: [],
}, },
{ {
title: 'Station Ctrl Mode', title: 'Station Ctrl Mode',
@ -64,25 +65,25 @@ export default {
{ {
title: 'To Station Control', title: 'To Station Control',
click: this.turnToStationControl, click: this.turnToStationControl,
operate: OperationEvent.StationControl.requestStationControl.mbar operate: OperationEvent.StationControl.requestStationControl.mbar,
}, },
{ {
title: 'Forced Station Control', title: 'Forced Station Control',
click: this.mandatoryStationControl, click: this.mandatoryStationControl,
operate: OperationEvent.StationControl.forcedStationControl.password operate: OperationEvent.StationControl.forcedStationControl.password,
}, },
{ {
title: 'To Center Control', title: 'To Center Control',
click: this.conterStationControl, click: this.conterStationControl,
operate: OperationEvent.StationControl.requestCentralControl.mbar, operate: OperationEvent.StationControl.requestCentralControl.mbar,
force: true force: true,
} },
] ],
}, },
{ {
title: 'Train Control', title: 'Train Control',
operate: '', operate: '',
click: this.trainControlShow click: this.trainControlShow,
}, },
{ {
title: 'Signal Device Control', title: 'Signal Device Control',
@ -91,170 +92,172 @@ export default {
{ {
title: 'Signal Close', title: 'Signal Close',
click: this.handleSignalOperate, click: this.handleSignalOperate,
operate: OperationEvent.Signal.signalClose.mbar operate: OperationEvent.Signal.signalClose.mbar,
}, },
{ {
title: 'Signal Reopen', title: 'Signal Reopen',
click: this.handleSignalOperate, click: this.handleSignalOperate,
operate: OperationEvent.Signal.reopenSignal.mbar operate: OperationEvent.Signal.reopenSignal.mbar,
}, },
{ {
title: 'Turnout Normal', title: 'Turnout Normal',
click: this.handleSwitchOperate, click: this.handleSwitchOperate,
operate: OperationEvent.Switch.locate.mbar operate: OperationEvent.Switch.locate.mbar,
}, },
{ {
title: 'Turnout Reverse', title: 'Turnout Reverse',
click: this.handleSwitchOperate, click: this.handleSwitchOperate,
operate: OperationEvent.Switch.reverse.mbar operate: OperationEvent.Switch.reverse.mbar,
}, },
{ {
title: 'Turnout Lock', title: 'Turnout Lock',
click: this.handleSwitchOperate, click: this.handleSwitchOperate,
operate: OperationEvent.Switch.lock.mBar operate: OperationEvent.Switch.lock.mBar,
}, },
{ {
title: 'Turnout Unlock', title: 'Turnout Unlock',
click: this.handleSwitchOperate, click: this.handleSwitchOperate,
operate: OperationEvent.Switch.unlock.mbar operate: OperationEvent.Switch.unlock.mbar,
} },
] ],
}, },
{ {
title: 'Operation Plan', title: 'Operation Plan',
operate: '', operate: '',
click: this.openOperationPlan, click: this.openOperationPlan,
children: [] children: [],
}, },
{ {
title: 'Plan Details', title: 'Plan Details',
operate: '', operate: '',
children: [] click: this.openPlanDetail,
} children: [],
] },
}; ],
}
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', ['stationList']),
'stationList'
])
}, },
mounted() { mounted() {
this.stationList.forEach(station => { this.stationList.forEach(station => {
this.menuNormal[2].children.push({ title: station.name, click: () => { this.menuNormal[2].children.push({
this.$jlmap.setCenter(station.code); title: station.name,
} }); click: () => {
}); this.$jlmap.setCenter(station.code)
},
})
})
}, },
methods: { methods: {
trainControlShow() { trainControlShow() {
this.$refs.trainOperation.doShow(); this.$refs.trainOperation.doShow()
}, },
handleSignalOperate(order) { handleSignalOperate(order) {
const operate = { const operate = {
operation: order.operation operation: order.operation,
}; }
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => { this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true })
this.$refs.signalControl.doShow(operate); this.$refs.signalControl.doShow(operate)
} }
}); })
}, },
handleSwitchOperate(order) { handleSwitchOperate(order) {
const operate = { const operate = {
operation: order.operation operation: order.operation,
}; }
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => { this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true })
this.$refs.switchControl.doShow(operate); this.$refs.switchControl.doShow(operate)
} }
}); })
}, },
turnToStationControl(order) { turnToStationControl(order) {
const operate = { const operate = {
operation: order.operation operation: order.operation,
}; }
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => { this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true })
this.$refs.stationControlConvert.doShow(operate); this.$refs.stationControlConvert.doShow(operate)
} }
}); })
}, },
// //
mandatoryStationControl(order) { mandatoryStationControl(order) {
const operate = { const operate = {
operation: order.operation operation: order.operation,
}; }
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => { this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true })
this.$refs.stationControlConvert.doShow(operate); this.$refs.stationControlConvert.doShow(operate)
} }
}); })
}, },
// //
conterStationControl(order) { conterStationControl(order) {
const operate = { const operate = {
operation: order.operation operation: order.operation,
}; }
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => { this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true })
this.$refs.stationControlConvert.doShow(operate); this.$refs.stationControlConvert.doShow(operate)
} }
}); })
}, },
uiControl(order) { uiControl(order) {
const operate = { const operate = {
operation: order.operation operation: order.operation,
}; }
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => { this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true })
this.$refs.viewName.doShow(operate); this.$refs.viewName.doShow(operate)
} }
}); })
}, },
blankClickClose() { blankClickClose() {
this.$refs.menuBar.doClose(); this.$refs.menuBar.doClose()
}, },
handleExit() { handleExit() {
this.$confirm('Whether to exit emulation?', 'Hint', { this.$confirm('Whether to exit emulation?', 'Hint', {
confirmButtonText: 'Confirm', confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
type: 'warning' type: 'warning',
}).then(() => { }).then(() => {
this.back(); this.back()
}); })
}, },
back() { back() {
if (this.$store.state.training.simulationCreator) { if (this.$store.state.training.simulationCreator) {
destroySimulationByAdmin(this.group); destroySimulationByAdmin(this.group)
} else { } else {
exitSimulation(this.group); exitSimulation(this.group)
} }
if (this.projectDevice && this.$store.state.training.simulationCreator) { if (this.projectDevice && this.$store.state.training.simulationCreator) {
this.logout(); this.logout()
} else if (this.$route.query.third) { } else if (this.$route.query.third) {
if (this.$route.query.project === 'cgy' || this.$route.query.project === 'drts') { if (this.$route.query.project === 'cgy' || this.$route.query.project === 'drts') {
window.parent.postMessage('back', '*'); window.parent.postMessage('back', '*')
} else { } else {
window.close(); window.close()
} }
} else if (this.projectDevice) { } else if (this.projectDevice) {
this.logout(); this.logout()
} else { } else {
this.$router.go(-1); this.$router.go(-1)
} }
}, },
// //
logout() { logout() {
this.$store.dispatch('LogOut').then(() => { this.$store.dispatch('LogOut').then(() => {
location.reload(); location.reload()
}); })
}, },
openOperationPlan() { openOperationPlan() {
this.$refs.setOperationPlan.doShow() this.$refs.setOperationPlan.doShow()

View File

@ -5,6 +5,7 @@
title="Operation Plan Detail" title="Operation Plan Detail"
:visible.sync="show" :visible.sync="show"
width="660px" width="660px"
height="500px"
:before-close="doClose" :before-close="doClose"
:z-index="2000" :z-index="2000"
:modal="false" :modal="false"
@ -20,10 +21,10 @@
highlight-current-row highlight-current-row
height="200" height="200"
> >
<el-table-column prop="trainCode" :width="100" label="列车编号" /> <el-table-column prop="groupNumber" :width="100" label="Train Code" />
<el-table-column prop="station" :width="160" label="车站" /> <el-table-column prop="stationName" :width="160" label="Station Name" />
<el-table-column prop="track" :width="180" label="接发车股道" /> <el-table-column prop="trackName" :width="180" label="Track Name" />
<el-table-column prop="time" label="停靠时间" /> <el-table-column prop="parkingDuration" label="Parking Duration" />
</el-table> </el-table>
</el-dialog> </el-dialog>
</template> </template>
@ -33,7 +34,7 @@ export default {
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
detailData: [{ trainCode: 'AAA', station: '1111', track: '123', time: '2023-07-02 08:00:00' }], detailData: [],
} }
}, },
computed: { computed: {
@ -44,7 +45,9 @@ export default {
methods: { methods: {
async doShow() { async doShow() {
this.dialogShow = true this.dialogShow = true
const resp = await getSandTableRunPlanDetail(this.$store.state) const resp = await getSandTableRunPlanDetail(this.$route.query.group)
this.detailData = resp.data
console.log(resp)
}, },
doClose() { doClose() {
this.dialogShow = false this.dialogShow = false

View File

@ -13,12 +13,20 @@
> >
<el-form> <el-form>
<div class="formRow" v-for="(item, i) in formData" :key="i"> <div class="formRow" v-for="(item, i) in formData" :key="i">
<el-form-item label="列车编号"> <el-form-item label="Train Code">
<el-select v-model="item.trainCode"></el-select> <el-select v-model="item.groupNumber">
<el-option v-for="option in trainList" :key="option" :label="option" :value="option">
</el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="股道编号"> <el-form-item label="Track Code">
<el-select v-model="item.trackCode"> <el-select v-model="item.trackCode">
<el-option v-for="train in trainList" :key="train.id"></el-option> <el-option
v-for="section in parkingTrackList"
:key="section.label"
:value="section.value"
:label="section.label"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</div> </div>
@ -28,13 +36,15 @@
</div> </div>
</el-form> </el-form>
<div class="formRow"> <div class="formRow">
<el-button @click="confirm">{{ $t('global.confirm') }}</el-button> <el-button @click="confirm">Run As Plan</el-button>
<el-button @click="cancel">{{ $t('global.cancel') }}</el-button> <el-button @click="cancel">Cancel</el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { sandTableRunAsPlan, setOccupy } from '@/api/simulation';
import { mapGetters } from 'vuex';
export default { export default {
name: 'SetOperationPlanDialog', name: 'SetOperationPlanDialog',
data() { data() {
@ -42,49 +52,69 @@ export default {
dialogShow: false, dialogShow: false,
formData: [ formData: [
{ {
trainCode: '', groupNumber: '',
trackCode: '', trackCode: '',
}, },
], ],
trainList: [], };
}
}, },
computed: { computed: {
...mapGetters('map', ['sectionList', 'stationList']),
show() { show() {
return this.dialogShow && !this.$store.state.menuOperation.break return this.dialogShow && !this.$store.state.menuOperation.break;
},
trainList() {
return this.$store.state.map.map.trainList.map(v => v.groupNumber);
},
parkingTrackList() {
return this.sectionList.filter(sec => sec.parkingTrack).map(v => ({ label: v.name, value: v.code }));
}, },
// trainList() {
// console.log(this.$store.state.activeTrainList)
// return this.$store.state.activeTrainList
// },
}, },
methods: { methods: {
doShow() { doShow() {
this.dialogShow = true this.dialogShow = true;
this.formData = [ this.formData = [
{ {
trainCode: '', groupNumber: '',
trackCode: '', trackCode: '',
}, },
] ];
console.log(this.$store.state.activeTrainList)
}, },
doClose() { doClose() {
this.dialogShow = false this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh') this.$store.dispatch('training/emitTipFresh');
}, },
addRow() { addRow() {
this.formData.push({ trainCode: '', trackCode: '' }) this.formData.push({ groupNumber: '', trackCode: '' });
}, },
deleteRow() { deleteRow() {
this.formData.pop() this.formData.pop();
},
async confirm() {
const validate = this.formData.every(item => item.groupNumber !== '' && item.trackCode !== '');
if (!validate) {
this.$message.error('Please select the correct Train Code and Track Code');
}
const simulationId = this.$route.query.group;
const sectionCodes = this.formData.map(_ => _.trackCode);
const runData = this.formData;
try {
const res = await setOccupy(simulationId, sectionCodes.join(','));
if (res.code !== 200) {
console.err(res);
return;
}
await sandTableRunAsPlan(simulationId, runData);
this.doClose();
} catch (err) {
this.$message.error(err.message);
}
}, },
confirm() {},
cancel() { cancel() {
this.doClose() this.doClose();
}, },
}, },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>