|
@@ -7,14 +7,15 @@
|
|
|
|
|
|
|
|
<BoardTags @change="handleTagChange" />
|
|
<BoardTags @change="handleTagChange" />
|
|
|
|
|
|
|
|
- <BoardAgentList @itemActive="handleItemActive" :list="list_agents" />
|
|
|
|
|
<template v-if="api_status === 2">
|
|
<template v-if="api_status === 2">
|
|
|
<div class="infomations-container">
|
|
<div class="infomations-container">
|
|
|
<a-spin :size="32" />
|
|
<a-spin :size="32" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
- <template v-if="api_status === 3 && list_agents.length === 0">
|
|
|
|
|
- <div class="infomations-container">
|
|
|
|
|
|
|
+ <template v-if="api_status === 3">
|
|
|
|
|
+ <BoardAgentList @itemActive="handleItemActive" :list="list_agents" />
|
|
|
|
|
+
|
|
|
|
|
+ <div class="infomations-container" v-if="list_agents.length === 0">
|
|
|
<a-empty> {{ $t('conversation.history_empty') }} </a-empty>
|
|
<a-empty> {{ $t('conversation.history_empty') }} </a-empty>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -43,11 +44,13 @@ import BoardWelcome from '../../modules/conversation-board/BoardWelcome.vue';
|
|
|
import BoardTags from '../../modules/conversation-board/BoardTags.vue';
|
|
import BoardTags from '../../modules/conversation-board/BoardTags.vue';
|
|
|
import BoardAgentList from '../../modules/conversation-board/BoardAgentList.vue';
|
|
import BoardAgentList from '../../modules/conversation-board/BoardAgentList.vue';
|
|
|
|
|
|
|
|
-import { conversationBoardList } from '../../modules/conversation-board/api-conversation-board';
|
|
|
|
|
|
|
+import { conversationBoardAgentList } from '../../modules/conversation-board/api-conversation-board';
|
|
|
import { useAllAgentStore } from '../../base/store/use-all-agents';
|
|
import { useAllAgentStore } from '../../base/store/use-all-agents';
|
|
|
|
|
|
|
|
const emit = defineEmits(['agentActive']);
|
|
const emit = defineEmits(['agentActive']);
|
|
|
|
|
|
|
|
|
|
+const selected_id = ref('');
|
|
|
|
|
+
|
|
|
// api请求的状态
|
|
// api请求的状态
|
|
|
const api_status = ref(1); // api状态 1 请求未启动 2 请求进心中 3 请求已成功 4 请求失败(网络成功,但是code不等于200) 5 请求出错
|
|
const api_status = ref(1); // api状态 1 请求未启动 2 请求进心中 3 请求已成功 4 请求失败(网络成功,但是code不等于200) 5 请求出错
|
|
|
const api_message = ref(''); // 请求消息 与 api_status 对应的 message 消息内容
|
|
const api_message = ref(''); // 请求消息 与 api_status 对应的 message 消息内容
|
|
@@ -58,8 +61,10 @@ const list_agents = ref([]); // 历史记录的列表数据
|
|
|
// store中保存的agents
|
|
// store中保存的agents
|
|
|
const allAgents = useAllAgentStore();
|
|
const allAgents = useAllAgentStore();
|
|
|
|
|
|
|
|
-const handleTagChange = (type) => {
|
|
|
|
|
- console.log(type);
|
|
|
|
|
|
|
+const handleTagChange = (tag_id) => {
|
|
|
|
|
+ selected_id.value = tag_id;
|
|
|
|
|
+
|
|
|
|
|
+ handleApiRequest();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const handleItemActive = (target_id) => {
|
|
const handleItemActive = (target_id) => {
|
|
@@ -70,18 +75,24 @@ const handleItemActive = (target_id) => {
|
|
|
* 处理请求参数
|
|
* 处理请求参数
|
|
|
*/
|
|
*/
|
|
|
const formatListOptions = () => {
|
|
const formatListOptions = () => {
|
|
|
- return {};
|
|
|
|
|
|
|
+ const obj = {};
|
|
|
|
|
+
|
|
|
|
|
+ if (selected_id.value) {
|
|
|
|
|
+ obj.label = selected_id.value;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return obj;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 调用api请求
|
|
* 调用api请求
|
|
|
*/
|
|
*/
|
|
|
const handleApiRequest = () => {
|
|
const handleApiRequest = () => {
|
|
|
- const cache_agents = allAgents.agents;
|
|
|
|
|
- if (cache_agents.length !== 0) {
|
|
|
|
|
- list_agents.value = cache_agents;
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // const cache_agents = allAgents.agents;
|
|
|
|
|
+ // if (cache_agents.length !== 0) {
|
|
|
|
|
+ // list_agents.value = cache_agents;
|
|
|
|
|
+ // return;
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
// 处理查询参数
|
|
// 处理查询参数
|
|
|
const opts = formatListOptions();
|
|
const opts = formatListOptions();
|
|
@@ -89,15 +100,15 @@ const handleApiRequest = () => {
|
|
|
// 进入加载状态
|
|
// 进入加载状态
|
|
|
api_status.value = 2;
|
|
api_status.value = 2;
|
|
|
api_message.value = '';
|
|
api_message.value = '';
|
|
|
- conversationBoardList(opts)
|
|
|
|
|
|
|
+ conversationBoardAgentList(opts)
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
if (res.code / 1 === 200) {
|
|
if (res.code / 1 === 200) {
|
|
|
// 成功
|
|
// 成功
|
|
|
const res_list = res.data; // 历史记录列表
|
|
const res_list = res.data; // 历史记录列表
|
|
|
|
|
|
|
|
list_agents.value = res_list;
|
|
list_agents.value = res_list;
|
|
|
- // 在store中缓存数据
|
|
|
|
|
- allAgents.setList(res_list);
|
|
|
|
|
|
|
+ // // 在store中缓存数据
|
|
|
|
|
+ // allAgents.setList(res_list);
|
|
|
|
|
|
|
|
// api请求成功
|
|
// api请求成功
|
|
|
api_status.value = 3;
|
|
api_status.value = 3;
|