fix(knowdge-base): 知识库页面样式优化

This commit is contained in:
sophie committed 2026-07-02 16:38:29 +08:00
1 parent 09cd6fc3c7
commit 599475d4e2
5 files changed
+87 -122

No files matched your search

@@ -3,7 +3,8 @@
* features/kb/views/KbWorkspaceView.vue * features/kb/views/KbWorkspaceView.vue
* 知识库作业面视图壳:模板与弹窗布局,业务逻辑见 useKbWorkspace。 * 知识库作业面视图壳:模板与弹窗布局,业务逻辑见 useKbWorkspace。
*/ */
import { ArrowLeft, BookOpen, ChevronDown, ChevronUp, FileText, Info, RefreshCw, Search, Settings, Trash2, Upload } from 'lucide-vue-next'; import { ArrowLeft, BookOpen, ChevronDown, ChevronUp, FileText, Info, RefreshCw, Search, Settings, SquareCheck, Trash2, Upload } from 'lucide-vue-next';
import PaginationBar from '@/shared/components/PaginationBar.vue';
import KbWorkspaceOverlays from '../components/KbWorkspaceOverlays.vue'; import KbWorkspaceOverlays from '../components/KbWorkspaceOverlays.vue';
import { useKbWorkspace } from '../composables/useKbWorkspace'; import { useKbWorkspace } from '../composables/useKbWorkspace';
@@ -45,14 +46,6 @@ const kb = useKbWorkspace({ embedded: props.embedded });
</div> </div>
</div> </div>
<div class="flex flex-wrap items-center gap-3"> <div class="flex flex-wrap items-center gap-3">
<button
v-if="kb.viewMode !== 'group_overview'"
@click="kb.refreshCurrentView"
class="btn-secondary"
>
<RefreshCw class="h-4 w-4" />
{{ kb.t('kbWorkspace.actions.refreshDocuments') }}
</button>
<button <button
v-if="kb.viewMode === 'group_overview'" v-if="kb.viewMode === 'group_overview'"
type="button" type="button"
@@ -233,12 +226,6 @@ const kb = useKbWorkspace({ embedded: props.embedded });
<ChevronUp v-else class="h-4 w-4" /> <ChevronUp v-else class="h-4 w-4" />
</button> </button>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<button
@click="kb.openPathUploadHistoryModal(kb.latestPathUploadJob?.id || null)"
class="inline-flex items-center rounded-xl border border-default px-3 py-1.5 text-xs font-medium text-secondary transition-colors hover:bg-surface-soft hover-surface-soft"
>
{{ kb.t('kbWorkspace.pathUpload.viewHistory') }}
</button>
<button <button
v-if="kb.latestPathUploadJob && kb.hasRetryablePathUploadFailure(kb.latestPathUploadJob) && !kb.pathUploadRunning" v-if="kb.latestPathUploadJob && kb.hasRetryablePathUploadFailure(kb.latestPathUploadJob) && !kb.pathUploadRunning"
@click="kb.handleRetryFailedPathUpload(kb.latestPathUploadJob)" @click="kb.handleRetryFailedPathUpload(kb.latestPathUploadJob)"
@@ -293,57 +280,6 @@ const kb = useKbWorkspace({ embedded: props.embedded });
> >
<div class="flex flex-col gap-3 xl:flex-row xl:items-center xl:justify-between"> <div class="flex flex-col gap-3 xl:flex-row xl:items-center xl:justify-between">
<div class="flex flex-wrap items-center gap-2"> <div class="flex flex-wrap items-center gap-2">
<button
v-for="tab in kb.stageFilterTabs"
:key="tab.key"
@click="kb.documentStageFilter = tab.key"
class="inline-flex items-center gap-2 rounded-full border px-4 py-2 text-sm font-medium transition-colors"
:class="kb.documentStageFilter === tab.key
? 'border-brand-200 bg-brand-50 text-brand-700'
: 'border-default bg-surface text-secondary hover:bg-surface-soft'"
>
<span>{{ tab.label }}</span>
<span class="rounded-full bg-surface-soft px-2 py-0.5 text-xs">{{ tab.count }}</span>
</button>
</div>
<div class="flex flex-wrap items-center gap-3 text-sm text-muted">
<label class="relative min-w-[260px] flex-1 xl:w-80 xl:flex-none">
<Search class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted" />
<input
v-model.trim="kb.documentKeyword"
type="text"
class="w-full rounded-2xl border border-default bg-surface py-2.5 pl-10 pr-4 text-sm text-primary outline-none transition-colors focus:border-brand-300"
:placeholder="kb.t('kbWorkspace.documents.searchPlaceholder')"
/>
</label>
<button
v-if="kb.documentKeyword"
type="button"
@click="kb.documentKeyword = ''"
class="inline-flex items-center rounded-xl border border-default bg-surface px-3 py-2 text-sm font-medium text-secondary transition-colors hover:bg-surface-soft"
>
{{ kb.t('kbWorkspace.documents.clearSearch') }}
</button>
<label class="inline-flex items-center gap-2">
<span>{{ kb.t('kbWorkspace.common.perPage') }}</span>
<select
v-model.number="kb.documentListPageSize"
class="rounded-xl border border-default bg-surface px-3 py-1.5 text-sm text-secondary outline-none transition-colors focus:border-brand-300"
>
<option v-for="size in kb.DOCUMENT_PAGE_SIZE_OPTIONS" :key="size" :value="size">{{ size }}</option>
</select>
<span>{{ kb.t('kbWorkspace.common.countUnit') }}</span>
</label>
</div>
</div>
<div class="flex flex-col gap-3 border-t border-default pt-3 lg:flex-row lg:items-center lg:justify-between">
<div class="flex flex-wrap items-center gap-2">
<button
@click="kb.toggleSelectAllFiltered"
class="inline-flex items-center gap-2 rounded-full border border-default bg-surface px-4 py-2 text-sm font-medium text-secondary transition-colors hover:bg-surface-soft"
>
{{ kb.isAllFilteredSelected ? kb.t('kbWorkspace.pathUpload.deselectAllFiltered') : kb.t('kbWorkspace.pathUpload.selectAllFiltered') }}
</button>
<button <button
v-if="kb.isKbAdmin" v-if="kb.isKbAdmin"
@click="kb.handleBatchClean" @click="kb.handleBatchClean"
@@ -370,17 +306,52 @@ const kb = useKbWorkspace({ embedded: props.embedded });
<Trash2 class="h-4 w-4" /> <Trash2 class="h-4 w-4" />
{{ kb.batchActionLabel('delete', kb.batchSubmitting, kb.selectedDocuments.length) }} {{ kb.batchActionLabel('delete', kb.batchSubmitting, kb.selectedDocuments.length) }}
</button> </button>
</div>
</div>
<div class="flex flex-wrap items-center gap-3 text-sm text-muted">
<label class="relative w-full max-w-md">
<Search class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted" />
<input
v-model.trim="kb.documentKeyword"
type="text"
class="w-full rounded-2xl border border-default bg-surface py-2.5 pl-10 pr-4 text-sm text-primary outline-none transition-colors focus:border-brand-300"
:placeholder="kb.t('kbWorkspace.documents.searchPlaceholder')"
/>
</label>
<button <button
@click="kb.openPathUploadHistoryModal()" v-if="kb.documentKeyword"
class="inline-flex items-center gap-2 rounded-full border border-default bg-surface px-4 py-2 text-sm font-medium text-secondary transition-colors hover:bg-surface-soft" type="button"
@click="kb.documentKeyword = ''"
class="inline-flex items-center rounded-xl border border-default bg-surface px-3 py-2 text-sm font-medium text-secondary transition-colors hover:bg-surface-soft"
> >
<FileText class="h-4 w-4" /> {{ kb.t('kbWorkspace.documents.clearSearch') }}
{{ kb.t('kbWorkspace.documents.historyBatches') }}
</button> </button>
</div> </div>
<div class="flex flex-wrap items-center gap-3 text-sm text-muted">
<span>{{ kb.t('kbWorkspace.documents.selectedCount', { selected: kb.selectedDocuments.length, total: kb.filteredDocuments.length }) }}</span> <div class="flex flex-col gap-3 border-t border-default pt-3 xl:flex-row xl:items-center xl:justify-between">
<span v-if="kb.filteredDocuments.length > 0">{{ kb.t('kbWorkspace.documents.showingRange', { start: kb.pagedDocumentRange.start, end: kb.pagedDocumentRange.end }) }}</span> <div class="flex flex-wrap items-center gap-2">
<button
@click="kb.toggleSelectAllFiltered"
class="inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-muted transition-colors hover:bg-surface hover:text-brand-600"
:class="kb.isAllFilteredSelected ? 'bg-brand-50 text-brand-600' : ''"
:title="kb.isAllFilteredSelected ? kb.t('kbWorkspace.pathUpload.deselectAllFiltered') : kb.t('kbWorkspace.pathUpload.selectAllFiltered')"
:aria-label="kb.isAllFilteredSelected ? kb.t('kbWorkspace.pathUpload.deselectAllFiltered') : kb.t('kbWorkspace.pathUpload.selectAllFiltered')"
>
<SquareCheck class="h-[18px] w-[18px]" />
</button>
<button
v-for="tab in kb.stageFilterTabs.filter((item) => item.key !== 'all')"
:key="tab.key"
@click="kb.documentStageFilter = kb.documentStageFilter === tab.key ? 'all' : tab.key"
class="inline-flex items-center gap-2 rounded-full border px-4 py-2 text-sm font-medium transition-colors"
:class="kb.documentStageFilter === tab.key
? 'border-brand-200 bg-brand-50 text-brand-700'
: 'border-default bg-surface text-secondary hover:bg-surface-soft'"
>
<span>{{ tab.label }}</span>
<span class="rounded-full bg-surface-soft px-2 py-0.5 text-xs">{{ tab.count }}</span>
</button>
</div> </div>
</div> </div>
</div> </div>
@@ -403,7 +374,8 @@ const kb = useKbWorkspace({ embedded: props.embedded });
? 'border-brand-200 bg-brand-50/50 border-brand-200' ? 'border-brand-200 bg-brand-50/50 border-brand-200'
: 'border-default'" : 'border-default'"
> >
<div class="grid gap-3 2xl:grid-cols-[minmax(420px,1fr)_minmax(280px,auto)_minmax(320px,auto)] 2xl:items-center"> <div class="space-y-3">
<div class="grid gap-3 lg:grid-cols-[minmax(360px,1fr)_auto] lg:items-start">
<div class="flex min-w-0 gap-3"> <div class="flex min-w-0 gap-3">
<label class="mt-1 inline-flex shrink-0 cursor-pointer items-center"> <label class="mt-1 inline-flex shrink-0 cursor-pointer items-center">
<input <input
@@ -438,7 +410,6 @@ const kb = useKbWorkspace({ embedded: props.embedded });
> >
{{ doc.latest_version.source_file_name }} {{ doc.latest_version.source_file_name }}
</button> </button>
<span class="shrink-0">{{ kb.t('kbWorkspace.documents.updatedAt', { time: kb.formatDateTime(doc.updated_at) }) }}</span>
</div> </div>
<div <div
v-if="kb.getDocumentWorkflowState(doc).primaryError" v-if="kb.getDocumentWorkflowState(doc).primaryError"
@@ -449,18 +420,7 @@ const kb = useKbWorkspace({ embedded: props.embedded });
</div> </div>
</div> </div>
<div class="flex min-w-0 flex-wrap items-center gap-2 2xl:justify-end"> <div class="flex min-w-0 flex-wrap items-center gap-2 lg:justify-end">
<div
v-for="badge in kb.getWorkflowBadges(doc)"
:key="`${doc.id}-${badge.label}`"
class="inline-flex shrink-0 items-center rounded-full border px-3 py-1 text-xs font-semibold"
:class="badge.className"
>
{{ badge.label }}:{{ badge.value }}
</div>
</div>
<div class="flex min-w-0 flex-wrap items-center gap-2 2xl:justify-end">
<button <button
@click="kb.openDocumentDetail(doc.id)" @click="kb.openDocumentDetail(doc.id)"
class="inline-flex shrink-0 items-center gap-1 rounded-xl border border-violet-200 px-3 py-2 text-xs font-medium text-violet-700 transition-colors hover:bg-violet-50" class="inline-flex shrink-0 items-center gap-1 rounded-xl border border-violet-200 px-3 py-2 text-xs font-medium text-violet-700 transition-colors hover:bg-violet-50"
@@ -493,31 +453,32 @@ const kb = useKbWorkspace({ embedded: props.embedded });
</button> </button>
</div> </div>
</div> </div>
</div>
<div class="grid gap-3 border-t border-default pt-3 lg:grid-cols-[minmax(260px,1fr)_auto] lg:items-center">
<span class="min-w-0 text-xs text-muted">
{{ kb.t('kbWorkspace.documents.updatedAt', { time: kb.formatDateTime(doc.updated_at) }) }}
</span>
<div class="flex min-w-0 flex-wrap items-center gap-2 lg:justify-end">
<div <div
v-for="badge in kb.getWorkflowBadges(doc)"
:key="`${doc.id}-${badge.label}`"
class="inline-flex shrink-0 items-center rounded-full border px-3 py-1 text-xs font-semibold"
:class="badge.className"
>
{{ badge.label }}:{{ badge.value }}
</div>
</div>
</div>
</div>
</div>
<PaginationBar
v-if="kb.filteredDocuments.length > 0" v-if="kb.filteredDocuments.length > 0"
class="flex flex-wrap items-center justify-between gap-3 rounded-2xl border border-default px-4 py-3 " v-model:page="kb.documentListPage"
> v-model:page-size="kb.documentListPageSize"
<div class="text-sm text-muted"> :total="kb.filteredDocuments.length"
{{ kb.t('kbWorkspace.documents.pageInfo', { page: kb.documentListPage, totalPages: kb.filteredDocumentTotalPages, total: kb.filteredDocuments.length }) }} :pages="kb.filteredDocumentTotalPages"
</div> :page-size-options="[...kb.DOCUMENT_PAGE_SIZE_OPTIONS]"
<div class="flex items-center gap-2"> />
<button
@click="kb.documentListPage = Math.max(1, kb.documentListPage - 1)"
:disabled="kb.documentListPage === 1"
class="inline-flex items-center justify-center rounded-xl border border-default px-4 py-2 text-sm font-medium text-secondary transition-colors hover:bg-surface-soft disabled:cursor-not-allowed disabled:opacity-60 hover-surface-soft"
>
{{ kb.t('kbWorkspace.common.prevPage') }}
</button>
<button
@click="kb.documentListPage = Math.min(kb.filteredDocumentTotalPages, kb.documentListPage + 1)"
:disabled="kb.documentListPage === kb.filteredDocumentTotalPages"
class="inline-flex items-center justify-center rounded-xl border border-default px-4 py-2 text-sm font-medium text-secondary transition-colors hover:bg-surface-soft disabled:cursor-not-allowed disabled:opacity-60 hover-surface-soft"
>
{{ kb.t('kbWorkspace.common.nextPage') }}
</button>
</div>
</div>
</div> </div>
</div> </div>
</section> </section>
+4 -3
View File
@@ -1,4 +1,4 @@
{ {
"kbDifySettings": { "kbDifySettings": {
"title": "Dify Settings", "title": "Dify Settings",
"subtitle": "Manage Dify connection and default sync parameters for the knowledge base module.", "subtitle": "Manage Dify connection and default sync parameters for the knowledge base module.",
@@ -168,8 +168,8 @@
"infoTip": "Basic document entries in this group. Uploading files creates documents and starts cleaning automatically.", "infoTip": "Basic document entries in this group. Uploading files creates documents and starts cleaning automatically.",
"uploadPath": "Upload path", "uploadPath": "Upload path",
"uploadFile": "Upload file", "uploadFile": "Upload file",
"batchClean": "Clean data", "batchClean": "Batch clean",
"batchCleanCount": "Clean data ({count})", "batchCleanCount": "Batch clean ({count})",
"batchSync": "Batch sync", "batchSync": "Batch sync",
"batchSyncCount": "Batch sync ({count})", "batchSyncCount": "Batch sync ({count})",
"batchDelete": "Batch delete", "batchDelete": "Batch delete",
@@ -390,3 +390,4 @@
} }
} }
} }
+4 -3
View File
@@ -1,4 +1,4 @@
{ {
"kbDifySettings": { "kbDifySettings": {
"title": "ตั้งค่า Dify", "title": "ตั้งค่า Dify",
"subtitle": "จัดการการเชื่อมต่อ Dify และค่าซิงค์เริ่มต้นของโมดูลคลังความรู้", "subtitle": "จัดการการเชื่อมต่อ Dify และค่าซิงค์เริ่มต้นของโมดูลคลังความรู้",
@@ -168,8 +168,8 @@
"infoTip": "รายการเอกสารพื้นฐานในกลุ่มนี้ การอัปโหลดไฟล์จะสร้างเอกสารและเริ่มทำความสะอาดอัตโนมัติ", "infoTip": "รายการเอกสารพื้นฐานในกลุ่มนี้ การอัปโหลดไฟล์จะสร้างเอกสารและเริ่มทำความสะอาดอัตโนมัติ",
"uploadPath": "อัปโหลดจาก path", "uploadPath": "อัปโหลดจาก path",
"uploadFile": "อัปโหลดไฟล์", "uploadFile": "อัปโหลดไฟล์",
"batchClean": "ทำความสะอาดข้อมูล", "batchClean": "ทำความสะอาดเป็นชุด",
"batchCleanCount": "ทำความสะอาดข้อมูล ({count})", "batchCleanCount": "ทำความสะอาดเป็นชุด ({count})",
"batchSync": "ซิงค์เป็นชุด", "batchSync": "ซิงค์เป็นชุด",
"batchSyncCount": "ซิงค์เป็นชุด ({count})", "batchSyncCount": "ซิงค์เป็นชุด ({count})",
"batchDelete": "ลบเป็นชุด", "batchDelete": "ลบเป็นชุด",
@@ -390,3 +390,4 @@
} }
} }
} }
+4 -3
View File
@@ -1,4 +1,4 @@
{ {
"kbDifySettings": { "kbDifySettings": {
"title": "Dify 设置", "title": "Dify 设置",
"subtitle": "管理知识库模块使用的 Dify 连接和默认同步参数。", "subtitle": "管理知识库模块使用的 Dify 连接和默认同步参数。",
@@ -168,8 +168,8 @@
"infoTip": "当前分组下的基础文档条目,上传文件后将自动创建文档并开始清洗流程。", "infoTip": "当前分组下的基础文档条目,上传文件后将自动创建文档并开始清洗流程。",
"uploadPath": "上传路径", "uploadPath": "上传路径",
"uploadFile": "上传文件", "uploadFile": "上传文件",
"batchClean": "清洗数据", "batchClean": "批量清洗",
"batchCleanCount": "清洗数据({count})", "batchCleanCount": "批量清洗({count})",
"batchSync": "批量同步", "batchSync": "批量同步",
"batchSyncCount": "批量同步({count})", "batchSyncCount": "批量同步({count})",
"batchDelete": "批量删除", "batchDelete": "批量删除",
@@ -390,3 +390,4 @@
} }
} }
} }
+4 -3
View File
@@ -1,4 +1,4 @@
{ {
"kbDifySettings": { "kbDifySettings": {
"title": "Dify 設定", "title": "Dify 設定",
"subtitle": "管理知識庫模組使用的 Dify 連線和預設同步參數。", "subtitle": "管理知識庫模組使用的 Dify 連線和預設同步參數。",
@@ -168,8 +168,8 @@
"infoTip": "當前分組下的基礎文檔條目,上傳文件後將自動創建文檔並開始清洗流程。", "infoTip": "當前分組下的基礎文檔條目,上傳文件後將自動創建文檔並開始清洗流程。",
"uploadPath": "上傳路徑", "uploadPath": "上傳路徑",
"uploadFile": "上傳文件", "uploadFile": "上傳文件",
"batchClean": "清洗數據", "batchClean": "批量清洗",
"batchCleanCount": "清洗數據({count})", "batchCleanCount": "批量清洗({count})",
"batchSync": "批量同步", "batchSync": "批量同步",
"batchSyncCount": "批量同步({count})", "batchSyncCount": "批量同步({count})",
"batchDelete": "批量刪除", "batchDelete": "批量刪除",
@@ -390,3 +390,4 @@
} }
} }
} }