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
You need to sign in or sign up before continuing.
Commit
ee2ae62f
authored
Sep 30, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
eventhub导入
parent
f4b0a55e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
21 deletions
components/chat-list-model.vue
components/chat-list.vue
components/model-detail.vue
components/workflow.vue
model/index.ts
xim/index.ts
components/chat-list-model.vue
View file @
ee2ae62f
...
@@ -244,7 +244,7 @@ export default class ModelChatList extends Vue {
...
@@ -244,7 +244,7 @@ export default class ModelChatList extends Vue {
this
.
listName
===
"group_receiving"
||
this
.
listName
===
"group_receiving"
||
this
.
listName
===
"group_wait"
this
.
listName
===
"group_wait"
)
{
)
{
this
.
$eventHub
.
$on
(
EVENTS
.
ChatUpdate
,
this
.
refreshListDebounce
);
xim
.
$on
(
EVENTS
.
ChatUpdate
,
this
.
refreshListDebounce
);
}
}
}
}
...
@@ -267,7 +267,7 @@ export default class ModelChatList extends Vue {
...
@@ -267,7 +267,7 @@ export default class ModelChatList extends Vue {
this
.
listName
===
"group_before_handle"
&&
this
.
listName
===
"group_before_handle"
&&
e
.
dataUpdates
.
findIndex
((
it
)
=>
it
.
action
===
"sendMsg"
)
>
-
1
e
.
dataUpdates
.
findIndex
((
it
)
=>
it
.
action
===
"sendMsg"
)
>
-
1
)
{
)
{
this
.
$eventHub
.
$emit
(
EVENTS
.
ChatUpdate
);
xim
.
$emit
(
EVENTS
.
ChatUpdate
);
}
}
this
.
refreshListDebounce
();
this
.
refreshListDebounce
();
}
}
...
...
components/chat-list.vue
View file @
ee2ae62f
...
@@ -59,8 +59,9 @@ import Controller from "./controller/chat-list";
...
@@ -59,8 +59,9 @@ import Controller from "./controller/chat-list";
import
{
EVENTS
}
from
"@/EventConsts"
;
import
{
EVENTS
}
from
"@/EventConsts"
;
import
avatar
from
"@/customer-service/components/avatar.vue"
;
import
avatar
from
"@/customer-service/components/avatar.vue"
;
import
{
ChatStore
}
from
"@/customer-service/store/model"
;
import
{
Chat
as
ChatType
}
from
"@/customer-service/xim/models/chat"
;
import
{
Chat
as
ChatType
}
from
"@/customer-service/xim/models/chat"
;
import
{
ServiceType
}
from
"../model"
;
import
xim
from
"@/customer-service/xim"
;
@
Component
({
components
:
{
avatar
}
})
@
Component
({
components
:
{
avatar
}
})
export
default
class
ChatList
extends
Controller
{
export
default
class
ChatList
extends
Controller
{
...
@@ -85,7 +86,7 @@ export default class ChatList extends Controller {
...
@@ -85,7 +86,7 @@ export default class ChatList extends Controller {
});
});
this
.
unReadMsgCount
=
unReadMsgCount
;
this
.
unReadMsgCount
=
unReadMsgCount
;
this
.
$emit
(
"list-count-update"
,
this
.
unReadMsgCount
);
this
.
$emit
(
"list-count-update"
,
this
.
unReadMsgCount
);
this
.
$eventHub
.
$emit
(
EVENTS
.
NewMsg
,
this
.
unReadMsgCount
);
xim
.
$emit
(
EVENTS
.
NewMsg
,
this
.
unReadMsgCount
);
return
list
;
return
list
;
}
}
return
[];
return
[];
...
@@ -100,7 +101,7 @@ export default class ChatList extends Controller {
...
@@ -100,7 +101,7 @@ export default class ChatList extends Controller {
async
created
()
{
async
created
()
{
await
this
.
getMyChatList
();
await
this
.
getMyChatList
();
this
.
setSource
(
ChatStore
.
StateChatSourceDirection
.
Server
);
this
.
setSource
(
ServiceType
.
Backend
);
this
.
scrollbar
.
update
();
this
.
scrollbar
.
update
();
}
}
...
...
components/model-detail.vue
View file @
ee2ae62f
...
@@ -122,7 +122,7 @@ export default class ChatModelDetail extends Vue {
...
@@ -122,7 +122,7 @@ export default class ChatModelDetail extends Vue {
}
}
if
(
!
authed
)
{
if
(
!
authed
)
{
this
.
$eventHub
.
$emit
(
EVENTS
.
ShowModalDialog
,
{
Chat
.
$emit
(
EVENTS
.
ShowModalDialog
,
{
dialogName
:
"authors_list"
,
dialogName
:
"authors_list"
,
params
:
{
params
:
{
actionName
:
actionParams
.
action_name
,
actionName
:
actionParams
.
action_name
,
...
@@ -135,7 +135,7 @@ export default class ChatModelDetail extends Vue {
...
@@ -135,7 +135,7 @@ export default class ChatModelDetail extends Vue {
if
(
container
===
"page"
)
{
if
(
container
===
"page"
)
{
this
.
$message
.
warning
(
"该类型操作暂不支持"
);
this
.
$message
.
warning
(
"该类型操作暂不支持"
);
}
else
if
(
container
===
"dialog"
||
container
===
"none"
)
{
}
else
if
(
container
===
"dialog"
||
container
===
"none"
)
{
this
.
$eventHub
.
$emit
(
EVENTS
.
ShowModalDialog
,
{
Chat
.
$emit
(
EVENTS
.
ShowModalDialog
,
{
dialogName
:
"general_executor_dialog"
,
dialogName
:
"general_executor_dialog"
,
params
:
{
params
:
{
autoSubmit
:
container
===
"none"
,
autoSubmit
:
container
===
"none"
,
...
@@ -154,7 +154,7 @@ export default class ChatModelDetail extends Vue {
...
@@ -154,7 +154,7 @@ export default class ChatModelDetail extends Vue {
},
},
});
});
}
else
if
(
container
===
"batch"
)
{
}
else
if
(
container
===
"batch"
)
{
this
.
$eventHub
.
$emit
(
EVENTS
.
ShowModalDialog
,
{
Chat
.
$emit
(
EVENTS
.
ShowModalDialog
,
{
dialogName
:
"general_execute_batch"
,
dialogName
:
"general_execute_batch"
,
params
:
{
params
:
{
model_name
:
this
.
model_name
,
model_name
:
this
.
model_name
,
...
@@ -165,7 +165,7 @@ export default class ChatModelDetail extends Vue {
...
@@ -165,7 +165,7 @@ export default class ChatModelDetail extends Vue {
},
},
});
});
}
else
if
(
container
===
"detail_dialog"
)
{
}
else
if
(
container
===
"detail_dialog"
)
{
this
.
$eventHub
.
$emit
(
EVENTS
.
ShowModalDialog
,
{
Chat
.
$emit
(
EVENTS
.
ShowModalDialog
,
{
dialogName
:
"general_detail_dialog"
,
dialogName
:
"general_detail_dialog"
,
params
:
{
params
:
{
forward
:
forward
,
forward
:
forward
,
...
@@ -183,7 +183,7 @@ export default class ChatModelDetail extends Vue {
...
@@ -183,7 +183,7 @@ export default class ChatModelDetail extends Vue {
forward
.
replace
(
/^
\/
/
,
""
);
forward
.
replace
(
/^
\/
/
,
""
);
}
}
}
}
this
.
$eventHub
.
$emit
(
EVENTS
.
ShowModalDialog
,
{
Chat
.
$emit
(
EVENTS
.
ShowModalDialog
,
{
dialogName
:
"general_iframe_dialog"
,
dialogName
:
"general_iframe_dialog"
,
params
:
{
params
:
{
title
:
""
,
title
:
""
,
...
@@ -193,7 +193,7 @@ export default class ChatModelDetail extends Vue {
...
@@ -193,7 +193,7 @@ export default class ChatModelDetail extends Vue {
},
},
});
});
}
else
if
(
container
===
"startProcess"
)
{
}
else
if
(
container
===
"startProcess"
)
{
this
.
$eventHub
.
$emit
(
EVENTS
.
ShowModalDialog
,
{
Chat
.
$emit
(
EVENTS
.
ShowModalDialog
,
{
dialogName
:
"start_process_dialog"
,
dialogName
:
"start_process_dialog"
,
params
:
{
params
:
{
autoSubmit
:
container
===
"none"
,
autoSubmit
:
container
===
"none"
,
...
...
components/workflow.vue
View file @
ee2ae62f
...
@@ -93,8 +93,8 @@ export default class WorkFlow extends Vue {
...
@@ -93,8 +93,8 @@ export default class WorkFlow extends Vue {
})
})
private
readonly
name
!
:
string
;
private
readonly
name
!
:
string
;
private
processName
=
""
private
processName
=
""
;
private
selectedProcess
=
[]
private
selectedProcess
=
[]
;
private
startDialogConfirm
()
{
private
startDialogConfirm
()
{
console
.
log
(
"startDialogConfirm"
);
console
.
log
(
"startDialogConfirm"
);
...
@@ -108,7 +108,10 @@ export default class WorkFlow extends Vue {
...
@@ -108,7 +108,10 @@ export default class WorkFlow extends Vue {
private
flowList
=
[];
private
flowList
=
[];
public
async
created
()
{
public
async
created
()
{
this
.
flowList
=
await
sdk
().
model
(
this
.
model_name
).
workflow2
().
queryProcessByAssociateId
(
+
this
.
id
);
this
.
flowList
=
await
sdk
()
.
model
(
this
.
model_name
)
.
workflow2
()
.
queryProcessByAssociateId
(
+
this
.
id
);
}
}
public
start
(
workflow
:
any
)
{
public
start
(
workflow
:
any
)
{
...
@@ -118,7 +121,7 @@ export default class WorkFlow extends Vue {
...
@@ -118,7 +121,7 @@ export default class WorkFlow extends Vue {
}
}
public
goToDetail
(
workflow
:
any
)
{
public
goToDetail
(
workflow
:
any
)
{
this
.
$eventHub
.
$emit
(
EVENTS
.
ShowModalDialog
,
{
Chat
.
$emit
(
EVENTS
.
ShowModalDialog
,
{
dialogName
:
"show_process_detail"
,
dialogName
:
"show_process_detail"
,
params
:
{
params
:
{
modelName
:
this
.
model_name
,
modelName
:
this
.
model_name
,
...
...
model/index.ts
View file @
ee2ae62f
...
@@ -62,6 +62,8 @@ export interface ChatOption {
...
@@ -62,6 +62,8 @@ export interface ChatOption {
* 用于标记会话启动是在客户端(用户)还是服务端(后端)
* 用于标记会话启动是在客户端(用户)还是服务端(后端)
*/
*/
serviceType
?:
ServiceType
;
serviceType
?:
ServiceType
;
eventHub
?:
Vue
;
}
}
export
interface
ChatServiceLogger
{
export
interface
ChatServiceLogger
{
...
...
xim/index.ts
View file @
ee2ae62f
...
@@ -19,12 +19,11 @@ class Chat {
...
@@ -19,12 +19,11 @@ class Chat {
private
token
!
:
TokenStringGetter
;
private
token
!
:
TokenStringGetter
;
private
serviceType
=
ServiceType
.
Backend
;
private
serviceType
=
ServiceType
.
Backend
;
private
product
=
CustomerServiceProduct
.
Default
;
private
product
=
CustomerServiceProduct
.
Default
;
private
eventHub
:
Vue
|
null
=
null
;
private
userMapping
:
{
[
key
:
string
]:
{
name
:
string
;
avatar
:
string
}
}
=
private
userMapping
:
{
[
key
:
string
]:
{
name
:
string
;
avatar
:
string
}
}
=
{};
{};
private
webHost
=
false
;
public
async
setup
(
option
:
ChatOption
)
{
public
async
setup
(
option
:
ChatOption
)
{
if
(
!
option
)
{
if
(
!
option
)
{
throw
new
Error
(
`You must specify a chat option for chat service`
);
throw
new
Error
(
`You must specify a chat option for chat service`
);
...
@@ -39,6 +38,7 @@ class Chat {
...
@@ -39,6 +38,7 @@ class Chat {
this
.
_orgId
=
option
.
orgId
;
this
.
_orgId
=
option
.
orgId
;
option
.
serviceType
&&
(
this
.
serviceType
=
option
.
serviceType
);
option
.
serviceType
&&
(
this
.
serviceType
=
option
.
serviceType
);
option
.
product
&&
(
this
.
product
=
option
.
product
);
option
.
product
&&
(
this
.
product
=
option
.
product
);
this
.
eventHub
=
option
.
eventHub
;
dbController
.
setup
(
this
.
_sdk
().
global
.
uid
);
dbController
.
setup
(
this
.
_sdk
().
global
.
uid
);
...
@@ -77,10 +77,6 @@ class Chat {
...
@@ -77,10 +77,6 @@ class Chat {
return
this
.
_orgId
();
return
this
.
_orgId
();
};
};
public
isWebHost
()
{
return
this
.
webHost
;
}
public
setToken
(
token
:
TokenStringGetter
)
{
public
setToken
(
token
:
TokenStringGetter
)
{
return
xim
.
setToken
(
token
);
return
xim
.
setToken
(
token
);
}
}
...
@@ -125,6 +121,18 @@ class Chat {
...
@@ -125,6 +121,18 @@ class Chat {
private
debug
(
message
:
string
)
{
private
debug
(
message
:
string
)
{
ChatLoggerService
.
logger
?.
debug
(
message
);
ChatLoggerService
.
logger
?.
debug
(
message
);
}
}
public
$emit
(
event
:
string
,
...
args
:
any
[])
{
if
(
this
.
eventHub
)
{
this
.
eventHub
.
$emit
(
event
,
...
args
);
}
}
public
$on
(
event
:
string
,
callback
:
Function
)
{
if
(
this
.
eventHub
)
{
this
.
eventHub
.
$on
(
event
,
callback
);
}
}
}
}
export
default
new
Chat
();
export
default
new
Chat
();
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