This commit is contained in:
fan 2020-05-29 16:57:31 +08:00
commit 31dd88b426
13 changed files with 285 additions and 160 deletions

View File

@ -29,6 +29,9 @@ function handle(state, data) {
case 'Simulation_Script_Tip': // 仿真-聊天界面用户进出仿真消息
handleSimulationScriptTipInfo(state, msg); // 用户进出仿真消息
break;
case 'Simulation_Start_Conversation': // 综合演练仿真-聊天界面用户邀请其他人加入群聊
state.inviteOtherIntoChat = msg;
break;
case 'Competition_Practical': // 竞赛裁判系统裁判员开始考试推送消息
state.competitionStart++; // 竞赛裁判系统裁判员开始考试推送消息
break;
@ -213,7 +216,8 @@ const socket = {
simulationStart: '', // 仿真-开始消息
simulationOver:0, // 退出仿真推送消息
simulationReset: '', // 仿真-异常消息
simulationText: {}, // 仿真-用户交互消息(聊天/命令)
simulationText: {}, // 仿真-用户交互消息(聊天/命令),
inviteOtherIntoChat:{}, // 综合演练仿真-聊天界面用户邀请其他人加入群聊推送信息
// coversitionList:{}, // 历史仿真-用户消息列表
message: {}, // 仿真聊天

View File

@ -43,6 +43,7 @@
</div>
<chat-setting ref="chatSetting" :form="form" @setSetting="setSetting" />
<chat-create-group ref="createGroup" :group="group" @addCoversition="addCoversition" />
<chat-tooltip />
</div>
</template>
<script>
@ -51,6 +52,7 @@ import ChatContent from './chatContent';
import ChatMemberList from './chatMemberList';
import ChatCoversitionList from './chatCoversitionList';
import ChatCreateGroup from './chatCreateGroup';
import ChatTooltip from './chatTooltip';
import RecordRTC from 'recordrtc';
import {uploadAudioFileNew} from '@/api/chat';
export default {
@ -60,7 +62,8 @@ export default {
ChatContent,
ChatMemberList,
ChatCoversitionList,
ChatCreateGroup
ChatCreateGroup,
ChatTooltip
},
props: {
group: {

View File

@ -12,8 +12,8 @@
</div>
</template>
<script>
import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie';
// import ConstConfig from '@/scripts/ConstConfig';
// import Cookies from 'js-cookie';
import {getSimulationConversationListNew} from '@/api/chat';
export default {
name:'ChatCoversitionList',
@ -32,15 +32,15 @@ export default {
if (resp.data) {
const data = resp.data;
data.map(coversition=>{
if (coversition.name) {
// if (coversition.name) {
coversition.coverName = coversition.name;
coversition.isOnline = true;
} else {
const objectCover = this.handleMemberName(coversition);
coversition.coverName = objectCover.coversitionName;
coversition.isOnline = objectCover.isOnline;
}
// }
// else {
// const objectCover = this.handleMemberName(coversition);
// coversition.coverName = objectCover.coversitionName;
// coversition.isOnline = objectCover.isOnline;
// }
return coversition;
});
this.coversitionList = data;
@ -54,14 +54,15 @@ export default {
addCoversition(data) {
const index = this.coversitionList.findIndex(item=>{ return item.id == data.id; });
if (index < 0) {
const objectCover = this.handleMemberName(data);
if (data.name) {
// const objectCover = this.handleMemberName(data);
// if (data.name) {
data.coverName = data.name;
data.isOnline = true;
} else {
data.coverName = objectCover.coversitionName;
data.isOnline = objectCover.isOnline;
}
// }
// else {
// data.coverName = objectCover.coversitionName;
// data.isOnline = objectCover.isOnline;
// }
this.coversitionList.push(data);
this.currentCoversition = data;
@ -74,62 +75,64 @@ export default {
// this.$refs.chatContent.reloadData(this.currentCoversition);
},
changeCoversitionOther(coversition) {
const objectCover = this.handleMemberName(coversition);
coversition.coverName = objectCover.coversitionName;
coversition.isOnline = objectCover.isOnline;
// const objectCover = this.handleMemberName(coversition);
// coversition.coverName = objectCover.coversitionName;
// coversition.isOnline = objectCover.isOnline;
coversition.coverName = coversition.name;
coversition.isOnline = true;
const index = this.coversitionList.findIndex(item=>{ return item.id == coversition.id; });
if (index < 0) {
this.coversitionList.push(coversition);
}
this.changeCoversition(coversition);
},
handleMemberName(conversition) {
if (conversition.all) {
return {coversitionName:conversition.name, isOnline:true};
} else {
let coversitionName = '';
let isOnline = true;
if (conversition.memberList) {
conversition.memberList.forEach(member=>{
if (member.userId != this.$store.state.user.id) {
const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
let data = member.role;
roleTypeList.forEach(function(element) {
const rolename = element.value;
if (Cookies.get('user_lang') == 'en') {
data = data.replace(rolename, element.enLabel);
} else {
data = data.replace(rolename, element.label);
}
});
const deviceName = member.deviceName ? '-' + member.deviceName : '';
const memberName = member.name ? '-' + member.name : '';
isOnline = member.online;
coversitionName = data + deviceName + memberName;
}
});
} else if (conversition.member) {
const member = conversition.member;
let data = member.role;
const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
roleTypeList.forEach(function(element) {
const rolename = element.value;
if (Cookies.get('user_lang') == 'en') {
data = data.replace(rolename, element.enLabel);
} else {
data = data.replace(rolename, element.label);
}
});
const deviceName = member.deviceName ? '-' + member.deviceName : '';
const memberName = member.name ? '-' + member.name : '';
isOnline = member.online;
coversitionName = data + deviceName + memberName;
} else {
coversitionName = conversition.name;
}
return {coversitionName:coversitionName, isOnline:isOnline};
}
}
// handleMemberName(conversition) {
// if (conversition.all) {
// return {coversitionName:conversition.name, isOnline:true};
// } else {
// let coversitionName = '';
// let isOnline = true;
// if (conversition.memberList) {
// conversition.memberList.forEach(member=>{
// if (member.userId != this.$store.state.user.id) {
// const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
// let data = member.role;
// roleTypeList.forEach(function(element) {
// const rolename = element.value;
// if (Cookies.get('user_lang') == 'en') {
// data = data.replace(rolename, element.enLabel);
// } else {
// data = data.replace(rolename, element.label);
// }
// });
// const deviceName = member.deviceName ? '-' + member.deviceName : '';
// const memberName = member.name ? '-' + member.name : '';
// isOnline = member.online;
// coversitionName = data + deviceName + memberName;
// }
// });
// } else if (conversition.member) {
// const member = conversition.member;
// let data = member.role;
// const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
// roleTypeList.forEach(function(element) {
// const rolename = element.value;
// if (Cookies.get('user_lang') == 'en') {
// data = data.replace(rolename, element.enLabel);
// } else {
// data = data.replace(rolename, element.label);
// }
// });
// const deviceName = member.deviceName ? '-' + member.deviceName : '';
// const memberName = member.name ? '-' + member.name : '';
// isOnline = member.online;
// coversitionName = data + deviceName + memberName;
// } else {
// coversitionName = conversition.name;
// }
// return {coversitionName:coversitionName, isOnline:isOnline};
// }
// }
}
};
</script>

View File

@ -1,5 +1,6 @@
<template>
<div v-show="dialogVisible" class="chat-create-group">
<div v-show="dialogVisible" class="chat-create-group-all">
<div class="chat-create-group">
<div class="create-group-header">
<div class="create-group-title">添加会话对象</div>
<div class="create-group-close">
@ -35,6 +36,7 @@
<el-button size="small" @click="doClose">取消</el-button>
</div>
</div>
</div>
</template>
<script>
import {getSimulationMembersNew, getSimulationConversationIdNew} from '@/api/chat';
@ -102,7 +104,7 @@ export default {
this.checkList = [];
}
}).catch(error=>{
this.$messageBox('创建会话失败: ' + error.messagfe);
this.$messageBox('创建会话失败: ' + error.message);
this.loading = false;
this.dialogVisible = false;
this.checkList = [];
@ -118,6 +120,14 @@ export default {
};
</script>
<style lang="scss" scoped>
.chat-create-group-all{
position:absolute;
width:100%;
height:100%;
left:0;
top:0;
z-index:10;
}
.chat-create-group{
position: absolute;
width: 70%;

View File

@ -0,0 +1,94 @@
<template>
<div v-show="dialogVisible" class="chatTooltipAll">
<div class="chatTooltip">
<div class="chatTooltipHeader">
{{ userName }} 邀请您加入会话
</div>
<div class="chatTooltipBootom">
<div class="create-group-bottom">
<el-button :loading="loading" size="small" type="primary" @click="doCreate">接受</el-button>
<el-button size="small" @click="doClose">拒绝</el-button>
</div>
</div>
</div>
</div>
</template>
<script>
import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie';
export default {
name:'ChatTooltip',
data() {
return {
userName:'',
dialogVisible:false,
loading:false
};
},
watch:{
'$store.state.socket.inviteOtherIntoChat':function(val) {
this.userName = this.coverName(val);
this.dialogVisible = true;
}
},
// {"conversationId":"22e10b17-7a6c-4b1b-8724-f87fb2053b76","from":{"id":"17","userId":"75","name":"",
// "role":"STATION_SUPERVISOR","deviceType":"STATION","deviceCode":"Station32955","deviceName":"","online":true,"robot":false}
methods:{
coverName(inviteUser) {
const member = inviteUser.from;
const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
let data = member.role;
roleTypeList.forEach(function(element) {
const rolename = element.value;
if (Cookies.get('user_lang') == 'en') {
data = data.replace(rolename, element.enLabel);
} else {
data = data.replace(rolename, element.label);
}
});
const deviceName = member.deviceName ? '-' + member.deviceName : '';
const memberName = member.name ? '-' + member.name : '';
return data + deviceName + memberName;
},
doCreate() {
},
doClose() {
this.dialogVisible = false;
}
}
};
</script>
<style lang="scss" scoped>
.chatTooltip{
position: absolute;
width: 290px;
left: 32%;
top: 42%;
z-index: 5;
background: #fff;
padding: 15px;
box-shadow: #969090 0px 0px 10px;
border-radius: 4px;
line-height: 20px;
transform: translateY(-50%);
}
.chatTooltipHeader{
margin-top:10px;
font-size:14px;
}
.chatTooltipBootom{
margin-top:10px;
text-align: center;
margin-bottom:10px;
}
.chatTooltipAll{
position:absolute;
width:100%;
height:100%;
left:0;
top:0;
z-index: 10;
}
</style>

View File

@ -26,7 +26,7 @@
<script>
import QrCode from '@/components/QrCode';
import ChatBox from './chatBox';
import ChatBox from './chatView/chatBox';
import SetTime from '@/views/newMap/displayNew/demon/setTime';
import { ranAsPlan, exitRunPlan } from '@/api/simulation';
import { exitFullscreen } from '@/utils/screen';

View File

@ -111,19 +111,20 @@ export default {
'stationStandList'
])
},
watch: {
signalList: function (val, old) {
const list = [];
if (val && val.length) {
for (let i = 0; i < val.length; i++) {
list.push({ label: val[i].uniqueName, value: val[i].code });
}
this.queryForm.queryObject.signalCode.config.data = list;
}
}
},
// watch: {
// signalList: function (val, old) {
// const list = [];
// if (val && val.length) {
// for (let i = 0; i < val.length; i++) {
// list.push({ label: val[i].uniqueName, value: val[i].code });
// }
// this.queryForm.queryObject.signalCode.config.data = list;
// }
// }
// },
mounted() {
this.acquireMapList();
this.initQueryObject();
},
methods: {
doShow() {
@ -133,6 +134,16 @@ export default {
doClose() {
this.show = false;
},
initQueryObject() {
const list = [];
const val = this.signalList;
if (val && val.length) {
for (let i = 0; i < val.length; i++) {
list.push({ label: val[i].uniqueName, value: val[i].code });
}
this.queryForm.queryObject.signalCode.config.data = list;
}
},
formatName(code) {
let name = '';
const device = this.$store.getters['map/getDeviceByCode'](code);

View File

@ -155,36 +155,35 @@ export default {
'stationList'
])
},
watch: {
stationList: function (val, old) {
const list = [];
if (val && val.length) {
val.forEach(elem => {
list.push({ label: this.formatName(elem.code), value: elem.code });
});
this.queryForm.queryObject.startStationCode.config.data = list;
this.queryForm.queryObject.endStationCode.config.data = list;
}
},
sectionList: function (val, old) {
const list = [];
if (val && val.length) {
val.forEach(elem => {
list.push({ label: this.formatName(elem.code), value: elem.code });
});
this.queryForm.queryObject.startSectionCode.config.data = list;
this.queryForm.queryObject.endSectionCode.config.data = list;
}
}
},
mounted() {
this.acquireMapList();
this.initQueryObject();
},
methods: {
doShow() {
this.show = true;
this.reloadTable();
},
initQueryObject() {
const stationList = [];
if (this.stationList && this.stationList.length) {
this.stationList.forEach(elem => {
stationList.push({ label: this.formatName(elem.code), value: elem.code });
});
this.queryForm.queryObject.startStationCode.config.data = stationList;
this.queryForm.queryObject.endStationCode.config.data = stationList;
}
const sectionList = [];
if (this.sectionList && this.sectionList.length) {
this.sectionList.forEach(elem => {
if (elem.standTrack || elem.reentryTrack || elem.transferTrack) {
sectionList.push({ label: this.formatName(elem.code), value: elem.code });
}
});
this.queryForm.queryObject.startSectionCode.config.data = sectionList;
this.queryForm.queryObject.endSectionCode.config.data = sectionList;
}
},
doClose() {
this.show = false;
},

View File

@ -158,26 +158,27 @@ export default {
'stationList'
])
},
watch: {
sectionList: function (val, old) {
const list = [];
if (val && val.length) {
val.forEach(elem => {
list.push({ label: `${elem.name}(${elem.code})`, value: elem.code });
});
this.queryForm.queryObject.startSectionCode.config.data = list;
this.queryForm.queryObject.endSectionCode.config.data = list;
}
}
},
mounted() {
this.acquireMapList();
this.initQueryObject();
},
methods: {
doShow() {
this.show = true;
this.reloadTable();
},
initQueryObject() {
const sectionList = [];
if (this.sectionList && this.sectionList.length) {
this.sectionList.forEach(elem => {
if (elem.standTrack || elem.reentryTrack || elem.transferTrack) {
sectionList.push({ label: this.formatName(elem.code), value: elem.code });
}
});
this.queryForm.queryObject.startSectionCode.config.data = sectionList;
this.queryForm.queryObject.endSectionCode.config.data = sectionList;
}
},
doClose() {
this.show = false;
},

View File

@ -105,19 +105,9 @@ export default {
'signalList'
])
},
watch: {
signalList: function (val, old) {
const list = [];
if (val && val.length) {
for (let i = 0; i < val.length; i++) {
list.push({ label: val[i].name + '(' + val[i].code + ')', value: val[i].code });
}
this.queryForm.queryObject.signalCode.config.data = list;
}
}
},
mounted() {
this.acquireMapList();
this.initQueryObject();
},
methods: {
doShow() {
@ -127,6 +117,16 @@ export default {
doClose() {
this.show = false;
},
initQueryObject() {
const list = [];
const val = this.signalList;
if (val && val.length) {
for (let i = 0; i < val.length; i++) {
list.push({ label: val[i].name + '(' + val[i].code + ')', value: val[i].code });
}
this.queryForm.queryObject.signalCode.config.data = list;
}
},
formatName(code) {
let name = '';
const device = this.$store.getters['map/getDeviceByCode'](code);