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 v-if="isShow" class="chat-box-content">
<!-- :filter-node-method="filterNode" -->
<el-tree
ref="tree"
:data="treeData"
:props="defaultProps"
node-key="id"
default-expand-all
:filter-node-method="filterNode"
show-checkbox
style="margin: 10px;overflow-y: auto;height: 100%;margin-right: 0;"
@check-change="handleCheckChange"
>
<span :id="data.id" slot-scope="{ node, data }">
<span v-if="data.type=='role'" style="font-size: 14px">{{ data.label }}</span>
<span v-else style="font-size: 14px">{{ data.memberName }}</span>
<span style="font-size: 14px">{{ data.label }}</span>
</span>
</el-tree>
</div>
@ -52,9 +51,12 @@
<chat-member-list ref="chatMemberList" :user-role="userRole" :current-member-list="currentMemberList" />
</div>
<div class="chat-box-footer">
<div class="chat-box-footer-tool" />
<el-button v-if="isShow" :loading="loading" size="mini" type="primary" class="chat-box-footer-send" @click="doCreate">创建群聊</el-button>
<div v-if="isShow">
<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 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="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>
@ -82,7 +84,7 @@ import ChatContent from './chatContent';
import ChatMemberList from './chatMemberList';
import ChatTooltip from './chatTooltip';
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 Cookies from 'js-cookie';
export default {
@ -110,7 +112,10 @@ export default {
bottom:15,
recordSending:false,
memberList:[],
treeData:[],
memberIdList: [],
queryMember: '',
userString:'',
currentMemberList:[],
chatContentList:[],
memberListCoversition:{},
@ -168,6 +173,11 @@ export default {
this.bottom = this.bottom + object.offsetHeight + objectBottom;
}
},
queryMember(val) {
if (this.$refs.tree) {
this.$refs.tree.filter(val);
}
},
'userRole':function(val) {
this.isHasCoversition = false;
//
@ -259,26 +269,29 @@ export default {
member.memberName = member.type + device.groupNumber + name;
if (activeList.length > 0 && activeList.includes(device.groupNumber)) {
lastMemberList.push(member);
member.label = member.memberName;
driverList.push(member);
}
} else {
if (device._type == 'Station') {
stationSupervisorList.push(member);
}
member.memberName = member.type + device.name + name;
lastMemberList.push(member);
if (device._type == 'Station') {
member.label = member.memberName;
stationSupervisorList.push(member);
}
}
} else {
member.memberName = member.type + member.deviceCode + name;
lastMemberList.push(member);
}
} else {
member.memberName = member.type + name;
member.label = member.memberName;
if (member.type == '行调') {
dispatcherList.push(member);
} else if (member.type == '通号') {
maintainerList.push(member);
}
member.memberName = member.type + name;
lastMemberList.push(member);
}
}
@ -286,25 +299,21 @@ export default {
this.treeData = [{
label: '行调',
id: 'dispatcher',
disabled: dispatcherList.length <= 0,
type: 'role',
children: dispatcherList
}, {
label: '车站值班员',
id: 'stationSupervisor',
disabled: stationSupervisorList.length <= 0,
type: 'role',
children: stationSupervisorList
}, {
label: '司机',
id: 'driver',
disabled: driverList.length <= 0,
type: 'role',
children: driverList
}, {
label: '通号',
id: 'maintainer',
disabled: maintainerList.length <= 0,
type: 'role',
children: maintainerList
}];
@ -312,24 +321,39 @@ export default {
this.getAllConversition();
},
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() {
const memberList = this.$refs.tree.getCheckedKeys();
const memberList = this.$refs.tree.getCheckedNodes();
this.userString = '';
this.memberIdList = [];
// if (memberList && memberList.length) {
// memberList.forEach(memberId => {
// const member = this.memberData[memberId];
// if (member && member.userId) {
// 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);
// }
// });
// }
if (memberList && memberList.length) {
memberList.forEach(member => {
if (member && !(member.children) && (member.userId == '' || member.userId)) {
this.userString += member.memberName + ',';
this.memberIdList.push(member.id);
}
});
}
},
getAllConversition() {
if (this.recordSending) {
@ -591,10 +615,11 @@ export default {
}
.chatcontentInner{
height: 100%;
width: 380px;
width: 362px;
display: inline-block;
overflow: auto;
cursor: auto;
position: relative;
}
.chat-box-footer{
@ -623,7 +648,7 @@ export default {
}
.chat-box-footer-tool{
width: 100%;
height: 18px;
height: 30px;
}
.chat-box-footer-send{
font-size: 12px;
@ -634,6 +659,14 @@ export default {
cursor: pointer;
padding: 5px 15px;
}
.chat-box-create-coversite{
font-size: 12px;
float: right;
margin-right: 10px;
margin-top: 18px;
cursor: pointer;
padding: 5px 15px;
}
.minimality {
float: right;
line-height: 40px;
@ -687,6 +720,19 @@ export default {
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{
float: right;
line-height: 40px;

View File

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