2020-05-28 13:21:51 +08:00
|
|
|
<template>
|
|
|
|
<div v-show="dialogVisible" class="chat-create-group">
|
|
|
|
<div class="create-group-header">
|
|
|
|
<div class="create-group-title">添加会话对象</div>
|
|
|
|
<div class="create-group-close">
|
|
|
|
<i class="el-icon-close" @click="dialogVisible=false" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="create-group-content">
|
|
|
|
<div class="chat-member-list">
|
|
|
|
<el-checkbox-group v-model="checkList">
|
|
|
|
<el-checkbox
|
|
|
|
v-for="member in memberList"
|
|
|
|
:key="member.id"
|
|
|
|
class="each-chat-member"
|
|
|
|
:label="member"
|
|
|
|
:disabled="member.userId === userId"
|
|
|
|
>{{ member.memberName }}</el-checkbox>
|
|
|
|
</el-checkbox-group>
|
|
|
|
</div>
|
|
|
|
<div class="currentSelectList">
|
|
|
|
<div
|
|
|
|
v-for="member in checkList"
|
|
|
|
:key="member.id"
|
|
|
|
class="eachSelect"
|
|
|
|
>
|
|
|
|
{{ member.memberName }}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- :style="member.userId === userId ?'color:red':''" -->
|
|
|
|
</div>
|
|
|
|
<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>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import {getSimulationMembersNew, getSimulationConversationIdNew} from '@/api/chat';
|
|
|
|
import ConstConfig from '@/scripts/ConstConfig';
|
|
|
|
import Cookies from 'js-cookie';
|
|
|
|
export default {
|
|
|
|
name:'ChatCreateGroup',
|
|
|
|
props: {
|
|
|
|
group: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
dialogVisible:false,
|
|
|
|
loading:false,
|
|
|
|
memberList:[],
|
|
|
|
checkList:[]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed:{
|
|
|
|
userId() {
|
|
|
|
return this.$store.state.user.id;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods:{
|
|
|
|
doShow() {
|
|
|
|
this.getSimulationMembers();
|
|
|
|
this.dialogVisible = true;
|
|
|
|
},
|
|
|
|
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);
|
|
|
|
lastData = lastData.filter(memberIn=>{ return memberIn.role != '观众'; });
|
|
|
|
lastData.map(member=>{
|
|
|
|
const deviceName = member.deviceName ? '-' + member.deviceName : '';
|
|
|
|
const memberName = member.name ? '-' + member.name : '';
|
|
|
|
member.memberName = member.role + deviceName + memberName;
|
|
|
|
return member;
|
|
|
|
});
|
|
|
|
this.memberList = lastData;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
doCreate() {
|
|
|
|
if (this.checkList.length > 0) {
|
|
|
|
this.loading = true;
|
|
|
|
const checkList = this.checkList.map(function(check) { return check.id; });
|
|
|
|
getSimulationConversationIdNew(checkList, this.group).then(resp => {
|
|
|
|
if (resp.data) {
|
|
|
|
const data = resp.data;
|
|
|
|
this.loading = false;
|
|
|
|
this.$emit('addCoversition', {data:data, headerTitle:resp.data.name});
|
|
|
|
this.dialogVisible = false;
|
|
|
|
this.checkList = [];
|
|
|
|
}
|
|
|
|
}).catch(error=>{
|
2020-05-29 16:56:02 +08:00
|
|
|
this.$messageBox('创建会话失败: ' + error.message);
|
2020-05-28 13:21:51 +08:00
|
|
|
this.loading = false;
|
|
|
|
this.dialogVisible = false;
|
|
|
|
this.checkList = [];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
doClose() {
|
|
|
|
this.checkList = [];
|
|
|
|
this.dialogVisible = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.chat-create-group{
|
|
|
|
position: absolute;
|
|
|
|
width: 70%;
|
|
|
|
height: 300px;
|
|
|
|
border: 1px #dedede solid;
|
|
|
|
left: 26%;
|
|
|
|
top: 8%;
|
|
|
|
z-index: 7;
|
|
|
|
border-radius: 8px;
|
|
|
|
box-shadow: #b5aeae 0 0 10px;
|
|
|
|
background: #fff;
|
|
|
|
}
|
|
|
|
.create-group-header{
|
|
|
|
padding-left: 10px;
|
|
|
|
padding-top: 6px;
|
|
|
|
font-size: 14px;
|
|
|
|
border-bottom: 1px #dedede solid;
|
|
|
|
padding-bottom: 6px;
|
|
|
|
}
|
|
|
|
.create-group-title{
|
|
|
|
display: inline-block;
|
|
|
|
}
|
|
|
|
.create-group-close{
|
|
|
|
float: right;
|
|
|
|
display: inline-block;
|
|
|
|
margin-right: 5px;
|
|
|
|
font-size: 16px;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
.chat-member-list{
|
|
|
|
width: 54%;
|
|
|
|
height: 216px;
|
|
|
|
overflow-y: auto;
|
|
|
|
padding: 5px 10px;
|
|
|
|
font-size: 14px;
|
|
|
|
overflow-x: hidden;
|
|
|
|
border-right: 1px #ccc solid;
|
|
|
|
display:inline-block;
|
|
|
|
}
|
|
|
|
.create-group-content{
|
|
|
|
width: 100%;
|
|
|
|
height: 220px;
|
|
|
|
padding-bottom: 10px;
|
|
|
|
border-bottom: 1px #dedede solid;
|
|
|
|
}
|
|
|
|
.create-group-bottom{
|
|
|
|
text-align: center;
|
|
|
|
margin-top:8px;
|
|
|
|
}
|
|
|
|
.each-chat-member{
|
|
|
|
display:block;
|
|
|
|
margin-top:5px;
|
|
|
|
}
|
|
|
|
.currentSelectList{
|
|
|
|
display: inline-block;
|
|
|
|
width: 44%;
|
|
|
|
font-size: 14px;
|
|
|
|
vertical-align: top;
|
|
|
|
padding: 5px 10px;
|
|
|
|
overflow-x: hidden;
|
|
|
|
overflow-y: auto;
|
|
|
|
height: 216px;
|
|
|
|
}
|
|
|
|
.eachSelect{
|
|
|
|
display:block;
|
|
|
|
margin-top:5px;
|
|
|
|
}
|
|
|
|
// 谷歌、safari、qq浏览器、360浏览器滚动条样式
|
|
|
|
// 定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸
|
|
|
|
.chat-member-list::-webkit-scrollbar,.currentSelectList::-webkit-scrollbar {
|
|
|
|
width: 6px;
|
|
|
|
height: 6px;
|
|
|
|
// height: 110px;
|
|
|
|
background-color: #FFFFFF;
|
|
|
|
}
|
|
|
|
/*定义滚动条轨道 内阴影+圆角*/
|
|
|
|
.chat-member-list::-webkit-scrollbar-track,.currentSelectList::-webkit-scrollbar-track{
|
|
|
|
// box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
|
|
|
|
border-radius: 10px;
|
|
|
|
background-color: #FFFFFF;;
|
|
|
|
}
|
|
|
|
/*定义滑块 内阴影+圆角*/
|
|
|
|
.chat-member-list::-webkit-scrollbar-thumb,.currentSelectList::-webkit-scrollbar-thumb{
|
|
|
|
border-radius: 10px;
|
|
|
|
// box-shadow: inset 0 0 6px rgba(0,0,0,.3);
|
|
|
|
background-color: #cacaca;
|
|
|
|
}
|
|
|
|
/*滑块效果*/
|
|
|
|
.chat-member-list::-webkit-scrollbar-thumb:hover,.currentSelectList::-webkit-scrollbar-thumb:hover {
|
|
|
|
border-radius: 5px;
|
|
|
|
// box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
|
|
|
|
background: rgba(0,0,0,0.4);
|
|
|
|
}
|
|
|
|
/*IE滚动条颜色*/
|
|
|
|
html {
|
|
|
|
scrollbar-face-color:#bfbfbf;/*滚动条颜色*/
|
|
|
|
scrollbar-highlight-color:#000;
|
|
|
|
scrollbar-3dlight-color:#000;
|
|
|
|
scrollbar-darkshadow-color:#000;
|
|
|
|
scrollbar-Shadow-color:#adadad;/*滑块边色*/
|
|
|
|
scrollbar-arrow-color:rgba(0,0,0,0.4);/*箭头颜色*/
|
|
|
|
scrollbar-track-color:#eeeeee;/*背景颜色*/
|
|
|
|
}
|
|
|
|
</style>
|