泰国运行计划

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
});
}
/** 设置轨道占用 */
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) {
return request({
url: `http://192.168.3.233:9000/api/sandTable/${simulationId}/runPlanDetail`,
url: `/api/sandTable/${simulationId}/runPlanDetail`,
method: 'get',
});
}

View File

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

View File

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

View File

@ -13,12 +13,20 @@
>
<el-form>
<div class="formRow" v-for="(item, i) in formData" :key="i">
<el-form-item label="列车编号">
<el-select v-model="item.trainCode"></el-select>
<el-form-item label="Train Code">
<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 label="股道编号">
<el-form-item label="Track Code">
<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-form-item>
</div>
@ -28,13 +36,15 @@
</div>
</el-form>
<div class="formRow">
<el-button @click="confirm">{{ $t('global.confirm') }}</el-button>
<el-button @click="cancel">{{ $t('global.cancel') }}</el-button>
<el-button @click="confirm">Run As Plan</el-button>
<el-button @click="cancel">Cancel</el-button>
</div>
</el-dialog>
</template>
<script>
import { sandTableRunAsPlan, setOccupy } from '@/api/simulation';
import { mapGetters } from 'vuex';
export default {
name: 'SetOperationPlanDialog',
data() {
@ -42,49 +52,69 @@ export default {
dialogShow: false,
formData: [
{
trainCode: '',
groupNumber: '',
trackCode: '',
},
],
trainList: [],
}
};
},
computed: {
...mapGetters('map', ['sectionList', 'stationList']),
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: {
doShow() {
this.dialogShow = true
this.dialogShow = true;
this.formData = [
{
trainCode: '',
groupNumber: '',
trackCode: '',
},
]
console.log(this.$store.state.activeTrainList)
];
},
doClose() {
this.dialogShow = false
this.$store.dispatch('training/emitTipFresh')
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
},
addRow() {
this.formData.push({ trainCode: '', trackCode: '' })
this.formData.push({ groupNumber: '', trackCode: '' });
},
deleteRow() {
this.formData.pop()
},
confirm() {},
cancel() {
this.doClose()
},
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);
}
},
cancel() {
this.doClose();
},
},
};
</script>
<style lang="scss" scoped>