取消工作空间查看更多功能,默认查所有

This commit is contained in:
2026-07-22 15:15:08 +08:00
parent cac2dd019c
commit adea3a90ec
2 changed files with 5 additions and 81 deletions
+1 -36
View File
@@ -68,10 +68,6 @@
</div>
</div>
</div>
<button v-if="props.hasMoreWorkspace" class="load-more-btn" @click="emit('load-more-workspace')">
<el-icon><ArrowDown /></el-icon>
展开更多
</button>
</div>
</div>
</div>
@@ -79,7 +75,7 @@
<script setup lang="ts">
import { ref } from 'vue';
import { Delete, ChatDotRound, ChatLineRound, EditPen, ArrowDown, Document, VideoPlay, Headset, Picture, FolderOpened } from '@element-plus/icons-vue';
import { Delete, ChatDotRound, ChatLineRound, EditPen, Document, VideoPlay, Headset, Picture, FolderOpened } from '@element-plus/icons-vue';
interface TreeNode {
id: string;
@@ -104,7 +100,6 @@ interface Props {
historyList: HistoryItem[];
treeNodes: TreeNode[];
treeLoading: boolean;
hasMoreWorkspace: boolean;
}
interface Emits {
@@ -115,7 +110,6 @@ interface Emits {
(e: 'preview-node', data: TreeNode): void;
(e: 'download-node', data: TreeNode): void;
(e: 'delete-node', data: TreeNode): void;
(e: 'load-more-workspace'): void;
}
const props = defineProps<Props>();
@@ -360,35 +354,6 @@ const handleDeleteNode = (data: TreeNode) => emit('delete-node', data);
}
}
/* 展开更多按钮 */
.load-more-btn {
display: flex;
align-items: center;
justify-content: center;
gap: 5px;
width: 100%;
height: 32px;
margin-top: 4px;
border: 1px dashed #cbd5e1;
border-radius: 8px;
background: transparent;
color: #64748b;
font-size: 12px;
cursor: pointer;
transition: border-color 0.15s, color 0.15s, background 0.15s;
outline: none;
.el-icon {
font-size: 12px;
}
&:hover {
border-color: #93c5fd;
color: #2563eb;
background: #eff6ff;
}
}
/* 工作空间树节点 */
.tree-date-group {
display: flex;
+4 -45
View File
@@ -6,8 +6,6 @@
:history-list="historyList"
:tree-nodes="treeNodes"
:tree-loading="treeLoading"
:has-more-workspace="hasMoreWorkspace"
@load-more-workspace="loadMoreWorkspace"
@menu-change="handleMenuChange"
@new-chat="handleCreateHistory"
@select-history="handleSelectHistory"
@@ -204,7 +202,7 @@ const removeNode = (nodes: TreeNode[], targetId: string): boolean => {
return true;
}
}
return false;
return false;
};
const mapSessionStatus = (code?: number): 'executing' | undefined => {
@@ -219,11 +217,9 @@ const getSessionData = (res: any): any[] => {
};
const getList = async () => {
workspacePage.value = 1;
hasMoreWorkspace.value = true;
treeLoading.value = true;
try {
const [execRes, sessionRes] = await Promise.all([getExecutionList({ pageSize: 10 }), getSessionList({ pageSize: 10 })]);
const [execRes, sessionRes] = await Promise.all([getExecutionList(), getSessionList({ pageSize: 10 })]);
imgAddressPrefix.value = execRes.data?.imgAddressPrefix || '';
treeNodes.value = buildTreeNodes(execRes.data?.tree || []);
const d = new Date();
@@ -265,9 +261,6 @@ const getList = async () => {
const selectedWorkflowDetail = ref<any>(null);
const mainContentRef = ref<any>(null);
const workspacePage = ref(1);
const hasMoreWorkspace = ref(true);
const workspaceLoading = ref(false);
const sendingSessions = reactive<Record<string, boolean>>({});
const isHistoryWorkflow = ref(false);
const inputBarRef = ref<any>(null);
@@ -296,38 +289,6 @@ const handleWorkflowSelect = async (workflowId: string | null) => {
}
};
const loadMoreWorkspace = async () => {
if (workspaceLoading.value) return;
workspaceLoading.value = true;
const nextPage = workspacePage.value + 1;
try {
const res = await getExecutionList({ pageNum: nextPage, pageSize: 10 });
const newTree = res.data?.tree || [];
if (newTree.length === 0) {
hasMoreWorkspace.value = false;
return;
}
workspacePage.value = nextPage;
const newNodes = buildTreeNodes(newTree);
// 合并跨页重复的日期分组
const lastExisting = treeNodes.value[treeNodes.value.length - 1];
const firstNew = newNodes[0];
if (lastExisting && firstNew && lastExisting.label === firstNew.label) {
const existingIds = new Set((lastExisting.children || []).map((c) => c.backendId));
const uniqueChildren = (firstNew.children || []).filter((c) => !existingIds.has(c.backendId));
lastExisting.children!.push(...uniqueChildren);
treeNodes.value.push(...newNodes.slice(1));
} else {
treeNodes.value = [...treeNodes.value, ...newNodes];
}
} catch {
// 错误已由全局拦截器处理
} finally {
workspaceLoading.value = false;
}
};
const handleMenuChange = (menu: string) => {
activeMenu.value = menu;
};
@@ -458,10 +419,8 @@ const handleSend = async (message: string) => {
isUser: false,
});
ElMessage.success('✅ 执行完成,可前往工作空间查看');
// 重置分页并刷新工作空间树
workspacePage.value = 1;
hasMoreWorkspace.value = true;
getExecutionList({ pageSize: 10 }).then((res) => {
// 刷新工作空间树(查询所有结果)
getExecutionList().then((res) => {
imgAddressPrefix.value = res.data?.imgAddressPrefix || '';
treeNodes.value = buildTreeNodes(res.data?.tree || []);
});