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> <template>
<div id="app"> <div id="app">
<router-view /> <router-view />
<deomon-topic ref="deomonTopic"/>
</div> </div>
</template> </template>
<script> <script>
import { handleToken } from '@/utils/auth';
import { creatSubscribe, perpetualTopic } from '@/utils/stomp';
import DeomonTopic from '@/views/demonstration/deomonTopic';
export default { 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> </script>

View File

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

View File

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

View File

@ -4,16 +4,19 @@
<span style="color: white;">{{ item.name }}</span> <span style="color: white;">{{ item.name }}</span>
</el-menu-item> </el-menu-item>
<deomon-list ref="deomonList" /> <deomon-list ref="deomonList" />
<qcode ref="qcode" />
</div> </div>
</template> </template>
<script> <script>
import DeomonList from '@/views/demonstration/deomonList'; import DeomonList from '@/views/demonstration/deomonList';
import Qcode from './Qcode';
export default { export default {
name: 'Entry', name: 'Entry',
components: { components: {
DeomonList DeomonList,
Qcode
}, },
data() { data() {
return { return {
@ -21,6 +24,10 @@ export default {
{ {
name: this.$t('global.quickEntry'), name: this.$t('global.quickEntry'),
handle: this.quickEntry handle: this.quickEntry
},
{
name: '扫码',
handle: this.qcodeEntry
} }
], ],
stomp: null, stomp: null,
@ -39,11 +46,16 @@ export default {
methods: { methods: {
quickEntry() { quickEntry() {
this.$refs.deomonList.doShow(); this.$refs.deomonList.doShow();
},
qcodeEntry() {
this.$refs.qcode.doShow();
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
.avatar-wrapper{
display: inline-block;
}
</style> </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 isDev = process.env.NODE_ENV === 'development';
const websocketUrl = `${getBaseUrl()}/joylink-websocket?token=`; const websocketUrl = `${getBaseUrl()}/joylink-websocket?token=`;
// const websocketUrl = `http://192.168.3.6:9000/joylink-websocket?token=`;
var StompClient = function (headers) { var StompClient = function (headers) {
this.url = websocketUrl + handleToken(); this.url = websocketUrl + handleToken();

View File

@ -9,7 +9,7 @@
:modal="false" :modal="false"
:close-on-click-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-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height+'px'}">
<el-tree <el-tree
ref="tree" ref="tree"

View File

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

View File

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

View File

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

View File

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