refactor(frontend): 统一 Element 语言注入并抽出全站皮肤

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
sophieandCursor committed 2026-10-27 19:49:05 +08:00
1 parent a10ecc8073
commit 81d82a88d5
28 files changed
+144 -240

No files matched your search

+1 -1
View File
@@ -18,4 +18,4 @@ globs: frontend/src/features/admin/**/*.vue,frontend/src/features/kb/components/
- 按钮、输入、下拉、表格、弹窗、分页用 Element Plus,不要新写 `<button>`、`<input>`、`<select>`、`<textarea>`。
- 不要新写 `btn-primary`、`btn-secondary`、`btn-ghost`、`btn-danger`、`input-field`、`select-field`。
- 图标用 `@element-plus/icons-vue`,不要新加 `lucide-vue-next`。
- 字号和颜色用 `element-trial.css` 里的 Element 变量,不要在单元格上写 `text-sm`、`text-xs`、`text-muted`。
- 字号和颜色用 `shared/styles/element-theme.css` 里的 Element 变量,不要在单元格上写 `text-sm`、`text-xs`、`text-muted`。
+1 -1
View File
@@ -6,7 +6,7 @@
这次改动如果碰到管理控制台、知识库配置,或已经换成 Element Plus 的页面,按 `docs/ui/ELEMENT_MIGRATION.md` §6 核对。没改界面就删掉下面的清单。
- [ ] 只在该页入口引入 Element 样式和 `element-trial.css`,并用 `ElConfigProvider` 包住。
- [ ] 只在该页入口引入 Element 样式。全站皮肤用 `element-theme.css`;管理列表用 `element-trial.css`(已包含全站皮肤)。不要再包 `ElConfigProvider`。
- [ ] 列表骨架符合规范 §3,左右 32px 对齐,只有一层卡片。
- [ ] 按钮符合规范 §4.1,没有 `size="small"` 和默认按钮混在一行。
- [ ] 表格状态是 `ElTag`,单元格没有 `text-xs` / `text-sm` / `text-muted`。
+16 -9
View File
@@ -21,21 +21,27 @@
```ts
import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/shared/styles/element-theme.css';
```
管理列表再加一行。`element-trial.css` 开头会引入 `element-theme.css`,所以管理页只引下面这一行即可,不必两份都写:
```ts
import '@/features/admin/styles/element-trial.css';
```
3. 用 `useElementProvider()` 取出 `elementLocale`,页面根上包 `ElConfigProvider`。亮暗靠现有 `html.dark` 加上面的暗色变量文件,不要在组件里再切一套主题算法。
3. 语言不要在页面里再包。`App.vue` 已用 `useElementProvider()` 取出 `elementLocale`,用 `ElConfigProvider` 包住整个 `router-view`。分页、日期、下拉等 Element 内置文案跟着界面语言走。页面和弹窗不要再包 `ElConfigProvider`,也不要写死 `zh-cn`。亮暗靠现有 `html.dark` 加上面的暗色变量文件,不要在组件里再切一套主题算法。
4. 使用 `v-loading` 时,在 `<script setup>` 里写 `const vLoading = ElLoading.directive`。
5. 文案继续用现有 i18n key。新增文案必须同时补齐 zh-CN / zh-TW / en / th。
6. 图标用 `@element-plus/icons-vue`,放进 `ElButton` 的 `icon` 属性。不要再把 `lucide-vue-next` 的图标塞进 Element 按钮。
`element-trial.css` 是管理端 Element 的公共皮肤,只放变量和与 Tailwind 共存的修正。某一页的列宽、筛选框宽度不要写进这个文件。
`shared/styles/element-theme.css` 是全站 Element 皮肤:主题变量,以及和 Tailwind 共存的按钮、输入框修正。对话页在暗色 CSS 之后引入它。`element-trial.css` 只放管理列表的表格内边距、分页条和表单补充说明,并在文件开头引入全站皮肤。某一页的列宽、筛选框宽度不要写进这两个文件。
---
## 2. 先写入变量,再换页面
下面这些变量已经写在 `frontend/src/features/admin/styles/element-trial.css` 的 `:root, html.dark` 里。Element 暗色表在 `html.dark` 上另有一份默认值,所以必须和亮色写在一起,后引入的文件才能盖过它。页面不要再各写一套字号和颜色。
下面这些变量已经写在 `frontend/src/shared/styles/element-theme.css` 的 `:root, html.dark` 里。Element 暗色表在 `html.dark` 上另有一份默认值,所以必须和亮色写在一起,后引入的文件才能盖过它。页面不要再各写一套字号和颜色。
| 变量 | 对齐到 | 用途 |
| --- | --- | --- |
@@ -135,16 +141,17 @@ section.admin-table-section 一张圆角卡片,页面上只此一层
### 4.6 语言
`useElementProvider` 已映射 zh-CN、zh-TW、en、th。新页面把 `elementLocale` 传给 `ElConfigProvider`,不要在某个弹窗里写死 `zh-cn`。
语言由 `App.vue` 统一注入。`useElementProvider` 映射 zh-CN、zh-TW、en、th,认不出的语言回退简体。新页面不要再包 `ElConfigProvider`,不要在弹窗里写死 `zh-cn`。
---
## 5. 不要这样做
- 不要在 `main.ts` 全量注册 Element。
- 不要在页面或弹窗里再包 `ElConfigProvider`。语言已在 `App.vue` 注入。
- 不要在同一工具栏里混用 `.btn-primary` 和 `ElButton`。
- 不要用 `!important` 压 Tailwind。Element 是静态 CSS,用更具体的选择器。单行输入框内部的蓝竖线,只重置 `.el-input__inner`,见 `element-trial.css`。
- 不要改全局 `svg { display }`。按钮图标的横向排列只写在 `element-trial.css` 的 `.el-button` 上。
- 不要用 `!important` 压 Tailwind。Element 是静态 CSS,用更具体的选择器。单行输入框内部的蓝竖线,只重置 `.el-input__inner`,见 `element-theme.css`。
- 不要改全局 `svg { display }`。按钮图标的横向排列只写在 `element-theme.css` 的 `.el-button` 上。
- 不要新增第二套组件库,也不要在已换 Element 的页面里再手写一套输入框样式。
- 不要为了换皮去改接口、分页协议和权限判断。
@@ -154,7 +161,7 @@ section.admin-table-section 一张圆角卡片,页面上只此一层
换完一页,逐项核对:
- [ ] 只在该页入口引入 Element 样式和 `element-trial.css`,并用 `ElConfigProvider` 包住。
- [ ] 只在该页入口引入 Element 样式。全站皮肤用 `element-theme.css`;管理列表用 `element-trial.css`(已包含全站皮肤)。不要再包 `ElConfigProvider`。
- [ ] 列表骨架符合 §3,左右 32px 对齐,只有一层卡片。
- [ ] 按钮符合 §4.1,没有 `size="small"` 和默认按钮混在一行。
- [ ] 表格状态是 `ElTag`,单元格没有 `text-xs` / `text-sm` / `text-muted`。
@@ -174,7 +181,7 @@ section.admin-table-section 一张圆角卡片,页面上只此一层
| 现象 | 原因 | 处理 |
| --- | --- | --- |
| 按钮里图标和文字分成两行 | Tailwind preflight 把 `svg` 设成 `display: block` | 只在 `.el-button` 上改为横向 flex,已写在 `element-trial.css` |
| 按钮里图标和文字分成两行 | Tailwind preflight 把 `svg` 设成 `display: block` | 只在 `.el-button` 上改为横向 flex,已写在 `element-theme.css` |
| 搜索框聚焦时内部多两条蓝竖线 | `@tailwindcss/forms` 给内部 `input` 加了边框 | 只重置 `.el-input__inner` 的边框和阴影 |
| 多行输入框看起来没有边框 | 上一行修正误伤了 `.el-textarea__inner` | 文本域保留 Element 的内阴影边框 |
| 筛选框每个占满一行 | `ElInput` / `ElSelect` 默认 `width: 100%` | 外层限定宽度,靠左排列 |
@@ -252,7 +259,7 @@ npm run lint
## 10. 建议的切换顺序
1. §2 的变量已写入 `element-trial.css`。换下一页之前,在暗色下打开一张已换页面,看按钮、表格和弹窗是否跟着令牌变。
1. §2 的变量已写入 `shared/styles/element-theme.css`。换下一页之前,在暗色下打开一张已换页面,看按钮、表格和弹窗是否跟着令牌变。
2. 三个试点的列表、短弹窗和应用配置创建/编辑表单内部已按 §6 收过。部门管理也已换成 `AdminListPage`。
3. 之后每个管理端列表按 §6 的清单换,一页一次,骨架用 `AdminListPage`。合并请求用 `.gitee/PULL_REQUEST_TEMPLATE.md` 里的清单。换完再开下一页。
4. §9.1 路径里的页面都换完后,按 §9.2 把 ESLint 规则改成 `error` 并接到 CI。
+6 -24
View File
@@ -2,17 +2,15 @@
/**
* App.vue
* 根组件:主题初始化、全局消息弹窗、401 登出监听、html lang 与 i18n locale 同步。
* 依赖:useTheme、useGlobalMessageDialog、auth、linked-nav.store。
* 依赖:useTheme、useGlobalMessageDialog、auth、linked-nav.store、useElementProvider。
* 逻辑:已登录时预取关联服务侧栏入口,避免页面切换后入口后闪现。
* 书签/刷新冷启动遇到 401 时只回登录页;本页已确认会话后中途失效才弹窗。
* Element 内置文案由根上的 ElConfigProvider 跟随 vue-i18n。页面不要再包一层。
*/
import { useI18n } from 'vue-i18n';
import { computed, watch, onMounted, onBeforeUnmount } from 'vue';
import { watch, onMounted, onBeforeUnmount } from 'vue';
import { ElConfigProvider } from 'element-plus';
import zhCn from 'element-plus/es/locale/lang/zh-cn';
import zhTw from 'element-plus/es/locale/lang/zh-tw';
import en from 'element-plus/es/locale/lang/en';
import th from 'element-plus/es/locale/lang/th';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import { useTheme } from '@/shared/composables/useTheme';
import LevelMessageDialog from '@/shared/components/LevelMessageDialog.vue';
import { useGlobalMessageDialog } from '@/shared/composables/useGlobalMessageDialog';
@@ -23,23 +21,7 @@ import { useLinkedNavStore } from '@/features/sso/stores/linked-nav.store';
const router = useRouter();
const { locale, t } = useI18n();
/**
* Element Plus 组件内置文案(下拉占位/日期面板/分页等)跟随应用语言:
* EP 有独立 locale 体系,默认英文,必须在根部经 el-config-provider 注入当前语言包。
*/
const elementPlusLocale = computed(() => {
switch (locale.value) {
case 'zh-TW':
return zhTw;
case 'en':
return en;
case 'th':
return th;
default:
return zhCn;
}
});
const { elementLocale } = useElementProvider();
const { themePreference, initTheme, setThemePreference } = useTheme();
const {
messageDialogVisible,
@@ -158,7 +140,7 @@ onBeforeUnmount(() => {
</script>
<template>
<el-config-provider :locale="elementPlusLocale">
<el-config-provider :locale="elementLocale">
<router-view />
<LevelMessageDialog
v-model="messageDialogVisible"
@@ -1,8 +1,9 @@
/**
* features/admin/composables/useElementProvider.ts
* 用途:管理端 Element Plus 试点的界面语言。
* 用途:把当前界面语言映射成 Element Plus 语言包。
* 依赖:element-plus locale、vue-i18n。
* 逻辑:UsersPage、AgentsPage、KbAdminPanel 把 elementLocale 传给 ElConfigProvider;亮暗靠 html.dark 与 Element 暗色变量,不在这里重复切换。
* 逻辑:只由 App.vue 根上的 ElConfigProvider 使用。页面和弹窗不要再包一层。
* 亮暗靠 html.dark 与 Element 暗色变量,不在这里切换。
*/
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
@@ -20,8 +21,8 @@ const ELEMENT_LOCALES = {
/**
* 取当前界面语言对应的 Element Plus 语言包。
* 核心逻辑:未知语言回退简体中文。
* @returns elementLocale,随 vue-i18n 语言变化
* 核心逻辑:zh-CN、zh-TW、en、th 各用官方语言包,未知语言回退简体中文。
* @returns elementLocale,随 vue-i18n 语言变化。交给 App.vue 的 ElConfigProvider。
*/
export function useElementProvider() {
const { locale } = useI18n();
@@ -12,7 +12,6 @@ import { useI18n } from 'vue-i18n';
import { Plus } from '@element-plus/icons-vue';
import {
ElButton,
ElConfigProvider,
ElEmpty,
ElLoading,
ElTable,
@@ -22,7 +21,6 @@ import {
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 AgentFormModal from './components/AgentFormModal.vue';
import AgentPermissionModal from './components/AgentPermissionModal.vue';
import AgentTestModal from './components/AgentTestModal.vue';
@@ -30,7 +28,6 @@ import { useAgentsAdmin } from './composables/useAgentsAdmin';
import type { AgentRow } from '@/features/admin/types/agent.types';
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const vLoading = ElLoading.directive;
const {
@@ -183,7 +180,6 @@ onMounted(() => {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<section class="admin-table-section min-h-64">
<div class="admin-table-header admin-table-header--stacked">
<div>
@@ -298,7 +294,6 @@ onMounted(() => {
@toggle-user="togglePermissionUser"
/>
</section>
</ElConfigProvider>
</template>
<style scoped>
@@ -1,26 +1,24 @@
/**
* features/admin/modules/announcements/AnnouncementsPage.vue
* 用途:公告管理列表。一张卡片里放标题、发布按钮和表格。
* 依赖:AdminListPage、useAnnouncementsAdmin、useElementProvider、element-plus、公告表单和详情对话框。
* 依赖:AdminListPage、useAnnouncementsAdmin、element-plus、公告表单和详情对话框。
* 逻辑:路由 /admin/announcements。骨架用 AdminListPage。发布、编辑、查看仍由本页的两个对话框完成。删除用 Element 确认框。
*/
<script setup lang="ts">
import { onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { Plus } from '@element-plus/icons-vue';
import { ElButton, ElConfigProvider, ElTable, ElTableColumn } from 'element-plus';
import { ElButton, ElTable, ElTableColumn } from 'element-plus';
import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import type { AdminAnnouncementRow } from '@/features/admin/types/admin.types';
import AnnouncementDetailModal from './components/AnnouncementDetailModal.vue';
import AnnouncementFormModal from './components/AnnouncementFormModal.vue';
import { useAnnouncementsAdmin } from './composables/useAnnouncementsAdmin';
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const {
announcements,
@@ -57,7 +55,6 @@ onMounted(() => {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<AdminListPage :loading="isLoading">
<template #title>
<h2 class="section-title">{{ t('admin.announcement.title') }}</h2>
@@ -113,7 +110,6 @@ onMounted(() => {
@close="closeDetailModal"
@edit="editFromDetail"
/>
</ElConfigProvider>
</template>
<style scoped>
@@ -1,25 +1,23 @@
/**
* features/admin/modules/approvals/ApprovalsPage.vue
* 用途:用户注册审批列表。一张卡片里放标题和待审表格。
* 依赖:AdminListPage、useApprovalsAdmin、useElementProvider、element-plus、roleLabel。
* 依赖:AdminListPage、useApprovalsAdmin、element-plus、roleLabel。
* 逻辑:路由未挂进当前菜单。通过和拒绝由 composable 弹出 Element 确认框后调接口。
*/
<script setup lang="ts">
import { onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { CircleCheck, Delete } from '@element-plus/icons-vue';
import { ElButton, ElConfigProvider, ElTable, ElTableColumn, ElTag } from 'element-plus';
import { ElButton, ElTable, ElTableColumn, ElTag } from 'element-plus';
import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import { adminRoleLabel } from '@/features/admin/utils/roleLabel';
import type { AdminUserRow } from '@/features/admin/types/admin.types';
import { useApprovalsAdmin } from './composables/useApprovalsAdmin';
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const {
pendingUsers,
@@ -35,7 +33,6 @@ onMounted(() => {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<AdminListPage :loading="isLoading">
<template #title>
<h2 class="section-title">{{ t('admin.approval.title') }}</h2>
@@ -90,5 +87,4 @@ onMounted(() => {
</ElTableColumn>
</ElTable>
</AdminListPage>
</ElConfigProvider>
</template>
@@ -1,7 +1,7 @@
/**
* features/admin/modules/dashboard/DashboardPage.vue
* 用途:管理后台仪表盘,四张可点击的统计卡。
* 依赖:useDashboardAdmin、useElementProvider、element-plus。
* 依赖:useDashboardAdmin、element-plus。
* 逻辑:路由 /admin/dashboard。统计来自 useDashboardAdmin。点击分别进入应用配置、应用权限和数据报表。本页不是列表,不用 AdminListPage。
*/
<script setup lang="ts">
@@ -9,17 +9,15 @@ import { onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import { ChatDotRound, DataAnalysis, Monitor, User } from '@element-plus/icons-vue';
import { ElCard, ElConfigProvider, ElIcon, ElLoading, ElStatistic, ElTag } from 'element-plus';
import { ElCard, ElIcon, ElLoading, ElStatistic, ElTag } from 'element-plus';
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 { useDashboardAdmin } from './composables/useDashboardAdmin';
const vLoading = ElLoading.directive;
const { t } = useI18n();
const router = useRouter();
const { elementLocale } = useElementProvider();
const {
agentCount,
@@ -49,7 +47,6 @@ onMounted(() => {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<section v-loading="isLoading" class="admin-dash">
<h2 class="section-title">{{ t('admin.nav.dashboard') }}</h2>
<div v-if="!isLoading" class="admin-dash__grid">
@@ -83,7 +80,6 @@ onMounted(() => {
</ElCard>
</div>
</section>
</ElConfigProvider>
</template>
<style scoped>
@@ -1,7 +1,7 @@
/**
* features/admin/modules/departments/DepartmentsPage.vue
* 用途:部门管理列表。一张卡片里放标题、添加按钮、搜索、表格。
* 依赖:AdminListPage、useDepartmentsAdmin、useElementProvider、element-plus、部门表单和员工名单弹窗。
* 依赖:AdminListPage、useDepartmentsAdmin、element-plus、部门表单和员工名单弹窗。
* 逻辑:路由 /admin/departments。骨架用 AdminListPage。筛选、列和两个弹窗留在本页。
* 名称、编码、公司用表头排序,排的是当前过滤结果。删除用 Element 确认框。
* 表格用 Element stripe 斑马纹。员工数、编辑、删除用 Element 链接按钮,悬停文案走 i18n title。
@@ -12,7 +12,6 @@ import { useI18n } from 'vue-i18n';
import { Delete, Edit, Plus, User } from '@element-plus/icons-vue';
import {
ElButton,
ElConfigProvider,
ElInput,
ElLoading,
ElTable,
@@ -22,7 +21,6 @@ import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import type { AdminDepartmentMembersResponse, AdminDepartmentRow } from '@/features/admin/types/admin.types';
import DepartmentFormModal from './components/DepartmentFormModal.vue';
import DepartmentMembersModal from './components/DepartmentMembersModal.vue';
@@ -34,7 +32,6 @@ const vLoading = ElLoading.directive;
const { t } = useI18n();
const msg = useMessage();
const { elementLocale } = useElementProvider();
const showMembersModal = ref(false);
const departmentMembers = ref<AdminDepartmentMembersResponse | null>(null);
@@ -110,7 +107,6 @@ onMounted(() => {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<AdminListPage :loading="isLoading">
<template #title>
<h2 class="section-title">{{ t('admin.dept.title') }}</h2>
@@ -202,7 +198,6 @@ onMounted(() => {
:data="departmentMembers"
@close="showMembersModal = false"
/>
</ElConfigProvider>
</template>
<style scoped>
@@ -10,7 +10,6 @@ import { useI18n } from 'vue-i18n';
import { Plus } from '@element-plus/icons-vue';
import {
ElButton,
ElConfigProvider,
ElSwitch,
ElTable,
ElTableColumn,
@@ -21,7 +20,6 @@ import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import AdminListTabs from '@/features/admin/components/AdminListTabs.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import IntegrationConnectorFormDrawer from './components/IntegrationConnectorFormDrawer.vue';
import IntegrationCapabilityCallModal from './components/IntegrationCapabilityCallModal.vue';
import IntegrationCallLogsPanel from './components/IntegrationCallLogsPanel.vue';
@@ -35,7 +33,6 @@ import type {
} from './types/integration-connector.types';
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const {
clients, interfaces, bindings, credentials, capabilities, credentialTypes,
@@ -207,7 +204,6 @@ function onListTab(name: string): void {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<AdminListPage :loading="isLoading">
<template #title>
<h2 class="section-title">{{ t('admin.integrationConnector.title') }}</h2>
@@ -544,7 +540,6 @@ function onListTab(name: string): void {
@close="closeCallModal"
@run="runCall"
/>
</ElConfigProvider>
</template>
<style scoped>
@@ -1,7 +1,7 @@
/**
* features/admin/modules/linked-services/LinkedServicesPage.vue
* 用途:关联服务列表。一张卡片里放标题、新增按钮和表格。
* 依赖:AdminListPage、useLinkedServicesAdmin、useElementProvider、element-plus、关联服务表单对话框。
* 依赖:AdminListPage、useLinkedServicesAdmin、element-plus、关联服务表单对话框。
* 逻辑:路由 /admin/linked-services。启用项会出现在对话和工作台侧栏。删除用 Element 确认框。
*/
<script setup lang="ts">
@@ -10,7 +10,6 @@ import { useI18n } from 'vue-i18n';
import { Plus } from '@element-plus/icons-vue';
import {
ElButton,
ElConfigProvider,
ElSwitch,
ElTable,
ElTableColumn,
@@ -19,13 +18,11 @@ import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import type { AdminLinkedServiceRow } from '@/features/admin/types/linked-service.types';
import LinkedServiceFormModal from './components/LinkedServiceFormModal.vue';
import { useLinkedServicesAdmin } from './composables/useLinkedServicesAdmin';
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const {
services,
@@ -56,7 +53,6 @@ onMounted(() => {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<AdminListPage :loading="isLoading">
<template #title>
<h2 class="section-title">{{ t('admin.linkedServices.title') }}</h2>
@@ -110,7 +106,6 @@ onMounted(() => {
@close="closeFormModal"
@save="saveService"
/>
</ElConfigProvider>
</template>
<style scoped>
@@ -1,7 +1,7 @@
/**
* features/admin/modules/permissions/PermissionsPage.vue
* 用途:应用权限页。已种子权限组时以角色包为主、矩阵只读;否则保留历史按人勾选。
* 依赖:AdminListPage、AdminListTabs、usePermissionsAdmin、useElementProvider、element-plus、RoleEditModal、RoleMembersConfirmDialog、UserPickerDialog、BatchPermissionModal。
* 依赖:AdminListPage、AdminListTabs、usePermissionsAdmin、element-plus、RoleEditModal、RoleMembersConfirmDialog、UserPickerDialog、BatchPermissionModal。
* 逻辑:路由 /admin/permissions。骨架用 AdminListPage。角色/矩阵用 AdminListTabs。
* 点人数打开选人弹窗,确定后必须确认增减才写库。删除和重写入口确认用 ElMessageBox。
*/
@@ -12,7 +12,6 @@ import { Download, Plus, Upload, User } from '@element-plus/icons-vue';
import {
ElButton,
ElCheckbox,
ElConfigProvider,
ElInput,
ElLoading,
ElOption,
@@ -28,7 +27,6 @@ import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import AdminListTabs from '@/features/admin/components/AdminListTabs.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import BatchPermissionModal from '@/features/admin/modules/users/components/BatchPermissionModal.vue';
import { getUserAvatarLabel } from '@/shared/utils/user-avatar';
import UserPickerDialog from '@/shared/components/UserPickerDialog.vue';
@@ -42,7 +40,6 @@ import { usePermissionsAdmin } from './composables/usePermissionsAdmin';
const vLoading = ElLoading.directive;
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const csvInputRef = ref<HTMLInputElement | null>(null);
const {
@@ -134,7 +131,6 @@ onMounted(() => {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<AdminListPage :loading="isLoading">
<template #title>
<h2 class="section-title">{{ t('admin.perm.title') }}</h2>
@@ -400,7 +396,6 @@ onMounted(() => {
@cancel="cancelMembersConfirm"
@confirm="applyMembers"
/>
</ElConfigProvider>
</template>
<style scoped>
@@ -1,7 +1,7 @@
/**
* features/admin/modules/platform-apps/PlatformAppsPage.vue
* 用途:平台应用说明(新手指南)管理。按应用筛选指南,维护上传、启停与排序。
* 依赖:AdminListPage、useElementProvider、element-plus、admin.api 指南 CRUD/上传、vue-i18n。
* 依赖:AdminListPage、element-plus、admin.api 指南 CRUD/上传、vue-i18n。
* 逻辑:Admin 路由挂载。选择应用后拉取指南列表。创建/编辑用对话框,删除用 Element 确认框。
*/
<script setup lang="ts">
@@ -11,7 +11,6 @@ import { Plus } from '@element-plus/icons-vue';
import {
ElAlert,
ElButton,
ElConfigProvider,
ElDialog,
ElForm,
ElFormItem,
@@ -30,7 +29,6 @@ import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import {
createAdminAgentGuide,
deleteAdminAgentGuide,
@@ -43,7 +41,6 @@ import {
const vLoading = ElLoading.directive;
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const agents = ref<any[]>([]);
const selectedAgentId = ref<number | ''>('');
@@ -333,7 +330,6 @@ const formatSize = (bytes: number) => {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<AdminListPage>
<template #title>
<h2 class="section-title">{{ t('admin.nav.platformApps') }}</h2>
@@ -499,7 +495,6 @@ const formatSize = (bytes: number) => {
</ElButton>
</template>
</ElDialog>
</ElConfigProvider>
</template>
<style scoped>
@@ -1,7 +1,7 @@
/**
* features/admin/modules/procurement-contract/ProcurementContractPage.vue
* 用途:采购合同审查管理。一张卡片里放模板库、风险规则、审查历史三个页签。
* 依赖:AdminListPage、AdminListTabs、useElementProvider、element-plus、procurement-contract.api、
* 依赖:AdminListPage、AdminListTabs、element-plus、procurement-contract.api、
* contract-ocr-match-tokens、ContractRiskRulesPanel、useMessage、vue-i18n。
* 逻辑:Admin 路由挂载。页签用 AdminListTabs,筛选和表格走 AdminListPage。上传、区域配置、详情用对话框。
* 删除用 Element 确认框。下载和保存仍走原有接口,参数不变。
@@ -15,7 +15,6 @@ import {
ElButton,
ElCheckbox,
ElCheckboxGroup,
ElConfigProvider,
ElDescriptions,
ElDescriptionsItem,
ElDialog,
@@ -37,7 +36,6 @@ import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import AdminListTabs from '@/features/admin/components/AdminListTabs.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import {
createAdminContractTemplate,
deleteAdminContractTemplate,
@@ -65,7 +63,6 @@ const vLoading = ElLoading.directive;
const { t } = useI18n();
const msg = useMessage();
const { elementLocale } = useElementProvider();
type ContractTab = 'templates' | 'rules' | 'reviews';
type TagType = 'primary' | 'success' | 'warning' | 'info' | 'danger';
@@ -701,7 +698,6 @@ function defaultLabel(isDefault: boolean): string {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<AdminListPage>
<template #title>
<h2 class="section-title">{{ t('admin.procurementContract.title') }}</h2>
@@ -1135,7 +1131,6 @@ function defaultLabel(isDefault: boolean): string {
</div>
</template>
</ElDialog>
</ElConfigProvider>
</template>
<style scoped>
@@ -1,7 +1,7 @@
/**
* features/admin/modules/questions/QuestionsPage.vue
* 用途:常用问题管理页。一张卡片里放标题、添加按钮、页签、筛选和表格。
* 依赖:AdminListPage、AdminListTabs、useQuestionsAdmin、useElementProvider、element-plus、QuestionFormModal、HotFaqCandidatesPanel。
* 依赖:AdminListPage、AdminListTabs、useQuestionsAdmin、element-plus、QuestionFormModal、HotFaqCandidatesPanel。
* 逻辑:路由 /admin/questions。骨架用 AdminListPage,页签用 AdminListTabs。
* 筛选、表格留在本页;热点候选由页签内容区的面板自己渲染。删除在 composable 里用 Element 确认框。
*/
@@ -12,7 +12,6 @@ import { Plus } from '@element-plus/icons-vue';
import {
ElButton,
ElCheckbox,
ElConfigProvider,
ElInput,
ElLoading,
ElOption,
@@ -26,7 +25,6 @@ import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import AdminListTabs from '@/features/admin/components/AdminListTabs.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import type { AdminQuickQuestionRow } from '@/features/admin/types/question.types';
import HotFaqCandidatesPanel from './components/HotFaqCandidatesPanel.vue';
import QuestionFormModal from './components/QuestionFormModal.vue';
@@ -35,7 +33,6 @@ import { useQuestionsAdmin } from './composables/useQuestionsAdmin';
const vLoading = ElLoading.directive;
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const activeTab = ref<'manual' | 'hot'>('manual');
const {
@@ -106,7 +103,6 @@ onMounted(() => {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<AdminListPage>
<template #title>
<h2 class="section-title">{{ t('admin.question.title') }}</h2>
@@ -242,7 +238,6 @@ onMounted(() => {
@save="saveQuestion"
@review="saveReviewQuestion"
/>
</ElConfigProvider>
</template>
<style scoped>
@@ -1,7 +1,7 @@
/**
* features/admin/modules/reports/ReportsPage.vue
* 用途:管理后台数据报表。使用分析、运营总览是仪表盘;问题分析、应用运营、聊天日志和反馈是列表。
* 依赖:useReportsAdmin、AdminListPage、AdminListTabs、useElementProvider、element-plus、@element-plus/icons-vue。
* 依赖:useReportsAdmin、AdminListPage、AdminListTabs、element-plus、@element-plus/icons-vue。
* 逻辑:路由 /admin/reports/:table?。看板块用 ElCard;有表格的页签用 AdminListPage。
* 反馈页签用 AdminListTabs。筛选和分页沿用 composable 里的原状态。删除聊天日志用 Element 确认框。
*/
@@ -24,7 +24,6 @@ import {
ElButton,
ElCard,
ElCheckbox,
ElConfigProvider,
ElDatePicker,
ElDescriptions,
ElDescriptionsItem,
@@ -48,14 +47,12 @@ import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import AdminListTabs from '@/features/admin/components/AdminListTabs.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import type { ApplicationReportItem, ApplicationSortKey, ApplicationUsageFilter } from '@/features/admin/types/report.types';
import { formatLocalDateTime } from '@/shared/utils/dateTime';
import { useReportsAdmin } from './composables/useReportsAdmin';
const vLoading = ElLoading.directive;
const { t } = useI18n();
const { elementLocale } = useElementProvider();
/** 通用报表行。动态列,字段随当前表变化。 */
interface ReportTableRow {
@@ -857,7 +854,6 @@ onMounted(() => {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<div v-loading="isLoading" class="report-page" :class="{ 'is-fullscreen': isFullScreen }">
<template v-if="!isLoading">
<section v-if="isUsageAnalysisTable" class="report-dash">
@@ -1899,7 +1895,6 @@ onMounted(() => {
<ElButton @click="closeChatLogDetail">{{ t('admin.report.chatLog.close') }}</ElButton>
</template>
</ElDialog>
</ElConfigProvider>
</template>
<style scoped>
@@ -2,15 +2,13 @@
* features/admin/modules/schedules/SchedulesPage.vue
* 用途:定时任务管理独立页面壳层。路由:/admin/schedules
* 依赖:useSchedulesAdmin、schedules.context、Element Plus、子 panel/overlays。
* 逻辑:reactive + provide admin;ElConfigProvider 包裹 admin-table-section;概览/工作台切换。
* 逻辑:reactive + provide admin;概览/工作台切换。
*/
<script setup lang="ts">
import { onMounted, provide, reactive } from 'vue';
import { ElConfigProvider } from 'element-plus';
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 { useSchedulesAdmin } from './composables/useSchedulesAdmin';
import {
SCHEDULES_ADMIN_KEY,
@@ -22,7 +20,6 @@ import ScheduleOverviewPanel from './components/ScheduleOverviewPanel.vue';
import ScheduleWorkbenchPanel from './components/ScheduleWorkbenchPanel.vue';
import SchedulesPageOverlays from './components/SchedulesPageOverlays.vue';
const { elementLocale } = useElementProvider();
const adminApi = useSchedulesAdmin();
const admin = reactive(adminApi) as SchedulesAdminContextProvided;
provide(SCHEDULES_ADMIN_KEY, admin);
@@ -36,12 +33,10 @@ onMounted(async () => {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<section class="admin-table-section animate-fade-in-up">
<SchedulePageHeader />
<ScheduleOverviewPanel v-if="admin.scheduleViewMode === 'overview'" />
<ScheduleWorkbenchPanel v-else />
</section>
<SchedulesPageOverlays />
</ElConfigProvider>
</template>
@@ -2,7 +2,7 @@
/**
* features/admin/modules/training-config/TrainingConfigPage.vue
* 用途:培训类型、资料、题库、复盘和精益周任务的后台配置界面。
* 依赖:AdminListTabs、admin.api 培训配置接口、training-config.types、TrainingTypeFormModal、LeanTargetModal、useElementProvider、element-plus。
* 依赖:AdminListTabs、admin.api 培训配置接口、training-config.types、TrainingTypeFormModal、LeanTargetModal、element-plus。
* 逻辑:培训类型用 AdminListTabs 切换;分区单选只展示当前卡片,避免高亮和可见内容错位。保存条留在内容列底部,不盖住表单。本页是配置工作台,不是列表,不用 AdminListPage。删除用 Element 确认框。保存时仍把题目同步到 settings 与内嵌题目资源后提交既有 API。
*/
import { computed, onMounted, ref } from 'vue';
@@ -27,7 +27,6 @@ import {
ElButton,
ElCard,
ElCheckbox,
ElConfigProvider,
ElDatePicker,
ElForm,
ElFormItem,
@@ -49,7 +48,6 @@ import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListTabs from '@/features/admin/components/AdminListTabs.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import { useMessage } from '@/shared/composables/useMessage';
import {
createAdminTrainingConfig,
@@ -85,7 +83,6 @@ import TrainingTypeFormModal from './components/TrainingTypeFormModal.vue';
import LeanTargetModal from './components/LeanTargetModal.vue';
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const vLoading = ElLoading.directive;
const msg = useMessage();
const configs = ref<TrainingConfig[]>([]);
@@ -929,7 +926,6 @@ onMounted(() => void load());
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<div v-loading="isLoading" class="training-page">
<header class="training-page__head">
<h2 class="section-title">{{ t('admin.trainingConfig.title') }}</h2>
@@ -1502,7 +1498,6 @@ onMounted(() => void load());
@save="handleLeanTargetSave"
/>
</div>
</ElConfigProvider>
</template>
<style scoped>
@@ -1,7 +1,7 @@
/**
* features/admin/modules/users/UsersPage.vue
* 用途:用户管理独立页面(服务端筛选分页、用户/部门列排序、批量操作)。
* 依赖:useUsersAdmin、useElementProvider、element-plus、用户相关 Modal、adminRoleLabel、getUserAvatarLabel。
* 依赖:useUsersAdmin、element-plus、用户相关 Modal、adminRoleLabel、getUserAvatarLabel。
* 逻辑:路由 /admin/users。列表骨架用 AdminListPage;筛选、表格、分页和三个业务弹窗仍由本页组装。
* 删除和改角色用 Element 确认框。列表经 listAdminUsersPage 按页拉取。
*/
@@ -11,7 +11,6 @@ import { useI18n } from 'vue-i18n';
import { Delete, Edit, Plus, User } from '@element-plus/icons-vue';
import {
ElButton,
ElConfigProvider,
ElInput,
ElLoading,
ElOption,
@@ -28,7 +27,6 @@ import '@/features/admin/styles/element-trial.css';
import { adminRoleLabel } from '@/features/admin/utils/roleLabel';
import { getUserAvatarLabel } from '@/shared/utils/user-avatar';
import type { AdminUserRow } from '@/features/admin/types/admin.types';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import BatchEditUserModal from './components/BatchEditUserModal.vue';
import BatchPermissionModal from './components/BatchPermissionModal.vue';
@@ -38,7 +36,6 @@ import { useUsersAdmin } from './composables/useUsersAdmin';
const vLoading = ElLoading.directive;
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const {
agents,
@@ -125,7 +122,6 @@ onMounted(() => {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<AdminListPage :loading="isLoading">
<template #title>
<h2 class="section-title">{{ t('admin.user.title') }}</h2>
@@ -277,7 +273,6 @@ onMounted(() => {
@close="showBatchPermissionModal = false"
@save="submitBatchPermission"
/>
</ElConfigProvider>
</template>
<style scoped>
@@ -1,21 +1,19 @@
<script setup lang="ts">
/**
* features/admin/modules/wecom/WecomLayout.vue
* 用途:企微管理壳层。注入共享数据,并提供 Element 语言与样式。
* 依赖:useWecomAdmin、useElementProvider、element-plus、WECOM_ADMIN_KEY。
* 用途:企微管理壳层。注入共享数据,并引入 Element 样式。
* 依赖:useWecomAdmin、element-plus、WECOM_ADMIN_KEY。
* 逻辑:路由 /admin/wecom 的父级。首屏等 loadAll 结束后再渲染子页。子页自己放页签和列表,解绑确认在 composable 里完成。
*/
import { onMounted, provide } from 'vue';
import { ElConfigProvider, ElLoading } from 'element-plus';
import { ElLoading } from 'element-plus';
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 { useWecomAdmin } from './composables/useWecomAdmin';
import { WECOM_ADMIN_KEY } from './wecom.context';
const vLoading = ElLoading.directive;
const { elementLocale } = useElementProvider();
const wecomAdmin = useWecomAdmin();
const { isLoading } = wecomAdmin;
provide(WECOM_ADMIN_KEY, wecomAdmin);
@@ -26,11 +24,9 @@ onMounted(() => {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<div v-loading="isLoading" class="wecom-layout">
<router-view v-if="!isLoading" />
</div>
</ElConfigProvider>
</template>
<style scoped>
@@ -10,7 +10,6 @@ import { useI18n } from 'vue-i18n';
import { Download, Refresh } from '@element-plus/icons-vue';
import {
ElButton,
ElConfigProvider,
ElOption,
ElPagination,
ElSelect,
@@ -24,14 +23,12 @@ import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import { formatLocalDateTime } from '@/shared/utils/dateTime';
import type { WecomLoginAuditRow } from '@/features/admin/types/wecom.types';
import WecomSubNav from '../components/WecomSubNav.vue';
import { WECOM_ADMIN_KEY } from '../wecom.context';
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const {
wecomAuditSourceFilter,
wecomAuditStatusFilter,
@@ -65,7 +62,6 @@ function onAuditStatusChange(value: 'success' | 'failed' | '' | undefined): void
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<AdminListPage>
<template #title>
<h2 class="section-title">{{ t('admin.wecom.title') }}</h2>
@@ -158,7 +154,6 @@ function onAuditStatusChange(value: 'success' | 'failed' | '' | undefined): void
/>
</template>
</AdminListPage>
</ElConfigProvider>
</template>
<style scoped>
@@ -11,7 +11,6 @@ import { Link, Refresh } from '@element-plus/icons-vue';
import {
ElButton,
ElCheckbox,
ElConfigProvider,
ElForm,
ElFormItem,
ElInput,
@@ -27,7 +26,6 @@ import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import type { WecomBindingRow } from '@/features/admin/types/wecom.types';
import WecomOverviewCards from '../components/WecomOverviewCards.vue';
import WecomSyncPanel from '../components/WecomSyncPanel.vue';
@@ -35,7 +33,6 @@ import WecomSubNav from '../components/WecomSubNav.vue';
import { WECOM_ADMIN_KEY } from '../wecom.context';
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const {
wecomBindUserOptions,
wecomBindUserQuery,
@@ -78,7 +75,6 @@ function onBindUserChange(value: number | string | undefined): void {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<div class="wecom-bindings">
<AdminListPage>
<template #title>
@@ -217,7 +213,6 @@ function onBindUserChange(value: number | string | undefined): void {
</template>
</AdminListPage>
</div>
</ElConfigProvider>
</template>
<style scoped>
@@ -14,7 +14,6 @@ import {
ElCard,
ElCollapse,
ElCollapseItem,
ElConfigProvider,
ElForm,
ElFormItem,
ElIcon,
@@ -30,13 +29,11 @@ import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import type { WecomIntegrationManifest } from '@/features/admin/types/wecom.types';
import WecomSubNav from '../components/WecomSubNav.vue';
import { WECOM_ADMIN_KEY } from '../wecom.context';
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const {
wecomSystemSettings,
isSaving,
@@ -77,7 +74,6 @@ const copyItems = computed(() => {
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<AdminListPage>
<template #title>
<h2 class="section-title">{{ t('admin.wecom.title') }}</h2>
@@ -384,7 +380,6 @@ const copyItems = computed(() => {
</section>
</div>
</AdminListPage>
</ElConfigProvider>
</template>
<style scoped>
@@ -1,89 +1,11 @@
/**
* features/admin/styles/element-trial.css
* 用途:管理端 Element Plus 的字体、字号、颜色、圆角、控件高度,以及和 Tailwind 共存的修正。
* 依赖:tokens.css 的 --text-* / --bg-* / --border-*,element-plus 暗色变量,Tailwind preflight。
* 逻辑:由 UsersPage、AgentsPage、KbAdminPanel 在暗色 CSS 之后引入,所以 html.dark 能盖过 Element 默认暗色。
* 字号和颜色以本文变量为准。页面不要再用 text-sm / text-muted 改表格和按钮。
* 用途:管理端列表专用的表格内边距、分页条和表单补充说明。
* 依赖:shared/styles/element-theme.css 的 Element 变量。
* 逻辑:本文件先引入全站皮肤。管理页在暗色 CSS 之后引入本文件,变量才能盖过 Element 默认暗色。
* 列宽、筛选框宽度不要写进这里。对话等非列表页只引 element-theme.css,不引本文件。
*/
:root,
html.dark {
--el-color-primary: #0284c7;
--el-color-primary-light-3: #4da3d6;
--el-color-primary-light-5: #81c2e3;
--el-color-primary-light-7: #b4daf0;
--el-color-primary-light-8: #cde6f4;
--el-color-primary-light-9: #e6f3fa;
--el-color-primary-dark-2: #0269a0;
--el-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
--el-font-size-extra-large: 20px;
--el-font-size-large: 18px;
--el-font-size-medium: 16px;
--el-font-size-base: 14px;
--el-font-size-small: 13px;
--el-font-size-extra-small: 12px;
--el-text-color-primary: var(--text-primary);
--el-text-color-regular: var(--text-secondary);
--el-text-color-secondary: var(--text-muted);
--el-text-color-placeholder: var(--text-muted);
--el-text-color-disabled: var(--text-muted);
--el-border-color: var(--border-default);
--el-border-color-light: var(--border-subtle);
--el-border-color-lighter: var(--border-subtle);
--el-bg-color: var(--bg-surface);
--el-bg-color-overlay: var(--bg-surface);
--el-fill-color-blank: var(--bg-surface);
--el-fill-color-light: var(--bg-surface-soft);
--el-border-radius-base: 8px;
--el-component-size: 32px;
}
.el-button {
display: inline-flex;
align-items: center;
justify-content: center;
}
.el-button .el-icon,
.el-button svg {
display: inline-flex;
flex: none;
}
/* Tailwind forms 会给单行输入框内部的 input 加边框。聚焦时左右两边会多出两条蓝线。
多行输入框的边框就画在 .el-textarea__inner 上,不能一起清掉。 */
.el-input__inner,
.el-select__input,
.el-range-input,
.el-input__inner:hover,
.el-select__input:hover,
.el-range-input:hover,
.el-input__inner:focus,
.el-select__input:focus,
.el-range-input:focus {
border: 0;
outline: none;
background-color: transparent;
box-shadow: none;
--tw-ring-shadow: 0 0 #0000;
--tw-ring-offset-shadow: 0 0 #0000;
}
.el-textarea__inner {
background-color: var(--el-input-bg-color, var(--el-fill-color-blank));
box-shadow: 0 0 0 1px var(--el-input-border-color, var(--el-border-color)) inset;
}
.el-textarea__inner:hover {
box-shadow: 0 0 0 1px var(--el-input-hover-border-color, var(--el-border-color-hover)) inset;
}
.el-textarea__inner:focus {
outline: none;
box-shadow: 0 0 0 1px var(--el-input-focus-border-color, var(--el-color-primary)) inset;
--tw-ring-shadow: 0 0 #0000;
--tw-ring-offset-shadow: 0 0 #0000;
}
@import "../../../shared/styles/element-theme.css";
/* 列表首尾列与页头 32px 对齐;分页贴在表格下方 */
.hx-admin-table .el-table__cell:first-child .cell {
@@ -2,14 +2,15 @@
/**
* features/chat/views/ChatView.vue
* 单个 Agent 对话页入口:provide 编排上下文,子组件 inject 消费。
* 依赖:useChatPage、ChatViewContent/ChatViewOverlays。
* 依赖:useChatPage、ChatViewContent/ChatViewOverlays、shared/styles/element-theme.css。
* 逻辑:在途调拨业务面板(Transfer* 组件)已 EP 组件化(el-dialog/el-table/el-select),
* EP 样式随本页入口全量引入(亮色 + 暗色变量,模式同 admin 页面内引入),
* 保证 chat 直达时样式就绪、不依赖 admin 路由先行加载。
* EP 官方样式和全站 element-theme.css 随本页入口引入,放在暗色变量之后。
* 不引管理端 element-trial.css。保证 chat 直达时样式就绪、不依赖 admin 路由先行加载。
*/
import { provide, reactive } from 'vue';
import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/shared/styles/element-theme.css';
import { useChatPage } from '@/features/chat/composables/useChatPage';
import { CHAT_PAGE_KEY, type ChatPageContextProvided } from '@/features/chat/composables/chat.context';
import ChatViewContent from '@/features/chat/components/ChatViewContent.vue';
@@ -13,7 +13,6 @@ import { CircleCheck, Plus, Search, Setting, Tools } from '@element-plus/icons-v
import {
ElAlert,
ElButton,
ElConfigProvider,
ElInput,
ElLoading,
ElMessageBox,
@@ -25,7 +24,6 @@ import {
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';
@@ -45,7 +43,6 @@ type GroupSortKey = 'name' | 'document_count' | 'updated_at';
const router = useRouter();
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const vLoading = ElLoading.directive;
const groups = ref<KbGroup[]>([]);
@@ -269,7 +266,6 @@ defineExpose({ loadData });
</script>
<template>
<ElConfigProvider :locale="elementLocale">
<AdminListPage>
<template #title>
<h2 class="section-title">{{ t('kbAdmin.groupsTitle') }}</h2>
@@ -372,7 +368,6 @@ defineExpose({ loadData });
<DifySettingsDialog :open="settingsDialogOpen" @close="settingsDialogOpen = false" @saved="(message) => { feedback = message; feedbackType = 'success'; void loadData(); }" @error="(message) => { feedback = message; feedbackType = 'error'; }" />
<DifyHealthDialog :open="healthDialogOpen" @close="healthDialogOpen = false" @error="(message) => { feedback = message; feedbackType = 'error'; }" />
</ElConfigProvider>
</template>
<style scoped>
@@ -0,0 +1,87 @@
/**
* shared/styles/element-theme.css
* 用途:全站 Element Plus 的字体、字号、颜色、圆角、控件高度,以及和 Tailwind 共存的修正。
* 依赖:tokens.css 的 --text-* / --bg-* / --border-*,element-plus 暗色变量,Tailwind preflight。
* 逻辑:用到 Element 的页面在 element-plus/theme-chalk/dark/css-vars.css 之后引入,html.dark 才能盖过 Element 默认暗色。
* 管理列表的列内边距和分页条不在这里,见 features/admin/styles/element-trial.css。
* 字号和颜色以本文变量为准。页面不要再用 text-sm / text-muted 改表格和按钮。
*/
:root,
html.dark {
--el-color-primary: #0284c7;
--el-color-primary-light-3: #4da3d6;
--el-color-primary-light-5: #81c2e3;
--el-color-primary-light-7: #b4daf0;
--el-color-primary-light-8: #cde6f4;
--el-color-primary-light-9: #e6f3fa;
--el-color-primary-dark-2: #0269a0;
--el-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
--el-font-size-extra-large: 20px;
--el-font-size-large: 18px;
--el-font-size-medium: 16px;
--el-font-size-base: 14px;
--el-font-size-small: 13px;
--el-font-size-extra-small: 12px;
--el-text-color-primary: var(--text-primary);
--el-text-color-regular: var(--text-secondary);
--el-text-color-secondary: var(--text-muted);
--el-text-color-placeholder: var(--text-muted);
--el-text-color-disabled: var(--text-muted);
--el-border-color: var(--border-default);
--el-border-color-light: var(--border-subtle);
--el-border-color-lighter: var(--border-subtle);
--el-bg-color: var(--bg-surface);
--el-bg-color-overlay: var(--bg-surface);
--el-fill-color-blank: var(--bg-surface);
--el-fill-color-light: var(--bg-surface-soft);
--el-border-radius-base: 8px;
--el-component-size: 32px;
}
.el-button {
display: inline-flex;
align-items: center;
justify-content: center;
}
.el-button .el-icon,
.el-button svg {
display: inline-flex;
flex: none;
}
/* Tailwind forms 会给单行输入框内部的 input 加边框。聚焦时左右两边会多出两条蓝线。
多行输入框的边框就画在 .el-textarea__inner 上,不能一起清掉。 */
.el-input__inner,
.el-select__input,
.el-range-input,
.el-input__inner:hover,
.el-select__input:hover,
.el-range-input:hover,
.el-input__inner:focus,
.el-select__input:focus,
.el-range-input:focus {
border: 0;
outline: none;
background-color: transparent;
box-shadow: none;
--tw-ring-shadow: 0 0 #0000;
--tw-ring-offset-shadow: 0 0 #0000;
}
.el-textarea__inner {
background-color: var(--el-input-bg-color, var(--el-fill-color-blank));
box-shadow: 0 0 0 1px var(--el-input-border-color, var(--el-border-color)) inset;
}
.el-textarea__inner:hover {
box-shadow: 0 0 0 1px var(--el-input-hover-border-color, var(--el-border-color-hover)) inset;
}
.el-textarea__inner:focus {
outline: none;
box-shadow: 0 0 0 1px var(--el-input-focus-border-color, var(--el-color-primary)) inset;
--tw-ring-shadow: 0 0 #0000;
--tw-ring-offset-shadow: 0 0 #0000;
}