Merge remote-tracking branch 'remotes/origin/master' into dev

# Conflicts:
#	src/i18n/langs/zh/rules.js
#	src/views/trainRoom/index.vue
This commit is contained in:
ival 2019-08-14 16:50:50 +08:00
commit fd2b66e984
11 changed files with 891 additions and 701 deletions

View File

@ -1,12 +1,52 @@
<template>
<div id="app">
<router-view />
<deomon-topic ref="deomonTopic"/>
</div>
</template>
<script>
import { handleToken } from '@/utils/auth';
import { creatSubscribe, perpetualTopic } from '@/utils/stomp';
import DeomonTopic from '@/views/demonstration/deomonTopic';
export default {
name: 'App'
name: 'App',
components: {
DeomonTopic
// QuickMenu
},
watch: {
'$store.state.socket.roomInvite': function (val) {
if (val.creatorId) {
this.subscribeMessage(val);
}
}
},
mounted() {
this.prohibitSystemContextMenu();
this.subscribe();
},
methods: {
prohibitSystemContextMenu() {
window.document.oncontextmenu = function () {
return false;
};
},
subscribe() {
this.$nextTick(() => {
if (!this.$route.path.includes('/login') && this.$route.path != '/404') {
const header = { group: '', 'X-Token': handleToken() };
creatSubscribe(perpetualTopic, header);
}
});
},
subscribeMessage(res) {
if (this.$refs.deomonTopic) {
this.$refs.deomonTopic.doShow(res);
this.$store.dispatch('socket/setRoomInvite');
}
}
}
};
</script>

View File

@ -427,6 +427,6 @@ export default {
thenList: '交路列表',
startStation: '起始站',
endStation: '终到站',
endStation: '终到站'
};

View File

@ -133,6 +133,6 @@ export default {
proximitySection: '请选择接近区段',
accessPropertyType: '请选择进路性质类型',
autoRouteType: '请选择自动进路类型',
physicalSegmentData: '请选择进路物理区段数据',
physicalSegmentData: '请选择进路物理区段数据'
};

View File

@ -4,16 +4,19 @@
<span style="color: white;">{{ item.name }}</span>
</el-menu-item>
<deomon-list ref="deomonList" />
<qcode ref="qcode" />
</div>
</template>
<script>
import DeomonList from '@/views/demonstration/deomonList';
import Qcode from './Qcode';
export default {
name: 'Entry',
components: {
DeomonList
DeomonList,
Qcode
},
data() {
return {
@ -21,6 +24,10 @@ export default {
{
name: this.$t('global.quickEntry'),
handle: this.quickEntry
},
{
name: '扫码',
handle: this.qcodeEntry
}
],
stomp: null,
@ -39,11 +46,16 @@ export default {
methods: {
quickEntry() {
this.$refs.deomonList.doShow();
},
qcodeEntry() {
this.$refs.qcode.doShow();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.avatar-wrapper{
display: inline-block;
}
</style>

View File

@ -0,0 +1,93 @@
<template>
<el-dialog title="输入房间号" :visible.sync="centerDialogVisible" width="30%" center>
<el-input v-model="input" placeholder="请输入房间号" />
<span slot="footer" class="dialog-footer">
<el-button @click="centerDialogVisible = false"> </el-button>
<el-button type="primary" @click="comit"> </el-button>
</span>
</el-dialog>
</template>
<script>
import { getPermissionJoint } from '@/api/chat';
export default {
name: 'Dashboard',
data() {
return {
centerDialogVisible: false,
input: ''
};
},
computed: {
isShow() {
return process.env.NODE_ENV == 'development';
}
},
methods: {
doShow() {
this.centerDialogVisible = true;
},
doClose() {
this.centerDialogVisible = false;
},
async comit() {
if (this.input) {
try {
await getPermissionJoint(`${this.input}`);
this.centerDialogVisible = false;
} catch (error) {
this.$messageBox('扫码错误:' + error.message);
}
} else {
this.$messageBox('请输入房间号');
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.dashboard {
&-container {
margin: 30px;
}
&-text {
font-size: 30px;
line-height: 46px;
}
}
/deep/ .el-carousel {
overflow: hidden;
}
.home-box {
float: left;
width: 100%;
font-family: 'Microsoft YaHei';
.title {
font-size: 45px;
text-align: center;
font-weight: 400;
border-bottom: 2px dashed #333;
padding-bottom: 15px;
margin: 50px 200px 120px 200px;
position: relative;
.logo-img {
position: absolute;
right: 0;
top: 0;
width: 55px;
}
}
.card-box {
width: 100%;
padding: 0 300px;
}
}
</style>

View File

@ -7,6 +7,7 @@ var Stomp = require('stompjs');
const isDev = process.env.NODE_ENV === 'development';
const websocketUrl = `${getBaseUrl()}/joylink-websocket?token=`;
// const websocketUrl = `http://192.168.3.6:9000/joylink-websocket?token=`;
var StompClient = function (headers) {
this.url = websocketUrl + handleToken();

View File

@ -9,7 +9,7 @@
:modal="false"
:close-on-click-modal="false"
>
<!-- <el-input placeholder="输入关键字进行过滤" v-model="filterText"></el-input> -->
<!-- <el-input v-model="filterText" placeholder="输入关键字进行过滤" /> -->
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height+'px'}">
<el-tree
ref="tree"

View File

@ -2,7 +2,7 @@
<el-card v-loading="loading" class="map-list-main">
<div slot="header" class="clearfix">
<span>地图列表</span>
<div v-if="role" class="back-home" @click="backHome">返回首页</div>
<!-- <div v-if="role" class="back-home" @click="backHome">返回首页</div> -->
</div>
<filter-city ref="filerCity" filter-empty :query-function="queryFunction" @filterSelectChange="refresh" @changeFilter="clearMapSelect" />
<el-input v-model="filterText" placeholder="输入关键字进行过滤" clearable />
@ -80,9 +80,9 @@ export default {
this.clearMapSelect();
},
methods: {
backHome() {
this.$router.push({ path: `/` });
},
// backHome() {
// this.$router.push({ path: `/` });
// },
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;

View File

@ -2,7 +2,7 @@
<el-card v-loading="loading" class="map-list-main">
<div slot="header" class="clearfix">
<span>试题列表</span>
<div v-if="role" class="back-home" @click="backHome">返回首页</div>
<!-- <div v-if="role" class="back-home" @click="backHome">返回首页</div> -->
</div>
<filter-city
ref="filerCity"
@ -97,9 +97,9 @@ export default {
}
},
methods: {
backHome() {
this.$router.push({ path: `/` });
},
// backHome() {
// this.$router.push({ path: `/` });
// },
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;

View File

@ -2,7 +2,7 @@
<el-card v-loading="loading" class="map-list-main">
<div slot="header" class="clearfix">
<span>课程列表</span>
<div v-if="role" class="back-home" @click="backHome">返回首页</div>
<!-- <div v-if="role" class="back-home" @click="backHome">返回首页</div> -->
</div>
<filter-city
ref="filerCity"
@ -108,9 +108,9 @@ export default {
}
},
methods: {
backHome() {
this.$router.push({ path: `/` });
},
// backHome() {
// this.$router.push({ path: `/` });
// },
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;

View File

@ -12,7 +12,7 @@
</div>
<!-- 聊天窗口 -->
<div class="chat-box">
<train-chat :groupRoom="roomInfo.group"></train-chat>
<train-chat :group-room="roomInfo.group" />
</div>
<!-- 参与人员 -->
<div class="personnel">
@ -21,39 +21,55 @@
<div class="Scheduling">
<p class="title">调度员</p>
<ul>
<li class="selectPerson" v-for="(nor, index) in dispatchList">
<li v-for="(nor, index) in dispatchList" :key="index" class="selectPerson">
<span>{{ nor.nickName }}</span>
<i class="el-icon-close delPerson" v-if="userId == roomInfo.creatorId"
@click="delDispatch(nor, index)"></i>
<i
v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson"
@click="delDispatch(nor, index)"
/>
</li>
</ul>
<div class="add-box" v-if="userId == roomInfo.creatorId">
<el-button icon="el-icon-plus" circle plain @click="addingRoles('dispatch', '增加调度人员')">
</el-button>
<div v-if="userId == roomInfo.creatorId" class="add-box">
<el-button icon="el-icon-plus" circle plain @click="addingRoles('dispatch', '增加调度人员')" />
</div>
</div>
<div class="Scheduling bottomNone">
<p class="title">车站值班员</p>
<ul>
<li class="selectPerson" v-for="(nor, index) in equipmentList">
<li v-for="(nor, index) in equipmentList" :key="index" class="selectPerson">
<span>{{ nor.nickName }}</span>
<i class="el-icon-close delPerson" v-if="userId == roomInfo.creatorId"
@click="delEquipment(nor, index)"></i>
<i
v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson"
@click="delEquipment(nor, index)"
/>
<div style="float: right; margin-right: 15px;">
<el-select v-model="nor.stationCode" placeholder="请选择"
@change="changeEquipment(nor)" size="mini"
:disabled="userId != roomInfo.creatorId">
<el-option v-for="item in stationList" :key="item.code" :label="item.name"
:value="item.code" :disabled="item.disabled">
</el-option>
<el-select
v-model="nor.stationCode"
placeholder="请选择"
size="mini"
:disabled="userId != roomInfo.creatorId"
@change="changeEquipment(nor)"
>
<el-option
v-for="item in stationList"
:key="item.code"
:label="item.name"
:value="item.code"
:disabled="item.disabled"
/>
</el-select>
</div>
</li>
</ul>
<div class="add-box" v-if="userId == roomInfo.creatorId">
<el-button icon="el-icon-plus" circle plain
@click="addingRoles('equipment', '增加车站值班员')">
</el-button>
<div v-if="userId == roomInfo.creatorId" class="add-box">
<el-button
icon="el-icon-plus"
circle
plain
@click="addingRoles('equipment', '增加车站值班员')"
/>
</div>
</div>
</div>
@ -61,29 +77,33 @@
<div class="Scheduling ">
<p class="title">教员</p>
<ul>
<li class="selectPerson" v-for="(nor, index) in adminList">
<li v-for="(nor, index) in adminList" :key="index" class="selectPerson">
<span>{{ nor.nickName }}</span>
<i class="el-icon-close delPerson" v-if="userId == roomInfo.creatorId"
@click="delAdmin(nor, index)"></i>
<i
v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson"
@click="delAdmin(nor, index)"
/>
</li>
</ul>
<div class="add-box" v-if="userId == roomInfo.creatorId">
<el-button icon="el-icon-plus" circle plain @click="addingRoles('admin', '增加教员')">
</el-button>
<div v-if="userId == roomInfo.creatorId" class="add-box">
<el-button icon="el-icon-plus" circle plain @click="addingRoles('admin', '增加教员')" />
</div>
</div>
<div class="Scheduling ">
<p class="title">通号</p>
<ul>
<li class="selectPerson" v-for="(nor, index) in signalList">
<li v-for="(nor, index) in signalList" :key="index" class="selectPerson">
<span>{{ nor.nickName }}</span>
<i class="el-icon-close delPerson" v-if="userId == roomInfo.creatorId"
@click="delSignal(nor, index)"></i>
<i
v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson"
@click="delSignal(nor, index)"
/>
</li>
</ul>
<div class="add-box" v-if="userId == roomInfo.creatorId">
<el-button icon="el-icon-plus" circle plain @click="addingRoles('signal', '增加通号')">
</el-button>
<div v-if="userId == roomInfo.creatorId" class="add-box">
<el-button icon="el-icon-plus" circle plain @click="addingRoles('signal', '增加通号')" />
</div>
</div>
</div>
@ -91,40 +111,61 @@
<div class="Scheduling bottomNone">
<p class="title">司机</p>
<ul>
<li class="selectPerson" v-for="(nor, index) in driverList">
<li v-for="(nor, index) in driverList" :key="index" class="selectPerson">
<span>{{ nor.nickName }}</span>
<i class="el-icon-close delPerson" v-if="userId == roomInfo.creatorId"
@click="delDriver(nor, index)"></i>
<i
v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson"
@click="delDriver(nor, index)"
/>
</li>
</ul>
<div class="add-box" v-if="userId == roomInfo.creatorId">
<el-button icon="el-icon-plus" circle plain @click="addingRoles('driver', '增加司机')">
</el-button>
<div v-if="userId == roomInfo.creatorId" class="add-box">
<el-button icon="el-icon-plus" circle plain @click="addingRoles('driver', '增加司机')" />
</div>
</div>
</div>
</div>
<div class="start-box">
<div v-if="!starting" style="float: right; margin-left: 10px;">
<el-button type="primary" style="float: right;" v-if="userId == roomInfo.creatorId"
@click="start">
<el-button
v-if="userId == roomInfo.creatorId"
type="primary"
style="float: right;"
@click="start"
>
开始仿真</el-button>
</div>
<div v-else>
<el-button type="primary" style="float: right; margin-right: 10px;" v-if=""
@click="joinJointTrain">
<el-button
type="primary"
style="float: right; margin-right: 10px;"
@click="joinJointTrain"
>
进入仿真</el-button>
<el-button type="" style="float: right; margin-right: 10px;" v-if="userId == roomInfo.creatorId"
@click="stop">
<el-button
v-if="userId == roomInfo.creatorId"
type=""
style="float: right; margin-right: 10px;"
@click="stop"
>
结束仿真</el-button>
</div>
<el-button type="" style="float: right; margin-right: 0px;" @click="postCode"
v-if="userId == roomInfo.creatorId">生成二维码
<el-button
v-if="userId == roomInfo.creatorId"
type=""
style="float: right; margin-right: 0px;"
@click="postCode"
>生成二维码
</el-button>
<el-button type="" style="float: right; margin-right: 10px;" @click="backRoom">返回
</el-button>
<el-button type="danger" style="float: right; margin-right: 0px;"
v-if="userId == roomInfo.creatorId" @click="exit">销毁房间
<el-button
v-if="userId == roomInfo.creatorId"
type="danger"
style="float: right; margin-right: 0px;"
@click="exit"
>销毁房间
</el-button>
</div>
</div>
@ -132,13 +173,20 @@
<!-- 观众席 -->
<div class="person-box">
<div class="title">
<div style="float: left;"></div>
<div style="float: left;" />
<div style="float: right; font-size: 15px;">{{ treeData.length }}/{{ roomInfo.totalNum }}</div>
</div>
<el-input placeholder="输入名称进行过滤" v-model="filterText" clearable> </el-input>
<el-scrollbar wrapClass="scrollbar-wrapper" :style="{ height: (height) +'px' }">
<el-tree ref="trainingTree" :data="treeData" :filter-node-method="filterNode" :lazy="false"
:props="defaultProps" @node-contextmenu="showContextMenu" class="tree-height-max">
<el-input v-model="filterText" placeholder="输入名称进行过滤" clearable />
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: (height) +'px' }">
<el-tree
ref="trainingTree"
:data="treeData"
:filter-node-method="filterNode"
:lazy="false"
:props="defaultProps"
class="tree-height-max"
@node-contextmenu="showContextMenu"
>
<span slot-scope="{ node, data }">
<!-- inRoom true 在线 false 不在线 -->
<span v-if="node.data.inRoom" style="color: green;">{{ data.nickName }}</span>
@ -147,31 +195,28 @@
</el-tree>
</el-scrollbar>
</div>
<add-person ref="addPerson" @handleDispatch="handleDispatch" @handleUserList="handleUserList"></add-person>
<qr-code ref="qrCode"></qr-code>
<tree-operate-menu ref="menu" :point="point" :clickUserId="clickUserId"></tree-operate-menu>
<add-person ref="addPerson" @handleDispatch="handleDispatch" @handleUserList="handleUserList" />
<qr-code ref="qrCode" />
<tree-operate-menu ref="menu" :point="point" :click-user-id="clickUserId" />
</div>
</template>
<script>
import Vue from 'vue';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import HZRecorder from '@/utils/HZRecorder';
import { postDataBd, postDataXf, getHistoryVoice, getJoinTrainCode, deljointTrainRoom, putUserRoles, postRoomDetail, getJointTrainRoomUserList, putJointTrainingExit, startJointTraining, putJointTrainingSimulation, putJointTrainingSimulationEntrance } from '@/api/chat';
import StompClient from '@/utils/sock';
import { handleToken } from '@/utils/auth';
import trainChat from './trainChat'
// import HZRecorder from '@/utils/HZRecorder';
import { getJoinTrainCode, deljointTrainRoom, putUserRoles, postRoomDetail, getJointTrainRoomUserList, putJointTrainingExit, startJointTraining, putJointTrainingSimulation, putJointTrainingSimulationEntrance } from '@/api/chat';
import trainChat from './trainChat';
import AddPerson from './addPerson';
import QrCode from "@/components/QrCode";
import QrCode from '@/components/QrCode';
import { getStationList } from '@/api/runplan';
import TreeOperateMenu from './operateMenu';
import { DeviceMenu } from '@/scripts/ConstDic';
import { checkLoginLine } from '@/api/login';
import { getPublishMapInfo } from '@/api/jmap/map';
import { launchFullscreen } from '@/utils/screen';
// import { launchFullscreen } from '@/utils/screen';
export default {
name: 'trainRoom',
name: 'TrainRoom',
components: {
trainChat,
AddPerson,
@ -189,14 +234,14 @@
creatorId: '',
group: '',
audienceNum: '',
permissionNum: '',
permissionNum: ''
},
filterText: '',
isShow: false,
listName: 'dispatch',
treeData: [],
defaultProps: {
label: 'nickName',
label: 'nickName'
},
dispatchList: [],
equipmentList: [],
@ -212,8 +257,8 @@
timeDemon: null,
starting: false,
mapId: '',
num: 0,
}
num: 0
};
},
watch: {
filterText(val) {
@ -231,28 +276,28 @@
},
'$store.state.socket.userRoomKickOut': function (val) {
if (val.id) { //
val.state = '03'
val.state = '03';
this.addPeopleList(val);
}
},
'$store.state.socket.userPermit': function (val) {
if (val.id) { //
val.state = '01'
val.state = '01';
this.addPeopleList(val);
}
},
'$store.state.socket.userInRoom': function (val) {
if (val.id) { //
val.state = '02'
val.state = '02';
this.addPeopleList(val);
}
},
'$store.state.socket.userOutRoom': function (val) {
if (val.id) { // 退
val.state = '02'
val.state = '02';
this.addPeopleList(val);
}
},
}
},
beforeDestroy() {
if (this.timeDemon) {
@ -277,14 +322,14 @@
return data.name.indexOf(value) !== -1;
},
async handleRoomInfo(data) {
let param = {
const param = {
creatorId: data.creatorId,
group: data.group,
mapId: data.mapId,
permissionNum: data.permissionNum,
roomName: data.roomName,
state: data.state,
}
state: data.state
};
if (data.state == '03') { //
this.$router.push({ path: `/demonstration/detail/${param.mapId}` });
} else if (data.state == '01') { //
@ -292,15 +337,15 @@
} else if (data.state == '02') {
this.starting = true;
await putJointTrainingSimulationEntrance(param.group);
let rest = await getPublishMapInfo(param.mapId);
let query = { skinCode: rest.data.skinCode, mapId: param.mapId, group: param.group, }
const rest = await getPublishMapInfo(param.mapId);
const query = { skinCode: rest.data.skinCode, mapId: param.mapId, group: param.group };
this.$router.push({ path: `/jointTraining`, query: query });
}
this.$store.dispatch('socket/setJointRoomInfo'); //
},
//
async getRoomState() {
let res = await postRoomDetail(this.$route.query.group);
const res = await postRoomDetail(this.$route.query.group);
this.mapId = res.data.mapId;
this.starting = false;
if (res.data.state == '02') {
@ -313,7 +358,7 @@
this.point = {
x: e.clientX,
y: e.clientY
}
};
if (this.userId == this.roomInfo.creatorId) {
this.clickUserId = obj.id;
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: DeviceMenu.JointRoom });
@ -322,29 +367,29 @@
async joinJointTrain() {
// launchFullscreen();
await putJointTrainingSimulationEntrance(this.$route.query.group);
let rest = await getPublishMapInfo(this.mapId);
let query = { skinCode: rest.data.skinCode, mapId: this.mapId, group: this.$route.query.group };
const rest = await getPublishMapInfo(this.mapId);
const query = { skinCode: rest.data.skinCode, mapId: this.mapId, group: this.$route.query.group };
this.$router.push({ path: `/jointTraining`, query: query });
},
// 线/线
addPeopleList(obj) {
let param = {
const param = {
id: obj.id,
inRoom: obj.inRoom,
inSimulation: obj.inSimulation,
name: obj.name,
nickName: obj.nickName,
userRole: obj.userRole,
}
userRole: obj.userRole
};
if (obj.state == '01') { //
this.treeData.push(param);
} else if (obj.state == '02') { // inRoom 线
let index = this.treeData.findIndex(nor => nor.id == param.id);
const index = this.treeData.findIndex(nor => nor.id == param.id);
if (index > -1) {
this.treeData[index].inRoom = param.inRoom;
}
} else if (obj.state == '03') { //
let index = this.treeData.findIndex(nor => nor.id == param.id);
const index = this.treeData.findIndex(nor => nor.id == param.id);
this.treeData.splice(index, 1);
if (this.userId == param.id) {
this.$router.push({ path: `/` });
@ -352,7 +397,7 @@
} else {
param.userRole = '';
param['stationCode'] = '';
let arr = [];
const arr = [];
arr.push(param);
this.addrolesList(arr); //
}
@ -362,15 +407,15 @@
addrolesList(list) {
list.forEach(item => {
switch (item.userRole) {
case 'Instructor': {
case 'Instructor':
this.adminList.push(item);
this.num++;
} break;
case 'Dispatcher': {
break;
case 'Dispatcher':
this.dispatchList.push(item);
this.num++;
} break;
case 'Attendant': {
break;
case 'Attendant':
this.equipmentList.forEach((nor, index) => {
if (nor.id == item.id) { //
this.equipmentList.splice(index, 1);
@ -379,16 +424,16 @@
});
this.equipmentList.push(item); //
this.num++;
} break;
case 'Driver': {
break;
case 'Driver':
this.driverList.push(item);
this.num++;
} break;
case 'Repair': {
break;
case 'Repair':
this.signalList.push(item);
this.num++;
} break;
default: {
break;
default:
this.dispatchList.forEach((nor, index) => {
if (item.id == nor.id) {
this.dispatchList.splice(index, 1);
@ -419,29 +464,29 @@
this.num--;
}
});
} break;
break;
}
});
},
async getRoomInfo() {
//
let res = await postRoomDetail(this.$route.query.group);
const res = await postRoomDetail(this.$route.query.group);
this.roomInfo = {
creatorId: res.data.creatorId,
totalNum: Number(res.data.permissionNum) + Number(res.data.audiencePermissionNum),
creator: res.data.creator.nickName,
group: res.data.group,
audienceNum: res.data.audiencePermissionNum,
permissionNum: res.data.permissionNum,
}
permissionNum: res.data.permissionNum
};
//
let resp = await getStationList(res.data.mapId);
const resp = await getStationList(res.data.mapId);
resp.data.forEach(item => {
if (item.centralized) {
this.stationList.push(item);
}
})
});
this.stationList.forEach(item => {
item.disabled = false;
this.equipmentList.forEach(nor => {
@ -459,48 +504,47 @@
this.adminList = [];
this.driverList = [];
this.signalList = [];
let res = await getJointTrainRoomUserList(this.$route.query.group);
const res = await getJointTrainRoomUserList(this.$route.query.group);
res.data.forEach(item => {
if (item.id == this.userId) {
item.disabled = true;
}
if (item.userRole != 'Audience' && item.userRole != '') this.num++
if (item.userRole != 'Audience' && item.userRole != '') this.num++;
switch (item.userRole) {
case 'Instructor': {
case 'Instructor':
item.select = true;
this.adminList.push(item);
} break;
case 'Dispatcher': {
break;
case 'Dispatcher':
item.select = true;
this.dispatchList.push(item);
} break;
case 'Attendant': {
break;
case 'Attendant':
item.select = true;
this.equipmentList.push(item);
} break;
case 'Driver': {
break;
case 'Driver':
item.select = true;
this.driverList.push(item);
} break;
case 'Repair': {
break;
case 'Repair':
item.select = true;
this.signalList.push(item);
}
};
this.treeData.push(item);
})
});
},
async postCode() {
try {
let res = await getJoinTrainCode({}, this.$route.query.group);
let param = {
const res = await getJoinTrainCode({}, this.$route.query.group);
if (res.code == '200') {
const param = {
url: res.data,
title: '分发房间二维码'
}
};
if (this.$refs) {
this.$refs.qrCode.doShow(param);
}
} catch (error) { };
}
},
async start() {
let flag = true;
@ -508,20 +552,20 @@
if (!item.stationCode) {
flag = false;
}
})
});
if (flag) {
try {
let res = await startJointTraining(this.$route.query.group);
await startJointTraining(this.$route.query.group);
} catch (error) {
this.messageInfo('开始综合演练失败。', 'error');
};
}
} else {
this.messageInfo('车站值班员所属车站不能为空', 'error');
}
},
async stop() {
let res = await putJointTrainingSimulation(this.$route.query.group);
const res = await putJointTrainingSimulation(this.$route.query.group);
this.mapId = res.data.mapId;
if (res.data.state == '01') {
this.starting = false;
@ -530,11 +574,11 @@
//
async backRoom() {
try {
let res = await putJointTrainingExit(this.$route.query.group);
await putJointTrainingExit(this.$route.query.group);
this.$router.push({ path: `/` });
} catch (error) {
this.messageInfo('操作失败!', 'error');
};
}
},
//
exit() {
@ -544,19 +588,19 @@
type: 'warning'
}).then(async () => {
try {
let res = await deljointTrainRoom(this.$route.query.group);
await deljointTrainRoom(this.$route.query.group);
} catch (error) {
this.messageInfo('销毁房间失败!', 'error');
};
})
}
});
},
//
changeEquipment(val) {
let params = [{
const params = [{
id: val.id,
nickName: val.nickName,
userRole: 'Attendant',
stationCode: val.stationCode,
stationCode: val.stationCode
}];
putUserRoles(params, this.$route.query.group);
this.stationList.forEach(item => {
@ -570,29 +614,29 @@
},
// Admin Instructor Dispatcher Attendant Audience Driver Repair
async handleDispatch(list) {
let arr = [];
const arr = [];
list.forEach(item => {
let params = {
const params = {
id: item.id,
nickName: item.nickName,
userRole: '',
}
userRole: ''
};
switch (this.listName) {
case 'admin': { //
case 'admin': //
params.userRole = 'Instructor';
} break;
case 'dispatch': { //
break;
case 'dispatch': //
params.userRole = 'Dispatcher';
} break;
case 'equipment': { //
break;
case 'equipment': //
params.userRole = 'Attendant';
} break;
case 'driver': { //
params.userRole = 'Driver'
} break;
case 'signal': { //
params.userRole = 'Repair'
} break;
break;
case 'driver': //
params.userRole = 'Driver';
break;
case 'signal': //
params.userRole = 'Repair';
break;
}
arr.push(params);
});
@ -604,7 +648,7 @@
if (item.id == nor.id) {
nor.userRole = item.userRole;
}
})
});
});
} catch (error) {
if (error.code == 500009) {
@ -614,20 +658,20 @@
if (item.userRole == '' || item.userRole == 'Audience') {
item.select = false;
}
})
});
}
}
},
//
addingRoles(name, title) {
this.listName = name;
let treeList = [];
const treeList = [];
this.treeData.forEach(item => {
if (!item.select) {
delete item.select;
treeList.push(item);
}
})
});
this.$refs.addPerson.doShow(title, treeList);
},
handleUserList(list) {
@ -636,8 +680,8 @@
if (item.id == nor.id) {
item = nor;
}
})
})
});
});
},
//
delDispatch(item, index) {
@ -669,17 +713,17 @@
this.handleProperty(item);
},
handleProperty(item) {
let treeIndex = this.treeData.findIndex(nor => nor.id == item.id);
const treeIndex = this.treeData.findIndex(nor => nor.id == item.id);
if (treeIndex > -1) {
this.num--;
this.treeData[treeIndex]['select'] = false;
this.treeData[treeIndex].userRole = 'Audience';
}
let params = [{
const params = [{
id: item.id,
nickName: item.nickName,
userRole: 'Audience',
stationCode: '',
stationCode: ''
}];
putUserRoles(params, this.$route.query.group);
},
@ -687,11 +731,11 @@
this.$message({
showClose: true,
message: message,
type: type,
type: type
});
}
},
}
};
</script>
<style scoped lang="scss">