diff --git a/src/views/newMap/displayNew/chatView/chatBox.vue b/src/views/newMap/displayNew/chatView/chatBox.vue index e492b8eaa..25f4ee623 100644 --- a/src/views/newMap/displayNew/chatView/chatBox.vue +++ b/src/views/newMap/displayNew/chatView/chatBox.vue @@ -55,7 +55,7 @@ import ChatCreateGroup from './chatCreateGroup'; import ChatMemberList from './chatMemberList'; import ChatTooltip from './chatTooltip'; import RecordRTC from 'recordrtc'; -import {sendSimulationConversition, overSimulationConversition, getSimulationMembersNew, getAllConversition, getSimulationConversition} from '@/api/chat'; +import {sendSimulationConversition, overSimulationConversition, getAllConversition, getSimulationConversition} from '@/api/chat'; import ConstConfig from '@/scripts/ConstConfig'; import Cookies from 'js-cookie'; export default { @@ -135,7 +135,6 @@ export default { const objectBottom = parseInt(object.style.bottom) || 0; this.bottom = this.bottom + object.offsetHeight + objectBottom; } - this.getSimulationMembers(); }, 'userRole':function(val) { this.isHasCoversition = false; @@ -196,77 +195,78 @@ export default { }, // 获取所有的成员列表 getSimulationMembers() { - getSimulationMembersNew(this.$route.query.group).then(resp => { - let lastData = JSON.stringify(resp.data); - const roleTypeList = ConstConfig.ConstSelect.roleTypeNew; - roleTypeList.forEach(function(element) { - const rolename = element.value; - if (Cookies.get('user_lang') == 'en') { - lastData = lastData.replace(new RegExp(rolename, 'g'), element.enLabel); - } else { - lastData = lastData.replace(new RegExp(rolename, 'g'), element.label); - } - }); - lastData = JSON.parse(lastData); - const activeList = this.$store.state.map.activeTrainList; - const memberList = []; - // lastData = lastData.filter(memberIn=>{ return memberIn.role != '观众'; }); - lastData.forEach((member, index)=>{ - if (member.type != '观众') { - const name = member.name == undefined ? '' : '-' + member.name; - if (member.deviceCode) { - const device = this.$store.getters['map/getDeviceByCode'](member.deviceCode); - if (device) { - if (device._type == 'Train') { - member.memberName = member.type + device.groupNumber + name; - if (activeList.length > 0 && activeList.includes(device.groupNumber)) { - memberList.push(member); - } - } else { - member.memberName = member.type + device.name + name; - memberList.push(member); + const memberList = this.$store.state.training.memberData; + let lastData = JSON.stringify(memberList); + const roleTypeList = ConstConfig.ConstSelect.roleTypeNew; + roleTypeList.forEach(function(element) { + const rolename = element.value; + if (Cookies.get('user_lang') == 'en') { + lastData = lastData.replace(new RegExp(rolename, 'g'), element.enLabel); + } else { + lastData = lastData.replace(new RegExp(rolename, 'g'), element.label); + } + }); + lastData = JSON.parse(lastData); + const activeList = this.$store.state.map.activeTrainList; + lastData = Object.values(lastData); + const lastMemberList = []; + lastData.forEach((member, index)=>{ + if (member.type != '观众') { + const name = member.name == undefined ? '' : '-' + member.name; + if (member.deviceCode) { + const device = this.$store.getters['map/getDeviceByCode'](member.deviceCode); + if (device) { + if (device._type == 'Train') { + member.memberName = member.type + device.groupNumber + name; + if (activeList.length > 0 && activeList.includes(device.groupNumber)) { + lastMemberList.push(member); } } else { - member.memberName = member.type + member.deviceCode + name; - memberList.push(member); + member.memberName = member.type + device.name + name; + lastMemberList.push(member); } } else { - member.memberName = member.type + name; - memberList.push(member); + member.memberName = member.type + member.deviceCode + name; + lastMemberList.push(member); } - } - }); - this.memberList = memberList; - - if (this.recordSending) { - this.cancleRecording(); - } - // 获取会话列表 - getAllConversition(this.$route.query.group).then(resp=>{ - if (resp.data && resp.data.length && resp.data.length > 0) { - this.isCreate = false; - const coversitionList = resp.data; - let memberListCoversition = {}; - coversitionList.forEach(coversition=>{ - if (!coversition.over) { - const memberList = coversition.memberList; - memberList.forEach(member=>{ - if (member.memberId == this.$store.state.scriptRecord.updateRoleId) { - memberListCoversition = {id:coversition.id, all:null}; - if (member.memberId == coversition.creatorId) { - this.isCreate = true; - } - } - }); - } - }); - this.memberListCoversition = memberListCoversition; } else { - this.isCreate = false; - this.memberListCoversition = {}; + member.memberName = member.type + name; + lastMemberList.push(member); } - this.getSimulationConverMembers(); - }); + } + }); + this.memberList = lastMemberList; + this.getAllConversition(); + }, + getAllConversition() { + if (this.recordSending) { + this.cancleRecording(); + } + // 获取会话列表 + getAllConversition(this.$route.query.group).then(resp=>{ + if (resp.data && resp.data.length && resp.data.length > 0) { + this.isCreate = false; + const coversitionList = resp.data; + let memberListCoversition = {}; + coversitionList.forEach(coversition=>{ + if (!coversition.over) { + const memberList = coversition.memberList; + memberList.forEach(member=>{ + if (member.memberId == this.$store.state.scriptRecord.updateRoleId) { + memberListCoversition = {id:coversition.id, all:null}; + if (member.memberId == coversition.creatorId) { + this.isCreate = true; + } + } + }); + } + }); + this.memberListCoversition = memberListCoversition; + } else { + this.isCreate = false; + this.memberListCoversition = {}; + } + this.getSimulationConverMembers(); }); }, // 获取当前对话的信息