From 872122e92be836153d93237ebc0fd80226bb745c Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Thu, 2 Jul 2020 17:57:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=BC=E5=90=88=E6=BC=94=E7=BB=83=E4=BB=BF?= =?UTF-8?q?=E7=9C=9F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/training.js | 69 +++++- src/views/ibp/ibpsystem/index.vue | 1 - src/views/newMap/jointTrainingNew/index.vue | 22 +- .../{ => memberManage}/addMember.vue | 0 .../memberManage/content-menu.vue | 103 +++++++++ .../memberManage/e-members.vue | 142 ++++++++++++ .../{ => memberManage}/membersManage.vue | 203 +++++++++--------- 7 files changed, 427 insertions(+), 113 deletions(-) rename src/views/newMap/jointTrainingNew/{ => memberManage}/addMember.vue (100%) create mode 100644 src/views/newMap/jointTrainingNew/memberManage/content-menu.vue create mode 100644 src/views/newMap/jointTrainingNew/memberManage/e-members.vue rename src/views/newMap/jointTrainingNew/{ => memberManage}/membersManage.vue (58%) diff --git a/src/store/modules/training.js b/src/store/modules/training.js index 2b0380a9e..3e8379992 100644 --- a/src/store/modules/training.js +++ b/src/store/modules/training.js @@ -4,6 +4,7 @@ import OperateHandler from '@/scripts/plugin/OperateHandler'; import deviceType from '../../jmap/constant/deviceType'; import LangStorage from '@/utils/lang'; import Handler from '@/scripts/cmdPlugin/Handler'; +import { deepAssign } from '@/utils/index'; /** * 实训状态数据 @@ -35,7 +36,10 @@ const training = { prdType: '', // 产品类型 roles: '', // 角色权限类型 group: '', // 设置全局 group - centerStationCode:'' // 当前居中的集中站code + centerStationCode:'', // 当前居中的集中站code + memberList: [], // 综合仿真成员列表 + memberData: {}, // 综合仿真成员列表 + simulationUserList: [] // 综合仿真用户列表 }, getters: { @@ -81,6 +85,12 @@ const training = { roles: (state) => { return state.roles; }, + memberList: (state) => { + return state.memberList; + }, + simulationUserList: (state) => { + return state.simulationUserList; + }, // 视图中的列车列表 viewTrainList: (state) => () =>{ const trainList = []; @@ -111,6 +121,8 @@ const training = { }, over: (state) => { state.started = false; + state.memberList = []; + state.simulationUserList = []; state.switchcount += 1; }, updateMapState: (state, deviceStatus) => { @@ -212,6 +224,49 @@ const training = { }, setCenterStationCode:(state, centerStationCode) => { state.centerStationCode = centerStationCode; + }, + setMemberList: (state, memberList) => { + state.memberList = memberList; + state.memberData = {}; + if (memberList && memberList.length) { + memberList.forEach(item => { + state.memberData[item.id] = deepAssign({userId: ''}, item); + }); + } + }, + setSimulationUserList: (state, simulationUserList) => { + state.simulationUserList = simulationUserList; + }, + updateMemberAndUser: (state, data) => { + data.forEach(item => { + let memberIndex = -1; + let memberId = ''; + state.simulationUserList.forEach((user, index) =>{ + if (user.userId === item.userId) { + memberId = user.memberId; + user.online = item.online; + user.memberId = item.memberId; + user.role = item.role; + memberIndex = index; + } + }); + try { + if (memberId !== item.memberId && memberId) { + state.memberData[memberId].userId = ''; + } + if (memberId !== item.memberId && item.memberId) { + state.memberData[item.memberId].userId = item.userId; + } + if (item.messageType === 'ENTER' && memberIndex < 0) { + delete item.messageType; + state.simulationUserList.push(item); + } else if (item.messageType === 'KICK_OUT' && memberIndex > -1) { + state.simulationUserList.splice(memberIndex, 1); + } + } catch (e) { + console.error(e); + } + }); } }, @@ -614,6 +669,18 @@ const training = { /** 设置当前居中的集中站code */ setCenterStationCode:({ commit }, centerStationCode) => { commit('setCenterStationCode', centerStationCode); + }, + /** 设置综合演练仿真成员列表 */ + setMemberList: ({ commit }, memberList) => { + commit('setMemberList', memberList); + }, + /** 设置综合演练仿真用户列表 */ + setSimulationUserList: ({ commit }, simulationUserList) => { + commit('setSimulationUserList', simulationUserList); + }, + /** 更新综合演练仿真成员和用户列表 */ + updateMemberAndUser: ({ commit }, simulationUserList) => { + commit('updateMemberAndUser', simulationUserList); } } }; diff --git a/src/views/ibp/ibpsystem/index.vue b/src/views/ibp/ibpsystem/index.vue index 328ba7a49..18e6f3f7f 100644 --- a/src/views/ibp/ibpsystem/index.vue +++ b/src/views/ibp/ibpsystem/index.vue @@ -9,7 +9,6 @@ import Vue from 'vue'; import IbpPan from '@/ibp/ibpPan'; import { parser } from '@/ibp/utils/parser'; -// import ibpData from '@/ibp/constant/ibpData'; import { mapGetters } from 'vuex'; import { exitFullscreen } from '@/utils/screen'; import { handlerIbpEvent } from '@/api/simulation'; diff --git a/src/views/newMap/jointTrainingNew/index.vue b/src/views/newMap/jointTrainingNew/index.vue index f6b09b95e..6b8003d0e 100644 --- a/src/views/newMap/jointTrainingNew/index.vue +++ b/src/views/newMap/jointTrainingNew/index.vue @@ -67,7 +67,7 @@ import { mapGetters } from 'vuex'; import { OperateMode, TrainingMode } from '@/scripts/ConstDic'; import { checkLoginLine } from '@/api/login'; import { loadNewMapDataByGroup } from '@/utils/loaddata'; -import { clearSimulation, getSimulationInfoNew, getSimulationUserInfo } from '@/api/simulation'; +import { clearSimulation, getSimulationInfoNew, getSimulationUserInfo, getSimulationMemberList, getAllSimulationUser } from '@/api/simulation'; import {getRaceUserById, getTestPaperDatail} from '@/api/competition'; import { getSessionStorage, getToken } from '@/utils/auth'; import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive'; @@ -77,8 +77,8 @@ import { timeFormat } from '@/utils/date'; import { Message } from 'element-ui'; import Vue from 'vue'; import localStore from 'storejs'; -import MembersManage from './membersManage'; -import AddMember from './addMember'; +import MembersManage from './memberManage/membersManage'; +import AddMember from './memberManage/addMember'; import { getLoginInfo } from '@/api/login'; export default { @@ -194,6 +194,8 @@ export default { this.mapBoxP.style.cursor = ''; this.mapViewLoadedOver = true; this.showSelectStation && this.setShowStation(this.showStation); + this.initMemberUserInfo(); + }, '$store.state.socket.permissionOver': function () { this.$alert(this.$t('tip.userRightsHaveBeenReclaimed'), this.$t('tip.hint'), { @@ -349,6 +351,18 @@ export default { this.$store.dispatch('SetProjecteDevice', resp.data.deviceVO); }); }, + initMemberUserInfo() { + getSimulationMemberList(this.$route.query.group).then(resp => { + this.$store.dispatch('training/setMemberList', resp.data); + }).catch(() => { + this.$messageBox('获取仿真成员列表失败!'); + }); + getAllSimulationUser(this.$route.query.group).then(resp => { + this.$store.dispatch('training/setSimulationUserList', resp.data); + }).catch(() => { + this.$messageBox('获取所有仿真用户失败!'); + }); + }, async loadSimulationInfo() { const resp = await getSimulationInfoNew(this.group); if (resp && resp.code == 200 && resp.data && !resp.data.dataError) { @@ -617,7 +631,7 @@ export default { this.$refs.addMember.doShow(); }, refreshMemberTree() { - this.$refs.membersManage.doShow(); + this.initMemberUserInfo(); }, changeAdminMode(adminMode, swch) { this.adminMode = adminMode; diff --git a/src/views/newMap/jointTrainingNew/addMember.vue b/src/views/newMap/jointTrainingNew/memberManage/addMember.vue similarity index 100% rename from src/views/newMap/jointTrainingNew/addMember.vue rename to src/views/newMap/jointTrainingNew/memberManage/addMember.vue diff --git a/src/views/newMap/jointTrainingNew/memberManage/content-menu.vue b/src/views/newMap/jointTrainingNew/memberManage/content-menu.vue new file mode 100644 index 000000000..a537967dc --- /dev/null +++ b/src/views/newMap/jointTrainingNew/memberManage/content-menu.vue @@ -0,0 +1,103 @@ + + + + diff --git a/src/views/newMap/jointTrainingNew/memberManage/e-members.vue b/src/views/newMap/jointTrainingNew/memberManage/e-members.vue new file mode 100644 index 000000000..cd338fe4b --- /dev/null +++ b/src/views/newMap/jointTrainingNew/memberManage/e-members.vue @@ -0,0 +1,142 @@ + + + + + diff --git a/src/views/newMap/jointTrainingNew/membersManage.vue b/src/views/newMap/jointTrainingNew/memberManage/membersManage.vue similarity index 58% rename from src/views/newMap/jointTrainingNew/membersManage.vue rename to src/views/newMap/jointTrainingNew/memberManage/membersManage.vue index c454aab58..0aa3aec45 100644 --- a/src/views/newMap/jointTrainingNew/membersManage.vue +++ b/src/views/newMap/jointTrainingNew/memberManage/membersManage.vue @@ -31,12 +31,12 @@ @node-click="handleNodeClick" > - {{ node.label }} - - + {{ data.label }} + + @@ -48,7 +48,7 @@