perf: 优化旧版浏览器页面恢复与资源加载

- 页面恢复时延后版本检查并补齐根背景,减少白闪与首帧卡顿

- 面向 Chrome 90 收敛公共分包,按需加载资源弹窗和知识库面板

- 压缩工作流图标并补充延迟加载与可见性生命周期测试
This commit is contained in:
2026-07-31 16:11:14 +08:00
parent 5c29ca9407
commit 12080ceedb
15 changed files with 505 additions and 68 deletions

View File

@@ -44,8 +44,8 @@ import CardPage from '#/components/page/CardList.vue';
import PageData from '#/components/page/PageData.vue';
import PageSide from '#/components/page/PageSide.vue';
import { copyTextWithFeedback } from '#/utils/clipboard-feedback';
import { createLazyComponentController } from '#/utils/lazy-component';
import { buildAbsoluteAppRouteUrl } from '#/utils/share-route-context';
import DocumentCollectionModal from '#/views/ai/documentCollection/DocumentCollectionModal.vue';
import AiResourceCornerMeta from '#/views/ai/shared/AiResourceCornerMeta.vue';
import { confirmPublishSubmission } from '#/views/ai/shared/approval-application-reason';
import {
@@ -70,6 +70,29 @@ const collectionTypeLabelMap = {
};
type VisibilityScope = 'DEPT' | 'PRIVATE' | 'PUBLIC';
interface DocumentCollectionModalInstance {
openDialog: (row: Record<string, unknown>) => void;
}
const {
component: DocumentCollectionModalComponent,
componentRef: aiKnowledgeModalRef,
ensureInstance: ensureDocumentCollectionModal,
loading: knowledgeModalLoading,
} = createLazyComponentController<DocumentCollectionModalInstance>(
() => import('#/views/ai/documentCollection/DocumentCollectionModal.vue'),
);
async function openKnowledgeModal(row: Record<string, unknown>) {
try {
const modal = await ensureDocumentCollectionModal();
modal.openDialog(row);
} catch (error) {
console.error('Failed to load knowledge modal:', error);
ElMessage.error($t('message.getDataError'));
}
}
const canManageKnowledgePermission = computed(() =>
hasAccessByCodes(['/api/v1/documentCollection/save']),
);
@@ -205,7 +228,7 @@ const actions: ActionButton[] = [
if (!ensureManageKnowledgeItem(row)) {
return;
}
aiKnowledgeModalRef.value.openDialog(row);
void openKnowledgeModal(row);
},
},
{
@@ -460,7 +483,6 @@ function resolvePublishStatusMeta(
}
const pageDataRef = ref();
const aiKnowledgeModalRef = ref();
const headerButtons = [
{
key: 'add',
@@ -474,7 +496,7 @@ const headerButtons = [
const handleButtonClick = (event: any, _item: any) => {
switch (event.key) {
case 'add': {
aiKnowledgeModalRef.value.openDialog({});
void openKnowledgeModal({});
break;
}
}
@@ -667,7 +689,7 @@ function changeCategory(category: any) {
</script>
<template>
<div class="flex h-full flex-col gap-6 p-6">
<div v-loading="knowledgeModalLoading" class="flex h-full flex-col gap-6 p-6">
<div class="knowledge-header">
<HeaderSearch
:buttons="headerButtons"
@@ -865,7 +887,9 @@ function changeCategory(category: any) {
</EasyFlowFormModal>
<!-- 新增知识库模态框-->
<DocumentCollectionModal
<component
:is="DocumentCollectionModalComponent"
v-if="DocumentCollectionModalComponent"
ref="aiKnowledgeModalRef"
@reload="reloadKnowledgeList"
/>