diff --git a/src/views/newMap/jointTrainingNew/chatView/chatBox.vue b/src/views/newMap/jointTrainingNew/chatView/chatBox.vue index 9e807b5fe..08f67ecf9 100644 --- a/src/views/newMap/jointTrainingNew/chatView/chatBox.vue +++ b/src/views/newMap/jointTrainingNew/chatView/chatBox.vue @@ -3,7 +3,7 @@
-
+
@@ -37,7 +37,7 @@
@@ -74,11 +74,11 @@
@@ -125,7 +125,7 @@ export default { bottom:15, recordSending:false, conversitionId: '', - commonConversation: true, + commonConversation: false, seconds:0, inter:null, recorders: null, @@ -149,8 +149,12 @@ export default { memberIdList: [], quitLoading: false, conversitionMemberList: [], + commonMemberList: [], + privateMemberList: [], isConversitionCreator: false, - messageList: [] + messageList: [], + commonMessageList: [], + privateMessageList: [] }; }, computed:{ @@ -172,7 +176,8 @@ export default { }, userRole(val) { if (val === 'AUDIENCE') { - this.isAudienceInitData(); + // this.isAudienceInitData(); + this.goCommonConversation(); } }, '$store.state.map.mapViewLoadedCount':function(val) { @@ -202,8 +207,9 @@ export default { memberList.push({memberId:id, connect:false}); } }); - console.log(memberList, val.memberIds); this.conversitionMemberList = memberList; + this.privateMemberList = memberList; + this.commonConversation = false; } }, '$store.state.socket.scriptFinish':function(val, old) { @@ -236,7 +242,9 @@ export default { if (val.id === this.conversitionId) { this.conversitionId = ''; this.conversitionMemberList = []; + this.privateMemberList = []; this.messageList = []; + this.privateMessageList = []; } }, '$store.state.training.memberList': function (val) { @@ -325,8 +333,8 @@ export default { this.createLoading = true; startConversition(this.group, this.memberIdList).then(resp => { this.conversitionId = resp.data.id; - // this.conversitionMemberList = resp.data.memberList; this.messageList = []; + this.privateMessageList = []; this.userString = ''; this.isConversitionCreator = true; this.$message.success('创建会话成功!'); @@ -475,7 +483,9 @@ export default { overSimulationConversition(this.group, this.conversitionId).then(resp => { this.conversitionId = ''; this.conversitionMemberList = []; + this.privateMemberList = []; this.messageList = []; + this.privateMessageList = []; this.quitLoading = false; }).catch(() => { this.$message.error('退出会话失败!'); @@ -486,8 +496,10 @@ export default { this.userString = ''; this.conversitionId = data.id; this.conversitionMemberList = data.memberList; + this.commonMemberList = data.memberList; this.isConversitionCreator = false; this.messageList = []; + this.privateMessageList = []; if (data.messageList && data.messageList) { data.messageList.forEach(message => { const member = this.memberData[message.memberId]; @@ -496,6 +508,7 @@ export default { message.self = this.$store.state.userId == member.userId; } this.messageList.push(message); + this.privateMessageList.push(message); }); } }, @@ -513,20 +526,19 @@ export default { }, isAudienceInitData() { getAllConversition(this.group).then(resp => { + const messages = []; if (resp.data && resp.data.length) { - const messageList = []; resp.data.forEach(conversation => { - if (this.userRole == 'AUDIENCE') { - (conversation.messageList || []).forEach(message => { - const member = this.memberData[message.memberId]; - message.src = `/audio/${message.audioPath}`; - message.members = conversation.memberList; - if (member) { - message.self = this.$store.state.userId == member.userId; - } - messageList.push(message); - }); - } else { + (conversation.messageList || []).forEach(message => { + const member = this.memberData[message.memberId]; + message.src = `/audio/${message.audioPath}`; + message.members = conversation.memberList; + if (member) { + message.self = this.$store.state.userId == member.userId; + } + messages.push(message); + }); + if (this.userRole !== 'AUDIENCE') { const user = this.simulationUsers[this.$store.state.user.id]; this.isConversitionCreator = conversation.creatorId == user.memberId; !conversation.over && conversation.memberList.forEach(member =>{ @@ -540,40 +552,61 @@ export default { if (member) { message.self = this.$store.state.userId == member.userId; } + this.privateMessageList.push(message); this.messageList.push(message); }); } }); } }); - this.messageList = messageList.sort(this.sortByMessageTime); + } + this.commonMessageList = messages.sort(this.sortByMessageTime); + const temDispatcherList = []; + const temStationSupervisorList = []; + const temMaintainerList = []; + const temDriverList = []; + this.$store.state.training.memberList.forEach(item =>{ + switch (item.type) { + case 'DISPATCHER': + temDispatcherList.push({memberId: item.id, connect:true }); + break; + case 'STATION_SUPERVISOR': + temStationSupervisorList.push({memberId: item.id, connect:true }); + break; + case 'MAINTAINER': + temMaintainerList.push({memberId: item.id, connect:true }); + break; + case 'DRIVER': + temDriverList.push({memberId: item.id, connect:true }); + break; + } + }); + if (this.userRole === 'AUDIENCE' || this.commonConversation) { + this.conversitionMemberList = []; + this.messageList = this.commonMessageList; + this.commonMemberList = [...temDispatcherList, ...temStationSupervisorList, ...temMaintainerList, ...temDriverList]; + this.conversitionMemberList = this.commonMemberList; } }); - this.conversitionMemberList = []; - const temDispatcherList = []; - const temStationSupervisorList = []; - const temMaintainerList = []; - const temDriverList = []; - this.$store.state.training.memberList.forEach(item =>{ - switch (item.type) { - case 'DISPATCHER': - temDispatcherList.push({memberId: item.id, connect:true }); - break; - case 'STATION_SUPERVISOR': - temStationSupervisorList.push({memberId: item.id, connect:true }); - break; - case 'MAINTAINER': - temMaintainerList.push({memberId: item.id, connect:true }); - break; - case 'DRIVER': - temDriverList.push({memberId: item.id, connect:true }); - break; - } - }); - this.conversitionMemberList = [...temDispatcherList, ...temStationSupervisorList, ...temMaintainerList, ...temDriverList]; }, changeMessageList(data) { this.messageList.push(data); + this.commonMessageList.push(data); + if (this.userRole !== 'AUDIENCE') { + this.privateMessageList.push(data); + } + }, + goCommonConversation() { + !this.commonConversation && this.$refs.chatContent && this.$refs.chatContent.conversationChange(); + this.commonConversation = true; + this.conversitionMemberList = this.commonMemberList; + this.messageList = this.commonMessageList; + }, + cancelCommonConversation() { + this.commonConversation && this.$refs.chatContent && this.$refs.chatContent.conversationChange(); + this.commonConversation = false; + this.conversitionMemberList = this.privateMemberList; + this.messageList = this.privateMessageList; }, clearAllData() { this.recordSending = false; @@ -585,12 +618,6 @@ export default { this.conversitionMemberList = []; this.messageList = []; } - // goCommonConversation() { - // this.commonConversation = true; - // }, - // cancelCommonConversation() { - // this.commonConversation = false; - // } } }; diff --git a/src/views/newMap/jointTrainingNew/chatView/chatContent.vue b/src/views/newMap/jointTrainingNew/chatView/chatContent.vue index e19195685..05fbe494f 100644 --- a/src/views/newMap/jointTrainingNew/chatView/chatContent.vue +++ b/src/views/newMap/jointTrainingNew/chatView/chatContent.vue @@ -93,37 +93,13 @@ export default { // this.inintData(); }, methods:{ - inintData() { - // if (this.coversition.id) { - // getSimulationContextListNew(this.$route.query.group, this.coversition.id).then(res=>{ - // const userId = this.$store.state.user.id; - // const coversitionList = res.data.map(coversition=>{ - // coversition.self = false; - // if (coversition.member.userId == userId) { - // coversition.self = true; - // } - // coversition.src = coversition.isAudio ? `/audio/${coversition.audioPath}` : ''; - // coversition.targetUser = coversition.targetMember ? coversition.targetMember : 'All'; - // return coversition; - // }); - // this.chatContentList = coversitionList; - // this.scrollTop(); - // }); - // } - // const coversitionListAll = Object.assign({}, this.$store.state.socket.coversitionList); - // const coversitionList = coversitionListAll[this.coversition.id] || []; - // // console.log('inintData---coversitionList' + JSON.stringify(this.$store.state.socket.coversitionList[this.coversition.id])); - // this.chatContentList = coversitionList; - }, scrollTop() { this.$nextTick(function() { const scrollTop = document.querySelector('.chatcontentInner').offsetHeight - document.querySelector('.chatcontentIn').offsetHeight + 30; document.querySelector('.chatcontentIn').scrollTop = scrollTop; }); }, - // formatTime(time) { - // return /\d{2}:\d{2}:\d{2}/.exec(time)[0] || time; - // }, + playAllAudio() { this.playEachAudio(this.currentAudioList[this.currentAudioIndex]); }, @@ -171,6 +147,9 @@ export default { playAudio(audioUrl) { document.querySelector('#audioPlay').src = audioUrl; document.querySelector('#audioPlay').play(); + }, + conversationChange() { + } } }; diff --git a/src/views/system/commandDictionary/copyParam.vue b/src/views/system/commandDictionary/copyParam.vue index e03741a6e..4f3490760 100644 --- a/src/views/system/commandDictionary/copyParam.vue +++ b/src/views/system/commandDictionary/copyParam.vue @@ -27,22 +27,12 @@ export default { fromName: '', targetIds: '', deviceType: [] - }, - deviceTypeList: [], - targetList: [], - lineCode: '' + }, + deviceTypeList: [], + targetList: [], + lineCode: '' }; - }, - watch: { - taskStatusList(list) { - this.targetList = []; - list.forEach(item => { - if (item.value != this.lineCode) { - this.targetList.push(item); - } - }) - } - }, + }, computed: { form() { const form = { @@ -65,19 +55,29 @@ export default { ] }; } - }, - created() { - this.deviceTypeList = []; - this.$ConstSelect.deviceTypeList.forEach(item => { - this.deviceTypeList.push(item); - }) - }, + }, + watch: { + taskStatusList(list) { + this.targetList = []; + list.forEach(item => { + if (item.value != this.lineCode) { + this.targetList.push(item); + } + }); + } + }, + created() { + this.deviceTypeList = []; + this.$ConstSelect.deviceTypeList.forEach(item => { + this.deviceTypeList.push(item); + }); + }, methods: { doShow(lineCode) { this.dialogVisible = true; if (lineCode) { - this.lineCode = lineCode; - this.targetList = []; + this.lineCode = lineCode; + this.targetList = []; this.taskStatusList.forEach(item => { item.value = item.code; item.label = item.name; @@ -91,7 +91,6 @@ export default { } }, doSave() { - const self = this; this.$refs.dataform.validateForm(() => { const param = { fromLineCode: this.formModel.fromCode, diff --git a/src/views/system/commandDictionary/index.vue b/src/views/system/commandDictionary/index.vue index 25532adcb..b164868ba 100644 --- a/src/views/system/commandDictionary/index.vue +++ b/src/views/system/commandDictionary/index.vue @@ -2,7 +2,7 @@
- +
@@ -16,8 +16,8 @@ import CopyParam from './copyParam'; export default { name: 'CommandDictionary', components: { - ShowCondition, - CopyParam + ShowCondition, + CopyParam }, data() { return { @@ -26,8 +26,8 @@ export default { pagerConfig: { pageSize: 'pageSize', pageIndex: 'pageNum' - }, - lineCode: '', + }, + lineCode: '', queryForm: { labelWidth: '80px', reset: true, @@ -122,8 +122,8 @@ export default { } ], actions: [ - { text: this.$t('global.add'), handler: this.handleAdd }, - { text: '复刻', handler: this.handleCopyAll } + { text: this.$t('global.add'), handler: this.handleAdd }, + { text: '复刻', handler: this.handleCopyAll } ] }, @@ -155,8 +155,8 @@ export default { queryFunction(params) { if (!params['lineCode']) { params['lineCode'] = ''; - } - this.lineCode = params['lineCode']; + } + this.lineCode = params['lineCode']; return getCommandList(params); }, replace(fieldValue) { @@ -211,11 +211,11 @@ export default { this.$message.error('复制指令失败!'); }); }); - }, - // 复制线路到其他线路 操作 - handleCopyAll() { - this.$refs.copyParam.doShow(this.lineCode); - }, + }, + // 复制线路到其他线路 操作 + handleCopyAll() { + this.$refs.copyParam.doShow(this.lineCode); + }, reloadTable() { this.queryList.reload(); } diff --git a/src/views/system/deviceManage/editConfigGateway.vue b/src/views/system/deviceManage/editConfigGateway.vue index 4374acfc5..3a6c212ff 100644 --- a/src/views/system/deviceManage/editConfigGateway.vue +++ b/src/views/system/deviceManage/editConfigGateway.vue @@ -1,6 +1,48 @@