From f434ce3b98b921e6437eb49eacf5567b4167c69b Mon Sep 17 00:00:00 2001 From: yinbangzhong <zhongbangyin@126.com> Date: 星期五, 16 八月 2024 18:28:11 +0800 Subject: [PATCH] 角色 --- src/views/sessionManager/components/historySession.vue | 67 ++++++++++++++++++++++++++++----- 1 files changed, 57 insertions(+), 10 deletions(-) diff --git a/src/views/sessionManager/components/historySession.vue b/src/views/sessionManager/components/historySession.vue index 63ed439..23b3479 100644 --- a/src/views/sessionManager/components/historySession.vue +++ b/src/views/sessionManager/components/historySession.vue @@ -8,7 +8,7 @@ top: 10px; left: -40px; font-size: 30px; - z-index: 9999; + z-index: 99; cursor: pointer" @click="emit('changeAgentType','1')" > @@ -47,6 +47,8 @@ class="item historyCenter-box" v-for="session in sessionList" @click="querySessionDetail(session)" + @mouseenter="handleMouseEnter(session)" + @mouseleave="handleMouseLeave(session)" > <div class="text" > <img @@ -57,12 +59,18 @@ {{ session.name }} </div> <div class="time" - >{{ - moment(new Date(session.create_time)).format( - 'YYYY-MM-DD HH:mm:ss' - ) - }} + > + <span v-show="session.showtype == 1" style="font-size: 14px"> + {{ + moment(new Date(session.create_time)).format( + 'YYYY-MM-DD HH:mm:ss' + ) + }} + </span> </div> + <a-button type="text" @click.stop="deleteSession(session)" style="color: red;position: absolute;right: 10px;top: 10px;" v-show="session.showtype == 2"> + <icon-delete style="font-size: 14px" /> + </a-button> </div> </div> </a-scrollbar> @@ -77,7 +85,7 @@ import { useAppStore, useUserStore } from "@/store"; import { computed, nextTick, onMounted, watch, reactive, ref, onBeforeMount, onBeforeUnmount } from "vue"; -import { Message } from "@arco-design/web-vue"; +import { Message, Modal } from "@arco-design/web-vue"; import EventBus from '@/utils/EventBus'; import moment from "moment"; import { @@ -85,11 +93,14 @@ chatApi, getDialogListApi, getSessionDetailsApi, + deleteSessionApi, sessionListApi } from "@/api/session"; + import { queryCanvasList } from "@/api/Agent"; const emit = defineEmits(["querySessionDetail","changeAgentType"]); import logo from "@/assets/images/model.png"; +import { deleteKnow } from "@/api/kbList"; const sessionList = ref([]); //浼氳瘽鍒楄〃 const activeSessionId = ref(""); const fieldNames = { value: "id", label: "name" }; @@ -152,7 +163,12 @@ const querySessionList = async (id) => { const { code, data } = await sessionListApi(id); if (code === 200) { - sessionList.value = data; + sessionList.value = data.map((item) => { + return { + ...item, + showtype: 1 + } + }); @@ -161,20 +177,50 @@ } }; +//鏍规嵁浼氳瘽id鍒犻櫎浼氳瘽 +const deleteSession = async (session) => { + Modal.confirm({ + title: '鎻愮ず淇℃伅', + content: '纭鍒犻櫎鍚�', + okText: '纭畾', + cancelText: '鍙栨秷', + hideTitle: true, + onOk: async () => { + const { code } = await deleteSessionApi([session.id]); + if (code === 200) { + Message.success('鍒犻櫎鎴愬姛'); + querySessionList(''); + } + }, + onCancel: () => {}, + }); +}; const querySessionDetail = async (session) => { console.log(session, 'session'); emit('changeAgentType','1'); emit('querySessionDetail',session); } + + +const handleMouseEnter = (session) => { + session.showtype = 2; +}; + +const handleMouseLeave = (session) => { + session.showtype = 1; +}; + onBeforeMount(()=>{ - DialogList() + // DialogList() + querySessionList(''); }) onMounted(() => { EventBus.on("history", () => { emit('changeAgentType','3'); - DialogList() + // DialogList() + querySessionList(''); }); }) @@ -218,6 +264,7 @@ width: 100%; margin-top: 30px; .historyCenter-box{ + position: relative; display: flex; width: 70%; margin-left: 15%; -- Gitblit v1.8.0