成都工学院第二个项目增加叶佳提供小车操作

This commit is contained in:
fan 2023-12-29 10:51:02 +08:00
parent ab31f2cefa
commit 5e38fa05e2
3 changed files with 75 additions and 1 deletions

View File

@ -590,3 +590,12 @@ export function getUnreceivedMessages(simulationId, memberId) {
method: 'get' method: 'get'
}); });
} }
/** 控制叶佳供货的小车 */
export function controlYjTrain(simulationId, right) {
return request({
url: `/api/realDevice/${simulationId}/train`,
method: 'put',
params: { right }
});
}

View File

@ -18,6 +18,7 @@
<exam-panel ref="examPanel" /> <exam-panel ref="examPanel" />
<device-manage ref="deviceManage" /> <device-manage ref="deviceManage" />
<simulation-id ref="simulationId" /> <simulation-id ref="simulationId" />
<train-operation ref="trainOperation" />
</div> </div>
</template> </template>
<script> <script>
@ -36,6 +37,7 @@ import { destroySimulationByAdmin, exitSimulation, ranAsPlan} from '@/api/simula
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import SimulationControl from './simulationControl'; import SimulationControl from './simulationControl';
import SimulationId from '../simulationId'; import SimulationId from '../simulationId';
import TrainOperation from './trainOperation';
export default { export default {
name: 'SimulationMenu', name: 'SimulationMenu',
components: { components: {
@ -48,7 +50,8 @@ export default {
MemberManage, MemberManage,
DeviceManage, DeviceManage,
SimulationControl, SimulationControl,
SimulationId SimulationId,
TrainOperation
}, },
data() { data() {
return { return {
@ -58,6 +61,7 @@ export default {
deviceif: false, deviceif: false,
deviceShow: true, deviceShow: true,
allMenuList: [ allMenuList: [
{ label: '列车操作', name: 'trainOperation', click: this.trainOperation, isDisabled: () => { return false; }, isShow: () => { return this.$route.query.project === 'cdgxy'; } },
{ label: '切换', name: 'switchOffset', click: this.switchOffset, isDisabled: () => { return false; }, isShow: () => { return this.$store.state.ibp.moreScreen; } }, { label: '切换', name: 'switchOffset', click: this.switchOffset, isDisabled: () => { return false; }, isShow: () => { return this.$store.state.ibp.moreScreen; } },
{ label: '设备视图', name: 'jlmap3dmodel', click: this.jlmap3dmodel, isDisabled: () => { return false; }, isShow: () => { return this.$route.query.client !== 'diagramEdit' && this.$route.query.simType !== 'EMERGENCY'; } }, { label: '设备视图', name: 'jlmap3dmodel', click: this.jlmap3dmodel, isDisabled: () => { return false; }, isShow: () => { return this.$route.query.client !== 'diagramEdit' && this.$route.query.simType !== 'EMERGENCY'; } },
{ label: '设备管理', name: 'deviceManage', click: this.deviceManage, isDisabled: () => { return false; }, { label: '设备管理', name: 'deviceManage', click: this.deviceManage, isDisabled: () => { return false; },
@ -141,6 +145,9 @@ export default {
switchOffset() { switchOffset() {
EventBus.$emit('switchOffset'); EventBus.$emit('switchOffset');
}, },
trainOperation() {
this.$refs.trainOperation.doShow();
},
generateQrCode() { generateQrCode() {
this.hideMenuList(); this.hideMenuList();
const param = { const param = {

View File

@ -0,0 +1,58 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="show" width="550px" center :before-close="doClose">
<div style="text-align: center;">
<el-button-group>
<el-button type="success" icon="el-icon-arrow-left" @click="trainRun(false)">启动</el-button>
<el-button type="success" @click="trainRun(true)">启动<i class="el-icon-arrow-right el-icon--right"></i></el-button>
</el-button-group>
</div>
</el-dialog>
</template>
<script>
import { controlYjTrain } from '@/api/simulation';
export default {
name: 'TrainOperation',
data() {
return {
show: false
};
},
computed: {
title() {
return '列车操作';
},
group() {
return this.$route.query.group;
}
},
methods: {
doShow() {
this.show = true;
},
doClose() {
this.show = false;
},
trainRun(right) {
this.$confirm('是否确认启动列车?', this.$t('tip.hint'), {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
controlYjTrain(this.group, right).then(() => {
this.$message.success('列车启动成功!');
}).catch(() => {
this.$message.error('列车启动失败!');
});
});
},
handleSure() {
}
}
};
</script>
<style scoped>
</style>