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

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'
});
}
/** 控制叶佳供货的小车 */
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" />
<device-manage ref="deviceManage" />
<simulation-id ref="simulationId" />
<train-operation ref="trainOperation" />
</div>
</template>
<script>
@ -36,6 +37,7 @@ import { destroySimulationByAdmin, exitSimulation, ranAsPlan} from '@/api/simula
import { EventBus } from '@/scripts/event-bus';
import SimulationControl from './simulationControl';
import SimulationId from '../simulationId';
import TrainOperation from './trainOperation';
export default {
name: 'SimulationMenu',
components: {
@ -48,7 +50,8 @@ export default {
MemberManage,
DeviceManage,
SimulationControl,
SimulationId
SimulationId,
TrainOperation
},
data() {
return {
@ -58,6 +61,7 @@ export default {
deviceif: false,
deviceShow: true,
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: '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; },
@ -141,6 +145,9 @@ export default {
switchOffset() {
EventBus.$emit('switchOffset');
},
trainOperation() {
this.$refs.trainOperation.doShow();
},
generateQrCode() {
this.hideMenuList();
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>