From 7a2e45e7c49d1a68c199c5f4ee9395a590324101 Mon Sep 17 00:00:00 2001 From: bot_dev1 Date: Wed, 5 Aug 2026 14:17:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=A8=E7=AB=99=20Ant=20Design=20Pro?= =?UTF-8?q?=20=E9=A3=8E=E6=A0=BC=E9=87=8D=E6=9E=84=20+=20=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E5=AE=88=E5=8D=AB=E4=B8=8E=E8=A7=92=E8=89=B2=E9=97=A8?= =?UTF-8?q?=E6=88=B7=EF=BC=88issue=20#131/#134=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 web/shared:pro.css(AntD 5 设计系统,旧 CSS 变量统一映射 AntD 色板)、 session.js(后端优先+本地账号降级双轨会话,IAOP_AUTH 兼容层)、 pro-header.js(全站统一 Pro 导航条:logo/页题/用户角色 Tag/退出) - 门户 web/index.html:未登录跳登录页(next 回跳),登录后按角色过滤 可见模块(readonly→驾驶舱/助手/移动端;engineer→+配置台;admin→全部) - 登录页 auth/login.html 重写为 Ant Design Pro 风格,本地降级模式自动 播种演示账号(admin/engineer/viewer),保留 OIDC SSO 双轨入口 - user_store.js 新增 verify() + seedDefaults() 默认账号播种 - 六模块页统一接入 pro.css + 统一导航条 + 登录守卫(PRD 8.2) - 驾驶舱主题 dark→light(Ant Design 5 色板):renderer.py THEME_TOKENS、 ti-cl4/resin 模板 theme、告警三级配色对齐 AntD(P0 #ff4d4f/P1 #faad14/ P2 #1677ff),渲染计划已重编(build_plans.py) - 验证:core/cockpit 86 单测通过;JS 语法检查通过;静态冒烟全 200 --- core/cockpit/renderer.py | 19 +- templates/resin/dashboard/cockpit.resin.yaml | 3 +- .../ti-cl4/dashboard/alarm_panel.ti.yaml | 17 +- templates/ti-cl4/dashboard/cockpit.ti.yaml | 4 +- web/admin/index.html | 6 +- web/auth/login.html | 393 +++++++++++++++--- web/auth/user_store.js | 32 ++ web/auth/users.html | 12 +- web/chat/assistant.html | 10 +- web/cockpit/cockpit.css | 17 +- web/cockpit/cockpit.js | 14 +- web/cockpit/index.html | 10 +- web/cockpit/plans/alarm_panel.ti.json | 16 +- web/cockpit/plans/resin.json | 16 +- web/cockpit/plans/ti-cl4.json | 16 +- web/index.html | 255 ++++++++---- web/mobile/index.html | 7 + web/shared/pro-header.js | 89 ++++ web/shared/pro.css | 295 +++++++++++++ web/shared/session.js | 191 +++++++++ web/studio/index.html | 6 +- 21 files changed, 1224 insertions(+), 204 deletions(-) create mode 100644 web/shared/pro-header.js create mode 100644 web/shared/pro.css create mode 100644 web/shared/session.js diff --git a/core/cockpit/renderer.py b/core/cockpit/renderer.py index ee3c200..4f1c44c 100644 --- a/core/cockpit/renderer.py +++ b/core/cockpit/renderer.py @@ -37,8 +37,9 @@ from .layout import ( # 复用 #50 已定义的布局模型与常量 # 主题 token(PRD 5.5「配置点:主题」dark / light 两套调色) # --------------------------------------------------------------------------- # 工业驾驶舱约定配色:dark 偏深蓝底 + 青绿强调(车间大屏常用); -# light 偏白底 + 蓝色强调(白天值班室)。前端按这些 CSS 变量渲染, -# 切换主题 = 切一套变量,组件代码不动。 +# light 采用 Ant Design 5 官方色板(2026-08 全站 Ant Design Pro 风格重构: +# 白底卡片 + #1677ff 主色 + 灰底 #f0f2f5,与门户/配置台/管理台统一)。 +# 前端按这些 CSS 变量渲染,切换主题 = 切一套变量,组件代码不动。 THEME_TOKENS: Dict[str, Dict[str, str]] = { "dark": { "--cockpit-bg": "#0b1220", @@ -50,13 +51,13 @@ THEME_TOKENS: Dict[str, Dict[str, str]] = { "--cockpit-grid-line": "rgba(255,255,255,0.06)", }, "light": { - "--cockpit-bg": "#f5f7fb", - "--cockpit-surface": "#ffffff", - "--cockpit-fg": "#1f2d3d", - "--cockpit-fg-muted": "#6b7c93", - "--cockpit-accent": "#2f7af2", # 蓝 - "--cockpit-warn": "#e08600", - "--cockpit-grid-line": "rgba(0,0,0,0.06)", + "--cockpit-bg": "#f0f2f5", # AntD colorBgLayout + "--cockpit-surface": "#ffffff", # AntD colorBgContainer + "--cockpit-fg": "rgba(0,0,0,0.88)", # AntD colorText + "--cockpit-fg-muted": "rgba(0,0,0,0.45)", # AntD colorTextTertiary + "--cockpit-accent": "#1677ff", # AntD 5 主色蓝(KPI / 趋势主线) + "--cockpit-warn": "#faad14", # AntD warning(告警强调) + "--cockpit-grid-line": "rgba(5,5,5,0.06)", # AntD colorSplit }, } diff --git a/templates/resin/dashboard/cockpit.resin.yaml b/templates/resin/dashboard/cockpit.resin.yaml index f4edd93..4e0dc97 100644 --- a/templates/resin/dashboard/cockpit.resin.yaml +++ b/templates/resin/dashboard/cockpit.resin.yaml @@ -7,7 +7,8 @@ # alarm_panel(告警面板)/ nl_query(NL查询入口)。 $schema: iAOP-cockpit-layout-v1 title: 吸附树脂车间驾驶舱 -theme: dark +# 2026-08 全站 Ant Design Pro 风格重构:dark → light(与 ti-cl4 一致) +theme: light widgets: - type: process_view src: resin_four_state.svg diff --git a/templates/ti-cl4/dashboard/alarm_panel.ti.yaml b/templates/ti-cl4/dashboard/alarm_panel.ti.yaml index ea712ea..fac4cba 100644 --- a/templates/ti-cl4/dashboard/alarm_panel.ti.yaml +++ b/templates/ti-cl4/dashboard/alarm_panel.ti.yaml @@ -12,20 +12,21 @@ $schema: iAOP-cockpit-alarm-panel-v1 # severityColors:P0/P1/P2 三级展示配色(覆盖主题默认告警色)。 # P0=红色(驾驶舱红色告警,PRD 场景A)、P1=黄色(加强监控)、P2=蓝色(提示)。 +# 2026-08 对齐 Ant Design 5 色板:error #ff4d4f / warning #faad14 / primary #1677ff。 severityColors: - severity: P0 - fg: "#ff3b30" # 红色前景(告警文本 / 图标) - bg: "rgba(255,59,48,0.12)" + fg: "#ff4d4f" # AntD error 红(告警文本 / 图标) + bg: "rgba(255,77,79,0.10)" icon: alert-octagon - border: "#ff3b30" + border: "#ff4d4f" - severity: P1 - fg: "#f5a623" # 黄色 - bg: "rgba(245,166,35,0.12)" + fg: "#faad14" # AntD warning 黄 + bg: "rgba(250,173,20,0.10)" icon: alert-triangle - border: "#f5a623" + border: "#faad14" - severity: P2 - fg: "#3aa0ff" # 蓝色(提示) - bg: "rgba(58,160,255,0.10)" + fg: "#1677ff" # AntD primary 蓝(提示) + bg: "rgba(22,119,255,0.08)" icon: info # rulesSource:告警面板订阅哪份规则资产(阈值/规则外置)。 # 指向 issue #72 落地的炉层杂质预警规则模板(templates/ti-cl4/impurity-forecast/ diff --git a/templates/ti-cl4/dashboard/cockpit.ti.yaml b/templates/ti-cl4/dashboard/cockpit.ti.yaml index adcf963..bade8c9 100644 --- a/templates/ti-cl4/dashboard/cockpit.ti.yaml +++ b/templates/ti-cl4/dashboard/cockpit.ti.yaml @@ -16,7 +16,9 @@ # bind 的 point_id 对齐 templates/ti-cl4/point-dict/point_dict.default.csv。 $schema: iAOP-cockpit-layout-v1 title: 海绵钛车间驾驶舱 -theme: dark +# 2026-08 全站 Ant Design Pro 风格重构:dark → light(Ant Design 5 色板, +# token 见 core/cockpit/renderer.py THEME_TOKENS["light"]) +theme: light widgets: # ---- 四状态工艺流程主视图(首屏立即加载) --------------------------- - type: process_view diff --git a/web/admin/index.html b/web/admin/index.html index 6b33519..01a2c78 100644 --- a/web/admin/index.html +++ b/web/admin/index.html @@ -5,8 +5,9 @@ iAOP 管理控制台 + - + -
-
- -

云美工业AI优化平台

+
+
+ iA +

iAOP 云美工业AI优化平台

-
Template-Ti 一期 · 配置台登录
+
iAOP-Core 通用内核 · Template-Ti(海绵钛)一期 · 配置化驾驶舱 / 模板配置台 / LLM 助手
+
- +
+ +

账号密码登录

-
- - -
-
- - -
+ -
- - -
+
+ +
+ 👤 + +
+
+
+ +
+ 🔒 + + +
+
- - + -
- 角色:readonly 只读 / engineer 可配置 / admin 可发布回滚。
- 未登录或只读角色不可执行写操作(PRD 8.2)。 -
+ + -
- 认证后端 core/auth · 会话 HttpOnly cookie · 密码 PBKDF2-HMAC-SHA256 +
+ 演示账号(纯静态部署·本地账号模式) +
+ 管理员 admin / Admin@12345填入
+ 工程师 engineer / Engineer@12填入
+ 只读 viewer / Viewer@1234填入
+ 不同角色登录后可见模块不同;生产环境请立即改密。 +
+
+ +
+ + - + diff --git a/web/auth/user_store.js b/web/auth/user_store.js index f485067..b66fdb8 100644 --- a/web/auth/user_store.js +++ b/web/auth/user_store.js @@ -37,9 +37,19 @@ var UserStore = (function () { }); } + /* 默认演示账号(Ant Design Pro 风格重构新增):纯静态部署(无 core/auth + * 后端)时的开箱登录账号,首次进入登录页自动播种。生产环境登录后请立即 + * 在用户管理页改密或删除。密码均 ≥ 8 位(对齐 auth.js 前端校验)。 */ + var DEFAULT_ACCOUNTS = [ + { username: "admin", password: "Admin@12345", role: "admin" }, + { username: "engineer", password: "Engineer@12", role: "engineer" }, + { username: "viewer", password: "Viewer@1234", role: "readonly" } + ]; + return { ROLES: ROLES, ROLE_LABELS: ROLE_LABELS, + DEFAULT_ACCOUNTS: DEFAULT_ACCOUNTS, /* ---------- 用户 CRUD(对齐 core/auth/users.py 的 User 字段语义) ---------- */ list: function () { return load(USERS_KEY, []); }, @@ -91,6 +101,28 @@ var UserStore = (function () { return Promise.resolve(); }, + /* ---------- 登录校验 + 默认账号播种(纯静态部署降级,见 shared/session.js) ---------- */ + /* 校验用户名密码,成功返回 {username, role, active},失败返回 null。 + * 不区分「用户不存在/密码错误/已禁用」,防用户名枚举。 */ + verify: function (username, password) { + var u = this.find(username); + if (!u || !u.active) return Promise.resolve(null); + return hashPassword(password, u.salt).then(function (h) { + return h === u.hash ? { username: u.username, role: u.role, + active: u.active } : null; + }); + }, + /* 用户库为空时播种默认演示账号(幂等:已有任何用户则跳过)。 */ + seedDefaults: function () { + var self = this; + if (this.list().length > 0) return Promise.resolve(false); + return DEFAULT_ACCOUNTS.reduce(function (p, acc) { + return p.then(function () { + return self.create(acc.username, acc.password, acc.role); + }); + }, Promise.resolve()).then(function () { return true; }); + }, + /* ---------- 写操作审计(template_registry._log 风格:时间/操作人/动作/资源/原因) ---------- */ audit: function (action, resource, reason, actor) { var log = load(AUDIT_KEY, []); diff --git a/web/auth/users.html b/web/auth/users.html index ab7390e..81027a3 100644 --- a/web/auth/users.html +++ b/web/auth/users.html @@ -29,16 +29,17 @@ button.primary { background:var(--accent); color:#04202a; } button.danger { background:#7a1f1a; color:#ffb4ad; } .row { display:flex; gap:8px; margin:10px 0; flex-wrap:wrap; align-items:center; } - .hint { font-size:11px; color:#64748b; } - .role-readonly { color:#8aa0bd; } .role-engineer { color:#38bdf8; } - .role-admin { color:var(--accent); } + .hint { font-size:11px; color:rgba(0,0,0,.45); } + .role-readonly { color:rgba(0,0,0,.45); } .role-engineer { color:#237804; } + .role-admin { color:#ad6800; } .disabled-user { opacity:.45; } #audit-list { max-height:420px; overflow-y:auto; font-size:12px; font-family:Consolas,monospace; } #audit-list div { padding:3px 0; border-bottom:1px solid var(--line); color:var(--muted); } @media (max-width:1000px) { main { grid-template-columns:1fr; } } + - +

用户/角色管理 RBAC 三级:readonly / engineer / admin · PRD 8.2

@@ -93,8 +94,9 @@
- + + diff --git a/web/chat/assistant.html b/web/chat/assistant.html index 818616f..79c1f04 100644 --- a/web/chat/assistant.html +++ b/web/chat/assistant.html @@ -5,8 +5,9 @@ iAOP 对话助手(增强版) + - + @@ -24,6 +25,13 @@ 布局 Schema: iAOP-cockpit-layout-v1 · 首屏静态资源本地化,目标 ≤ 2s(PRD 9) + + + + diff --git a/web/cockpit/plans/alarm_panel.ti.json b/web/cockpit/plans/alarm_panel.ti.json index 9ce60ea..2eb6cb6 100644 --- a/web/cockpit/plans/alarm_panel.ti.json +++ b/web/cockpit/plans/alarm_panel.ti.json @@ -2,20 +2,20 @@ "subscribe": "alarm_stream", "severityStyles": { "P0": { - "fg": "#ff3b30", - "bg": "rgba(255,59,48,0.12)", + "fg": "#ff4d4f", + "bg": "rgba(255,77,79,0.10)", "icon": "alert-octagon", - "border": "#ff3b30" + "border": "#ff4d4f" }, "P1": { - "fg": "#f5a623", - "bg": "rgba(245,166,35,0.12)", + "fg": "#faad14", + "bg": "rgba(250,173,20,0.10)", "icon": "alert-triangle", - "border": "#f5a623" + "border": "#faad14" }, "P2": { - "fg": "#3aa0ff", - "bg": "rgba(58,160,255,0.10)", + "fg": "#1677ff", + "bg": "rgba(22,119,255,0.08)", "icon": "info" } }, diff --git a/web/cockpit/plans/resin.json b/web/cockpit/plans/resin.json index 0d07b87..e54ee80 100644 --- a/web/cockpit/plans/resin.json +++ b/web/cockpit/plans/resin.json @@ -1,15 +1,15 @@ { "$schema": "iAOP-cockpit-layout-v1", "title": "吸附树脂车间驾驶舱", - "theme": "dark", + "theme": "light", "themeTokens": { - "--cockpit-bg": "#0b1220", - "--cockpit-surface": "#13203a", - "--cockpit-fg": "#e6edf6", - "--cockpit-fg-muted": "#8aa0bd", - "--cockpit-accent": "#18d3c8", - "--cockpit-warn": "#f5a623", - "--cockpit-grid-line": "rgba(255,255,255,0.06)" + "--cockpit-bg": "#f0f2f5", + "--cockpit-surface": "#ffffff", + "--cockpit-fg": "rgba(0,0,0,0.88)", + "--cockpit-fg-muted": "rgba(0,0,0,0.45)", + "--cockpit-accent": "#1677ff", + "--cockpit-warn": "#faad14", + "--cockpit-grid-line": "rgba(5,5,5,0.06)" }, "grid": { "columns": 12 diff --git a/web/cockpit/plans/ti-cl4.json b/web/cockpit/plans/ti-cl4.json index 232d762..5f963e6 100644 --- a/web/cockpit/plans/ti-cl4.json +++ b/web/cockpit/plans/ti-cl4.json @@ -1,15 +1,15 @@ { "$schema": "iAOP-cockpit-layout-v1", "title": "海绵钛车间驾驶舱", - "theme": "dark", + "theme": "light", "themeTokens": { - "--cockpit-bg": "#0b1220", - "--cockpit-surface": "#13203a", - "--cockpit-fg": "#e6edf6", - "--cockpit-fg-muted": "#8aa0bd", - "--cockpit-accent": "#18d3c8", - "--cockpit-warn": "#f5a623", - "--cockpit-grid-line": "rgba(255,255,255,0.06)" + "--cockpit-bg": "#f0f2f5", + "--cockpit-surface": "#ffffff", + "--cockpit-fg": "rgba(0,0,0,0.88)", + "--cockpit-fg-muted": "rgba(0,0,0,0.45)", + "--cockpit-accent": "#1677ff", + "--cockpit-warn": "#faad14", + "--cockpit-grid-line": "rgba(5,5,5,0.06)" }, "grid": { "columns": 12 diff --git a/web/index.html b/web/index.html index e1068e2..307cb7e 100644 --- a/web/index.html +++ b/web/index.html @@ -3,96 +3,183 @@ -iAOP 云美工业AI优化平台 +iAOP 云美工业AI优化平台 · 门户 + - -
-

iAOP 云美工业AI优化平台 推理服务检测中…

-

iAOP-Core 通用内核 · Template-Ti(海绵钛)一期 · 配置化驾驶舱 / 模板配置台 / LLM 助手

-
-
- -

🚀 驾驶舱

-

四状态工艺流程视图、实时趋势、KPI 卡片、告警面板、NL 查询(PRD 5.5)

- 业务用户 · 只读为主 -
- -

💬 对话助手

-

NL 工艺查询 / 报警智能解释 / 交接班报告生成(PRD 5.4)

- 值班长 · 工程师 -
- -

🧩 模板配置台

-

点位字典导入 / 模型超参 / RAG 知识库 / 驾驶舱布局编排 / 版本发布(PRD 5.7)

- 实施 · 行业工程师 -
- -

⚙️ 管理控制台

-

模型管理(版本/阶段/回滚)、知识库管理、告警确认、审计查询

- 管理员 -
- -

👤 用户与角色

-

用户管理、角色分配(readonly / engineer / admin)、审计(PRD 8.2)

- 管理员 -
- -

📱 移动端

-

移动端只读驾驶舱与交接班摘要(iOS14+ / Android 10+)

- 移动端 · 值班长 -
-
- - + + +
+ + +
+
+ + + + + + + diff --git a/web/mobile/index.html b/web/mobile/index.html index 4411ae4..caec531 100644 --- a/web/mobile/index.html +++ b/web/mobile/index.html @@ -6,6 +6,7 @@ iAOP 移动端驾驶舱 +