Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
foreign
/
customer-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ef8432c0
authored
Sep 28, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
批量接待
parent
a5f82bc4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
47 deletions
components/chat-container.vue
components/chat-list-model.vue
components/chat-list.vue
components/chat-container.vue
View file @
ef8432c0
<
template
>
<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
v-if=
"!modelName"
ref=
"chatListComp"
@
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
v-if=
"modelName"
@
list-count-update=
"$emit('list-count-update', $event)"
...
...
@@ -101,7 +102,6 @@ export default class ChatContainer extends Vue {
}
}
.keyword-input
{
width
:
300px
;
margin
:
15px
0
14px
20px
;
/deep/
.el-input__inner
{
font-size
:
13px
;
...
...
@@ -118,7 +118,6 @@ export default class ChatContainer extends Vue {
}
}
.search-wrap
{
height
:
59px
;
border-bottom
:
1px
solid
#ddd
;
}
.close-btn
{
...
...
components/chat-list-model.vue
View file @
ef8432c0
...
...
@@ -66,21 +66,34 @@
无接待
</div>
</el-scrollbar>
<el-pagination
class=
"page-comp"
background
small
@
size-change=
"handleSizeChange"
:page-size=
"pageSize"
:total=
"total"
:current-page
.
sync=
"currentPage"
@
current-change=
"getList"
:page-sizes=
"[10, 20, 50]"
:pager-count=
"5"
layout=
"total, prev, pager, next"
></el-pagination>
<div
class=
"d-flex align-items-center justify-content-center"
>
<el-pagination
class=
"page-comp"
small
@
size-change=
"handleSizeChange"
:page-size=
"pageSize"
:total=
"total"
:current-page
.
sync=
"currentPage"
@
current-change=
"getList"
:page-sizes=
"[10, 20, 50]"
:pager-count=
"5"
layout=
"total, prev, pager, next"
></el-pagination>
<i
title=
"刷新"
class=
"refresh-icon"
@
click=
"getList"
:class=
"
refreshing ? 'el-icon-loading' : 'el-icon-refresh'
"
></i>
</div>
<div
class=
"action-row"
>
<el-button
@
click=
"getList"
>
刷新
</el-button>
<el-button
v-if=
"showItemCheckbox"
@
click=
"toggle"
>
全选
</el-button
>
<el-button
v-if=
"!showItemCheckbox"
@
click=
"showItemCheckbox = true"
...
...
@@ -89,11 +102,10 @@
<el-button
v-if=
"showItemCheckbox"
@
click=
"batchStartReception"
type=
"primary"
>
确定接待
</el-button
>
<el-button
v-if=
"showItemCheckbox"
@
click=
"showItemCheckbox = false"
<el-button
v-if=
"showItemCheckbox"
@
click=
"unselectAll"
>
取消
</el-button
>
</div>
...
...
@@ -156,6 +168,7 @@ export default class ModelChatList extends Vue {
private
currentPage
=
1
;
private
sseTs
=
0
;
private
showItemCheckbox
=
false
;
private
refreshing
=
false
;
private
get
chatRooms
()
{
return
this
.
chatList
||
[];
...
...
@@ -166,13 +179,15 @@ export default class ModelChatList extends Vue {
}
private
async
getList
()
{
this
.
refreshing
=
true
;
let
result
=
await
this
.
sdk
.
model
(
this
.
modelName
)
.
list
(
this
.
listName
||
undefined
)
.
query
({
pageIndex
:
this
.
currentPage
,
item_size
:
this
.
pageSize
,
});
})
.
finally
(()
=>
(
this
.
refreshing
=
false
));
if
(
result
.
pageData
.
rows
.
length
===
0
&&
this
.
currentPage
!==
1
)
{
this
.
currentPage
=
1
;
if
(
result
.
pageData
.
record_count
>
0
)
{
...
...
@@ -198,8 +213,9 @@ export default class ModelChatList extends Vue {
last_msg_content
:
it
.
LastMsgContent
.
value
,
last_msg_ts
:
it
.
LastMsgTime
.
value
,
last_msg_type
:
it
.
LastMsgType
.
value
,
title
:
it
.
Title
.
value
,
}
as
ChatType
;
title
:
it
.
Title
.
value
||
`会话
${
it
.
id
.
value
}
`
,
checked
:
false
,
}
as
SelectChatType
;
});
this
.
total
=
result
.
pageData
.
record_count
;
this
.
$emit
(
"list-count-update"
,
this
.
total
);
...
...
@@ -315,20 +331,41 @@ export default class ModelChatList extends Vue {
private
batchStartReception
()
{
const
chats
=
this
.
chatRooms
.
filter
((
chat
)
=>
chat
.
checked
);
if
(
chats
.
length
===
0
)
{
this
.
$message
.
warning
(
"请先勾选要接待的会话"
);
return
;
return
this
.
$message
.
warning
(
"请先勾选要接待的会话"
);
}
const
length
=
chats
.
length
;
let
count
=
0
;
chats
.
forEach
((
chat
)
=>
{
const
{
model_name
,
obj_id
}
=
chat
.
business_data
;
this
.
sdk
.
model
(
model_name
)
.
chat
(
+
obj_id
,
this
.
global
.
org
.
id
.
toString
())
.
startChat
();
.
startChat
()
.
finally
(()
=>
{
count
++
;
if
(
count
>=
length
)
{
this
.
getList
();
this
.
$message
.
success
(
`批量接待完成`
);
}
});
chat
.
checked
=
false
;
});
this
.
showItemCheckbox
=
false
;
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
>
...
...
@@ -363,8 +400,8 @@ export default class ModelChatList extends Vue {
}
}
.keyword-input
{
width
:
200px
;
margin
:
15px
0
;
width
:
90%
;
margin
:
15px
;
/deep/
.el-input__inner
{
font-size
:
13px
;
height
:
30px
;
...
...
@@ -457,4 +494,10 @@ export default class ModelChatList extends Vue {
border-radius
:
15px
;
}
}
.refresh-icon
{
margin
:
0
5px
;
cursor
:
pointer
;
color
:
#409eff
;
}
</
style
>
components/chat-list.vue
View file @
ef8432c0
<
template
>
<div
class=
"chat-list-con"
>
<div
class=
"chat-list h-100"
>
<slot
/>
<div
class=
"chat-list-scroll"
>
<el-scrollbar
ref=
"scrollbar"
class=
"h-100 no-bottom-scrollbar"
>
<div
...
...
@@ -146,7 +147,7 @@ export default class ChatList extends Controller {
display
:
inline-block
;
width
:
25%
;
box-sizing
:
border-box
;
height
:
calc
(
100%
-
59px
)
;
height
:
100%
;
border-right
:
1px
solid
#ddd
;
.title
{
padding-left
:
20px
;
...
...
@@ -166,8 +167,8 @@ export default class ChatList extends Controller {
}
}
.keyword-input
{
width
:
200px
;
margin
:
15px
0
;
width
:
90%
;
margin
:
15px
;
/deep/
.el-input__inner
{
font-size
:
13px
;
height
:
30px
;
...
...
@@ -178,6 +179,9 @@ export default class ChatList extends Controller {
/
deep
/
.el-icon-time
{
background
:
transparent
;
}
/
deep
/
.el-input__icon
{
line-height
:
32px
;
}
}
.chat-list
{
.chat-item
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment