fix(admin): 管理控制台界面使用element plus
This commit is contained in:
1 parent
6c47d0639c
commit
cdc8610ec1
45 files changed
+6258
-4639
No files matched your search
@@ -2,8 +2,8 @@
|
||||
/**
|
||||
* features/kb/components/KbAdminPanel.vue
|
||||
* 知识库配置面板(治理面:分组、Dify)。
|
||||
* 依赖:kb.api、Element Plus、DifySettingsDialog、DifyHealthDialog、Vue I18n。
|
||||
* 逻辑:管理控制台加载知识库分组;列表、表头排序、文档数筛选、分页和删除确认用 Element。排序和筛选都作用在全量数据上,再分页。新增/编辑走 KbGroupDrawer。
|
||||
* 依赖:kb.api、Element Plus、AdminListPage、DifySettingsDialog、DifyHealthDialog、Vue I18n。
|
||||
* 逻辑:管理控制台加载知识库分组。列表骨架用 AdminListPage。表头排序、文档数筛选、分页和删除确认用 Element。排序和筛选都作用在全量数据上,再分页。新增/编辑走 KbGroupDrawer。
|
||||
*/
|
||||
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
@@ -26,6 +26,7 @@ import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
|
||||
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
|
||||
import KbGroupDrawer, { type KbGroupFormValue } from './KbGroupDrawer.vue';
|
||||
import DifyHealthDialog from './DifyHealthDialog.vue';
|
||||
import DifySettingsDialog from './DifySettingsDialog.vue';
|
||||
@@ -269,50 +270,49 @@ defineExpose({ loadData });
|
||||
|
||||
<template>
|
||||
<ElConfigProvider :locale="elementLocale">
|
||||
<section class="admin-table-section">
|
||||
<div class="admin-table-header admin-table-header--stacked">
|
||||
<div class="min-w-0 flex-1">
|
||||
<AdminListPage>
|
||||
<template #title>
|
||||
<h2 class="section-title">{{ t('kbAdmin.groupsTitle') }}</h2>
|
||||
<p class="section-desc mt-1">{{ t('kbAdmin.groupManageSubtitle') }}</p>
|
||||
</div>
|
||||
<ElSpace wrap>
|
||||
<ElButton :icon="Setting" @click="settingsDialogOpen = true">{{ t('kbAdmin.difySettings') }}</ElButton>
|
||||
<ElButton :icon="CircleCheck" @click="healthDialogOpen = true">{{ t('kbAdmin.healthCheck') }}</ElButton>
|
||||
<ElButton :icon="Tools" @click="router.push(WORKSPACE_PATHS.knowledgeBase)">{{ t('kbAdmin.goWorkspace') }}</ElButton>
|
||||
<ElButton type="primary" :icon="Plus" @click="openCreateDrawer">{{ t('kbAdmin.form.create') }}</ElButton>
|
||||
</ElSpace>
|
||||
</div>
|
||||
<div class="kb-admin-filters">
|
||||
<div class="kb-element-filters">
|
||||
<ElInput
|
||||
v-model="searchKeyword"
|
||||
clearable
|
||||
:prefix-icon="Search"
|
||||
:placeholder="t('kbAdmin.filters.searchPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ElAlert
|
||||
v-if="feedback"
|
||||
class="kb-admin-alert"
|
||||
:title="feedback"
|
||||
:type="feedbackType === 'error' ? 'error' : 'success'"
|
||||
show-icon
|
||||
closable
|
||||
@close="feedback = ''"
|
||||
</template>
|
||||
<template #actions>
|
||||
<ElSpace wrap>
|
||||
<ElButton :icon="Setting" @click="settingsDialogOpen = true">{{ t('kbAdmin.difySettings') }}</ElButton>
|
||||
<ElButton :icon="CircleCheck" @click="healthDialogOpen = true">{{ t('kbAdmin.healthCheck') }}</ElButton>
|
||||
<ElButton :icon="Tools" @click="router.push(WORKSPACE_PATHS.knowledgeBase)">{{ t('kbAdmin.goWorkspace') }}</ElButton>
|
||||
<ElButton type="primary" :icon="Plus" @click="openCreateDrawer">{{ t('kbAdmin.form.create') }}</ElButton>
|
||||
</ElSpace>
|
||||
</template>
|
||||
<template #filters>
|
||||
<ElInput
|
||||
v-model="searchKeyword"
|
||||
clearable
|
||||
class="kb-filter-search"
|
||||
:prefix-icon="Search"
|
||||
:placeholder="t('kbAdmin.filters.searchPlaceholder')"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<ElTable
|
||||
v-loading="isRefreshing"
|
||||
class="hx-admin-table"
|
||||
:data="pagedGroups"
|
||||
row-key="id"
|
||||
:default-sort="{ prop: 'updated_at', order: 'descending' }"
|
||||
:empty-text="tableEmptyText"
|
||||
@sort-change="onSortChange"
|
||||
@filter-change="onFilterChange"
|
||||
>
|
||||
<ElAlert
|
||||
v-if="feedback"
|
||||
class="kb-admin-alert"
|
||||
:title="feedback"
|
||||
:type="feedbackType === 'error' ? 'error' : 'success'"
|
||||
show-icon
|
||||
closable
|
||||
@close="feedback = ''"
|
||||
/>
|
||||
|
||||
<ElTable
|
||||
v-loading="isRefreshing"
|
||||
class="hx-admin-table"
|
||||
:data="pagedGroups"
|
||||
row-key="id"
|
||||
:default-sort="{ prop: 'updated_at', order: 'descending' }"
|
||||
:empty-text="tableEmptyText"
|
||||
@sort-change="onSortChange"
|
||||
@filter-change="onFilterChange"
|
||||
>
|
||||
<ElTableColumn prop="name" :label="t('kbAdmin.table.name')" min-width="160" sortable="custom">
|
||||
<template #default="{ row }">
|
||||
<div class="truncate" :title="(row as KbGroup).name">{{ (row as KbGroup).name }}</div>
|
||||
@@ -348,18 +348,18 @@ defineExpose({ loadData });
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
|
||||
<div v-if="filteredGroups.length > 0" class="hx-admin-pager">
|
||||
<ElPagination
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
:total="filteredGroups.length"
|
||||
:page-sizes="pageSizeOptions"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
background
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
<template v-if="filteredGroups.length > 0" #pagination>
|
||||
<ElPagination
|
||||
v-if="filteredGroups.length > 0"
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
:total="filteredGroups.length"
|
||||
:page-sizes="pageSizeOptions"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
background
|
||||
/>
|
||||
</template>
|
||||
</AdminListPage>
|
||||
|
||||
<KbGroupDrawer
|
||||
v-model:form="form"
|
||||
@@ -376,28 +376,11 @@ defineExpose({ loadData });
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.kb-admin-filters {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 12px 24px;
|
||||
padding: 16px 32px;
|
||||
border-bottom: 1px solid var(--el-border-color-lighter);
|
||||
:deep(.kb-filter-search) {
|
||||
width: 16rem;
|
||||
}
|
||||
|
||||
.kb-admin-alert {
|
||||
margin: 16px 32px 0;
|
||||
}
|
||||
|
||||
.kb-element-filters {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.kb-element-filters :deep(.el-input) {
|
||||
width: 16rem;
|
||||
flex: none;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user