This commit is contained in:
fan 2020-07-15 18:36:58 +08:00
commit 24197cba1a
2 changed files with 79 additions and 34 deletions

View File

@ -21,20 +21,19 @@
</div> </div>
</div> </div>
<div v-if="isShow" class="chat-box-content"> <div v-if="isShow" class="chat-box-content">
<!-- :filter-node-method="filterNode" -->
<el-tree <el-tree
ref="tree" ref="tree"
:data="treeData" :data="treeData"
:props="defaultProps" :props="defaultProps"
node-key="id" node-key="id"
default-expand-all default-expand-all
:filter-node-method="filterNode"
show-checkbox show-checkbox
style="margin: 10px;overflow-y: auto;height: 100%;margin-right: 0;" style="margin: 10px;overflow-y: auto;height: 100%;margin-right: 0;"
@check-change="handleCheckChange" @check-change="handleCheckChange"
> >
<span :id="data.id" slot-scope="{ node, data }"> <span :id="data.id" slot-scope="{ node, data }">
<span v-if="data.type=='role'" style="font-size: 14px">{{ data.label }}</span> <span style="font-size: 14px">{{ data.label }}</span>
<span v-else style="font-size: 14px">{{ data.memberName }}</span>
</span> </span>
</el-tree> </el-tree>
</div> </div>
@ -52,9 +51,12 @@
<chat-member-list ref="chatMemberList" :user-role="userRole" :current-member-list="currentMemberList" /> <chat-member-list ref="chatMemberList" :user-role="userRole" :current-member-list="currentMemberList" />
</div> </div>
<div class="chat-box-footer"> <div class="chat-box-footer">
<div class="chat-box-footer-tool" /> <div v-if="isShow">
<el-button v-if="isShow" :loading="loading" size="mini" type="primary" class="chat-box-footer-send" @click="doCreate">创建群聊</el-button> <div class="userString">{{ userString }}</div>
<el-button :loading="loading" size="mini" type="primary" class="chat-box-create-coversite" @click="doCreate">创建群聊</el-button>
</div>
<div v-else> <div v-else>
<div class="chat-box-footer-tool" />
<el-button v-if="isButtonShow&&isCreate" size="mini" type="danger" class="chat-box-footer-quit" :loading="loading" @click="quitCoversition()">退出群聊</el-button> <el-button v-if="isButtonShow&&isCreate" size="mini" type="danger" class="chat-box-footer-quit" :loading="loading" @click="quitCoversition()">退出群聊</el-button>
<el-button v-if="memberListCoversition.all||isButtonShow" class="chat-box-footer-send" size="mini" type="primary" :disabled="recordSending" @click="startRecording()">发送语音</el-button> <el-button v-if="memberListCoversition.all||isButtonShow" class="chat-box-footer-send" size="mini" type="primary" :disabled="recordSending" @click="startRecording()">发送语音</el-button>
<div v-if="scriptTip" class="scriptTip">{{ scriptTip }}</div> <div v-if="scriptTip" class="scriptTip">{{ scriptTip }}</div>
@ -82,7 +84,7 @@ import ChatContent from './chatContent';
import ChatMemberList from './chatMemberList'; import ChatMemberList from './chatMemberList';
import ChatTooltip from './chatTooltip'; import ChatTooltip from './chatTooltip';
import RecordRTC from 'recordrtc'; import RecordRTC from 'recordrtc';
import {sendSimulationConversition, overSimulationConversition, getAllConversition, getSimulationConversition} from '@/api/chat'; import {sendSimulationConversition, overSimulationConversition, getAllConversition, getSimulationConversition, startConversition} from '@/api/chat';
import ConstConfig from '@/scripts/ConstConfig'; import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
export default { export default {
@ -110,7 +112,10 @@ export default {
bottom:15, bottom:15,
recordSending:false, recordSending:false,
memberList:[], memberList:[],
treeData:[],
memberIdList: [],
queryMember: '', queryMember: '',
userString:'',
currentMemberList:[], currentMemberList:[],
chatContentList:[], chatContentList:[],
memberListCoversition:{}, memberListCoversition:{},
@ -168,6 +173,11 @@ export default {
this.bottom = this.bottom + object.offsetHeight + objectBottom; this.bottom = this.bottom + object.offsetHeight + objectBottom;
} }
}, },
queryMember(val) {
if (this.$refs.tree) {
this.$refs.tree.filter(val);
}
},
'userRole':function(val) { 'userRole':function(val) {
this.isHasCoversition = false; this.isHasCoversition = false;
// //
@ -259,26 +269,29 @@ export default {
member.memberName = member.type + device.groupNumber + name; member.memberName = member.type + device.groupNumber + name;
if (activeList.length > 0 && activeList.includes(device.groupNumber)) { if (activeList.length > 0 && activeList.includes(device.groupNumber)) {
lastMemberList.push(member); lastMemberList.push(member);
member.label = member.memberName;
driverList.push(member); driverList.push(member);
} }
} else { } else {
if (device._type == 'Station') {
stationSupervisorList.push(member);
}
member.memberName = member.type + device.name + name; member.memberName = member.type + device.name + name;
lastMemberList.push(member); lastMemberList.push(member);
if (device._type == 'Station') {
member.label = member.memberName;
stationSupervisorList.push(member);
}
} }
} else { } else {
member.memberName = member.type + member.deviceCode + name; member.memberName = member.type + member.deviceCode + name;
lastMemberList.push(member); lastMemberList.push(member);
} }
} else { } else {
member.memberName = member.type + name;
member.label = member.memberName;
if (member.type == '行调') { if (member.type == '行调') {
dispatcherList.push(member); dispatcherList.push(member);
} else if (member.type == '通号') { } else if (member.type == '通号') {
maintainerList.push(member); maintainerList.push(member);
} }
member.memberName = member.type + name;
lastMemberList.push(member); lastMemberList.push(member);
} }
} }
@ -286,25 +299,21 @@ export default {
this.treeData = [{ this.treeData = [{
label: '行调', label: '行调',
id: 'dispatcher', id: 'dispatcher',
disabled: dispatcherList.length <= 0,
type: 'role', type: 'role',
children: dispatcherList children: dispatcherList
}, { }, {
label: '车站值班员', label: '车站值班员',
id: 'stationSupervisor', id: 'stationSupervisor',
disabled: stationSupervisorList.length <= 0,
type: 'role', type: 'role',
children: stationSupervisorList children: stationSupervisorList
}, { }, {
label: '司机', label: '司机',
id: 'driver', id: 'driver',
disabled: driverList.length <= 0,
type: 'role', type: 'role',
children: driverList children: driverList
}, { }, {
label: '通号', label: '通号',
id: 'maintainer', id: 'maintainer',
disabled: maintainerList.length <= 0,
type: 'role', type: 'role',
children: maintainerList children: maintainerList
}]; }];
@ -312,24 +321,39 @@ export default {
this.getAllConversition(); this.getAllConversition();
}, },
doCreate() { doCreate() {
if (this.memberIdList.length > 0) {
this.loading = true;
startConversition(this.group, this.memberIdList).then(resp => {
if (resp.data) {
const data = resp.data;
this.loading = false;
this.addCoversition({data:data, headerTitle:resp.data.name});
this.memberIdList = [];
this.userString = '';
}
}).catch(error=>{
this.$messageBox('创建会话失败: ' + error.message);
this.loading = false;
this.dialogVisible = false;
this.checkList = [];
});
}
},
filterNode(value, data) {
return data.label.indexOf(value) !== -1;
}, },
handleCheckChange() { handleCheckChange() {
const memberList = this.$refs.tree.getCheckedKeys(); const memberList = this.$refs.tree.getCheckedNodes();
this.userString = ''; this.userString = '';
this.memberIdList = []; this.memberIdList = [];
// if (memberList && memberList.length) { if (memberList && memberList.length) {
// memberList.forEach(memberId => { memberList.forEach(member => {
// const member = this.memberData[memberId]; if (member && !(member.children) && (member.userId == '' || member.userId)) {
// if (member && member.userId) { this.userString += member.memberName + ',';
// this.memberIdList.push(member.id); this.memberIdList.push(member.id);
// this.userString += ((this.userString ? ',' : '') + member.label + '(' + this.simulationUsers[member.userId].nickName + ')'); }
// } else if (member) { });
// this.userString += ((this.userString ? ',' : '') + member.label); }
// this.memberIdList.push(member.id);
// }
// });
// }
}, },
getAllConversition() { getAllConversition() {
if (this.recordSending) { if (this.recordSending) {
@ -591,10 +615,11 @@ export default {
} }
.chatcontentInner{ .chatcontentInner{
height: 100%; height: 100%;
width: 380px; width: 362px;
display: inline-block; display: inline-block;
overflow: auto; overflow: auto;
cursor: auto; cursor: auto;
position: relative;
} }
.chat-box-footer{ .chat-box-footer{
@ -623,7 +648,7 @@ export default {
} }
.chat-box-footer-tool{ .chat-box-footer-tool{
width: 100%; width: 100%;
height: 18px; height: 30px;
} }
.chat-box-footer-send{ .chat-box-footer-send{
font-size: 12px; font-size: 12px;
@ -634,6 +659,14 @@ export default {
cursor: pointer; cursor: pointer;
padding: 5px 15px; padding: 5px 15px;
} }
.chat-box-create-coversite{
font-size: 12px;
float: right;
margin-right: 10px;
margin-top: 18px;
cursor: pointer;
padding: 5px 15px;
}
.minimality { .minimality {
float: right; float: right;
line-height: 40px; line-height: 40px;
@ -687,6 +720,19 @@ export default {
bottom: -7px; bottom: -7px;
} }
.userString{
height: 50px;
width: 409px;
position: absolute;
left: 0;
top: 0;
padding: 4px 5px;
overflow-x: auto;
font-size: 13px;
line-height: 135%;
resize: none;
}
.showMembers{ .showMembers{
float: right; float: right;
line-height: 40px; line-height: 40px;

View File

@ -51,16 +51,15 @@ export default {
height: 100%; height: 100%;
background: #fff; background: #fff;
border-left: 1px #dedede solid; border-left: 1px #dedede solid;
z-index: 2; padding: 12px 2px 10px 10px;
padding: 12px 2px 10px 16px;
font-size: 14px; font-size: 14px;
} }
.chat-member-title{ .chat-member-title{
} }
.chat-member-list{ .chat-member-list{
margin-top: 13px; margin-top: 10px;
font-size: 12px; font-size: 12px;
margin-left: 2px; margin-left: 0px;
height: 350px; height: 350px;
overflow-y: auto; overflow-y: auto;
} }