Commit ef8432c0 by Sixong.Zhu

批量接待

parent a5f82bc4
<template> <template>
<div class="chat-container" :class="{ 'is-in-page': isInPage }"> <div class="chat-container" :class="{ 'is-in-page': isInPage }">
<div class="search-wrap" v-if="!modelName">
<el-input
class="keyword-input"
placeholder="会话标题"
prefix-icon="el-icon-search"
v-model="searchKeyword"
v-on:keyup.enter.native="search"
clearable
@clear="search"
></el-input>
<i
v-if="!isInPage"
class="close-btn el-icon-close"
@click="$emit('close')"
></i>
</div>
<chat-list <chat-list
v-if="!modelName" v-if="!modelName"
ref="chatListComp" ref="chatListComp"
@list-count-update="$emit('list-count-update', $event)" @list-count-update="$emit('list-count-update', $event)"
/> >
<div class="search-wrap" v-if="!modelName">
<el-input
class="keyword-input"
placeholder="会话标题"
prefix-icon="el-icon-search"
v-model="searchKeyword"
v-on:keyup.enter.native="search"
clearable
@clear="search"
></el-input>
<i
v-if="!isInPage"
class="close-btn el-icon-close"
@click="$emit('close')"
></i>
</div>
</chat-list>
<chat-list-model <chat-list-model
v-if="modelName" v-if="modelName"
@list-count-update="$emit('list-count-update', $event)" @list-count-update="$emit('list-count-update', $event)"
...@@ -101,7 +102,6 @@ export default class ChatContainer extends Vue { ...@@ -101,7 +102,6 @@ export default class ChatContainer extends Vue {
} }
} }
.keyword-input { .keyword-input {
width: 300px;
margin: 15px 0 14px 20px; margin: 15px 0 14px 20px;
/deep/ .el-input__inner { /deep/ .el-input__inner {
font-size: 13px; font-size: 13px;
...@@ -118,7 +118,6 @@ export default class ChatContainer extends Vue { ...@@ -118,7 +118,6 @@ export default class ChatContainer extends Vue {
} }
} }
.search-wrap { .search-wrap {
height: 59px;
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
} }
.close-btn { .close-btn {
......
...@@ -66,21 +66,34 @@ ...@@ -66,21 +66,34 @@
无接待 无接待
</div> </div>
</el-scrollbar> </el-scrollbar>
<el-pagination <div class="d-flex align-items-center justify-content-center">
class="page-comp" <el-pagination
background class="page-comp"
small small
@size-change="handleSizeChange" @size-change="handleSizeChange"
:page-size="pageSize" :page-size="pageSize"
:total="total" :total="total"
:current-page.sync="currentPage" :current-page.sync="currentPage"
@current-change="getList" @current-change="getList"
:page-sizes="[10, 20, 50]" :page-sizes="[10, 20, 50]"
:pager-count="5" :pager-count="5"
layout="total, prev, pager, next" layout="total, prev, pager, next"
></el-pagination> ></el-pagination>
<i
title="刷新"
class="refresh-icon"
@click="getList"
:class="
refreshing ? 'el-icon-loading' : 'el-icon-refresh'
"
></i>
</div>
<div class="action-row"> <div class="action-row">
<el-button @click="getList">刷新</el-button> <el-button v-if="showItemCheckbox" @click="toggle"
>全选</el-button
>
<el-button <el-button
v-if="!showItemCheckbox" v-if="!showItemCheckbox"
@click="showItemCheckbox = true" @click="showItemCheckbox = true"
...@@ -89,11 +102,10 @@ ...@@ -89,11 +102,10 @@
<el-button <el-button
v-if="showItemCheckbox" v-if="showItemCheckbox"
@click="batchStartReception" @click="batchStartReception"
type="primary"
>确定接待</el-button >确定接待</el-button
> >
<el-button <el-button v-if="showItemCheckbox" @click="unselectAll"
v-if="showItemCheckbox"
@click="showItemCheckbox = false"
>取消</el-button >取消</el-button
> >
</div> </div>
...@@ -156,6 +168,7 @@ export default class ModelChatList extends Vue { ...@@ -156,6 +168,7 @@ export default class ModelChatList extends Vue {
private currentPage = 1; private currentPage = 1;
private sseTs = 0; private sseTs = 0;
private showItemCheckbox = false; private showItemCheckbox = false;
private refreshing = false;
private get chatRooms() { private get chatRooms() {
return this.chatList || []; return this.chatList || [];
...@@ -166,13 +179,15 @@ export default class ModelChatList extends Vue { ...@@ -166,13 +179,15 @@ export default class ModelChatList extends Vue {
} }
private async getList() { private async getList() {
this.refreshing = true;
let result = await this.sdk let result = await this.sdk
.model(this.modelName) .model(this.modelName)
.list(this.listName || undefined) .list(this.listName || undefined)
.query({ .query({
pageIndex: this.currentPage, pageIndex: this.currentPage,
item_size: this.pageSize, item_size: this.pageSize,
}); })
.finally(() => (this.refreshing = false));
if (result.pageData.rows.length === 0 && this.currentPage !== 1) { if (result.pageData.rows.length === 0 && this.currentPage !== 1) {
this.currentPage = 1; this.currentPage = 1;
if (result.pageData.record_count > 0) { if (result.pageData.record_count > 0) {
...@@ -198,8 +213,9 @@ export default class ModelChatList extends Vue { ...@@ -198,8 +213,9 @@ export default class ModelChatList extends Vue {
last_msg_content: it.LastMsgContent.value, last_msg_content: it.LastMsgContent.value,
last_msg_ts: it.LastMsgTime.value, last_msg_ts: it.LastMsgTime.value,
last_msg_type: it.LastMsgType.value, last_msg_type: it.LastMsgType.value,
title: it.Title.value, title: it.Title.value || `会话${it.id.value}`,
} as ChatType; checked: false,
} as SelectChatType;
}); });
this.total = result.pageData.record_count; this.total = result.pageData.record_count;
this.$emit("list-count-update", this.total); this.$emit("list-count-update", this.total);
...@@ -315,20 +331,41 @@ export default class ModelChatList extends Vue { ...@@ -315,20 +331,41 @@ export default class ModelChatList extends Vue {
private batchStartReception() { private batchStartReception() {
const chats = this.chatRooms.filter((chat) => chat.checked); const chats = this.chatRooms.filter((chat) => chat.checked);
if (chats.length === 0) { if (chats.length === 0) {
this.$message.warning("请先勾选要接待的会话"); return this.$message.warning("请先勾选要接待的会话");
return;
} }
const length = chats.length;
let count = 0;
chats.forEach((chat) => { chats.forEach((chat) => {
const { model_name, obj_id } = chat.business_data; const { model_name, obj_id } = chat.business_data;
this.sdk this.sdk
.model(model_name) .model(model_name)
.chat(+obj_id, this.global.org.id.toString()) .chat(+obj_id, this.global.org.id.toString())
.startChat(); .startChat()
.finally(() => {
count++;
if (count >= length) {
this.getList();
this.$message.success(`批量接待完成`);
}
});
chat.checked = false; chat.checked = false;
}); });
this.showItemCheckbox = false; this.showItemCheckbox = false;
this.clearActiveId(); this.clearActiveId();
} }
private toggle() {
for (const item of this.chatList) {
item.checked = true;
}
}
private unselectAll() {
for (const item of this.chatList) {
item.checked = false;
}
this.showItemCheckbox = false;
}
} }
</script> </script>
...@@ -363,8 +400,8 @@ export default class ModelChatList extends Vue { ...@@ -363,8 +400,8 @@ export default class ModelChatList extends Vue {
} }
} }
.keyword-input { .keyword-input {
width: 200px; width: 90%;
margin: 15px 0; margin: 15px;
/deep/ .el-input__inner { /deep/ .el-input__inner {
font-size: 13px; font-size: 13px;
height: 30px; height: 30px;
...@@ -457,4 +494,10 @@ export default class ModelChatList extends Vue { ...@@ -457,4 +494,10 @@ export default class ModelChatList extends Vue {
border-radius: 15px; border-radius: 15px;
} }
} }
.refresh-icon {
margin: 0 5px;
cursor: pointer;
color: #409eff;
}
</style> </style>
<template> <template>
<div class="chat-list-con"> <div class="chat-list-con">
<div class="chat-list h-100"> <div class="chat-list h-100">
<slot />
<div class="chat-list-scroll"> <div class="chat-list-scroll">
<el-scrollbar ref="scrollbar" class="h-100 no-bottom-scrollbar"> <el-scrollbar ref="scrollbar" class="h-100 no-bottom-scrollbar">
<div <div
...@@ -146,7 +147,7 @@ export default class ChatList extends Controller { ...@@ -146,7 +147,7 @@ export default class ChatList extends Controller {
display: inline-block; display: inline-block;
width: 25%; width: 25%;
box-sizing: border-box; box-sizing: border-box;
height: calc(100% - 59px); height: 100%;
border-right: 1px solid #ddd; border-right: 1px solid #ddd;
.title { .title {
padding-left: 20px; padding-left: 20px;
...@@ -166,8 +167,8 @@ export default class ChatList extends Controller { ...@@ -166,8 +167,8 @@ export default class ChatList extends Controller {
} }
} }
.keyword-input { .keyword-input {
width: 200px; width: 90%;
margin: 15px 0; margin: 15px;
/deep/ .el-input__inner { /deep/ .el-input__inner {
font-size: 13px; font-size: 13px;
height: 30px; height: 30px;
...@@ -178,6 +179,9 @@ export default class ChatList extends Controller { ...@@ -178,6 +179,9 @@ export default class ChatList extends Controller {
/deep/ .el-icon-time { /deep/ .el-icon-time {
background: transparent; background: transparent;
} }
/deep/ .el-input__icon {
line-height: 32px;
}
} }
.chat-list { .chat-list {
.chat-item { .chat-item {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment