|
@@ -1,14 +1,15 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <a-dropdown trigger="hover">
|
|
|
|
|
- <a-button v-if="api_status === 1" class="history-type-btn" type="text">{{ btn_label }}</a-button>
|
|
|
|
|
|
|
+ <a-dropdown trigger="hover" :defaultValue="btn_label_str">
|
|
|
|
|
+ <a-button v-if="api_status === 1" class="history-type-btn" type="text">{{ btn_label_str }}</a-button>
|
|
|
<a-button v-if="api_status === 2" class="history-type-btn" type="text"><a-spin :size="16" /></a-button>
|
|
<a-button v-if="api_status === 2" class="history-type-btn" type="text"><a-spin :size="16" /></a-button>
|
|
|
- <a-button v-if="api_status === 3" class="history-type-btn" type="text">{{ btn_label }}</a-button>
|
|
|
|
|
|
|
+ <a-button v-if="api_status === 3" class="history-type-btn" type="text">{{ btn_label_str }}</a-button>
|
|
|
|
|
|
|
|
<template #content>
|
|
<template #content>
|
|
|
<a-doption
|
|
<a-doption
|
|
|
v-for="(item, index) of list_agents"
|
|
v-for="(item, index) of list_agents"
|
|
|
:key="item.id"
|
|
:key="item.id"
|
|
|
:disabled="disabled_options"
|
|
:disabled="disabled_options"
|
|
|
|
|
+ :value="item.name"
|
|
|
@click="handleChatTypeConfirm(item)"
|
|
@click="handleChatTypeConfirm(item)"
|
|
|
>{{ item.name }}</a-doption
|
|
>{{ item.name }}</a-doption
|
|
|
>
|
|
>
|
|
@@ -20,6 +21,7 @@
|
|
|
import { ref, computed, onMounted } from 'vue';
|
|
import { ref, computed, onMounted } from 'vue';
|
|
|
|
|
|
|
|
import useAgentList4History from '../conversation-board/use-agent-list-4-history';
|
|
import useAgentList4History from '../conversation-board/use-agent-list-4-history';
|
|
|
|
|
+import { useRecentSearchTypeStore } from '../../base/store/use-recent-history-search-type';
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
|
/**
|
|
/**
|
|
@@ -29,14 +31,36 @@ const props = defineProps({
|
|
|
list_status: Number
|
|
list_status: Number
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-const btn_label = ref('');
|
|
|
|
|
|
|
+const recentSearchType = useRecentSearchTypeStore();
|
|
|
|
|
|
|
|
-const { api_status, api_message, list_agents, getAgentList } = useAgentList4History((item) => {
|
|
|
|
|
- handleChatTypeConfirm(item);
|
|
|
|
|
|
|
+const { api_status, api_message, list_agents, getAgentList } = useAgentList4History((agent_list) => {
|
|
|
|
|
+ const cur_id = recentSearchType?.search_type?.id || '';
|
|
|
|
|
+
|
|
|
|
|
+ let item = null;
|
|
|
|
|
+
|
|
|
|
|
+ const len = agent_list.length;
|
|
|
|
|
+ for (let i = 0; i < len; i++) {
|
|
|
|
|
+ const agent = agent_list[i];
|
|
|
|
|
+
|
|
|
|
|
+ if (agent.id === cur_id) {
|
|
|
|
|
+ item = agent;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (item) {
|
|
|
|
|
+ handleChatTypeConfirm(item);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ handleChatTypeConfirm(agent_list[0]);
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const emit = defineEmits(['typeSelected']);
|
|
const emit = defineEmits(['typeSelected']);
|
|
|
|
|
|
|
|
|
|
+const btn_label_str = computed(() => {
|
|
|
|
|
+ return recentSearchType?.search_type?.name || '';
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 是否禁用下拉菜单
|
|
* 是否禁用下拉菜单
|
|
|
* 当列表正在加载时,应该禁用下拉菜单
|
|
* 当列表正在加载时,应该禁用下拉菜单
|
|
@@ -49,7 +73,7 @@ const disabled_options = computed(() => {
|
|
|
* 已经确定类型
|
|
* 已经确定类型
|
|
|
*/
|
|
*/
|
|
|
const handleChatTypeConfirm = (item) => {
|
|
const handleChatTypeConfirm = (item) => {
|
|
|
- btn_label.value = item.name;
|
|
|
|
|
|
|
+ recentSearchType.setType(item);
|
|
|
|
|
|
|
|
emit('typeSelected', item);
|
|
emit('typeSelected', item);
|
|
|
};
|
|
};
|