feat(web): 接入和信企业 Design System 并统一控制台主色

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
unknownandCursor committed 2026-11-19 15:40:38 +08:00
1 parent b071c2a7a4
commit ae67fefc80
9 files changed
+168 -17

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
---
description: 管理端 Element Plus + 和信企业共享风格(已启用)。改 console Vue 时自动约束。
globs: web/apps/console/src/**/*.vue
alwaysApply: false
---
# 管理端 Element Plus(Watchman)
改匹配文件时遵守本仓 `docs/ui/ELEMENT_MIGRATION.md`,并与共享视觉规范对齐:
- 共享风格(跨项目):`D:\FDE\SP\design-system\`(DESIGN / PAGE_PATTERNS / COMPONENTS)
- 本仓库执行细则:`docs/ui/ELEMENT_MIGRATION.md`
- 本仓库列表/页脚等业务约定:`docs/current/frontend-ui.md`
- 公司 EP 落地(按页导入、确认框等):`standards://frontend/element-plus`(最新版)
硬约束:
- 按钮、输入、下拉、表格、弹窗、分页用 Element Plus;不要新写 `<button>`、`<input>`、`<select>`、`<textarea>` 充当主 UI。
- 不要新写 `btn-primary`、`btn-secondary`、`btn-ghost`、`btn-danger`、`input-field`、`select-field`。
- 图标用 `@element-plus/icons-vue`,不要往 Element 按钮里塞其他图标库组件。
- 字号和颜色走 `web/design/tokens.css` → `shared/styles/element-theme.css` 的 `--el-*`;不要在单元格上用 `text-sm` / `text-muted` 改 EP 控件。
- 危险确认用 `ElMessageBox.confirm`。
- Primary 对齐和信共享色 `#0284c7`(本仓已确认覆盖公司 visual-ux 默认紫蓝,见 `docs/decisions.md` D41)。
- 列表结构:一层卡片、左右约 32px 对齐;Watchman 筛选/分页细则以 `docs/current/frontend-ui.md` 为准。
- 禁止为还原原型引入第二套 UI 库;OpenDesign HTML 须用 EP 重写。
+10
View File
@@ -358,6 +358,16 @@ Project-local docs, rules, skills, and task files must be preserved unless the u
4. 角色、模块任务、进度和安全底线听下面的 Watchman 工作规范。`docs/progress.md` 与 `docs/tasks/` 是业务任务权威;`.task/` 不替换它们。
5. 「大任务内部不必逐个批准」只在已经批准的模块或切片内有效。
## UI / Design System
- 共享风格:`D:\FDE\SP\design-system\`(ADOPT.md / DESIGN.md / PAGE_PATTERNS.md / COMPONENTS.md)
- 本仓库 EP 细则:`docs/ui/ELEMENT_MIGRATION.md`
- 本仓库列表/页脚约定:`docs/current/frontend-ui.md`
- Cursor 规则:`.cursor/rules/element-admin-ui.mdc`(globs:`web/apps/console/src/**/*.vue`)
- Token / 桥接:`web/design/tokens.css` → `web/apps/console/src/shared/styles/element-theme.css`
- 危险确认:`ElMessageBox.confirm`
- 主色:`#0284c7`(D41;覆盖公司 visual-ux 文档默认紫蓝)
<!-- project-local:end -->
<!-- project-local-imported:start -->
+3
View File
@@ -2,6 +2,9 @@
写控制台页面时遵守。组件库是 Element Plus。
跨项目视觉与 Pattern:`D:\FDE\SP\design-system\`。本仓 Token/Cursor 规则/主色决策:`docs/ui/ELEMENT_MIGRATION.md`、`docs/decisions.md` D41。
下文是 **Watchman 业务页布局与模块特例**(筛选、页脚、数据源/查询等),与共享色板互补,冲突时布局听本文、色板听 tokens。
## 按钮位置
列表页的页面按钮放在表格上方,例如「新建」。不要放进页脚。表格每一行自己的操作留在该行。
+1
View File
@@ -46,6 +46,7 @@
| D38 | M06 报警权限点(本仓库登记,沿用既有 `watchman.*` 模式):`perm:data:emp:watchman.alarm.read`、`.take`、`.progress`、`.close` | 2026-11-19 用户批准并开工 S3 |
| D39 | M06 S4 原型确认并批准 S5:不做等级筛选/列;S5 只展示接口已有字段;viewer 隐藏接手/进展/关闭按钮;已关闭页脚仅返回;保留三种空状态;admin 可关闭他人报警但不可抢走处理人或代写进展 | 2026-11-19 用户确认 1–6 并批准 S5 |
| D40 | M06 认领动作界面文案:按钮与历史动作由「接手」改为「处理」;成功提示用「已开始处理」,避免与关闭结果「已处理」混淆;字段「接手时间」改为「开始处理时间」。API/权限点仍为 `claim`/`watchman.alarm.take`,语义不变 | 2026-11-19 用户要求改得更正式 |
| D41 | Watchman 控制台接入和信企业共享 Design System:Cursor 规则 `element-admin-ui.mdc`;主色与页面底对齐 `#0284c7` / `#f8fafc`(覆盖公司 `visual-ux` 文档基线 `#5e6ad2`);列表/页脚等业务布局仍以 `docs/current/frontend-ui.md` 与 `standards://frontend/element-plus` 为准 | 2026-11-19 用户要求套用 `D:\FDE\SP\design-system` |
## 冻结前/相关模块实现前必须确认
+12 -5
View File
@@ -169,21 +169,28 @@ Copy this block for each major project area:
### 控制台界面
- Areas: 管理台页面、页脚按钮、密码输入
- Tags: frontend, element-plus, detail, password
- Areas: 管理台页面、页脚按钮、密码输入、共享 Design System 接入
- Tags: frontend, element-plus, detail, password, design-system
- Docs:
- Current: `docs/current/frontend-ui.md`
- Current: `docs/current/frontend-ui.md`、`docs/ui/ELEMENT_MIGRATION.md`
- Shared: `D:\FDE\SP\design-system\`(ADOPT / DESIGN / PAGE_PATTERNS)
- Decision: `docs/decisions.md` D41
- Rules:
- `AGENTS.md` 项目本地段
- `AGENTS.md` 项目本地段「UI / Design System」
- `.cursor/rules/element-admin-ui.mdc`
- `standards://frontend/element-plus`(公司 EP 接入)
- Read When:
- 写或改 `web/apps/console` 的页面,尤其是详情、表单和密码框
- 写或改 `web/apps/console` 的页面,尤其是详情、表单、列表和密码框
- 调整 Token/主题色或对齐和信企业风格
- Boundaries:
- 列表页按钮放在表格上方
- 详情页按钮放在页脚并居中,不放进纵向滚动区域
- 表格行内操作留在该行
- 密码框用 Element Plus 自带的 `show-password`
- 主色走 `web/design/tokens.css`(`#0284c7`),页面不散落 hex
- Validation:
- 列表按钮在表格上方;详情页滚动时页脚按钮仍居中停在底部
- 新管理页符合 `element-admin-ui.mdc` 与 `ELEMENT_MIGRATION.md`
## Mudball-Friendly Documentation Guidance
+33
View File
@@ -0,0 +1,33 @@
# Watchman 管理端 Element Plus 细则
> 本文件是 **本仓库** 执行细则;跨项目视觉真源见 `D:\FDE\SP\design-system\`。
> 公司 EP 接入方式(按页导入、确认框、检查清单)以 `standards://frontend/element-plus` 最新版为准。
## 1. 索引
| 层 | 位置 | 职责 |
| --- | --- | --- |
| 共享风格 | `D:\FDE\SP\design-system\` | 色板、Pattern、组件选用 |
| 本仓 Token | `web/design/tokens.css` | 可执行色/字阶/圆角 |
| EP 桥接 | `web/apps/console/src/shared/styles/element-theme.css` | `--el-*` 映射 |
| 业务页面约定 | `docs/current/frontend-ui.md` | 列表筛选、页脚按钮、模块特例 |
| Cursor 规则 | `.cursor/rules/element-admin-ui.mdc` | 改 `web/apps/console/src/**/*.vue` 时约束 Agent |
## 2. 硬规则(与共享 + 公司规范对齐)
1. 控件用 Element Plus;禁止第二 UI 库;OpenDesign HTML 须 EP 重写。
2. 危险确认:`ElMessageBox.confirm`(文案走 i18n)。
3. Primary:`#0284c7`(见 D41);页面禁止散落 hex,改色只动 tokens。
4. 列表:一层卡片、左右约 32px;筛选「查询才请求」、服务端排序分页等以 `frontend-ui.md` 为准。
5. 短表单 `ElDialog`(约 480/680);长内容才用 `ElDrawer`。
6. 图标:`@element-plus/icons-vue`。
## 3. 与公司 visual-ux 的关系
公司 `standards://frontend/visual-ux` 文档基线主色为 `#5e6ad2`。
**Watchman 控制台已确认改用和信企业共享主色 `#0284c7`**(D41)。结构与接入方式仍遵守 `standards://frontend/element-plus`。
## 4. 后续可选
- 在 `web/packages/ui-components` 落地 ProTable / 列表骨架封装(公司 EP §3)。
- 需要时在本会话启用 Skill:`D:\FDE\SP\runtime\skills\hexin-ui-design-system`(勿全局 always)。
+2 -1
View File
@@ -62,7 +62,8 @@ const crumbs = computed(() => {
const linkClass =
"block rounded-md px-2.5 py-[7px] text-[var(--text-secondary)] no-underline hover:text-[var(--color-primary)]";
const activeClass = "!bg-[#eef0fb] !font-semibold !text-[var(--color-primary)]";
const activeClass =
"!bg-[var(--color-primary-soft)] !font-semibold !text-[var(--color-primary)]";
</script>
<template>
@@ -1,24 +1,56 @@
/* Map Element Plus skin vars to web/design/tokens.css (standards://frontend/element-plus). */
/**
* apps/console/src/shared/styles/element-theme.css
* 用途:把 web/design/tokens.css 映射到 Element Plus --el-*,并修正与 Tailwind 共存问题。
* 依赖:tokens.css、element-plus/theme-chalk(含 dark/css-vars)。
* 逻辑:styles.css 在 Tailwind 之后引入本文件;页面禁止再各自覆盖 --el-color-primary。
*/
:root,
html.dark {
--el-color-primary: var(--color-primary);
--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: var(--font-size-base);
--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: var(--radius-control);
--el-component-size: 32px;
}
/* Tailwind preflight sets svg { display:block }; keep Element button icons inline. */
/* Tailwind preflight 会把 svg 设成 block;保持 Element 按钮图标与文字同行。 */
.el-button {
display: inline-flex;
align-items: center;
justify-content: center;
}
.el-button .el-icon,
.el-button svg {
display: inline-block;
display: inline-flex;
flex: none;
vertical-align: middle;
}
+47 -8
View File
@@ -1,12 +1,51 @@
/**
* web/design/tokens.css
* 用途:Watchman 控制台 L1 Design Tokens(颜色、字阶、圆角);可执行真源。
* 依赖:无;由 apps/console/src/styles.css 引入,再由 element-theme.css 映射到 --el-*。
* 逻辑:对齐 D:\FDE\SP\design-system\DESIGN.md(和信企业默认皮肤);换肤只改本文件。
* 决策:主色 #0284c7 见 docs/decisions.md D41(覆盖公司 visual-ux 文档基线紫蓝)。
*/
:root {
--color-primary: #5e6ad2;
--text-primary: #1f2328;
--text-secondary: #59636e;
--text-muted: #8b949e;
/* Surfaces */
--bg-page: #f8fafc;
--bg-surface: #ffffff;
--bg-surface-soft: #f6f8fa;
--border-default: #d0d7de;
--border-subtle: #eaeef2;
--bg-surface-soft: #f8fafc;
--bg-surface-strong: #f1f5f9;
/* Brand */
--color-primary: #0284c7;
--color-primary-soft: #e0f2fe;
/* Text */
--text-primary: #0f172a;
--text-secondary: #334155;
--text-muted: #64748b;
/* Borders */
--border-default: #e2e8f0;
--border-subtle: #f1f5f9;
/* Radius & type */
--radius-control: 8px;
--font-size-base: 13.5px;
--radius-surface: 16px;
--font-size-base: 14px;
}
html.dark {
color-scheme: dark;
--bg-page: #020617;
--bg-surface: #0b1220;
--bg-surface-soft: #0f172a;
--bg-surface-strong: #1e293b;
--color-primary: #38bdf8;
--color-primary-soft: rgba(14, 165, 233, 0.18);
--text-primary: #f8fafc;
--text-secondary: #cbd5e1;
--text-muted: #94a3b8;
--border-default: #334155;
--border-subtle: #1e293b;
}