From cdc8610ec1aba1d89edcaca0b6473e9bbf332017 Mon Sep 17 00:00:00 2001
From: sophie
Date: Tue, 20 Oct 2026 17:01:24 +0800
Subject: [PATCH 1/2] =?UTF-8?q?fix(admin):=20=E7=AE=A1=E7=90=86=E6=8E=A7?=
=?UTF-8?q?=E5=88=B6=E5=8F=B0=E7=95=8C=E9=9D=A2=E4=BD=BF=E7=94=A8element?=
=?UTF-8?q?=20plus?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
debug-access-unavailable.md | 21 -
debug-training-video-push-duplicate.md | 37 -
docs/demand.md | 4 +
docs/features/README.md | 1 +
.../training/annual-training-plan-demand.md | 143 ++
.../training/annual-training-plan-design.md | 153 ++
.../annual-training-plan-prototype.html | 686 +++++++-
docs/funclist.md | 8 +
docs/ui/ELEMENT_MIGRATION.md | 21 +-
.../admin/components/AdminListPage.vue | 62 +
.../admin/components/AdminListTabs.vue | 89 ++
.../admin/modules/agents/AgentsPage.vue | 6 +-
.../components/AgentCapabilitiesConfig.vue | 112 +-
.../agents/components/AgentFormModal.vue | 1401 +++++++++--------
.../components/AgentToolRunProgressConfig.vue | 209 ++-
.../announcements/AnnouncementsPage.vue | 167 +-
.../components/AnnouncementDetailModal.vue | 82 +-
.../components/AnnouncementFormModal.vue | 72 +-
.../composables/useAnnouncementsAdmin.ts | 77 +-
.../admin/modules/dashboard/DashboardPage.vue | 140 +-
.../modules/departments/DepartmentsPage.vue | 389 +++--
.../components/DepartmentFormModal.vue | 120 +-
.../components/DepartmentMembersModal.vue | 90 +-
.../composables/useDepartmentsAdmin.ts | 93 +-
.../IntegrationConnectorPage.spec.ts | 6 +-
.../IntegrationConnectorPage.vue | 771 +++++----
.../useIntegrationConnectorAdmin.ts | 56 +-
.../knowledge-base/KnowledgeBasePage.vue | 8 +-
.../linked-services/LinkedServicesPage.vue | 171 +-
.../components/LinkedServiceFormModal.vue | 110 +-
.../composables/useLinkedServicesAdmin.ts | 70 +-
.../modules/permissions/PermissionsPage.vue | 641 ++++----
.../permissions/components/RoleEditModal.vue | 459 +++---
.../components/RoleMembersConfirmDialog.vue | 152 +-
.../composables/usePermissionsAdmin.ts | 82 +-
.../platform-apps/PlatformAppsPage.vue | 525 +++---
.../ProcurementContractPage.vue | 1371 +++++++++-------
.../components/ContractRiskRulesPanel.vue | 627 ++++----
.../admin/modules/questions/QuestionsPage.vue | 638 +++-----
.../components/HotFaqCandidatesPanel.vue | 360 +++--
.../components/QuestionFormModal.vue | 375 +++--
.../composables/useQuestionsAdmin.ts | 67 +-
.../admin/modules/users/UsersPage.vue | 94 +-
.../features/kb/components/KbAdminPanel.vue | 129 +-
.../src/shared/composables/useTableSort.ts | 2 +-
45 files changed, 6258 insertions(+), 4639 deletions(-)
delete mode 100644 debug-access-unavailable.md
delete mode 100644 debug-training-video-push-duplicate.md
create mode 100644 docs/features/training/annual-training-plan-demand.md
create mode 100644 docs/features/training/annual-training-plan-design.md
create mode 100644 frontend/src/features/admin/components/AdminListPage.vue
create mode 100644 frontend/src/features/admin/components/AdminListTabs.vue
diff --git a/debug-access-unavailable.md b/debug-access-unavailable.md
deleted file mode 100644
index d2cc58e3..00000000
--- a/debug-access-unavailable.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# 调试记录:访问不可用
-
-- 状态:OPEN
-- 会话:access-unavailable
-- 日期:2026-09-09
-
-## 症状
-
-用户反馈“无法访问”,尚未明确是前端页面、后端接口、登录链路还是企微消息访问失败。
-
-## 假设
-
-1. 前端开发服务器未启动或端口 8881 不可达。
-2. 后端 Flask 服务未启动或端口 5052 不可达。
-3. 前端代理、环境地址或跨域配置指向了错误的后端地址。
-4. 服务启动后因数据库或外部集成初始化异常退出。
-5. 浏览器会话、认证或路由守卫导致访问被拒绝。
-
-## 证据与下一步
-
-待确认访问目标、访问地址、浏览器报错或网络响应后,再收集运行时证据。
diff --git a/debug-training-video-push-duplicate.md b/debug-training-video-push-duplicate.md
deleted file mode 100644
index 51dcfe3b..00000000
--- a/debug-training-video-push-duplicate.md
+++ /dev/null
@@ -1,37 +0,0 @@
----
-session_id: training-video-push-duplicate
-status: RESOLVED
----
-
-# 员工培训视频重复推送调试记录
-
-## 症状
-
-测试环境只有 2 个可推送视频,但第 1 期和第 2 期任务向员工展示了相同的 2 个视频。预期是全部视频推送完成后暂停,不再重复推送。
-
-## 假设
-
-1. 推送游标没有跨任务继承,新任务重新从第一个视频开始。
-2. 已推送判断只按任务 ID,而不是按视频资源 ID。
-3. 推送完成后游标没有持久化或读取错误。
-4. 前端资源快照映射错误,后端实际推送资源与页面展示资源不一致。
-5. 发布与补推并发读取同一游标,产生重复批次。
-
-## 当前阶段
-
-已定位根因并修复(2026-09-18,用户确认后实施);2026-09-29 生产环境复现变体(每周自动推送路径),已按方案 A 二次修复。
-
-## 结论
-
-- **根因(假设 1 成立)**:HR 在管理端手动新建下一期周任务走 `create_or_update_weekly_task`,新实例 `pushed_video_count=0`,API 层因游标为 0 自动推首批——视频从第 1 个重新推起;视频总数 ≤ 每周推送数量时两期展示完全相同。自动滚动路径(周一排程 `ensure_current_week_task`)本就继承游标,不受影响。
-- **修复**:
- 1. `lean_training_service.create_or_update_weekly_task`:新建任务游标改为继承历史推送进度——取新冻结列表的"最长已推送前缀"长度(`_inherited_pushed_video_count`,以全部已发布任务已推送前缀并集为基线),从上一任务断点续推;
- 2. `lean_training_push_service.push_lean_training_videos`:分批时跨任务绝对去重(`_already_pushed_resource_ids`),已被其它任务推送过的视频绝不进批次(游标越过);待推区间全部重复时游标推进到末尾、返回 completed 且不发企微。
-- **回归保障**:`backend/tests/test_lean_training_push.py` 两条契约测试(继承游标不重推首批 / 断点续推只推新视频且重复区间推完即停)。
-
-## 第二轮(2026-09-29):自动滚动路径的"内容重复"变体
-
-- **现象**:生产环境第 2 期(每周一自动推送)又出现第 1 期已推送视频(如 17、18)。数据库实况:第 2 期 `video_resource_ids=[17,18,25,24,23,22,21,20,19]`、`pushed_video_count=4`、`weekly_count=2`。
-- **根因**:与第一轮不同——**企微推送并未重发旧视频**(批次实为 [25,24] 新视频,游标=继承 2 + 本期 2 = 4 属正常绝对游标语义)。重复发生在**任务内容层**:`ensure_current_week_task` 自动滚动时把上一期冻结列表原样复制进新一期(复制 + 尾部追加新视频),而学员端展示(`serialize_weekly_task(learner_view)`)、观看/完成校验(`mark_video_watched` / `save_completion`)、管理看板视频列(`_task_video_rows`)全部按**累积已推送前缀** `video_resource_ids[:pushed_video_count]` 取数——上一期已推送视频出现在第 2 期且要求重看重写感悟,员工感知即"重复推送"。
-- **修复(方案 A,2026-09-29)**:新增 `_first_pushed_video_ids_map()` / `_own_pushed_video_ids()`(按周次升序遍历已发布任务,已推送前缀中"此前其它任务未推送过"的视频才归属本任务),并把上述四处口径统一改为"本任务首次推送的部分"。游标与数据结构不动;已产生的脏数据(第 2 期前缀含旧视频)自动恢复正常展示,无需修库。
-- **回归保障**:新增契约测试 `test_learner_period_videos_only_own_first_pushed`(复刻生产脏数据:第 2 期学员端只见/只考本期新增视频、第 1 期展示不受影响、看板口径一致、越权观看被拒)。
diff --git a/docs/demand.md b/docs/demand.md
index 3bd6a402..d481fad1 100644
--- a/docs/demand.md
+++ b/docs/demand.md
@@ -1,5 +1,9 @@
# 智能HR请假管理需求
+## 年度教育训练计划(2026-10)
+
+独立于入职、安全、精益、出国规章培训。年底按主办单位收集下一年度计划,讲师按月排课;课程库保存可重复使用的课件和试题,签到、录制、考试发布和完成状态记在月度场次上。未完成提醒每周一 09:00 发给当月仍有未完成场次的讲师,文案对齐人事课内部邮件。细则见 [features/training/annual-training-plan-demand.md](features/training/annual-training-plan-demand.md),设计方案见 [features/training/annual-training-plan-design.md](features/training/annual-training-plan-design.md),原型见 [features/training/annual-training-plan-prototype.html](features/training/annual-training-plan-prototype.html)。
+
## 订单交期回复 Agent(2026-09)
生管在工作台按 ERP 已审核、已核准、未结案的销售订单行回复交期(可拆多批次),保存后经行内或批量企微通知对应业务员并锁定;具备只读权限的业务人员可查看,回执不改状态。系统只读 ERP,不回写。操作权限按用户功能权限划分。每天 07:00(北京时间)全量同步全部合格订单,可手动刷新;正式环境可配置同步起始日期(`ORDER_DELIVERY_SYNC_DATE_FROM`,如上线日 2026-10-10),只同步订单日期 ≥ 起始日的订单行(2026-10-09 增补)。一期不做单别白名单管理,操作页不出单别列。细则见 [features/order-delivery-reply/demand.md](features/order-delivery-reply/demand.md)。
diff --git a/docs/features/README.md b/docs/features/README.md
index a4606000..c95e60f5 100644
--- a/docs/features/README.md
+++ b/docs/features/README.md
@@ -16,6 +16,7 @@
| [contract-payment-plan](contract-payment-plan/) | 合同付款计划 / 预警 Agent | [方案 V3](contract-payment-plan/contract-payment-warning-proposal-v3.md) · [工作台原型](contract-payment-plan/contract-payment-plan-workspace-prototype-v2.html) · [人工复核原型](contract-payment-plan/contract-payment-review-prototype.html) · [Chat Agent 原型](contract-payment-plan/contract-payment-chat-agent-prototype.html) |
| [equipment-maintenance](equipment-maintenance/README.md) | 设备维保助手 | [聊天原型](equipment-maintenance/equipment-maintenance-agent-chat-lofi.html) |
| [equipment-acceptance-warning](equipment-acceptance-warning/README.md) | 设备验收停留预警 | [需求说明](equipment-acceptance-warning/demand.md) · [数据设计](equipment-acceptance-warning/technical.md) |
+| [training](training/) | 教育训练:新人培训与年度计划 | [年度教育训练计划需求](training/annual-training-plan-demand.md) · [设计方案](training/annual-training-plan-design.md) · [可点击原型](training/annual-training-plan-prototype.html) · [精益周任务规则](training/精益管理周任务规则手册.md) |
**平台级**设计与跨域原型见 [platform/](../platform/README.md)。
diff --git a/docs/features/training/annual-training-plan-demand.md b/docs/features/training/annual-training-plan-demand.md
new file mode 100644
index 00000000..56e85b2f
--- /dev/null
+++ b/docs/features/training/annual-training-plan-demand.md
@@ -0,0 +1,143 @@
+# 年度教育训练计划需求说明
+
+> **版本**:V1.1
+> **更新日期**:2026-10-20
+> **状态**:需求已整理,尚未开发。设计方案见 [annual-training-plan-design.md](annual-training-plan-design.md)。可点击原型见 [annual-training-plan-prototype.html](annual-training-plan-prototype.html)。
+> **适用范围**:年底年度计划收集、课程库、月度排课、线下签到、线上学习、学员评价与讲师查看、每周一未完成提醒。
+
+本模块与现有新人培训(入职、安全、精益、出国规章)分开。不读取培训配置,不写入 `training_records`。
+
+## 业务流程
+
+主路径是:先有课程和年度计划,讲师排成一场月度培训,再按线上或线下走完,最后学员自己评价、讲师查看。
+
+```mermaid
+flowchart TD
+ course["HR 维护课程"] --> annual["部门负责人提交年度计划"]
+ yearRemind["12月1日 09:00 提醒未交的负责人"] -.-> annual
+ annual --> plan{"讲师排月度计划"}
+ plan -->|"从年度转入,占用一次"| session["确定一场培训"]
+ plan -->|年度计划外,不占次数| session
+ session --> mode{"形式"}
+ mode -->|线下授课| offline["学员到场签到,讲师可补签"]
+ mode -->|线上学习| online["学员看课件并完成本场考试"]
+ offline --> review["学员只提交自己的评价"]
+ online --> review
+ review --> instructor["讲师查看每人的评价原文"]
+ offline --> finish["讲师标记完成"]
+ online --> finish
+ weekRemind["每周一 09:00 提醒未完成的讲师"] -.-> finish
+ instructor --> board["HR 看板与导出"]
+ finish --> board
+```
+
+取消的场次不占年度次数,也不进看板、不发周一提醒。线下的纸质签到表仍交给人事。
+
+## 1. 角色
+
+不新增角色,用功能权限区分:
+
+| 身份 | 能做的事 |
+| --- | --- |
+| 部门负责人 | 维护本主办单位的年度计划。主办单位取 `users.department`。 |
+| 讲师 | 新建月度计划,或把本单位年度计划行转成月度计划。可维护课程资料。同一人可以既是部门负责人又是讲师。 |
+| 受训人 | 只看到点到自己名字的培训。线上看课件、完成本场考试,并只提交自己的评价。线下到场签到,没有学习链接,课后只提交自己的评价。看不到别人的评价。 |
+| HR / 管理员 | 维护课程库、厂区选项、主办单位选项。查看和导出全部计划。不审批。 |
+
+外训只是年度计划上的「内 / 外」标记,不建外部讲师账号。
+
+## 2. 课程与月度计划
+
+同一门课会反复开,所以课程是主数据。年度计划和月度计划都从课程库选择,不在场次里手填一门新课。选课旁边可以「新建课程」,保存后仍写入课程库,并回到刚才的月度计划。
+
+| 内容 | 放在课程 | 放在月度计划 |
+| --- | --- | --- |
+| 名称、一级分类、二级分类、分类 | 是 | 选择课程。保存时把分类快照下来,以后改课程库不改写已导出的年度计划 |
+| 课件、视频、试题 | 是,下次排课继续用 | 只可另附本场补充资料,不写回课程 |
+| 是否关联年度计划 | | 是。不关联记为年度计划外,不占年度次数 |
+| 日期、时间、时长、讲师、参加人员、地点 | | 是 |
+| 线上 / 线下 | | 是。线下可上传本次录制,并做签到。线上由学员在截止日前看课件、考试并评价,不上传录制;需要同步直播时另填会议链接 |
+| 发布考试、考试起止时间 | 题目来自课程试题 | 只对这一场发布,成绩记在这一场 |
+| 签到 | | 是,只记这一场的点名名单 |
+
+停用课程后不能再被新计划选中,历史计划仍显示原课程名。
+
+## 3. 年度计划
+
+年底收集下一年度计划。部门负责人直接提交,无审批流。时区 Asia/Shanghai。12 月 1 日 09:00 提醒部门负责人,截止 12 月 31 日。逾期仍可提交,标记为逾期提交。
+
+列与 2026 年苏州和信精密《年度教育训练计划》一致,不含培训费用:编号、厂区、主办单位、课程名称、一级分类、二级分类、次数、参加人员、地点、分类、内/外培训。
+
+- 厂区不在用户表上。HR 维护厂区选项,如 1厂、2厂。
+- 主办单位来自现有部门字符串,HR 可以补充。
+- 参加人员是点名用户,可以跨部门。表格里的「财会人员」「仓储全员」只是对象说明,不代表全部门。
+- 年度行不写具体上课日。上课日在月度场次上。
+- 一行有稳定编号,便于转成月度计划。同一行最多转出「次数」场。已取消的月度场次不占次数。
+
+## 4. 月度计划状态
+
+| 状态 | 含义 |
+| --- | --- |
+| 待开课 | 还没到上课结束时间 |
+| 已逾期 | 上课结束时间已过,讲师还没标记完成。由时间推算,不单独保存 |
+| 已完成 | 讲师标记完成。完成后不再发未完成提醒 |
+| 已取消 | 不占年度次数,不能签到,不再提醒 |
+
+签到和完成是两件事。签到只记录谁来了;完成表示这场培训结束。
+
+## 5. 签到
+
+签到记在月度场次上。名单就是这一场已点名的人,一个人一场只有一条记录。
+
+- 仅线下授课签到。上课开始前 30 分钟到结束前,学员自己签到。必须已登录且在名单内,重复点击只算一次。
+- 线下由讲师出示二维码。线上不签到,学员看完规定课件记为已学习。
+- 过了签到时间,学员不能再自己签。讲师在这场的签到页补签,补签盖过学员自己的结果,并标成补签。
+- 已取消的场次不能签到。
+
+人事课现行要求仍然有效:线下签到表使用纸质版,提交给人事。系统里的签到记录不替代这张纸质表。周一提醒的附件里带空白《培训签到表》。
+
+评价线上和线下都有。学员只提交自己的满意度和收获,讲师在这场查看每人原文,不能代填。
+
+## 6. 提醒
+
+两条提醒分开。都走现有企业微信文本卡片和平台排程,同一收件人同一发送日只发一条。
+
+### 6.1 年底收集
+
+12 月 1 日 09:00 发给各部门负责人,请提交下一年度计划,截止 12 月 31 日。
+
+### 6.2 每周一未完成提醒
+
+对齐人事课 2026-10-19 内部邮件《2026年10月教育训练(第三周提醒)》。
+
+- 发送时间:每周一 09:00(北京时间)。
+- 收件人:当月仍有待开课或已逾期场次的讲师。已完成、已取消的场次不算。已经约好上课时间、但还没标记完成的讲师也收。
+- 抄送:人事课指定收件人,在配置里维护,不写死姓名。
+- 周次:按当月周一计数。10 月 19 日是 2026 年 10 月第三个周一,标题为「第三周提醒」。
+- 附件:空白《培训签到表》、当月《教育训练登记》。
+- 系统只发送提醒。正文中的「同奖同罚」扣讲师费由薪资处理,本模块不计算、不扣款。
+- 邮件原文要求在 N8 上传视频和课件。新模块上线后,上传改在本系统的课程和月度场次里完成。纸质签到表仍交人事。
+
+标题:
+
+`{年}年{月}月教育训练(第{周}周提醒)`
+
+正文:
+
+```text
+Hi 各位讲师,
+上午好!
+
+{月}月已进入第{周}周,附件为{年}年{月}月份的教育训练,请各位讲师提前与人事约定培训时间,并于{月}月内完成系统课件和考试及评价等,感谢!(已预约的讲师作为提醒)
+
+在当月结束时未完成的讲师根据「同奖同罚」会在薪资中扣除相对应的讲师费,请知悉,感谢!
+
+注:请各位讲师在本系统上进行培训以及相关视频、课件的上传,签到表仍需使用纸质版并提交至人事,谢谢。
+```
+
+## 7. 本期不做
+
+- 不把出勤率放进培训看板。看板只统计计划次数、已排场次、分类和讲师时长,已取消场次不计入。
+- 不执行讲师费扣薪。
+- 不把本模块的成绩或资料写入新人培训记录。
+- 学员不查看他人评价,也不进入课程库、年度计划和月度计划表。
diff --git a/docs/features/training/annual-training-plan-design.md b/docs/features/training/annual-training-plan-design.md
new file mode 100644
index 00000000..3f4cfc1b
--- /dev/null
+++ b/docs/features/training/annual-training-plan-design.md
@@ -0,0 +1,153 @@
+# 年度教育训练计划 — 设计方案
+
+| 项目 | 说明 |
+| --- | --- |
+| 版本 | V1.0(2026-10-19) |
+| 状态 | 方案,尚未开发 |
+| 需求基线 | [annual-training-plan-demand.md](annual-training-plan-demand.md) |
+| 原型 | [annual-training-plan-prototype.html](annual-training-plan-prototype.html) |
+
+本模块是 HXOPS 里的独立业务。复用现有用户、功能权限、企业微信文本卡片、平台排程和 MinIO。不读 `TrainingConfig`,不写 `training_records`,不进入员工培训聊天工作区。
+
+现有应用是 Flask 单体。本模块继续放在这个进程里,用新的 Blueprint 和表,以便直接调用用户、企微和排程。不另起 FastAPI 服务。
+
+## 1. 页面与权限
+
+入口是独立页面「教育训练计划」,页签与原型一致:培训看板、年度计划、课程管理、收集提醒、月度计划。受训人没有这个入口,只打开签到页。
+
+新增三个功能权限,不新增角色。同一个人可以同时拥有部门负责人和讲师权限。
+
+| 权限 | 默认 | 数据范围 |
+| --- | --- | --- |
+| `edu_plan_dept_manage` | 无,按人授予 | 年度计划仅本 `users.department` |
+| `edu_plan_instruct` | 无,按人授予 | 月度计划仅本部门;可维护课程资料 |
+| `edu_plan_hr_manage` | 管理员、HR 默认开启 | 课程库、厂区、主办单位选项、全部查看与导出、提醒抄送人 |
+
+主办单位等于部门字符串。厂区不在用户表上,由 HR 维护选项。外训只是年度行上的标记,不建外部账号。
+
+## 2. 数据
+
+新表使用 `edu_plan_` 前缀,配 Alembic 迁移。文件进 MinIO,库里只存对象键和文件名。
+
+```text
+edu_plan_course
+ 课程主数据:名称唯一、一级、二级、分类、启用/停用
+
+edu_plan_course_file
+ 挂在课程上。类型 courseware(课件/视频)或 exam(试题)
+
+edu_plan_annual_line
+ 年度计划行。稳定 id、年度、厂区、主办单位、course_id
+ 保存时写入课程名称和分类快照
+ 次数、地点、内/外、对象说明、提交时间
+
+edu_plan_annual_attendee
+ 年度行点名。user_id,可跨部门
+
+edu_plan_session
+ 月度场次。可空的 annual_line_id(空即计划外)
+ 月份、开始、结束、时长、讲师 user_id、主办单位、厂区
+ 形式 online/offline、地点或会议链接
+ 课程名称和分类快照
+ 本场考试:选用哪份课程试题、起止时间
+ completed_at、cancelled_at
+
+edu_plan_session_file
+ 只属于这场。类型 supplement(补充资料)、recording(线下录制)、evaluation(评价表)
+
+edu_plan_session_attendee
+ 这场点名。从年度行带出,可增删
+
+edu_plan_attendance
+ 一场一人一条。user_id、来源 self/makeup、signed_at
+ 唯一约束 (session_id, user_id)
+
+edu_plan_option
+ HR 维护的厂区、额外主办单位
+
+edu_plan_notify_log
+ 提醒幂等。event_key 唯一,记录收件人、发送日、结果
+```
+
+分类快照写在年度行和场次上。之后改课程库,不回写这两处,导出年度计划读快照。
+
+停用课程后,新建年度行和计划外场次不能再选它。已有行仍显示快照里的课程名。
+
+一场「已排」次数 = 同一 `annual_line_id` 且 `cancelled_at` 为空的场次数。达到年度行的次数后不能再转入。计划外场次不占次数。
+
+场次对外状态不落库:
+
+| 条件 | 状态 |
+| --- | --- |
+| `cancelled_at` 有值 | 已取消 |
+| `completed_at` 有值 | 已完成 |
+| 结束时间早于当前时间 | 已逾期 |
+| 其余 | 待开课 |
+
+完成只写 `completed_at`。签到人数不影响完成。
+
+## 3. 主流程
+
+### 3.1 年底收集
+
+部门负责人新增年度行:选厂区、选课程、填次数、地点、内/外、对象说明,并点名参加人员。至少 1 人。
+
+12 月 1 日 09:00 的提醒只发给拥有 `edu_plan_dept_manage`、且下一年度还没有本部门计划行的人。12 月 31 日之后提交的行标记逾期,仍然保存。无审批。
+
+### 3.2 月度排课
+
+两条入口:
+
+1. 从年度行转入。复制厂区、主办单位、课程快照、地点、内/外、点名名单。讲师补月份、上课时间、时长、资料和考试。
+2. 讲师直接新建。不填年度行,记为计划外。选已有课程;旁边「新建课程」先写入课程库,再回到这场,已填的时间、人员和形式保留。
+
+线上保存会议链接,不接收录制文件。线下保存地点,可上传本次录制。本场补充资料和评价表不写回课程。
+
+考试只是「对本场发布课程里的某一份试题」,并记录起止时间。一期不做在线答题器。成绩由讲师记在这场上。
+
+### 3.3 签到
+
+签到页地址:`/edu-plan/sessions/{id}/check-in`。企业微信卡片和线下二维码都打开这个地址。二维码只在线下场次的签到抽屉里展示。
+
+学员自己签到须同时满足:已登录、在这场点名名单里、当前时间在开始前 30 分钟到结束时间之间、场次未取消。重复提交不新增记录,来源保持 `self`。
+
+讲师或 HR 补签不受这个时间窗口限制。补签把来源改成 `makeup` 并更新 `signed_at`。已取消场次拒绝签到和补签。
+
+纸质《培训签到表》仍由讲师交给人事。系统记录不替代这张表。周一提醒附上空白模板。
+
+## 4. 提醒
+
+两条排程都注册为平台任务,时区 Asia/Shanghai。发送复用 `send_wecom_event_message`。`edu_plan_notify_log.event_key` 唯一,同一收件人同一发送日只发一条。未绑定企业微信的人记失败原因,不改发给别人。
+
+| 任务 | Cron | 收件人 | event_key |
+| --- | --- | --- | --- |
+| 年底收集 | `0 9 1 12 *` | 尚未提交下一年度计划的部门负责人 | `edu_plan_annual:{年}:{user_id}` |
+| 周一未完成 | `0 9 * * 1` | 当月仍有待开课或已逾期场次的讲师;抄送 HR 配置的人事收件人 | `edu_plan_weekly:{周一日期}:{user_id}` |
+
+周一提醒的周次按当月周一计数。2026-10-19 是 10 月第三个周一,标题为「2026年10月教育训练(第三周提醒)」。正文使用需求说明第 6.2 节的固定文字,只替换年、月、周次。
+
+附件两份:空白培训签到表、当月教育训练登记。登记按当月未取消场次导出。已约好上课时间但未标记完成的讲师同样收到。系统不计算、不扣除讲师费。
+
+## 5. 接口与前端
+
+后端 Blueprint 前缀 `/api/edu-plan`。JSON 使用现有 `{ success, data | error, request_id }`。业务失败抛 `AppError`。前端放在 `frontend/src/features/edu-plan/`,HTTP 走 `requestJson`。文案补齐 zh-CN、zh-TW、en、th。
+
+| 接口 | 谁可以调用 |
+| --- | --- |
+| 课程、厂区、主办单位选项的维护 | HR |
+| 课程资料上传 | HR、讲师 |
+| 年度行的增改、导出 | 部门负责人限本部门;HR 全部 |
+| 场次的增改、完成、取消、补签 | 讲师限本部门;HR 全部 |
+| 学员签到 | 名单内的登录用户 |
+| 看板 | 按权限过滤后的场次和年度行 |
+
+看板只统计计划次数、已排场次、分类和讲师时长。已取消场次不计入。不出出勤率。
+
+年度导出列:编号、厂区、主办单位、课程名称、一级分类、二级分类、次数、参加人员、地点、分类、内/外培训。不含培训费用。分类和课程名称用快照。
+
+## 6. 本期不做
+
+- 不把成绩、课件写入员工培训。
+- 不做学员工作台,不做在线答题器。
+- 不执行同奖同罚扣薪。
+- 不把系统签到当成已提交给人事的纸质签到表。
diff --git a/docs/features/training/annual-training-plan-prototype.html b/docs/features/training/annual-training-plan-prototype.html
index 330b2861..eed9e570 100644
--- a/docs/features/training/annual-training-plan-prototype.html
+++ b/docs/features/training/annual-training-plan-prototype.html
@@ -1,9 +1,9 @@
@@ -28,14 +28,17 @@
.link { border:0; padding:0; color:#175cd3; background:transparent; font-size:12px; font-weight:800; } .names { color:#334155; } .note { color:var(--muted); } .ops { display:flex; gap:10px; white-space:nowrap; } .chips { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; } .chip { padding:4px 8px; border-radius:99px; background:#f1f5f9; font-size:12px; }
.mask { position:fixed; inset:0; display:none; background:rgba(15,23,42,.35); } .mask.show { display:block; }
.drawer { position:fixed; top:0; right:0; width:min(460px,100%); height:100%; display:flex; flex-direction:column; background:#fff; box-shadow:-12px 0 40px rgba(15,23,42,.12); transform:translateX(100%); transition:.2s; } .drawer.monthly { width:min(560px,100%); } .mask.show .drawer { transform:none; }
- .drawer header,.drawer footer { padding:16px 18px; border-bottom:1px solid var(--line); } .drawer footer { border-bottom:0; border-top:1px solid var(--line); display:flex; justify-content:flex-end; gap:8px; } .drawer h2 { margin:0; font-size:16px; } .drawer .body { padding:16px 18px 24px; overflow:auto; } .field { margin-bottom:12px; } .field input,.field select { width:100%; height:36px; } .field textarea { min-height:64px; resize:vertical; } .readonly { display:flex; align-items:center; min-height:36px; padding:8px 10px; border:1px solid #e7edf5; border-radius:8px; color:#334155; background:#f8fafc; }
+ .drawer header,.drawer footer { padding:16px 18px; border-bottom:1px solid var(--line); } .drawer footer { border-bottom:0; border-top:1px solid var(--line); display:flex; justify-content:flex-end; gap:8px; } .drawer h2 { margin:0; font-size:16px; } .drawer .body { padding:16px 18px 24px; overflow:auto; } .field { margin-bottom:12px; } .field input,.field select { width:100%; height:36px; } .field textarea { width:100%; min-height:64px; resize:vertical; } .readonly { display:flex; align-items:center; min-height:36px; padding:8px 10px; border:1px solid #e7edf5; border-radius:8px; color:#334155; background:#f8fafc; }
.sheet { display:flex; flex-direction:column; gap:16px; } .block { padding:12px; border:1px solid var(--line); border-radius:12px; background:#fbfcfe; } .block h3 { margin:0 0 10px; font-size:13px; } .sheet .field { margin:0; } .pair { display:grid; grid-template-columns:1fr 1fr; gap:10px 12px; } .pair .full { grid-column:1 / -1; } .triple { display:grid; grid-template-columns:1.2fr .8fr .8fr; gap:10px; }
.file-add { display:grid; grid-template-columns:1fr 72px; gap:8px; margin-top:8px; } .chip .x { margin-left:6px; border:0; padding:0; color:#64748b; background:transparent; font-weight:700; }
+ .course-pick { display:grid; grid-template-columns:1fr auto; gap:8px; align-items:end; } .course-pick .btns { display:flex; gap:8px; } .switch { display:flex; gap:8px; } .switch label { display:flex; align-items:center; gap:6px; height:36px; margin:0; padding:0 12px; border:1px solid #b8c8dd; border-radius:8px; background:#fff; color:var(--ink); font-size:13px; font-weight:600; } .switch input { width:auto; height:auto; }
.people { max-height:220px; overflow:auto; border:1px solid var(--line); border-radius:8px; } .person { display:flex; gap:8px; align-items:center; padding:8px 10px; border-bottom:1px solid var(--line); } .person:last-child { border-bottom:0; } .person small { margin-left:auto; color:var(--muted); }
+ .qr { width:120px; height:120px; display:grid; grid-template-columns:repeat(7,1fr); gap:3px; padding:8px; border:1px solid var(--line); border-radius:10px; background:#fff; } .qr i { background:#142033; border-radius:1px; } .qr i.off { background:#e8eef6; } .sign-head { display:flex; justify-content:space-between; gap:12px; align-items:center; }
.hint { margin:0 0 8px; color:var(--muted); font-size:12px; }
- .two { display:grid; grid-template-columns:1fr 360px; gap:14px; } .phone { width:100%; padding:16px; border-radius:24px; color:#fff; background:#172033; } .phone small { display:block; color:#aab9cc; text-align:center; } .notice { margin-top:12px; overflow:hidden; border-radius:12px; color:var(--ink); background:#fff; } .notice h3 { margin:0; padding:14px 14px 6px; font-size:15px; } .notice p { margin:0; padding:0 14px 14px; white-space:pre-line; color:#3d4b61; font-size:13px; } .notice button { width:100%; padding:11px; border:0; border-top:1px solid var(--line); color:var(--brand); background:#fff; font-weight:800; }
+ .two { display:grid; grid-template-columns:1fr 360px; gap:14px; } .phone { width:100%; padding:16px; border-radius:24px; color:#fff; background:#172033; } .phone small { display:block; color:#aab9cc; text-align:center; } .notice { margin-top:12px; overflow:hidden; border-radius:12px; color:var(--ink); background:#fff; } .notice h3 { margin:0; padding:14px 14px 6px; font-size:15px; } .notice p { margin:0; padding:0 14px 14px; white-space:pre-line; color:#3d4b61; font-size:13px; } .notice button { width:100%; padding:11px; border:0; border-top:1px solid var(--line); color:var(--brand); background:#fff; font-weight:800; } .notice button:disabled { color:#94a3b8; cursor:not-allowed; }
.kv { display:grid; grid-template-columns:88px 1fr; gap:8px; padding:8px 0; border-bottom:1px solid var(--line); font-size:13px; } .kv b { color:var(--muted); font-weight:700; }
.toast { position:fixed; right:18px; bottom:18px; z-index:5; padding:10px 12px; border-radius:9px; color:#fff; background:#142036; opacity:0; transition:.2s; } .toast.show { opacity:1; }
+ .learn-wrap { width:min(760px,100%); margin:0 auto; } .learn-wrap h1 { margin:0; font-size:28px; letter-spacing:-.03em; } .mine { display:grid; gap:12px; margin-top:16px; } .mine-card { display:grid; grid-template-columns:1fr auto; gap:12px; align-items:center; padding:18px 18px 16px; border:0; border-radius:18px; background:#fff; box-shadow:0 8px 24px rgba(20,32,51,.06); text-align:left; } .mine-card b { display:block; margin:6px 0 4px; font-size:18px; } .mine-card p { margin:0; color:var(--muted); font-size:13px; } .back { margin-bottom:14px; border:0; padding:0; color:#175cd3; background:transparent; font-weight:800; } .player { display:grid; grid-template-columns:180px 1fr; gap:18px; padding:22px; border-radius:22px; background:#fff; box-shadow:0 8px 24px rgba(20,32,51,.06); } .steps { display:flex; flex-direction:column; gap:8px; margin:0; padding:0; list-style:none; } .steps button { width:100%; padding:10px 12px; border:0; border-radius:12px; color:#334155; background:#f4f7fb; font-weight:800; text-align:left; } .steps button.on { color:#fff; background:#0f766e; } .stage h2 { margin:0 0 8px; font-size:22px; } .file-row { display:flex; justify-content:space-between; gap:8px; align-items:center; margin-top:8px; padding:12px 14px; border-radius:12px; background:#f4f7fb; } .choices { display:flex; gap:8px; margin:12px 0; } .choices button { flex:1; padding:14px 8px; border:1px solid var(--line); border-radius:14px; background:#fff; font-weight:800; } .choices button.on { border-color:#0f766e; color:#fff; background:#0f766e; } .eval-only { padding:28px 24px; border-radius:22px; background:#fff; box-shadow:0 8px 24px rgba(20,32,51,.06); } .stage textarea,.eval-only textarea { width:100%; min-height:96px; padding:10px; border:1px solid #b8c8dd; border-radius:12px; resize:vertical; } .eval-only h2 { margin:8px 0; font-size:26px; } .facts { display:grid; gap:6px; margin:0 0 16px; color:#334155; } .quotes { display:grid; gap:10px; } .quote { padding:12px 14px; border-radius:12px; background:#f8fafc; } .quote p { margin:6px 0 0; } @media (max-width:700px) { .player { grid-template-columns:1fr; } }
.charts { display:grid; gap:12px; margin-bottom:12px; } .charts.two { grid-template-columns:1fr 1fr; } .charts.three { grid-template-columns:1fr 1fr 1fr; }
.chart-hd { display:flex; justify-content:space-between; gap:8px; align-items:flex-start; padding:12px 14px 0; } .chart-hd h2 { margin:0; font-size:14px; } .chart-hd p { margin:3px 0 0; color:var(--muted); font-size:12px; }
.chart-bd { padding:4px 8px 10px; } .chart-bd svg { display:block; width:100%; height:auto; }
@@ -45,7 +48,7 @@
- 教育训练计划原型 · 年度收集与月度排课
+ 教育训练计划原型 · 年度收集与月度排课
@@ -112,11 +116,11 @@
-
课程管理
课程可被多个年度、多个主办单位重复选用。停用后不能进入新计划,已引用的计划仍保留。
+
课程管理
课程可重复开课。课件、视频和试题放在课程上,下次排课继续用。
- | 课程名称 | 一级分类 | 二级分类 | 分类 | 状态 | 被计划引用 | |
+ | 课程名称 | 一级分类 | 二级分类 | 分类 | 课件 | 试题 | 状态 | 被计划引用 | |
@@ -131,29 +135,44 @@
逾期仍可补交,将标记为逾期提交。
发送规则
对象各主办单位的部门负责人
-
之后部门提交年度计划后,讲师在「月度计划」里排课。开课提醒和出勤不在本原型。
+
之后部门提交年度计划后,讲师在「月度计划」里排课。未完成场次每周一 09:00 提醒讲师。
进度HR 在年度计划页看到未提交 / 已提交 / 逾期提交
+
+
月度计划
-
讲师创建。从年度计划转入时带出课程、地点和已选人员;直接新建的记为计划外。
+
选课程库里的课。线上、线下都在这里排;本次录制只用于线下。
+
+
+
- | 月份 | 来源 | 课程 | 主办单位 | 上课时间 | 时长 | 讲师 | 资料 | 参加人员 | 状态 | |
+ | 月份 | 来源 | 课程 | 形式 | 主办单位 | 时间 | 讲师 | 本场补充 | 录制 | 考试 | 签到 / 学习 | 状态 | |
@@ -238,12 +257,60 @@
{ id:12, annualNo:15, month:'2026-11', unit:'仓储课', plant:'1厂', course:'ERP 基本操作', place:'教育训练室', side:'内', start:'2026-11-05T09:00', end:'2026-11-05T11:00', hours:'2', instructor:'郑兰', files:['ERP入门.pdf'], ids:warehouse.slice(), status:'scheduled' }
];
const instructors = ['王敏','赵琳','吴凯','郑兰'];
+ const courseAssets = {
+ '叉车安全操作规范': { files: ['叉车操作规范.mp4'], exams: ['叉车安全试题.pdf'] },
+ 'ERP 基本操作': { files: ['ERP入门.pdf'], exams: ['ERP操作试题.pdf'] },
+ '应收系统账务处理操作': { files: ['应收操作.pptx'], exams: [] },
+ '化学品操作规范': { files: ['化学品规范.mp4'], exams: ['化学品试题.pdf'] }
+ };
+ /**
+ * 取课程上的课件和试题。没有则建空记录,避免月度计划读到空指针。
+ * @param {string} name 课程名称
+ * @returns {{files: string[], exams: string[]}}
+ */
+ function assetsOf(name) {
+ if (!courseAssets[name]) courseAssets[name] = { files: [], exams: [] };
+ return courseAssets[name];
+ }
+ monthlies.forEach((item) => {
+ item.mode = 'offline';
+ item.recording = '';
+ item.examOn = false;
+ item.examPaper = '';
+ item.examFrom = '';
+ item.examTo = '';
+ item.files = [];
+ });
+ Object.assign(monthlies[0], { recording: '叉车现场录制.mp4', examOn: true, examPaper: '叉车安全试题.pdf', examFrom: '2026-03-12 16:00', examTo: '2026-03-19 18:00' });
+ Object.assign(monthlies[1], { mode: 'online', place: '', deadline: '2026-03-31', liveOn: false, files: ['本场补充说明.pdf'], examOn: true, examPaper: 'ERP操作试题.pdf', examFrom: '2026-03-01', examTo: '2026-03-31' });
+ const PROTO_TODAY = '2026-06-18T09:00';
+ monthlies.forEach((item) => {
+ if (item.mode !== 'online' && item.end < '2026-06-01') item.status = 'done';
+ });
+ const attendance = {
+ 1: { wu: 'self', zheng: 'self', feng: 'makeup' },
+ 3: { wang: 'self', li: 'self', zhao: 'self' },
+ 6: { wang: 'self', li: 'self', zhao: 'self' }
+ };
+ const learning = {
+ 1: {
+ wu: { learned: false, exam: false, review: true, score: '满意', note: '现场演示清楚,急停位置记住了' },
+ zheng: { learned: false, exam: false, review: true, score: '一般', note: '场地有点吵,后半段听不清' }
+ },
+ 2: { wu: { learned: true, exam: true, review: true, score: '满意', note: '能自己过一遍入库单了' }, zheng: { learned: true, exam: false, review: false, score: '', note: '' } }
+ };
+ const LEARNER_ID = 'wu';
+ let learnFocus = null;
let role = 'hr';
let drawerMode = '';
let editingNo = 0;
let editingCourse = '';
let editingMonthly = 0;
+ let attendingId = 0;
let draftFiles = [];
+ let draftCourseFiles = [];
+ let draftCourseExams = [];
+ let monthlyDraft = null;
const courseOf = (name) => courses.find((item) => item[0] === name);
const personName = (id) => (people.find((item) => item.id === id) || {}).name || id;
const toast = (message) => { $('toast').textContent = message; $('toast').classList.add('show'); setTimeout(() => $('toast').classList.remove('show'), 2200); };
@@ -304,8 +371,9 @@
$('tabCourses').style.display = role === 'hr' ? '' : 'none';
$('courseRows').innerHTML = courses.map((item) => {
const used = plans.filter((plan) => plan.course === item[0]).length;
+ const asset = assetsOf(item[0]);
const status = item[4] === 'enabled' ? '启用' : '停用';
- return '| ' + item[0] + ' | ' + item[1] + ' | ' + item[2] + ' | ' + item[3] + ' | ' + status + ' | ' + used + ' | |
';
+ return '| ' + item[0] + ' | ' + item[1] + ' | ' + item[2] + ' | ' + item[3] + ' | ' + (asset.files.length ? asset.files.length + ' 份' : '—') + ' | ' + (asset.exams.length ? asset.exams.length + ' 套' : '—') + ' | ' + status + ' | ' + used + ' | |
';
}).join('');
}
@@ -410,7 +478,7 @@
$('boardKpis').innerHTML = [
[submittedNames + '/' + unitTotal, '已提交主办单位'],
[periodSessions.length + ' / ' + planTimes, month ? '本月已排 / 全年计划次数' : '已排场次 / 计划次数'],
- [String(outside), '计划外场次'],
+ [String(outside), '年度计划外'],
[String(peopleCount), '计划受训人次']
].map(([value, label]) => '' + value + '' + label + '').join('');
const months = ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'];
@@ -439,7 +507,78 @@
}
/**
- * 渲染月度计划。已取消场次仍展示,但不计入年度已排次数。
+ * 计算月度场次对外展示的状态。已逾期不单独落库,由上课结束时间相对原型日期推出来。
+ * @param {{status: string, end: string}} item 月度计划
+ * @returns {'cancelled'|'done'|'overdue'|'scheduled'}
+ */
+ function sessionState(item) {
+ if (item.status === 'cancelled') return 'cancelled';
+ if (item.status === 'done') return 'done';
+ if (item.mode === 'online') {
+ const due = (item.deadline || '').slice(0, 10);
+ if (due && due < PROTO_TODAY.slice(0, 10)) return 'overdue';
+ return 'scheduled';
+ }
+ if ((item.end || item.start || '') < PROTO_TODAY) return 'overdue';
+ return 'scheduled';
+ }
+
+ /**
+ * 状态对应的标签。待开课和已逾期都会进入本月未完成提醒,已完成和已取消不再提醒。
+ * @param {string} state sessionState 的返回值
+ * @returns {string}
+ */
+ function stateBadge(state) {
+ if (state === 'cancelled') return '已取消';
+ if (state === 'done') return '已完成';
+ if (state === 'overdue') return '已逾期';
+ return '待开课';
+ }
+
+ /**
+ * 计算某个日期落在当月的第几个周一。6 月 18 日所在周的周一是 6 月 15 日,对应第三周。
+ * @param {string} iso 原型当前日期
+ * @returns {string} 中文周次,如「三」
+ */
+ function monthWeekLabel(iso) {
+ const date = new Date(iso.slice(0, 10) + 'T00:00:00');
+ const first = new Date(date.getFullYear(), date.getMonth(), 1);
+ const firstMonday = 1 + ((8 - (first.getDay() || 7)) % 7);
+ const monday = date.getDate() - ((date.getDay() + 6) % 7);
+ const index = Math.max(1, Math.floor((monday - firstMonday) / 7) + 1);
+ return ['一', '二', '三', '四', '五', '六'][index - 1] || String(index);
+ }
+
+ /**
+ * 渲染本月未完成提醒。每周一 09:00 发给仍有未完成场次的讲师,文案对齐人事课内部邮件。
+ * @param {string} unit 主办单位筛选,空字符串表示不限
+ */
+ function renderRemind(unit) {
+ const month = PROTO_TODAY.slice(0, 7);
+ const monthNum = String(Number(month.slice(5, 7)));
+ const year = month.slice(0, 4);
+ const week = monthWeekLabel(PROTO_TODAY);
+ const open = monthlies.filter((item) => {
+ const state = sessionState(item);
+ return item.month === month && (!unit || item.unit === unit) && (state === 'scheduled' || state === 'overdue');
+ });
+ const instructors = [...new Set(open.map((item) => item.instructor))];
+ $('remindHint').textContent = '原型按 ' + PROTO_TODAY.slice(0, 10) + ' 计算。每周一 09:00 发给本月还未完成的讲师。已约好上课时间的也提醒。';
+ $('remindRules').innerHTML = '时间每周一 09:00(北京时间)。同一讲师同一个周一只发一条。
对象本月仍有待开课或已逾期场次的讲师。已完成、已取消不发。
抄送人事课指定收件人,在配置里维护,不写死姓名。
附件培训签到表.xls、' + year + '年' + monthNum + '月教育训练登记.xls
扣薪正文告知同奖同罚。系统只发提醒,不计算、不扣除讲师费。
';
+ $('remindList').innerHTML = open.length ? open.map((item) => {
+ const state = sessionState(item);
+ const kind = state === 'overdue' ? '已逾期' : '待开课';
+ return '' + item.instructor + '' + kind + ' ' + item.course + ' · ' + item.start.replace('T', ' ') + '
';
+ }).join('') : '本月没有未完成的讲师。
';
+ const title = year + '年' + monthNum + '月教育训练(第' + week + '周提醒)';
+ const body = instructors.length
+ ? ('Hi 各位讲师,\n上午好!\n\n' + monthNum + '月已进入第' + week + '周,附件为' + year + '年' + monthNum + '月份的教育训练,请各位讲师提前与人事约定培训时间,并于' + monthNum + '月内完成系统课件和考试及评价等,感谢!(已预约的讲师作为提醒)\n\n在当月结束时未完成的讲师根据「同奖同罚」会在薪资中扣除相对应的讲师费,请知悉,感谢!\n\n注:请各位讲师在本系统上进行培训以及相关视频、课件的上传,签到表仍需使用纸质版并提交至人事,谢谢。\n\n收件人:' + instructors.join('、'))
+ : '本月没有未完成的讲师。';
+ $('remindPhone').innerHTML = '' + title + '
' + body + '
';
+ }
+
+ /**
+ * 渲染月度计划。已取消场次仍展示,但不计入年度已排次数。已完成、已逾期由上课时间相对原型日期区分。
*/
function renderMonthly() {
const locked = scopeUnit();
@@ -449,23 +588,284 @@
unitSelect.disabled = Boolean(locked);
unitSelect.value = locked || current;
if (locked) unitSelect.value = locked;
- $('monthlyDesc').textContent = locked
- ? locked + '讲师可新建月度计划,或从本单位未排满的年度计划转入。'
- : '讲师创建。从年度计划转入时带出课程、地点和已选人员;直接新建的记为计划外。';
+ $('monthlyDesc').textContent = (locked ? locked + '的月度计划。' : '') + '线下点「签到」看名单,线上点「学习」看进度。线上和线下都点「评价」,查看学员自己提交的内容。';
const month = $('monthFilter').value;
const unit = locked || unitSelect.value;
const rows = monthlies.filter((item) => (!month || item.month === month) && (!unit || item.unit === unit));
$('monthRows').innerHTML = rows.map((item) => {
- const when = (item.start || '').replace('T', ' ') + (item.end ? ' – ' + item.end.slice(11) : '');
- const source = item.annualNo ? '年度 #' + item.annualNo + '' : '计划外';
- const state = item.status === 'cancelled' ? '已取消' : '待开课';
- const cancel = item.status === 'cancelled' ? '' : '';
- return '| ' + item.month + ' | ' + source + ' | ' + item.course + ' | ' + item.unit + ' | ' + when + ' | ' + item.hours + ' 小时 | ' + item.instructor + ' | ' + (item.files.join('、') || '—') + ' | ' + item.ids.map(personName).join('、') + ' | ' + state + ' | ' + cancel + ' |
';
- }).join('') || '| 这个范围还没有月度计划。 |
';
+ const when = item.mode === 'online'
+ ? ('截止 ' + (item.deadline || '—') + (item.liveOn && item.place ? '
直播' : ''))
+ : ((item.start || '').replace('T', ' ') + (item.end ? ' – ' + item.end.slice(11) : ''));
+ const source = item.annualNo ? '年度 #' + item.annualNo + '' : '年度计划外';
+ const state = sessionState(item);
+ const stateLabel = stateBadge(state);
+ const done = (state === 'scheduled' || state === 'overdue') ? '' : '';
+ const cancel = (state === 'scheduled' || state === 'overdue') ? '' : '';
+ const modeLabel = item.mode === 'online' ? '线上学习' : '线下授课';
+ const examLabel = item.examOn ? '已发布' : '—';
+ const attendText = state === 'cancelled' ? '—' : (item.mode === 'online'
+ ? ''
+ : '');
+ const reviewLink = state === 'cancelled' ? '' : '';
+ return '| ' + item.month + ' | ' + source + ' | ' + item.course + ' | ' + modeLabel + ' | ' + item.unit + ' | ' + when + ' | ' + item.instructor + ' | ' + ((item.files || []).join('、') || '—') + ' | ' + (item.mode === 'offline' && item.recording ? item.recording : '—') + ' | ' + examLabel + ' | ' + attendText + ' | ' + stateLabel + ' | ' + reviewLink + done + cancel + ' |
';
+ }).join('') || '| 这个范围还没有月度计划。 |
';
+ renderRemind(unit);
}
- function openMask(monthly) { document.querySelector('.drawer').classList.toggle('monthly', Boolean(monthly)); $('mask').classList.add('show'); }
- function closeMask() { $('mask').classList.remove('show'); document.querySelector('.drawer').classList.remove('monthly'); drawerMode = ''; }
+ /**
+ * 取一场的签到记录。没有则建空对象,键是人员 id,值是 self 或 makeup。
+ * @param {number} id 月度计划 id
+ * @returns {Record}
+ */
+ function attendOf(id) {
+ if (!attendance[id]) attendance[id] = {};
+ return attendance[id];
+ }
+
+ /**
+ * 统计这场名单里已经签到或被补签的人数。
+ * @param {{id: number, ids: string[]}} item 月度计划
+ * @returns {number}
+ */
+ function signedCount(item) {
+ const book = attendOf(item.id);
+ return item.ids.filter((id) => book[id]).length;
+ }
+
+ /**
+ * 取一场线上学习进度。每人有课件、考试、评价三项,缺省都是未完成。
+ * @param {number} id 月度计划 id
+ * @returns {Record}
+ */
+ function learnOf(id) {
+ if (!learning[id]) learning[id] = {};
+ return learning[id];
+ }
+
+ /**
+ * 统计课件、考试、评价都完成的人数。
+ * @param {{id: number, ids: string[]}} item 月度计划
+ * @returns {number}
+ */
+ function finishedCount(item) {
+ const book = learnOf(item.id);
+ return item.ids.filter((id) => { const row = book[id]; return row && row.learned && row.exam && row.review; }).length;
+ }
+
+ /**
+ * 统计这场已经提交评价的人数。线上和线下都计。
+ * @param {{id: number, ids: string[]}} item 月度计划
+ * @returns {number}
+ */
+ function reviewCount(item) {
+ const book = learnOf(item.id);
+ return item.ids.filter((id) => book[id] && book[id].review).length;
+ }
+
+ /**
+ * 判断学员自己签到的窗口。上课开始前 30 分钟到结束前为 open,更早是 before,结束后是 closed。
+ * @param {{start: string, end: string}} item 月度计划
+ * @returns {'before'|'open'|'closed'}
+ */
+ function signWindow(item) {
+ const now = new Date(PROTO_TODAY).getTime();
+ const openAt = new Date(item.start).getTime() - 30 * 60 * 1000;
+ const closeAt = new Date(item.end || item.start).getTime();
+ if (now < openAt) return 'before';
+ if (now > closeAt) return 'closed';
+ return 'open';
+ }
+
+ /**
+ * 打开这场签到抽屉。名单来自月度计划已点名的人;讲师勾选未签到的人后点补签。
+ * @param {object} item 月度计划
+ */
+ function openAttendance(item) {
+ if (item.mode === 'online') { openLearning(item); return; }
+ if (sessionState(item) === 'cancelled') { toast('已取消的场次不能签到'); return; }
+ drawerMode = 'attend';
+ attendingId = item.id;
+ const windowState = signWindow(item);
+ const windowText = windowState === 'open' ? '学员现在可以自己签到' : (windowState === 'before' ? '未到签到时间,上课前 30 分钟开放' : '签到已截止,只能由讲师补签');
+ $('drawerTitle').textContent = '签到 · ' + item.course;
+ $('drawerHint').textContent = '这是讲师的签到名单。学员评价不在这里,回到列表点「评价」。补签会盖过学员自己的签到。';
+ const qr = item.mode === 'online' ? '' : '' + '1100111011010111011010110110101011010111011010110'.split('').map((bit) => '').join('') + '
';
+ const channel = item.mode === 'online'
+ ? '线上不出示二维码。学员从企业微信卡片进入同一签到页。
'
+ : '';
+ $('drawerBody').innerHTML = '学员签到
' + windowText + '。' + item.start.replace('T', ' ') + ' – ' + (item.end || '').slice(11) + '
' + channel + '请签到
' + item.course + '\n' + item.start.replace('T', ' ') + '\n' + item.place + '
';
+ const paint = () => {
+ const book = attendOf(item.id);
+ const rows = item.ids.map((id) => {
+ const person = people.find((row) => row.id === id) || { name: id, dept: '' };
+ const mark = book[id];
+ const badge = mark === 'makeup' ? '补签' : (mark === 'self' ? '已签到' : '未签到');
+ const box = mark ? '' : '';
+ return '';
+ }).join('');
+ $('sign-list').innerHTML = rows;
+ $('sign-sum').textContent = '已签到 ' + signedCount(item) + ' / ' + item.ids.length + '。未签到的人可以勾选后补签。';
+ };
+ $('sign-self').addEventListener('click', () => {
+ if (signWindow(item) !== 'open') { toast('现在不能自己签到'); return; }
+ const book = attendOf(item.id);
+ const next = item.ids.find((id) => !book[id]);
+ if (!next) { toast('名单上的人都已签到'); return; }
+ book[next] = 'self';
+ paint();
+ renderMonthly();
+ toast(personName(next) + ' 已签到');
+ });
+ paint();
+ openMask(true);
+ $('drawerSave').textContent = '补签';
+ }
+
+ /**
+ * 打开线上学习进度。讲师只看每人是否学完、考完、评完,不展示课件和评价原文。
+ * @param {object} item 月度计划
+ */
+ function openLearning(item) {
+ if (sessionState(item) === 'cancelled') { toast('已取消的场次不能学习'); return; }
+ drawerMode = 'learn';
+ attendingId = item.id;
+ $('drawerTitle').textContent = '学习进度 · ' + item.course;
+ $('drawerHint').textContent = '这是讲师看的完成进度,只显示做没做完。评价原文在列表「评价」。';
+ $('drawerBody').innerHTML = '每人进度
截止 ' + (item.deadline || '—') + (item.examOn ? '。本场已发布考试。' : '。本场未发布考试。') + '学员在「我的培训」里自己完成。
';
+ const book = learnOf(item.id);
+ $('learn-list').innerHTML = item.ids.map((id) => {
+ const person = people.find((row) => row.id === id) || { name: id, dept: '' };
+ const row = book[id] || { learned: false, exam: false, review: false };
+ const badge = (ok, yes, no) => '' + (ok ? yes : no) + '';
+ return '' + person.name + '' + badge(row.learned, '已学习', '未学习') + badge(row.exam, '已考试', '未考试') + badge(row.review, '已评价', '未评价') + '' + person.dept + '
';
+ }).join('');
+ $('learn-sum').textContent = '全部完成 ' + finishedCount(item) + ' / ' + item.ids.length + '。';
+ openMask(true);
+ $('drawerSave').textContent = '关闭';
+ }
+
+ /**
+ * 讲师查看这一场的评价原文。线上和线下都有,只读,不能代学员填写。
+ * @param {object} item 月度计划
+ */
+ function openReviews(item) {
+ if (sessionState(item) === 'cancelled') { toast('已取消的场次没有评价'); return; }
+ drawerMode = 'learn';
+ $('drawerTitle').textContent = '评价 · ' + item.course;
+ $('drawerHint').textContent = '学员只提交自己的评价。这里给讲师看原文,线上和线下都一样。';
+ const book = learnOf(item.id);
+ const rows = item.ids.map((id) => {
+ const row = book[id];
+ if (!row || !row.review) return '' + personName(id) + '未评价
';
+ return '' + personName(id) + ' ' + (row.score || '已评价') + '' + (row.note || '未填写收获') + '
';
+ }).join('');
+ $('drawerBody').innerHTML = '已提交 ' + reviewCount(item) + ' / ' + item.ids.length + '
' + rows + '
';
+ openMask(true);
+ $('drawerSave').textContent = '关闭';
+ }
+
+ /**
+ * 学员自己的培训页。线上进入学习(课件、考试,最后自己评价);线下只有评价,没有学习链接。
+ */
+ function renderLearner() {
+ const mine = monthlies.filter((item) => item.ids.includes(LEARNER_ID) && sessionState(item) !== 'cancelled');
+ const root = $('learnRoot');
+ if (!learnFocus) {
+ root.innerHTML = '' + personName(LEARNER_ID) + ',你好
只显示点到你名字的培训。线上去学习,线下只评价。评价只有你自己能填,讲师能看到你写的内容。
' + mine.map((item) => {
+ const online = item.mode === 'online';
+ const row = learnOf(item.id)[LEARNER_ID] || {};
+ const when = online ? ('请在 ' + (item.deadline || '—') + ' 前完成') : ((item.start || '').replace('T', ' ') + ' · ' + (item.place || ''));
+ const action = online ? '去学习' : (item.end < PROTO_TODAY ? (row.review ? '查看评价' : '去评价') : '课后开放');
+ return '
';
+ }).join('') + '
';
+ return;
+ }
+ const item = monthlies.find((row) => row.id === learnFocus.id);
+ if (!item) { learnFocus = null; renderLearner(); return; }
+ const online = item.mode === 'online';
+ const row = learnOf(item.id)[LEARNER_ID] || { learned: false, exam: false, review: false, score: '', note: '' };
+ if (!online) {
+ const locked = item.end >= PROTO_TODAY;
+ root.innerHTML = '课后评价' + item.course + '
' + (item.start || '').replace('T', ' ') + (item.end ? ' – ' + item.end.slice(11) : '') + '' + (item.place || '') + ' · 讲师 ' + item.instructor + '这场没有学习链接,也没有课件和考试。
' + (locked ? '下课以后才能评价。
' : reviewForm(row)) + '';
+ bindLearner(item, row);
+ return;
+ }
+ const steps = ['课件', '考试', '评价'];
+ const step = learnFocus.step || '课件';
+ const asset = assetsOf(item.course);
+ let stage = '';
+ if (step === '课件') {
+ const files = asset.files.concat(item.files || []);
+ stage = '课件
看完后标记。截止 ' + (item.deadline || '—') + '
' + (files.length ? files.map((name) => '' + name + '
').join('') : '这门课还没有课件
') + '';
+ } else if (step === '考试') {
+ stage = item.examOn
+ ? '考试
' + (item.examPaper || '本场考试') + '
'
+ : '考试
这场没有考试,直接去评价。
';
+ } else {
+ stage = '我的评价
只提交你自己的。讲师能看到这段文字,其他学员看不到。
' + reviewForm(row);
+ }
+ root.innerHTML = '' + steps.map((name) => '').join('') + '
' + stage + '
';
+ bindLearner(item, row);
+ }
+
+ /**
+ * 学员评价表。只写自己的满意度和收获。
+ * @param {{review?: boolean, score?: string, note?: string}} row 当前学员记录
+ * @returns {string}
+ */
+ function reviewForm(row) {
+ const score = row.score || '满意';
+ const choices = ['满意', '一般', '不满意'].map((name) => '').join('');
+ return '' + choices + '
';
+ }
+
+ /**
+ * 绑定学员页上的返回、步骤和学习动作。
+ * @param {object} item 月度计划
+ * @param {object} row 当前学员记录
+ */
+ function bindLearner(item, row) {
+ const book = learnOf(item.id);
+ const ensure = () => {
+ if (!book[LEARNER_ID]) book[LEARNER_ID] = { learned: false, exam: false, review: false, score: '满意', note: '' };
+ return book[LEARNER_ID];
+ };
+ $('learn-back').addEventListener('click', () => { learnFocus = null; renderLearner(); });
+ document.querySelectorAll('[data-step]').forEach((button) => button.addEventListener('click', () => { learnFocus.step = button.dataset.step; renderLearner(); }));
+ const learned = $('mark-learned');
+ if (learned) learned.addEventListener('click', () => { ensure().learned = true; renderMonthly(); toast('已看完课件'); renderLearner(); });
+ const exam = $('mark-exam');
+ if (exam) exam.addEventListener('click', () => { ensure().exam = true; renderMonthly(); toast('已提交考试'); renderLearner(); });
+ document.querySelectorAll('[data-score]').forEach((button) => button.addEventListener('click', () => {
+ document.querySelectorAll('[data-score]').forEach((node) => node.classList.toggle('on', node === button));
+ }));
+ const save = $('save-review');
+ if (save) save.addEventListener('click', () => {
+ const current = ensure();
+ const picked = document.querySelector('[data-score].on');
+ current.review = true;
+ current.score = picked ? picked.dataset.score : '满意';
+ current.note = $('my-note').value.trim();
+ renderMonthly();
+ toast('评价已提交,讲师可以查看');
+ renderLearner();
+ });
+ }
+
+ function openMask(monthly) { $('drawerSave').textContent = '保存'; document.querySelector('.drawer').classList.toggle('monthly', Boolean(monthly)); $('mask').classList.add('show'); }
+ function closeMask() { $('mask').classList.remove('show'); document.querySelector('.drawer').classList.remove('monthly'); drawerMode = ''; monthlyDraft = null; }
+ /**
+ * 关闭抽屉。从月度计划临时去建课程时,取消回到那场,不丢掉已填的时间、人员和形式。
+ */
+ function cancelDrawer() {
+ if (drawerMode === 'course' && monthlyDraft) {
+ const draft = monthlyDraft;
+ monthlyDraft = null;
+ openMonthly(draft, null);
+ return;
+ }
+ closeMask();
+ }
/**
* 打开计划行抽屉。分类从课程带出且只读,人员默认不勾选。
@@ -490,16 +890,24 @@
}
/**
- * 打开课程抽屉。已有课程改分类不影响已保存计划行的展示快照,原型里用当前课程库直接展示。
- * @param {Array|null} course
+ * 打开课程抽屉。课件和试题记在课程上,供以后的月度计划重复使用。
+ * 从月度计划点「新建课程」或「编辑课程」进来时,monthlyDraft 里留着未保存的场次,保存或取消后回到那场。
+ * @param {Array|null} course 为空时是新增
*/
function openCourse(course) {
drawerMode = 'course';
editingCourse = course ? course[0] : '';
+ const asset = editingCourse ? assetsOf(editingCourse) : { files: [], exams: [] };
+ draftCourseFiles = editingCourse ? asset.files.slice() : [];
+ draftCourseExams = editingCourse ? asset.exams.slice() : [];
$('drawerTitle').textContent = course ? '编辑课程' : '新增课程';
- $('drawerHint').textContent = '停用后不能被新的年度计划选用。';
- $('drawerBody').innerHTML = '';
- openMask();
+ $('drawerHint').textContent = monthlyDraft ? '保存后回到刚才的月度计划,并选中这门课。' : '课件和试题保存在课程上,下次排课可以继续用。';
+ const chips = (list, kind) => list.length ? list.map((name, index) => '' + name + '').join('') : '还没有';
+ $('drawerBody').innerHTML = '';
+ const paintCourseFiles = () => { $('c-files').innerHTML = chips(draftCourseFiles, 'cfile'); $('c-exams').innerHTML = chips(draftCourseExams, 'cexam'); };
+ $('c-add-file').addEventListener('click', () => { const name = $('c-file').value.trim(); if (!name) return; draftCourseFiles.push(name); $('c-file').value = ''; paintCourseFiles(); });
+ $('c-add-exam').addEventListener('click', () => { const name = $('c-exam').value.trim(); if (!name) return; draftCourseExams.push(name); $('c-exam').value = ''; paintCourseFiles(); });
+ openMask(true);
}
/**
@@ -513,24 +921,58 @@
return;
}
drawerMode = 'monthly';
- editingMonthly = record ? record.id : 0;
+ editingMonthly = record && record.id ? record.id : 0;
const source = annual || (record && record.annualNo ? plans.find((item) => item.no === record.annualNo) : null);
- draftFiles = (record ? record.files : []).slice();
- $('drawerTitle').textContent = record ? '编辑月度计划' : (source ? '从年度计划转入' : '新建月度计划');
- $('drawerHint').textContent = source ? '来自年度计划 #' + source.no + '。上课时间和资料由讲师填写。' : '未关联年度计划,保存后记为计划外。';
+ draftFiles = (record && record.files ? record.files : []).slice();
+ $('drawerTitle').textContent = editingMonthly ? '编辑月度计划' : (source ? '从年度计划转入' : '新建月度计划');
+ $('drawerHint').textContent = source ? '来自年度计划 #' + source.no + '。课程沿用年度计划,不能在这里改成另一门。' : '选「年度计划外」时不占年度次数。课程从课程库选择。';
const selected = new Set(record ? record.ids : (source ? source.ids : []));
const courseName = record ? record.course : (source ? source.course : '');
const courseOptions = courses.filter((item) => item[4] === 'enabled' || item[0] === courseName).map((item) => '').join('');
- const annualOptions = '' + visiblePlans().map((item) => '').join('');
+ const annualOptions = '' + visiblePlans().map((item) => '').join('');
const unitName = record ? record.unit : (source ? source.unit : (scopeUnit() || '财务部'));
const classDate = record && record.start ? record.start.slice(0, 10) : '';
const startTime = record && record.start ? record.start.slice(11, 16) : '09:00';
const endTime = record && record.end ? record.end.slice(11, 16) : '10:00';
- const courseField = source
- ? '' + courseName + '
'
- : '';
- $('drawerBody').innerHTML = '课程
' + courseField + '
';
+ const courseField = '';
+ const mode = record && record.mode === 'online' ? 'online' : 'offline';
+ const deadlineValue = record && record.deadline ? record.deadline : '';
+ const liveOn = Boolean(record && record.liveOn);
+ const newCourseBtn = '';
+ $('drawerBody').innerHTML = '课程
' + courseField + '
' + newCourseBtn + '
到场签到
仅线下授课。上课前 30 分钟到结束,讲师出示二维码,学员扫码签到,讲师可补签。纸质签到表仍交人事。学员没有学习链接,课后只在「我的培训」里评价。讲师在列表「评价」查看。
';
const paintFiles = () => { $('m-files').innerHTML = draftFiles.length ? draftFiles.map((name, index) => '' + name + '').join('') : '还没有资料'; };
+ const courseNameNow = () => $('m-course').value;
+ const paintCourseAssets = () => {
+ const asset = assetsOf(courseNameNow());
+ $('m-course-files').innerHTML = asset.files.length ? asset.files.map((name) => '' + name + '').join('') : '这门课还没有课件,可点「编辑课程」上传';
+ const current = record && record.examPaper ? record.examPaper : '';
+ $('m-exam-paper').innerHTML = (asset.exams.length ? asset.exams : ['']).map((name) => '').join('');
+ };
+ const syncMode = () => {
+ const offline = document.querySelector('input[name="m-mode"]:checked').value === 'offline';
+ const live = !offline && $('m-live').checked;
+ $('m-class-time').style.display = offline ? '' : 'none';
+ $('m-recording-wrap').style.display = offline ? '' : 'none';
+ $('m-sign-block').style.display = offline ? '' : 'none';
+ $('m-place-field').style.display = offline ? '' : 'none';
+ $('m-online-block').style.display = offline ? 'none' : '';
+ $('m-live-fields').style.display = live ? '' : 'none';
+ $('m-place-label').textContent = '地点';
+ };
+ const syncExam = () => { $('m-exam-fields').style.display = $('m-exam-on').checked ? '' : 'none'; };
+ const leaveForCourse = (course) => {
+ monthlyDraft = {
+ id: editingMonthly, annualNo: Number($('m-source').value || 0), course: courseNameNow(),
+ unit: $('m-unit').textContent, place: $('m-place').value, instructor: $('m-instructor').value,
+ start: ($('m-date').value && $('m-start-time').value) ? $('m-date').value + 'T' + $('m-start-time').value : '',
+ end: ($('m-date').value && $('m-end-time').value) ? $('m-date').value + 'T' + $('m-end-time').value : '',
+ hours: $('m-hours').value, files: draftFiles.slice(), ids: [...document.querySelectorAll('#m-people input:checked')].map((item) => item.value),
+ mode: document.querySelector('input[name="m-mode"]:checked').value, recording: $('m-recording').value.trim(),
+ deadline: $('m-deadline').value.trim(), liveOn: $('m-live').checked, meeting: $('m-meeting').value.trim(),
+ examOn: $('m-exam-on').checked, examPaper: $('m-exam-paper').value, examFrom: $('m-exam-from').value.trim(), examTo: $('m-exam-to').value.trim()
+ };
+ openCourse(course);
+ };
const syncHours = () => {
const start = ($('m-start-time').value || '').split(':');
const end = ($('m-end-time').value || '').split(':');
@@ -538,11 +980,8 @@
const minutes = (Number(end[0]) * 60 + Number(end[1])) - (Number(start[0]) * 60 + Number(start[1]));
if (minutes > 0) $('m-hours').value = String(Math.round(minutes / 6) / 10);
};
- const applySource = () => {
- const no = Number($('m-source').value);
- const plan = plans.find((item) => item.no === no);
- if (!plan || $('m-course').tagName !== 'DIV') return;
- $('m-course').textContent = plan.course;
+ const applySource = (plan) => {
+ $('m-course').value = plan.course;
$('m-unit').textContent = plan.unit;
$('m-place').value = plan.place;
document.querySelectorAll('#m-people input').forEach((input) => { input.checked = plan.ids.includes(input.value); });
@@ -562,24 +1001,37 @@
});
$('m-start-time').addEventListener('change', syncHours);
$('m-end-time').addEventListener('change', syncHours);
- if (!record) $('m-source').addEventListener('change', () => {
+ if (!$('m-source').disabled) $('m-source').addEventListener('change', () => {
const no = Number($('m-source').value);
if (!no) {
- $('drawerHint').textContent = '未关联年度计划,保存后记为计划外。';
+ $('m-course').disabled = false;
+ $('m-new-course').style.display = '';
+ $('drawerHint').textContent = '选「年度计划外」时不占年度次数。课程从课程库选择。';
+ paintCourseAssets();
return;
}
const plan = plans.find((item) => item.no === no);
if (plan && scheduledCount(plan.no) >= plan.times) { toast('这条年度计划次数已排满'); $('m-source').value = '0'; return; }
- $('drawerHint').textContent = '来自年度计划 #' + plan.no + '。上课时间和资料由讲师填写。';
- if ($('m-course').tagName === 'DIV') applySource();
- else {
- $('m-unit').textContent = plan.unit;
- $('m-place').value = plan.place;
- $('m-course').value = plan.course;
- document.querySelectorAll('#m-people input').forEach((input) => { input.checked = plan.ids.includes(input.value); });
- }
+ $('m-course').disabled = true;
+ $('m-new-course').style.display = 'none';
+ $('drawerHint').textContent = '来自年度计划 #' + plan.no + '。课程沿用年度计划,不能在这里改成另一门。';
+ applySource(plan);
+ paintCourseAssets();
});
+ $('m-course').addEventListener('change', paintCourseAssets);
+ if ($('m-new-course')) $('m-new-course').addEventListener('click', () => leaveForCourse(null));
+ $('m-edit-course').addEventListener('click', () => {
+ const name = courseNameNow();
+ if (!name) { toast('请先选择课程'); return; }
+ leaveForCourse(courseOf(name) || [name, '', '', '知识', 'enabled']);
+ });
+ document.querySelectorAll('input[name="m-mode"]').forEach((input) => input.addEventListener('change', syncMode));
+ $('m-live').addEventListener('change', syncMode);
+ $('m-exam-on').addEventListener('change', syncExam);
paintFiles();
+ paintCourseAssets();
+ syncMode();
+ syncExam();
openMask(true);
}
@@ -587,28 +1039,50 @@
* 保存抽屉。计划行至少点名 1 人;课程名称不能空;月度计划必须填写上课时间。
*/
function saveDrawer() {
+ if (drawerMode === 'learn') { closeMask(); return; }
+ if (drawerMode === 'attend') {
+ const picked = [...document.querySelectorAll('#sign-list input:checked')].map((item) => item.value);
+ if (!picked.length) { toast('请勾选要补签的人'); return; }
+ const book = attendOf(attendingId);
+ picked.forEach((id) => { book[id] = 'makeup'; });
+ toast('已补签 ' + picked.length + ' 人');
+ closeMask();
+ renderMonthly();
+ return;
+ }
if (drawerMode === 'monthly') {
const ids = [...document.querySelectorAll('#m-people input:checked')].map((item) => item.value);
if (!ids.length) { toast('请至少选择 1 名参加人员'); return; }
+ const offline = document.querySelector('input[name="m-mode"]:checked').value === 'offline';
const classDate = $('m-date').value.trim();
const startTime = $('m-start-time').value.trim();
const endTime = $('m-end-time').value.trim();
- if (!/^\d{4}-\d{2}-\d{2}$/.test(classDate) || !/^\d{2}:\d{2}$/.test(startTime) || !/^\d{2}:\d{2}$/.test(endTime)) { toast('日期填 2026-04-09,时间填 09:00'); return; }
+ const deadline = $('m-deadline').value.trim();
+ const liveOn = !offline && $('m-live').checked;
+ if (offline && (!/^\d{4}-\d{2}-\d{2}$/.test(classDate) || !/^\d{2}:\d{2}$/.test(startTime) || !/^\d{2}:\d{2}$/.test(endTime))) { toast('线下授课要填上课日期和时间,如 2026-04-09、09:00'); return; }
+ if (!offline && !/^\d{4}-\d{2}-\d{2}$/.test(deadline)) { toast('线上学习要填截止日,如 2026-03-31'); return; }
+ if (liveOn && !$('m-meeting').value.trim()) { toast('勾了同步直播就要填会议链接'); return; }
const annualNo = Number($('m-source').value || 0);
const annual = plans.find((item) => item.no === annualNo);
if (annual && scheduledCount(annual.no) >= annual.times && editingMonthly === 0) { toast('次数已排满'); return; }
- const courseEl = $('m-course');
+ const courseName = $('m-course').value;
+ if ($('m-exam-on').checked && !assetsOf(courseName).exams.length) { toast('这门课还没有试题,请先点「编辑课程」上传'); return; }
const payload = {
- annualNo, month: classDate.slice(0, 7), unit:$('m-unit').textContent,
+ annualNo, month: (offline ? classDate : deadline).slice(0, 7), unit:$('m-unit').textContent,
plant: annual ? annual.plant : '1厂',
- course: courseEl.tagName === 'DIV' ? courseEl.textContent : courseEl.value,
- place:$('m-place').value.trim() || '教育训练室', side: annual ? annual.side : '内',
- start: classDate + 'T' + startTime, end: classDate + 'T' + endTime, hours:$('m-hours').value || '1',
- instructor:$('m-instructor').value, files:draftFiles.slice(), ids, status:'scheduled'
+ course: courseName,
+ place: offline ? ($('m-place').value.trim() || '教育训练室') : (liveOn ? $('m-meeting').value.trim() : ''), side: annual ? annual.side : '内',
+ start: offline ? classDate + 'T' + startTime : '', end: offline ? classDate + 'T' + endTime : '', hours: offline ? ($('m-hours').value || '1') : '',
+ deadline: offline ? '' : deadline, liveOn,
+ instructor:$('m-instructor').value, files:draftFiles.slice(), ids, status:'scheduled',
+ mode: offline ? 'offline' : 'online',
+ recording: offline ? $('m-recording').value.trim() : '',
+ examOn: $('m-exam-on').checked, examPaper: $('m-exam-on').checked ? $('m-exam-paper').value : '',
+ examFrom: $('m-exam-on').checked ? $('m-exam-from').value.trim() : '', examTo: $('m-exam-on').checked ? $('m-exam-to').value.trim() : ''
};
if (editingMonthly) Object.assign(monthlies.find((item) => item.id === editingMonthly), payload);
else monthlies.push({ id: monthlies.reduce((max, item) => Math.max(max, item.id), 0) + 1, ...payload });
- toast(editingMonthly ? '已更新月度计划' : (annualNo ? '已从年度计划转入' : '已新建计划外月度计划'));
+ toast(editingMonthly ? '已更新月度计划' : (annualNo ? '已从年度计划转入' : '已新建年度计划外的月度计划'));
closeMask();
renderPlans();
renderMonthly();
@@ -630,10 +1104,26 @@
const next = [name, $('c-1').value.trim() || '未分类', $('c-2').value.trim() || '未分类', $('c-3').value.trim() || '知识', $('c-status').value];
if (editingCourse) {
const index = courses.findIndex((item) => item[0] === editingCourse);
+ if (editingCourse !== name) {
+ courseAssets[name] = courseAssets[editingCourse] || { files: [], exams: [] };
+ delete courseAssets[editingCourse];
+ }
plans.forEach((item) => { if (item.course === editingCourse) item.course = name; });
+ monthlies.forEach((item) => { if (item.course === editingCourse) item.course = name; });
courses[index] = next;
} else if (courses.some((item) => item[0] === name)) { toast('课程名称已存在'); return; }
else courses.push(next);
+ assetsOf(name).files = draftCourseFiles.slice();
+ assetsOf(name).exams = draftCourseExams.slice();
+ if (monthlyDraft) {
+ const draft = monthlyDraft;
+ monthlyDraft = null;
+ draft.course = name;
+ toast('课程已保存,已回到月度计划');
+ renderCourses();
+ openMonthly(draft, null);
+ return;
+ }
toast(editingCourse ? '已更新课程' : '已新增课程');
renderCourses();
}
@@ -644,12 +1134,39 @@
}
function go(view) {
+ if (role === 'student' && view !== 'learn') return;
+ if (view === 'learn' && role !== 'student') return;
if (view === 'courses' && role !== 'hr') { toast('课程库由 HR 维护'); return; }
document.querySelectorAll('.view').forEach((item) => item.classList.toggle('active', item.id === 'v-' + view));
document.querySelectorAll('#tabs button').forEach((item) => item.classList.toggle('active', item.dataset.v === view));
}
- $('role').addEventListener('change', () => { role = $('role').value; if (role !== 'hr' && document.getElementById('v-courses').classList.contains('active')) go('annual'); renderUnitFilter(); renderProgress(); renderPlans(); renderCourses(); renderMonthly(); renderBoard(); });
+ /**
+ * 切换身份。学员只看到自己的培训页,讲师和 HR 回到管理页。
+ */
+ function applyRole() {
+ role = $('role').value;
+ const student = role === 'student';
+ $('tabs').style.display = student ? 'none' : '';
+ $('brandSub').textContent = student ? '学员 · 我的培训' : '原型 · 年度收集与月度排课';
+ if (student) {
+ learnFocus = null;
+ renderLearner();
+ go('learn');
+ } else if (document.getElementById('v-learn').classList.contains('active')) {
+ go('monthly');
+ } else if (role !== 'hr' && document.getElementById('v-courses').classList.contains('active')) {
+ go('annual');
+ }
+ renderUnitFilter();
+ renderProgress();
+ renderPlans();
+ renderCourses();
+ renderMonthly();
+ renderBoard();
+ }
+
+ $('role').addEventListener('change', applyRole);
$('tabs').addEventListener('click', (event) => { const button = event.target.closest('[data-v]'); if (button) go(button.dataset.v); });
$('plant').addEventListener('change', renderPlans);
$('unit').addEventListener('change', renderPlans);
@@ -667,7 +1184,22 @@
$('monthRows').addEventListener('click', (event) => {
const edit = event.target.closest('[data-medit]');
const cancel = event.target.closest('[data-cancel]');
+ const done = event.target.closest('[data-done]');
+ const attend = event.target.closest('[data-attend]');
+ const learn = event.target.closest('[data-learn]');
+ const reviews = event.target.closest('[data-reviews]');
if (edit) openMonthly(monthlies.find((item) => item.id === Number(edit.dataset.medit)), null);
+ if (attend) openAttendance(monthlies.find((item) => item.id === Number(attend.dataset.attend)));
+ if (learn) openLearning(monthlies.find((item) => item.id === Number(learn.dataset.learn)));
+ if (reviews) openReviews(monthlies.find((item) => item.id === Number(reviews.dataset.reviews)));
+ if (done) {
+ const item = monthlies.find((row) => row.id === Number(done.dataset.done));
+ item.status = 'done';
+ toast('已标记完成,这场不再提醒');
+ renderPlans();
+ renderMonthly();
+ renderBoard();
+ }
if (cancel) {
const item = monthlies.find((row) => row.id === Number(cancel.dataset.cancel));
item.status = 'cancelled';
@@ -677,6 +1209,20 @@
renderBoard();
}
});
+ $('remindPhone').addEventListener('click', (event) => {
+ const button = event.target.closest('[data-remind-month]');
+ if (!button) return;
+ $('monthFilter').value = button.dataset.remindMonth;
+ renderMonthly();
+ toast('已筛到 ' + button.dataset.remindMonth + ' 的未完成场次');
+ });
+ $('learnRoot').addEventListener('click', (event) => {
+ const card = event.target.closest('[data-open-learn]');
+ if (!card) return;
+ const item = monthlies.find((row) => row.id === Number(card.dataset.openLearn));
+ learnFocus = { id: item.id, step: item.mode === 'online' ? '课件' : '评价' };
+ renderLearner();
+ });
$('monthFilter').addEventListener('change', renderMonthly);
$('monthUnit').addEventListener('change', renderMonthly);
$('createMonthly').addEventListener('click', () => openMonthly(null, null));
@@ -686,9 +1232,21 @@
openMonthly(null, candidate);
});
$('courseRows').addEventListener('click', (event) => { const button = event.target.closest('[data-course]'); if (button) openCourse(courseOf(button.dataset.course)); });
- $('drawerCancel').addEventListener('click', closeMask);
+ $('drawerBody').addEventListener('click', (event) => {
+ if (drawerMode !== 'course') return;
+ const file = event.target.closest('[data-cfile]');
+ const exam = event.target.closest('[data-cexam]');
+ if (file) draftCourseFiles.splice(Number(file.dataset.cfile), 1);
+ if (exam) draftCourseExams.splice(Number(exam.dataset.cexam), 1);
+ if (file || exam) {
+ const chips = (list, kind) => list.length ? list.map((name, index) => '' + name + '').join('') : '还没有';
+ $('c-files').innerHTML = chips(draftCourseFiles, 'cfile');
+ $('c-exams').innerHTML = chips(draftCourseExams, 'cexam');
+ }
+ });
+ $('drawerCancel').addEventListener('click', cancelDrawer);
$('drawerSave').addEventListener('click', saveDrawer);
- $('mask').addEventListener('click', (event) => { if (event.target === $('mask')) closeMask(); });
+ $('mask').addEventListener('click', (event) => { if (event.target === $('mask')) cancelDrawer(); });
$('goFill').addEventListener('click', () => { $('role').value = 'dept'; $('role').dispatchEvent(new Event('change')); go('annual'); });
['boardYear','boardMonth','boardPlant','boardUnit'].forEach((id) => $(id).addEventListener('change', renderBoard));
renderUnitFilter(); renderProgress(); renderPlans(); renderCourses(); renderMonthly(); renderBoard();
diff --git a/docs/funclist.md b/docs/funclist.md
index 0ef369b4..3ee34542 100644
--- a/docs/funclist.md
+++ b/docs/funclist.md
@@ -95,6 +95,14 @@
| 意见反馈入库 | 已实现 | 用户在 Workspace/Chat 提交意见后写入 `general_feedbacks`,后台报表可查看 |
| 反馈企业微信群通知 | 已实现 | 反馈入库后通过 `WECOM_FEEDBACK_BOT_WEBHOOK` 即时推送到企业微信群;未配置 webhook 时静默跳过,不影响用户提交 |
+## 年度教育训练计划
+
+独立于下方「新人培训 Agent」。需求已整理,尚未开发。
+
+| 功能项 | 状态 | 说明 |
+| --- | --- | --- |
+| 年度收集、课程库、月度排课、签到与周一提醒 | 已文档化 | 不读写现有 `training_records`。每周一 09:00 提醒当月未完成讲师。需求见 [docs/features/training/annual-training-plan-demand.md](features/training/annual-training-plan-demand.md),设计见 [docs/features/training/annual-training-plan-design.md](features/training/annual-training-plan-design.md),原型见 [docs/features/training/annual-training-plan-prototype.html](features/training/annual-training-plan-prototype.html) |
+
## 新人培训 Agent
| 功能项 | 状态 | 说明 |
diff --git a/docs/ui/ELEMENT_MIGRATION.md b/docs/ui/ELEMENT_MIGRATION.md
index 71a28932..7a04eef1 100644
--- a/docs/ui/ELEMENT_MIGRATION.md
+++ b/docs/ui/ELEMENT_MIGRATION.md
@@ -3,7 +3,7 @@
> **用途**:管理端页面从手写 Tailwind 控件换成 Element Plus 时的唯一操作说明。后续每换一页,按本文做,不要再单页发明一套间距、字号或按钮写法。
> **适用**:管理控制台里已经或即将换成 Element 的列表、筛选、表格、表单弹窗。
> **不适用**:对话、文档画布、冻结列宽表(订单交期回复、发货审核等)。这些仍走 [UI_CODING_GUIDELINES.md](./UI_CODING_GUIDELINES.md),不要在同一块界面里混用两套按钮和输入框。
-> **试点**:用户管理、应用配置、知识库分组。列表和短弹窗已按本文收过。应用配置的创建/编辑表单内部还没换完,见 §8。新页面以本文为准。
+> **试点**:用户管理、应用配置、知识库分组。列表、短弹窗和应用配置的创建/编辑表单已按本文收过。新页面以本文为准。
旧页面在换完之前,继续遵守 [UI_CODING_GUIDELINES.md](./UI_CODING_GUIDELINES.md)。换到 Element 的那一块,以本文为准。
@@ -65,8 +65,9 @@ import '@/features/admin/styles/element-trial.css';
## 3. 列表页骨架(只有这一套)
```text
-section.admin-table-section 一张圆角卡片,页面上只此一层
+section.admin-table-section 一张圆角卡片,页面上只此一层。组件是 features/admin/components/AdminListPage.vue
标题栏 section-title + section-desc + 右侧 ElSpace 按钮
+ 页签 AdminListTabs,没有页签就不占一行
筛选条 一行控件,底部分隔线
ElTable 表头用 Element 灰底,左右内边距与标题栏一致
分页 右对齐,上边一条分隔线
@@ -191,7 +192,17 @@ section.admin-table-section 一张圆角卡片,页面上只此一层
| --- | --- |
| 用户管理 | 列表、筛选、三个业务弹窗、删除和改角色确认已按 §3、§4 对齐。筛选宽度和两列表单写在页面里。 |
| 知识库分组 | 列表骨架、行内链接按钮、删除确认、创建分组、Dify 设置和健康检查已对齐。 |
-| 应用配置 | 列表、状态标签、测试弹窗、授权弹窗和删除确认已对齐。创建/编辑弹窗外壳是 680px `ElDialog`,内部字段仍是 `input-field` 和 lucide 图标。下一步只改这个弹窗内部,不要连带改保存接口。 |
+| 应用配置 | 列表、状态标签、测试弹窗、授权弹窗、删除确认和 680px 创建/编辑表单内部已对齐。保存仍走原来的 `save` 事件。 |
+| 部门管理 | 列表已用 `AdminListPage`。搜索、表头排序、行内链接、480px 表单、员工名单和删除确认已按 §3、§4 对齐。列表仍是本地过滤和排序,没有分页。 |
+| 公告管理 | 列表已用 `AdminListPage`。发布/编辑是 680px 对话框,详情是描述列表,删除确认已对齐。 |
+| 关联服务 | 列表已用 `AdminListPage`。启用用 `ElSwitch`,表单 480px,删除确认已对齐。 |
+| 知识库分组 | 外层不再套第二张卡片,列表骨架改为 `AdminListPage`。 |
+| 仪表盘 | 四张统计卡改为 `ElCard` + `ElStatistic`。它不是列表,不用 `AdminListPage`。 |
+| 平台应用 | 列表已用 `AdminListPage`。应用筛选、指南表格、680px 表单、上传和删除确认已对齐。 |
+| 集成连接器 | 列表已用 `AdminListPage` 和 `AdminListTabs`。六个页签的表格、启停开关、状态标签和行内操作已对齐。创建/编辑抽屉、调用日志和手动调用弹窗仍是原来的控件。 |
+| 常用问题 | 列表已用 `AdminListPage` 和 `AdminListTabs`。编辑弹窗、热点发现和删除确认已对齐。 |
+| 应用权限 | 列表已用 `AdminListPage` 和 `AdminListTabs`。筛选、分页、权限组表单和删除确认已对齐。选人仍用共享的 `UserPickerDialog`。CSV 导入仍是隐藏文件框。 |
+| 采购合同 | 列表已用 `AdminListPage` 和 `AdminListTabs`。模板、规则、审查三个页签,上传和删除确认已对齐。下载和保存参数未改。 |
---
@@ -242,7 +253,7 @@ npm run lint
## 10. 建议的切换顺序
1. §2 的变量已写入 `element-trial.css`。换下一页之前,在暗色下打开一张已换页面,看按钮、表格和弹窗是否跟着令牌变。
-2. 三个试点的列表和短弹窗已按 §6 收过。还剩应用配置创建/编辑表单内部,换完它再进下一页。
-3. 之后每个管理端列表按 §6 的清单换,一页一次。合并请求用 `.gitee/PULL_REQUEST_TEMPLATE.md` 里的清单。换完再开下一页。
+2. 三个试点的列表、短弹窗和应用配置创建/编辑表单内部已按 §6 收过。部门管理也已换成 `AdminListPage`。
+3. 之后每个管理端列表按 §6 的清单换,一页一次,骨架用 `AdminListPage`。合并请求用 `.gitee/PULL_REQUEST_TEMPLATE.md` 里的清单。换完再开下一页。
4. §9.1 路径里的页面都换完后,按 §9.2 把 ESLint 规则改成 `error` 并接到 CI。
5. 对话、文档画布、冻结列表格不在本顺序里。
diff --git a/frontend/src/features/admin/components/AdminListPage.vue b/frontend/src/features/admin/components/AdminListPage.vue
new file mode 100644
index 00000000..20da7886
--- /dev/null
+++ b/frontend/src/features/admin/components/AdminListPage.vue
@@ -0,0 +1,62 @@
+/**
+ * features/admin/components/AdminListPage.vue
+ * 用途:管理端列表页的唯一卡片骨架。标题、操作、页签、筛选、表格、分页按固定顺序和 32px 内边距排列。
+ * 依赖:element-plus 的加载指令、components-ds.css 的 admin-table-section / admin-table-header、element-trial.css 的分页条。
+ * 逻辑:AdminLayout 提供菜单和内容区外边距;各业务页把文案和控件填进插槽。本组件不请求数据。
+ * 用户管理、部门管理、常用问题等列表调用本组件。页签用 AdminListTabs。页签、筛选、分页没有内容时不占一行。
+ */
+
+
+
+
+
+
+
diff --git a/frontend/src/features/admin/components/AdminListTabs.vue b/frontend/src/features/admin/components/AdminListTabs.vue
new file mode 100644
index 00000000..336593ac
--- /dev/null
+++ b/frontend/src/features/admin/components/AdminListTabs.vue
@@ -0,0 +1,89 @@
+/**
+ * features/admin/components/AdminListTabs.vue
+ * 用途:管理端列表卡片里的页签条。只负责切换,不放表格和筛选。
+ * 依赖:element-plus 的 ElTabs、ElTabPane、ElTag。
+ * 逻辑:放进 AdminListPage 的 tabs 插槽。当前页签用 v-model 交给页面,页面再决定筛选和表格。
+ */
+
+
+
+
+
+
+
+ {{ item.label }}
+
+ {{ item.badge }}
+
+
+
+
+
+
+
+
diff --git a/frontend/src/features/admin/modules/agents/AgentsPage.vue b/frontend/src/features/admin/modules/agents/AgentsPage.vue
index 4ad49695..f6358345 100644
--- a/frontend/src/features/admin/modules/agents/AgentsPage.vue
+++ b/frontend/src/features/admin/modules/agents/AgentsPage.vue
@@ -4,6 +4,7 @@
* 用途:管理控制台的应用管理页,提供应用列表、创建/编辑弹窗、测试与授权入口。
* 依赖:useAgentsAdmin 业务编排、Element Plus 表格与按钮、AgentFormModal/AgentTestModal/AgentPermissionModal 弹窗。
* 逻辑:页面加载后先展示应用列表;目录、用户和排程在后台补齐。权限组启用后隐藏按人授权按钮。
+ * 列表使用 Element stripe 斑马纹。选中行浅底画在单元格上,盖过斑马纹。
*/
-
-
-
- {{ t('admin.agent.capabilities.title') }}
-
-
- {{ t('admin.agent.capabilities.subtitle') }}
-
+
+
+
diff --git a/frontend/src/features/admin/modules/agents/components/AgentFormModal.vue b/frontend/src/features/admin/modules/agents/components/AgentFormModal.vue
index ff4cb499..ac41ba57 100644
--- a/frontend/src/features/admin/modules/agents/components/AgentFormModal.vue
+++ b/frontend/src/features/admin/modules/agents/components/AgentFormModal.vue
@@ -2,15 +2,30 @@
* features/admin/modules/agents/components/AgentFormModal.vue
*
* 用途:应用管理新增/编辑弹窗,集中承载 Agent 基础信息(含启用状态)、Dify/Iframe 配置和常见问题表单。
- * 依赖:element-plus 对话框、agent.types AgentFormState、schedule.types ScheduleTask、AgentToolRunProgressConfig、vue-i18n。
- * 逻辑:父组件控制 visible/isEditing/isSaving 与保存;外壳是 680px 对话框。表单内部字段仍沿用原有输入控件。
+ * 依赖:element-plus 对话框与表单、agent.types AgentFormState、schedule.types ScheduleTask、AgentCapabilitiesConfig、AgentToolRunProgressConfig、vue-i18n。
+ * 逻辑:父组件控制 visible/isEditing/isSaving 与保存;外壳是 680px 对话框。内部字段已换 Element。
*/
-
-
-
-
-
{{ $t('admin.agent.toolRunProgress.title') }}
-
{{ $t('admin.agent.toolRunProgress.subtitle') }}
-
-
-
-
-
-
-
{{ $t('admin.agent.toolRunProgress.scheduleTaskHint') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+/**
+ * features/admin/modules/agents/components/AgentToolRunProgressConfig.vue
+ * 用途:应用管理表单中的任务进度关联配置(排程绑定、轮询间隔、运行期锁输入)。
+ * 依赖:element-plus 表单控件、agent.types AgentFormState、schedule.types ScheduleTask、vue-i18n。
+ * 逻辑:task_progress 能力开关由 AgentCapabilitiesConfig 维护;本组件只写 bound_schedule_task_id 与 handler_config 轮询参数。内部字段已换 Element。
+ */
+
+
+
+
+
+
+
diff --git a/frontend/src/features/admin/modules/announcements/AnnouncementsPage.vue b/frontend/src/features/admin/modules/announcements/AnnouncementsPage.vue
index fb5c6e31..d3fbb44f 100644
--- a/frontend/src/features/admin/modules/announcements/AnnouncementsPage.vue
+++ b/frontend/src/features/admin/modules/announcements/AnnouncementsPage.vue
@@ -1,19 +1,26 @@
/**
* features/admin/modules/announcements/AnnouncementsPage.vue
- * 公告管理独立页面:全宽表格列表 + 发布/编辑/详情居中弹窗。
- * 依赖:useAnnouncementsAdmin、AnnouncementFormModal、AnnouncementDetailModal、DeleteConfirmDialog。
- * 逻辑:路由 /admin/announcements 挂载本页;列表摘要截断,完整内容在详情弹窗查看。
+ * 用途:公告管理列表。一张卡片里放标题、发布按钮和表格。
+ * 依赖:AdminListPage、useAnnouncementsAdmin、useElementProvider、element-plus、公告表单和详情对话框。
+ * 逻辑:路由 /admin/announcements。骨架用 AdminListPage。发布、编辑、查看仍由本页的两个对话框完成。删除用 Element 确认框。
*/
-
-
+
+
+
+ {{ t('admin.announcement.title') }}
+ {{ t('admin.announcement.subtitle') }}
+
+
+
+ {{ t('admin.announcement.add') }}
+
+
-
-
-
-
-
-
-
- | {{ t('admin.announcement.headers.title') }} |
- {{ t('admin.announcement.headers.publishedAt') }} |
- {{ t('admin.announcement.headers.preview') }} |
- {{ t('admin.announcement.headers.actions') }} |
-
-
-
-
- | {{ t('admin.announcement.noData') }} |
-
-
- |
- {{ ann.title }}
- |
-
- {{ formatPublishedAt(ann.created_at) }}
- |
-
-
- {{ truncateAnnouncementPreview(ann.content) }}
-
- |
-
-
-
-
-
-
- |
-
-
-
-
-
+
+
+
+ {{ formatPublishedAt(row.created_at) }}
+
+
+
+ {{ truncateAnnouncementPreview(row.content) }}
+
+
+
+
+
+ {{ t('admin.announcement.actions.view') }}
+
+
+ {{ t('admin.announcement.actions.edit') }}
+
+
+ {{ t('admin.announcement.actions.delete') }}
+
+
+
+
+
{
@close="closeFormModal"
@save="saveAnnouncement"
/>
-
-
-
-
+
+
+
diff --git a/frontend/src/features/admin/modules/announcements/components/AnnouncementDetailModal.vue b/frontend/src/features/admin/modules/announcements/components/AnnouncementDetailModal.vue
index b9353609..06df824e 100644
--- a/frontend/src/features/admin/modules/announcements/components/AnnouncementDetailModal.vue
+++ b/frontend/src/features/admin/modules/announcements/components/AnnouncementDetailModal.vue
@@ -1,11 +1,12 @@
/**
* features/admin/modules/announcements/components/AnnouncementDetailModal.vue
- * 公告详情居中弹窗,展示完整标题、时间与正文。
- * 依赖:AdminAnnouncementRow、admin 通用 modal 样式。
- * 逻辑:AnnouncementsPage 列表「查看」打开;可跳转编辑或关闭。
+ * 用途:只读展示公告标题、发布时间和正文。
+ * 依赖:element-plus 对话框和描述列表、AdminAnnouncementRow。
+ * 逻辑:AnnouncementsPage 点「查看」后传入。可关闭,或 emit edit 交给页面打开编辑框。
*/
-
-
-
-
{{ t('admin.announcement.viewDetail') }}
-
{{ formatDateTime(announcement.created_at) }}
-
-
-
-
- {{ t('admin.announcement.fields.title') }}
-
-
{{ announcement.title }}
-
-
-
- {{ t('admin.announcement.fields.content') }}
-
-
{{ announcement.content }}
-
-
-
-
-
+
+
+ {{ formatDateTime(announcement.created_at) }}
+
+
+ {{ announcement.title }}
+
+
+ {{ announcement.content }}
+
+
+
+
+ {{ t('admin.close') }}
+ {{ t('admin.edit') }}
+
+
+
+
diff --git a/frontend/src/features/admin/modules/announcements/components/AnnouncementFormModal.vue b/frontend/src/features/admin/modules/announcements/components/AnnouncementFormModal.vue
index 4c984542..71b1b0a7 100644
--- a/frontend/src/features/admin/modules/announcements/components/AnnouncementFormModal.vue
+++ b/frontend/src/features/admin/modules/announcements/components/AnnouncementFormModal.vue
@@ -1,11 +1,12 @@
/**
* features/admin/modules/announcements/components/AnnouncementFormModal.vue
- * 公告创建/编辑居中弹窗。
- * 依赖:AnnouncementFormState、admin 通用 modal 样式。
- * 逻辑:AnnouncementsPage 打开本组件;提交时 emit save,由 composable 调 API。
+ * 用途:公告发布和编辑对话框。标题一行,正文多行。
+ * 依赖:element-plus 对话框和表单、AnnouncementFormState。
+ * 逻辑:AnnouncementsPage 打开本组件。提交时 emit save,由 composable 调接口。样式跟页面已引入的 Element 皮肤走。
*/
-
-
-
-
- {{ form.id ? t('admin.announcement.edit') : t('admin.announcement.add') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ {{ t('admin.cancel') }}
+
+ {{ form.id ? t('admin.update') : t('admin.announcement.publish') }}
+
+
+
diff --git a/frontend/src/features/admin/modules/announcements/composables/useAnnouncementsAdmin.ts b/frontend/src/features/admin/modules/announcements/composables/useAnnouncementsAdmin.ts
index 7c89e4e8..d4746219 100644
--- a/frontend/src/features/admin/modules/announcements/composables/useAnnouncementsAdmin.ts
+++ b/frontend/src/features/admin/modules/announcements/composables/useAnnouncementsAdmin.ts
@@ -1,11 +1,12 @@
/**
* features/admin/modules/announcements/composables/useAnnouncementsAdmin.ts
* 公告管理:列表、发布/编辑弹窗、详情弹窗、删除。
- * 依赖:admin.api、announcement.types、useMessage。
- * 逻辑:AnnouncementsPage 调用本 composable 驱动表格与两个居中弹窗。
+ * 依赖:admin.api、announcement.types、useMessage、element-plus 确认框。
+ * 逻辑:AnnouncementsPage 调用本 composable 驱动表格与两个对话框。删除用 ElMessageBox。
*/
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
+import { ElMessageBox } from 'element-plus';
import {
createAnnouncement,
deleteAnnouncement,
@@ -33,10 +34,6 @@ export function useAnnouncementsAdmin() {
const showFormModal = ref(false);
const showDetailModal = ref(false);
- const showDeleteConfirmDialog = ref(false);
- const deleteConfirmMessage = ref('');
- let deleteConfirmAction: (() => Promise
| void) | null = null;
-
/**
* 拉取公告列表并写入 announcements。
* @returns Promise
@@ -60,36 +57,6 @@ export function useAnnouncementsAdmin() {
isLoading.value = false;
};
- /**
- * 打开删除确认对话框并绑定确认后的删除动作。
- * @param message - 确认文案
- * @param action - 用户确认后执行的异步删除逻辑
- */
- const openDeleteConfirm = (message: string, action: () => Promise | void): void => {
- deleteConfirmMessage.value = message;
- deleteConfirmAction = action;
- showDeleteConfirmDialog.value = true;
- };
-
- /** 关闭删除确认对话框并清空待执行动作。 */
- const closeDeleteConfirm = (): void => {
- showDeleteConfirmDialog.value = false;
- deleteConfirmAction = null;
- };
-
- /**
- * 执行删除确认对话框中绑定的删除动作。
- * @returns Promise
- */
- const confirmDelete = async (): Promise => {
- if (!deleteConfirmAction) return;
- try {
- await deleteConfirmAction();
- } finally {
- closeDeleteConfirm();
- }
- };
-
/** 打开「发布公告」弹窗并重置表单。 */
const openCreateModal = (): void => {
form.value = createEmptyAnnouncementForm();
@@ -168,22 +135,30 @@ export function useAnnouncementsAdmin() {
};
/**
- * 删除指定公告,删除前弹出确认框。
+ * 删除指定公告。先用 Element 确认框询问,取消则不请求。
+ * 核心逻辑:MessageBox 取消时 reject,这里吞掉;确定后删除并刷新列表。
* @param id - 公告主键
*/
- const deleteAnnouncementItem = (id: number): void => {
- openDeleteConfirm(t('admin.announcement.confirmDelete'), async () => {
- try {
- await deleteAnnouncement(id);
- if (viewingAnnouncement.value?.id === id) {
- closeDetailModal();
- }
- await loadAnnouncements();
- } catch (e) {
- console.error(e);
- msg.error((e as Error).message || t('admin.msg.requestFailed'));
+ const deleteAnnouncementItem = async (id: number): Promise => {
+ try {
+ await ElMessageBox.confirm(t('admin.announcement.confirmDelete'), t('common.deleteDialog.defaultTitle'), {
+ type: 'warning',
+ confirmButtonText: t('common.deleteDialog.confirm'),
+ cancelButtonText: t('common.deleteDialog.cancel'),
+ });
+ } catch {
+ return;
+ }
+ try {
+ await deleteAnnouncement(id);
+ if (viewingAnnouncement.value?.id === id) {
+ closeDetailModal();
}
- });
+ await loadAnnouncements();
+ } catch (e) {
+ console.error(e);
+ msg.error((e as Error).message || t('admin.msg.requestFailed'));
+ }
};
/**
@@ -201,8 +176,6 @@ export function useAnnouncementsAdmin() {
isSaving,
showFormModal,
showDetailModal,
- showDeleteConfirmDialog,
- deleteConfirmMessage,
loadAll,
openCreateModal,
openEditModal,
@@ -212,8 +185,6 @@ export function useAnnouncementsAdmin() {
editFromDetail,
saveAnnouncement,
deleteAnnouncementItem,
- closeDeleteConfirm,
- confirmDelete,
truncateAnnouncementPreview,
formatPublishedAt,
};
diff --git a/frontend/src/features/admin/modules/dashboard/DashboardPage.vue b/frontend/src/features/admin/modules/dashboard/DashboardPage.vue
index 173c6c0e..61dd6769 100644
--- a/frontend/src/features/admin/modules/dashboard/DashboardPage.vue
+++ b/frontend/src/features/admin/modules/dashboard/DashboardPage.vue
@@ -1,16 +1,25 @@
/**
* features/admin/modules/dashboard/DashboardPage.vue
- * 管理后台仪表盘。路由:/admin/dashboard
+ * 用途:管理后台仪表盘,四张可点击的统计卡。
+ * 依赖:useDashboardAdmin、useElementProvider、element-plus。
+ * 逻辑:路由 /admin/dashboard。统计来自 useDashboardAdmin。点击分别进入应用配置、应用权限和数据报表。本页不是列表,不用 AdminListPage。
*/
-
-
-
-
-
-
-
-
+
+
+ {{ t('admin.nav.dashboard') }}
+
+
+
+
+ +2 {{ t('admin.dash.new') }}
-
- +2 {{ t('admin.dash.new') }}
-
-
- {{ agentCount }}
- {{ t('admin.dash.activeAgents') }}
-
+
+
-
-
-
-
{{ userCount }}
-
{{ t('admin.dash.totalUsers') }}
-
+
+
-
-
-
-
{{ totalConversations }}
-
{{ t('admin.dash.totalConversations') }}
-
+
+
-
-
-
-
- {{ avgScore.toFixed(1) }}
-
-
{{ t('admin.dash.avgRating') }}
+
+
-
-
+
+
+
+
diff --git a/frontend/src/features/admin/modules/departments/DepartmentsPage.vue b/frontend/src/features/admin/modules/departments/DepartmentsPage.vue
index c31f7b64..c7e2d4c7 100644
--- a/frontend/src/features/admin/modules/departments/DepartmentsPage.vue
+++ b/frontend/src/features/admin/modules/departments/DepartmentsPage.vue
@@ -1,24 +1,41 @@
/**
* features/admin/modules/departments/DepartmentsPage.vue
- * 用途:部门管理独立页面——全宽表格列表 + 列排序 + 创建/编辑居中弹窗。
- * 依赖:useDepartmentsAdmin、SortableTableHeader、DepartmentFormModal、DeleteConfirmDialog。
- * 逻辑:路由 /admin/departments;表头排序复用 shared SortableTableHeader + useTableSort。
+ * 用途:部门管理列表。一张卡片里放标题、添加按钮、搜索、表格。
+ * 依赖:AdminListPage、useDepartmentsAdmin、useElementProvider、element-plus、lucide-vue-next、部门表单和员工名单弹窗。
+ * 逻辑:路由 /admin/departments。骨架用 AdminListPage。筛选、列和两个弹窗留在本页。
+ * 名称、编码、公司用表头排序,排的是当前过滤结果。删除用 Element 确认框。
+ * 表格用 Element stripe 斑马纹。员工、编辑、删除保持图标按钮,悬停文案走 i18n title。
*/
-
-
+
+
+
+ {{ t('admin.dept.title') }}
+ {{ t('admin.dept.subtitle') }}
+
+
+
+ {{ t('admin.dept.add') }}
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
- |
-
-
- |
-
-
- |
- {{ t('admin.dept.headers.members') }} |
- {{ t('admin.dept.headers.actions') }} |
-
-
-
-
- |
- {{ searchQuery.trim() ? t('admin.dept.noSearchResults') : t('admin.dept.noDepts') }}
- |
-
-
- |
- {{ d.name }}
-
- {{ d.description }}
-
- |
-
- {{ d.code || '-' }}
- |
-
- {{ d.company || '-' }}
- |
-
-
- |
-
-
-
-
-
- |
-
-
-
-
-
+
+
+
+ {{ row.name }}
+
+ {{ row.description }}
+
+
+
+
+ {{ row.code || '-' }}
+
+
+ {{ row.company || '-' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
=> {
:data="departmentMembers"
@close="showMembersModal = false"
/>
-
-
-
+
+
+
diff --git a/frontend/src/features/admin/modules/departments/components/DepartmentFormModal.vue b/frontend/src/features/admin/modules/departments/components/DepartmentFormModal.vue
index 29661d3a..40f7be09 100644
--- a/frontend/src/features/admin/modules/departments/components/DepartmentFormModal.vue
+++ b/frontend/src/features/admin/modules/departments/components/DepartmentFormModal.vue
@@ -1,11 +1,12 @@
/**
* features/admin/modules/departments/components/DepartmentFormModal.vue
- * 用途:部门创建/编辑居中弹窗。
- * 依赖:DepartmentFormState、admin 通用 modal 样式。
- * 逻辑:DepartmentsPage 打开本组件;提交时 emit save,由 useDepartmentsAdmin 调 API。
+ * 用途:部门创建和编辑对话框。四个字段,单列。
+ * 依赖:element-plus 对话框和表单、DepartmentFormState。
+ * 逻辑:DepartmentsPage 打开本组件。提交时 emit save,由 useDepartmentsAdmin 调接口。样式跟页面已引入的 Element 皮肤走。
*/
-
-
-
-
- {{ form.id ? t('admin.dept.edit') : t('admin.dept.add') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ t('admin.cancel') }}
+
+ {{ form.id ? t('admin.update') : t('admin.add') }}
+
+
+
diff --git a/frontend/src/features/admin/modules/departments/components/DepartmentMembersModal.vue b/frontend/src/features/admin/modules/departments/components/DepartmentMembersModal.vue
index 188825fd..5bcf8f18 100644
--- a/frontend/src/features/admin/modules/departments/components/DepartmentMembersModal.vue
+++ b/frontend/src/features/admin/modules/departments/components/DepartmentMembersModal.vue
@@ -1,44 +1,72 @@
/**
* features/admin/modules/departments/components/DepartmentMembersModal.vue
- * 用途:展示部门对应的员工数量和名单。
- * 依赖:部门成员只读 API 响应与 Vue 事件。
- * 逻辑:DepartmentsPage 点击员工图标后传入数据,本组件只负责呈现与关闭。
+ * 用途:只读展示某个部门的员工数量和名单。
+ * 依赖:element-plus 对话框和表格、部门成员响应类型。
+ * 逻辑:DepartmentsPage 拉到名单后传入。本组件不请求接口,只展示和关闭。
*/
-
-
-
-
-
-
- {{ t('admin.dept.members.empty') }}
-
-
- -
-
-
{{ member.real_name || member.username }}
-
{{ member.employee_id || member.username }} · {{ member.email || '-' }}
-
- {{ member.status }}
-
-
-
-
-
+
+
+ {{ t('admin.dept.members.count', { count: data.count }) }}
+
+
+ {{ row.real_name || row.username }}
+
+
+ {{ row.employee_id || '-' }}
+
+
+ {{ row.email || '-' }}
+
+
+ {{ row.status || '-' }}
+
+
+
+
+ {{ t('admin.close') }}
+
+
+
+
diff --git a/frontend/src/features/admin/modules/departments/composables/useDepartmentsAdmin.ts b/frontend/src/features/admin/modules/departments/composables/useDepartmentsAdmin.ts
index a31a3bc0..97f2b7be 100644
--- a/frontend/src/features/admin/modules/departments/composables/useDepartmentsAdmin.ts
+++ b/frontend/src/features/admin/modules/departments/composables/useDepartmentsAdmin.ts
@@ -1,11 +1,12 @@
/**
* features/admin/modules/departments/composables/useDepartmentsAdmin.ts
* 用途:部门管理列表、搜索过滤、列排序、创建/编辑弹窗、删除。
- * 依赖:admin.api、department.types、useMessage、useTableSort。
- * 逻辑:DepartmentsPage 调用本 composable;排序状态委托 shared useTableSort。
+ * 依赖:admin.api、department.types、useMessage、useTableSort、element-plus 的确认框。
+ * 逻辑:DepartmentsPage 调用本 composable。表头排序由页面把 Element 的 sort-change 交给 applySort,仍在本地对过滤后的列表排序。删除用 ElMessageBox,不再使用 DeleteConfirmDialog。
*/
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
+import { ElMessageBox } from 'element-plus';
import {
createAdminDepartment,
deleteAdminDepartment,
@@ -14,6 +15,7 @@ import {
} from '@/features/admin/api/admin.api';
import { useMessage } from '@/shared/composables/useMessage';
import { useTableSort } from '@/shared/composables/useTableSort';
+import type { SortDir } from '@/shared/utils/table-sort';
import type { AdminDepartmentRow } from '@/features/admin/types/admin.types';
import {
createEmptyDepartmentForm,
@@ -24,6 +26,11 @@ import {
/** 部门表可排序列 */
export type DeptSortKey = 'name' | 'code' | 'company';
+/**
+ * 部门管理页的列表、表单和删除状态。
+ * 核心逻辑:拉全量部门后在本地过滤和排序,保存与删除成功后再拉一次列表。
+ * @returns 页面绑定的状态和打开弹窗、排序、保存、删除方法
+ */
export function useDepartmentsAdmin() {
const { t } = useI18n();
const msg = useMessage();
@@ -31,18 +38,15 @@ export function useDepartmentsAdmin() {
const departments = ref
([]);
const form = ref(createEmptyDepartmentForm());
const searchQuery = ref('');
- const { sortKey, sortDir, toggleSort, sortItems } = useTableSort({
+ const { sortKey, sortDir, sortItems } = useTableSort({
initialKey: 'name',
initialDir: 'asc',
});
const isLoading = ref(true);
+ const isListLoading = ref(false);
const isSaving = ref(false);
const showFormModal = ref(false);
- const showDeleteConfirmDialog = ref(false);
- const deleteConfirmMessage = ref('');
- let deleteConfirmAction: (() => Promise | void) | null = null;
-
/**
* 先按关键词过滤,再按当前排序列排序。
* 核心逻辑:模糊匹配四字段 → useTableSort.sortItems。
@@ -71,11 +75,14 @@ export function useDepartmentsAdmin() {
* @returns Promise
*/
const loadDepartments = async (): Promise => {
+ isListLoading.value = true;
try {
departments.value = await listAdminDepartments();
} catch (e) {
console.error('Failed to load departments', e);
departments.value = [];
+ } finally {
+ isListLoading.value = false;
}
};
@@ -90,33 +97,18 @@ export function useDepartmentsAdmin() {
};
/**
- * 打开删除确认对话框并绑定确认后的删除动作。
- * @param message - 确认文案
- * @param action - 用户确认后执行的异步删除逻辑
+ * 把 Element 表头排序写回本地排序状态。
+ * 核心逻辑:第三次点击清空排序时回到接口原顺序;有效列只排当前过滤结果,不请求接口。
+ * @param key - 名称、编码、公司;空字符串表示取消排序
+ * @param dir - asc、desc,或空
*/
- const openDeleteConfirm = (message: string, action: () => Promise | void): void => {
- deleteConfirmMessage.value = message;
- deleteConfirmAction = action;
- showDeleteConfirmDialog.value = true;
- };
-
- /** 关闭删除确认对话框并清空待执行动作。 */
- const closeDeleteConfirm = (): void => {
- showDeleteConfirmDialog.value = false;
- deleteConfirmAction = null;
- };
-
- /**
- * 执行删除确认对话框中绑定的删除动作。
- * @returns Promise
- */
- const confirmDelete = async (): Promise => {
- if (!deleteConfirmAction) return;
- try {
- await deleteConfirmAction();
- } finally {
- closeDeleteConfirm();
+ const applySort = (key: DeptSortKey | '', dir: SortDir | ''): void => {
+ if (key === '' || dir === '') {
+ sortKey.value = undefined;
+ return;
}
+ sortKey.value = key;
+ sortDir.value = dir;
};
/** 打开「添加部门」弹窗并重置表单。 */
@@ -173,19 +165,27 @@ export function useDepartmentsAdmin() {
};
/**
- * 删除指定部门,删除前弹出确认框。
+ * 删除指定部门。先用 Element 确认框询问,取消则不请求。
+ * 核心逻辑:MessageBox 在取消时 reject,这里吞掉;确定后再调删除接口并刷新列表。
* @param id - 部门主键
*/
- const deleteDepartment = (id: number): void => {
- openDeleteConfirm(t('admin.dept.confirmDelete'), async () => {
- try {
- await deleteAdminDepartment(id);
- await loadDepartments();
- } catch (e) {
- console.error(e);
- msg.error((e as Error).message || t('admin.msg.requestFailed'));
- }
- });
+ const deleteDepartment = async (id: number): Promise => {
+ try {
+ await ElMessageBox.confirm(t('admin.dept.confirmDelete'), t('common.deleteDialog.defaultTitle'), {
+ type: 'warning',
+ confirmButtonText: t('common.deleteDialog.confirm'),
+ cancelButtonText: t('common.deleteDialog.cancel'),
+ });
+ } catch {
+ return;
+ }
+ try {
+ await deleteAdminDepartment(id);
+ await loadDepartments();
+ } catch (e) {
+ console.error(e);
+ msg.error((e as Error).message || t('admin.msg.requestFailed'));
+ }
};
return {
@@ -196,18 +196,15 @@ export function useDepartmentsAdmin() {
sortKey,
sortDir,
isLoading,
+ isListLoading,
isSaving,
showFormModal,
- showDeleteConfirmDialog,
- deleteConfirmMessage,
loadAll,
- toggleSort,
+ applySort,
openCreateModal,
openEditModal,
closeFormModal,
saveDepartment,
deleteDepartment,
- closeDeleteConfirm,
- confirmDelete,
};
}
diff --git a/frontend/src/features/admin/modules/integration-connector/IntegrationConnectorPage.spec.ts b/frontend/src/features/admin/modules/integration-connector/IntegrationConnectorPage.spec.ts
index 43894651..c0a5f0a4 100644
--- a/frontend/src/features/admin/modules/integration-connector/IntegrationConnectorPage.spec.ts
+++ b/frontend/src/features/admin/modules/integration-connector/IntegrationConnectorPage.spec.ts
@@ -8,7 +8,7 @@
*/
import { describe, expect, it, vi } from 'vitest';
import { defineComponent, h, ref } from 'vue';
-import { mount } from '@vue/test-utils';
+import { flushPromises, mount } from '@vue/test-utils';
import { createMemoryHistory, createRouter } from 'vue-router';
import i18n from '@/i18n';
import IntegrationConnectorPage from './IntegrationConnectorPage.vue';
@@ -79,8 +79,10 @@ function mountPage() {
}
describe('IntegrationConnectorPage credential list', () => {
- it('按重设计列渲染:类型徽标 + 非密账号 + 来源徽标 + 启停开关,不再显示 secret_ref 原文', () => {
+ it('按重设计列渲染:类型徽标 + 非密账号 + 来源徽标 + 启停开关,不再显示 secret_ref 原文', async () => {
const wrapper = mountPage();
+ // Element 表格要等列宽计算完才把单元格写进文档,原生 table 是同步的。
+ await flushPromises();
const text = wrapper.text();
// password 类型:类型标签 + 非密账号(username 值)+ 来源本地化;状态不走文字(开关 + 悬停提示)
expect(text).toContain('tiptop-erp');
diff --git a/frontend/src/features/admin/modules/integration-connector/IntegrationConnectorPage.vue b/frontend/src/features/admin/modules/integration-connector/IntegrationConnectorPage.vue
index 275471f7..16677438 100644
--- a/frontend/src/features/admin/modules/integration-connector/IntegrationConnectorPage.vue
+++ b/frontend/src/features/admin/modules/integration-connector/IntegrationConnectorPage.vue
@@ -1,31 +1,41 @@
-
+/**
+ * features/admin/modules/integration-connector/IntegrationConnectorPage.vue
+ * 用途:集成连接器管理页。一张卡片里放标题、新增、六个页签和对应表格。
+ * 依赖:AdminListPage、AdminListTabs、useIntegrationConnectorAdmin、element-plus、表单抽屉、调用弹窗、调用日志面板。
+ * 逻辑:路由挂载本页。页签切换仍走 selectTab;能力清单和调用日志只读。创建/编辑抽屉和调用日志面板仍由子组件负责。
+ */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- | {{ t('admin.integrationConnector.headers.name') }} |
- {{ t('admin.integrationConnector.headers.connectorType') }} |
- {{ t('admin.integrationConnector.headers.environment') }} |
- {{ t('admin.integrationConnector.headers.endpoint') }} |
- {{ t('admin.integrationConnector.fields.enabled') }} |
- {{ t('admin.integrationConnector.headers.testStatus') }} |
- {{ t('admin.integrationConnector.headers.actions') }} |
-
-
-
- | {{ t('admin.integrationConnector.empty') }} |
-
-
- |
- {{ row.name }}
- {{ row.code }}
- |
-
- {{ connectorTypeLabel(row.connector_type) }}
- |
-
- {{ envLabel(row.environment) }}
- |
-
- {{ row.endpoint }}
- —
- |
-
-
- |
-
- {{ t('admin.integrationConnector.msg.testing') }}
-
- —
- |
-
-
- |
-
-
-
- |
- {{ testDetailText(row.code) }}
- |
-
+
+
+ {{ row.name }}
+ {{ row.code }}
+
+
+
+
+ {{ connectorTypeLabel(row.connector_type) }}
+
+
+
+
+ {{ envLabel(row.environment) }}
+
+
+
+
+ {{ row.endpoint }}
+ —
+
+
+
+
+
+
+
+
+
+ {{ t('admin.integrationConnector.msg.testing') }}
+
+
+ {{ testBadgeText(row.code) }}
+
+
+ {{ testDetailText(row.code) }}
+
-
-
-
+ —
+
+
+
+
+ {{ t('admin.integrationConnector.test') }}
+ {{ t('admin.edit') }}
+ {{ t('admin.delete') }}
+
+
+
-
-
-
-
-
- | {{ t('admin.integrationConnector.headers.code') }} |
- {{ t('admin.integrationConnector.headers.name') }} |
- {{ t('admin.integrationConnector.headers.clientInstance') }} |
- {{ t('admin.integrationConnector.headers.status') }} |
- {{ t('admin.integrationConnector.headers.actions') }} |
-
-
-
- | {{ t('admin.integrationConnector.empty') }} |
-
- | {{ row.code }} |
- {{ row.name }} |
-
- {{ clientNameOf(row.client_instance_code) || row.client_instance_code }}
- {{ row.client_instance_code }}
- |
-
- {{ statusLabel(row.status) }}
- |
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
-
-
+
+
+
+
+
+ {{ clientNameOf(row.client_instance_code) || row.client_instance_code }}
+ {{ row.client_instance_code }}
+
+
+
+
+
+ {{ statusLabel(row.status) }}
+
+
+
+
+
+
+ {{ t('admin.integrationConnector.lifecycle.publish') }}
+
+
+
+ {{ t('admin.integrationConnector.lifecycle.unpublish') }}
+
+
+ {{ t('admin.integrationConnector.lifecycle.retire') }}
+
+
+
+ {{ t('admin.integrationConnector.lifecycle.reopen') }}
+
+ {{ t('admin.edit') }}
+
+
+
-
-
-
-
-
- | {{ t('admin.integrationConnector.headers.capability') }} |
- {{ t('admin.integrationConnector.headers.clientInstance') }} |
- {{ t('admin.integrationConnector.headers.interfaceDef') }} |
- {{ t('admin.integrationConnector.headers.status') }} |
- {{ t('admin.integrationConnector.headers.actions') }} |
-
-
-
- | {{ t('admin.integrationConnector.empty') }} |
-
-
- |
- {{ capabilityLabelOf(row.capability) }}
- {{ row.capability }}
- |
-
-
-
- {{ idx + 1 }}.{{ clientNameOf(step.client_code) || step.client_code }}
-
- |
-
-
-
- {{ idx + 1 }}.{{ interfaceNameOf(step.interface_code) || step.interface_code }}
-
- |
-
- {{ statusLabel(row.status) }}
- |
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
-
-
+
+
+
+ {{ capabilityLabelOf(row.capability) }}
+ {{ row.capability }}
+
+
+
+
+
+ {{ idx + 1 }}. {{ clientNameOf(step.client_code) || step.client_code }}
+
+
+
+
+
+
+ {{ idx + 1 }}. {{ interfaceNameOf(step.interface_code) || step.interface_code }}
+
+
+
+
+
+
+ {{ statusLabel(row.status) }}
+
+
+
+
+
+
+ {{ t('admin.integrationConnector.lifecycle.publish') }}
+
+
+
+ {{ t('admin.integrationConnector.lifecycle.unpublish') }}
+
+
+ {{ t('admin.integrationConnector.lifecycle.retire') }}
+
+
+
+ {{ t('admin.integrationConnector.lifecycle.reopen') }}
+
+ {{ t('admin.edit') }}
+
+
+
-
-
-
-
-
- | {{ t('admin.integrationConnector.headers.code') }} |
- {{ t('admin.integrationConnector.headers.connectorType') }} |
- {{ t('admin.integrationConnector.headers.account') }} |
- {{ t('admin.integrationConnector.headers.secretProvider') }} |
- {{ t('admin.integrationConnector.fields.enabled') }} |
- {{ t('admin.integrationConnector.headers.actions') }} |
-
-
-
- | {{ t('admin.integrationConnector.empty') }} |
-
- | {{ row.code }} |
-
- {{ credentialTypeLabel(row.credential_type) }}
- |
- {{ credentialAccountText(row) }} |
-
- {{ secretProviderLabel(row.secret_provider) }}
- |
-
-
-
- |
-
-
-
-
- |
-
-
-
-
+
+
+
+
+ {{ credentialTypeLabel(row.credential_type) }}
+
+
+
+ {{ credentialAccountText(row as IntegrationCredentialReferenceRow) }}
+
+
+
+
+ {{ secretProviderLabel(row.secret_provider) }}
+
+
+
+
+
+
+
+
+
+
+ {{ t('admin.edit') }}
+
+
+
-
-
-
-
-
-
- | {{ t('admin.integrationConnector.headers.name') }} |
- {{ t('admin.integrationConnector.headers.write') }} |
- {{ t('admin.integrationConnector.headers.idempotency') }} |
- {{ t('admin.integrationConnector.headers.actions') }} |
-
-
-
- | {{ t('admin.integrationConnector.empty') }} |
-
-
- |
- {{ capabilityLabelOf(row.name) }}
- {{ row.name }}
- |
- {{ row.write ? t('admin.integrationConnector.writeLabels.yes') : t('admin.integrationConnector.writeLabels.no') }} |
- {{ idempotencyLabel(row.idempotency) }} |
-
-
- |
-
-
-
-
+
+
+
+ {{ capabilityLabelOf(row.name) }}
+ {{ row.name }}
+
+
+
+
+ {{ row.write ? t('admin.integrationConnector.writeLabels.yes') : t('admin.integrationConnector.writeLabels.no') }}
+
+
+
+ {{ idempotencyLabel(row.idempotency) }}
+
+
+
+ {{ t('admin.integrationConnector.call') }}
+
+
+
+
-
+
+
+
diff --git a/frontend/src/features/admin/modules/integration-connector/composables/useIntegrationConnectorAdmin.ts b/frontend/src/features/admin/modules/integration-connector/composables/useIntegrationConnectorAdmin.ts
index 167128dd..31aaa2dd 100644
--- a/frontend/src/features/admin/modules/integration-connector/composables/useIntegrationConnectorAdmin.ts
+++ b/frontend/src/features/admin/modules/integration-connector/composables/useIntegrationConnectorAdmin.ts
@@ -11,12 +11,14 @@
* param_mapping_json),client 由各步接口归属自带、不再发送旧单步顶层字段;
* 凭据状态只经列表行内开关流转(启用↔停用,表单不维护状态);
* 全部行内状态操作经 lifecycleBusy 互斥(进行中忽略新触发);接口/绑定退役
- * 接近终态需 window.confirm 二次确认,可逆转移直达;
- * 连接测试结果按行存放(列表徽章+展开详情);
- * 启停支持行内开关(失败回滚);删除带确认。保存/删除后刷新对应列表。
+ * 接近终态仍走现有 window.confirm,可逆转移直达;
+ * 连接测试结果按行存放(列表标签+展开详情);
+ * 启停支持行内开关(失败回滚);删除用 Element 确认框,取消则返回。
+ * 首屏 isLoading 盖住整张卡片;保存、删除和生命周期刷新后的 isListLoading 只盖表格。
*/
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
+import { ElMessageBox } from 'element-plus';
import { useMessage } from '@/shared/composables/useMessage';
import {
callIntegrationCapability,
@@ -87,7 +89,10 @@ export function useIntegrationConnectorAdmin() {
const credentials = ref([]);
const capabilities = ref([]);
const credentialTypes = ref([]);
+ /** 首屏整卡加载。为 true 时列表卡片先不画出表格。 */
const isLoading = ref(true);
+ /** 首屏之后的列表刷新。只盖住当前表格,不把标题和页签再盖住。 */
+ const isListLoading = ref(false);
// ---- 表单弹窗态 ----
const activeEntity = ref('client');
@@ -145,11 +150,21 @@ export function useIntegrationConnectorAdmin() {
}
};
+ /**
+ * 刷新一个实体的列表,并只在表格上显示加载。
+ * 核心逻辑:保存成功后按当前实体重拉;加载标记在请求结束后关掉,失败继续抛给调用方。
+ * @param entity - 要刷新的客户端、接口、绑定或凭据
+ */
const reloadOne = async (entity: EditableEntity) => {
- if (entity === 'client') await loadClients();
- else if (entity === 'interface') await loadInterfaces();
- else if (entity === 'binding') await loadBindings();
- else await loadCredentials();
+ isListLoading.value = true;
+ try {
+ if (entity === 'client') await loadClients();
+ else if (entity === 'interface') await loadInterfaces();
+ else if (entity === 'binding') await loadBindings();
+ else await loadCredentials();
+ } finally {
+ isListLoading.value = false;
+ }
};
// ---- 弹窗打开/关闭 ----
@@ -380,10 +395,13 @@ export function useIntegrationConnectorAdmin() {
if (action === 'retire' && !window.confirm(t('admin.integrationConnector.msg.retireInterfaceConfirm'))) return;
try {
await changeIntegrationInterfaceLifecycle(row.code, action);
+ isListLoading.value = true;
await loadInterfaces();
msg.success(t('admin.integrationConnector.msg.statusUpdated'));
} catch (e) {
msg.error((e as Error).message || t('admin.integrationConnector.msg.statusUpdateFailed'));
+ } finally {
+ isListLoading.value = false;
}
});
};
@@ -394,10 +412,13 @@ export function useIntegrationConnectorAdmin() {
if (action === 'retire' && !window.confirm(t('admin.integrationConnector.msg.retireBindingConfirm'))) return;
try {
await changeIntegrationBindingLifecycle(row.id, action);
+ isListLoading.value = true;
await loadBindings();
msg.success(t('admin.integrationConnector.msg.statusUpdated'));
} catch (e) {
msg.error((e as Error).message || t('admin.integrationConnector.msg.statusUpdateFailed'));
+ } finally {
+ isListLoading.value = false;
}
});
};
@@ -431,24 +452,39 @@ export function useIntegrationConnectorAdmin() {
}
};
- /** 删除客户端实例:先确认(提示语带名称),确认后才调 API。 */
+ /**
+ * 删除客户端实例。先用 Element 确认框询问,取消则不请求。
+ * 核心逻辑:确认框取消时 reject,这里直接返回;确定后才调删除接口并刷新列表。
+ * @param row - 要删除的客户端实例行
+ */
const deleteClient = async (row: IntegrationClientInstanceRow) => {
const summary = t('admin.integrationConnector.msg.deleteConfirm', { code: row.code, name: row.name });
- if (!window.confirm(summary)) return;
+ try {
+ await ElMessageBox.confirm(summary, t('common.deleteDialog.defaultTitle'), {
+ type: 'warning',
+ confirmButtonText: t('common.deleteDialog.confirm'),
+ cancelButtonText: t('common.deleteDialog.cancel'),
+ });
+ } catch {
+ return;
+ }
try {
await deleteIntegrationClientInstance(row.code);
const { [row.code]: _removed, ...rest } = testResults.value;
testResults.value = rest;
+ isListLoading.value = true;
await loadClients();
msg.success(t('admin.integrationConnector.msg.deleted'));
} catch (e) {
msg.error((e as Error).message || t('admin.msg.requestFailed'));
+ } finally {
+ isListLoading.value = false;
}
};
return {
clients, interfaces, bindings, credentials, capabilities, credentialTypes,
- isLoading, activeEntity, showFormModal, isSaving,
+ isLoading, isListLoading, activeEntity, showFormModal, isSaving,
clientForm, interfaceForm, bindingForm, credentialForm,
showCallModal, callCapability, callParamsText, callContextText, callResult, callBusy,
testingClientCode, testResults,
diff --git a/frontend/src/features/admin/modules/knowledge-base/KnowledgeBasePage.vue b/frontend/src/features/admin/modules/knowledge-base/KnowledgeBasePage.vue
index 7f80ff04..ba4d98de 100644
--- a/frontend/src/features/admin/modules/knowledge-base/KnowledgeBasePage.vue
+++ b/frontend/src/features/admin/modules/knowledge-base/KnowledgeBasePage.vue
@@ -1,13 +1,13 @@
/**
* features/admin/modules/knowledge-base/KnowledgeBasePage.vue
- * 知识库配置页(治理面)。路由:/admin/knowledge-base
+ * 用途:管理端知识库配置页入口。
+ * 依赖:KbAdminPanel。
+ * 逻辑:路由 /admin/knowledge-base。卡片骨架在 KbAdminPanel 的 AdminListPage 里,本页不再套第二层卡片。
*/
-
+
diff --git a/frontend/src/features/admin/modules/linked-services/LinkedServicesPage.vue b/frontend/src/features/admin/modules/linked-services/LinkedServicesPage.vue
index 248b0e76..17f2837e 100644
--- a/frontend/src/features/admin/modules/linked-services/LinkedServicesPage.vue
+++ b/frontend/src/features/admin/modules/linked-services/LinkedServicesPage.vue
@@ -1,18 +1,31 @@
/**
* features/admin/modules/linked-services/LinkedServicesPage.vue
- * 关联服务管理独立页面:表格列表 + 新增/编辑弹窗。
- * 依赖:useLinkedServicesAdmin、LinkedServiceFormModal、DeleteConfirmDialog。
- * 逻辑:路由 /admin/linked-services;启用项自动出现在 Chat/工作台侧栏底部。
+ * 用途:关联服务列表。一张卡片里放标题、新增按钮和表格。
+ * 依赖:AdminListPage、useLinkedServicesAdmin、useElementProvider、element-plus、关联服务表单对话框。
+ * 逻辑:路由 /admin/linked-services。启用项会出现在对话和工作台侧栏。删除用 Element 确认框。
*/
-
-
+
+
+
+ {{ t('admin.linkedServices.title') }}
+ {{ t('admin.linkedServices.subtitle') }}
+
+
+
+ {{ t('admin.linkedServices.add') }}
+
+
-
-
-
-
-
-
-
- | {{ t('admin.linkedServices.headers.name') }} |
- {{ t('admin.linkedServices.headers.url') }} |
- {{ t('admin.linkedServices.headers.status') }} |
- {{ t('admin.linkedServices.headers.sortOrder') }} |
- {{ t('admin.linkedServices.headers.actions') }} |
-
-
-
-
- | {{ t('admin.linkedServices.empty') }} |
-
-
- | {{ row.name }} |
- {{ row.url }} |
-
-
- |
- {{ row.sort_order }} |
-
-
-
-
-
- |
-
-
-
-
-
+
+
+
+
+ {{ row.url }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ t('admin.edit') }}
+
+
+ {{ t('admin.delete') }}
+
+
+
+
+
{
@close="closeFormModal"
@save="saveService"
/>
-
-
-
+
+
+
diff --git a/frontend/src/features/admin/modules/linked-services/components/LinkedServiceFormModal.vue b/frontend/src/features/admin/modules/linked-services/components/LinkedServiceFormModal.vue
index d891e6ab..7300fd62 100644
--- a/frontend/src/features/admin/modules/linked-services/components/LinkedServiceFormModal.vue
+++ b/frontend/src/features/admin/modules/linked-services/components/LinkedServiceFormModal.vue
@@ -1,11 +1,20 @@
/**
* features/admin/modules/linked-services/components/LinkedServiceFormModal.vue
- * 关联服务创建/编辑居中弹窗。
- * 依赖:LinkedServiceFormState、admin 通用 modal 样式。
- * 逻辑:LinkedServicesPage 打开本组件;提交时 emit save。
+ * 用途:关联服务创建和编辑对话框。名称、地址、排序和启用开关。
+ * 依赖:element-plus 对话框和表单、LinkedServiceFormState。
+ * 逻辑:LinkedServicesPage 打开本组件。提交时 emit save,由 composable 调接口。
*/
-
-
-
-
- {{ form.id ? t('admin.linkedServices.edit') : t('admin.linkedServices.add') }}
-
-
{{ t('admin.linkedServices.formHint') }}
-
-
-
-
-
+
+ {{ t('admin.linkedServices.formHint') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ t('admin.cancel') }}
+
+ {{ form.id ? t('admin.update') : t('admin.add') }}
+
+
+
+
+
diff --git a/frontend/src/features/admin/modules/linked-services/composables/useLinkedServicesAdmin.ts b/frontend/src/features/admin/modules/linked-services/composables/useLinkedServicesAdmin.ts
index bd5d6561..79b6727b 100644
--- a/frontend/src/features/admin/modules/linked-services/composables/useLinkedServicesAdmin.ts
+++ b/frontend/src/features/admin/modules/linked-services/composables/useLinkedServicesAdmin.ts
@@ -1,11 +1,12 @@
/**
* features/admin/modules/linked-services/composables/useLinkedServicesAdmin.ts
* 关联服务管理:列表、新增/编辑弹窗、启用开关、删除。
- * 依赖:admin.api、linked-service.types、linked-nav.store、useMessage。
- * 逻辑:LinkedServicesPage 调用本 composable;保存/删除后刷新侧栏入口缓存。
+ * 依赖:admin.api、linked-service.types、linked-nav.store、useMessage、element-plus 确认框。
+ * 逻辑:LinkedServicesPage 调用本 composable;保存/删除后刷新侧栏入口缓存。删除用 ElMessageBox。
*/
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
+import { ElMessageBox } from 'element-plus';
import {
createLinkedService,
deleteLinkedService,
@@ -32,10 +33,6 @@ export function useLinkedServicesAdmin() {
const isSaving = ref(false);
const showFormModal = ref(false);
- const showDeleteConfirmDialog = ref(false);
- const deleteConfirmMessage = ref('');
- let deleteConfirmAction: (() => Promise | void) | null = null;
-
/**
* 拉取关联服务列表。
* @returns Promise
@@ -60,29 +57,6 @@ export function useLinkedServicesAdmin() {
isLoading.value = false;
};
- /** 打开删除确认对话框。 */
- const openDeleteConfirm = (message: string, action: () => Promise | void): void => {
- deleteConfirmMessage.value = message;
- deleteConfirmAction = action;
- showDeleteConfirmDialog.value = true;
- };
-
- /** 关闭删除确认对话框。 */
- const closeDeleteConfirm = (): void => {
- showDeleteConfirmDialog.value = false;
- deleteConfirmAction = null;
- };
-
- /** 执行删除确认动作。 */
- const confirmDelete = async (): Promise => {
- if (!deleteConfirmAction) return;
- try {
- await deleteConfirmAction();
- } finally {
- closeDeleteConfirm();
- }
- };
-
/** 打开「新增关联服务」弹窗。 */
const openCreateModal = (): void => {
form.value = createEmptyLinkedServiceForm();
@@ -160,21 +134,29 @@ export function useLinkedServicesAdmin() {
};
/**
- * 删除指定关联服务。
+ * 删除指定关联服务。先用 Element 确认框询问,取消则不请求。
+ * 核心逻辑:确定后删除、刷新列表,并更新侧栏入口缓存。
* @param id - 主键
*/
- const deleteServiceItem = (id: number): void => {
- openDeleteConfirm(t('admin.linkedServices.confirmDelete'), async () => {
- try {
- await deleteLinkedService(id);
- await loadServices();
- void linkedNav.refresh();
- msg.success(t('admin.linkedServices.msg.deleted'));
- } catch (e) {
- console.error(e);
- msg.error((e as Error).message || t('admin.msg.requestFailed'));
- }
- });
+ const deleteServiceItem = async (id: number): Promise => {
+ try {
+ await ElMessageBox.confirm(t('admin.linkedServices.confirmDelete'), t('common.deleteDialog.defaultTitle'), {
+ type: 'warning',
+ confirmButtonText: t('common.deleteDialog.confirm'),
+ cancelButtonText: t('common.deleteDialog.cancel'),
+ });
+ } catch {
+ return;
+ }
+ try {
+ await deleteLinkedService(id);
+ await loadServices();
+ void linkedNav.refresh();
+ msg.success(t('admin.linkedServices.msg.deleted'));
+ } catch (e) {
+ console.error(e);
+ msg.error((e as Error).message || t('admin.msg.requestFailed'));
+ }
};
return {
@@ -183,8 +165,6 @@ export function useLinkedServicesAdmin() {
isLoading,
isSaving,
showFormModal,
- showDeleteConfirmDialog,
- deleteConfirmMessage,
loadAll,
openCreateModal,
openEditModal,
@@ -192,7 +172,5 @@ export function useLinkedServicesAdmin() {
saveService,
toggleEnabled,
deleteServiceItem,
- closeDeleteConfirm,
- confirmDelete,
};
}
diff --git a/frontend/src/features/admin/modules/permissions/PermissionsPage.vue b/frontend/src/features/admin/modules/permissions/PermissionsPage.vue
index e0c6a991..a5da1288 100644
--- a/frontend/src/features/admin/modules/permissions/PermissionsPage.vue
+++ b/frontend/src/features/admin/modules/permissions/PermissionsPage.vue
@@ -1,24 +1,49 @@
/**
* features/admin/modules/permissions/PermissionsPage.vue
* 用途:应用权限页。已种子权限组时以角色包为主、矩阵只读;否则保留历史按人勾选。
- * 依赖:usePermissionsAdmin、RoleEditModal、UserPickerDialog、PaginationBar、roleLabel、getUserAvatarLabel。
- * 逻辑:路由 /admin/permissions;点人数打开选人弹窗,确定后必须确认增减才写库。
+ * 依赖:AdminListPage、AdminListTabs、usePermissionsAdmin、useElementProvider、element-plus、RoleEditModal、RoleMembersConfirmDialog、UserPickerDialog、BatchPermissionModal。
+ * 逻辑:路由 /admin/permissions。骨架用 AdminListPage。角色/矩阵用 AdminListTabs。
+ * 点人数打开选人弹窗,确定后必须确认增减才写库。删除和重写入口确认用 ElMessageBox。
*/
-
-
-
-
-
-
-
{{ t('admin.perm.title') }}
-
- {{ rolesConfigured ? t('admin.permRoles.subtitle') : t('admin.perm.subtitle') }}
-
-
-
-
-
-
-
-
+
+
+
+
+
+ {{ t('admin.permRoles.matrixHint') }}
+
+
+
+
+
+
+ {{ row.name }}
+
+ {{ t('admin.permRoles.badge.default') }}
+
+ {{ t('admin.permRoles.badge.admin') }}
+
+
+
+
+
+
+ {{ row.description || '-' }}
+
+
+
+
+
+ {{ t('admin.permRoles.memberCount', { count: row.member_count }) }}
+
+
+ {{ t('admin.permRoles.memberCount', { count: row.member_count }) }}
+
+
+
+
+
+
+ {{
+ row.is_platform_admin
+ ? t('admin.permRoles.allApps')
+ : (row.agent_names || []).join('、') || '-'
+ }}
+
+
+
+
+
+
+ {{ t('admin.edit') }}
+
+
+ {{ t('admin.delete') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ getUserAvatarLabel(row) }}
+ {{ row.username }}
+
+
+
+
+
+ {{ row.real_name || '-' }}
+
+
+
+
+
+ {{ row.department || '-' }}
+
+
+
+
+
+ {{ adminRoleLabel(t, row.role, row.role_name) }}
+
+
+
- {{ t('admin.permRoles.tabs.matrix') }}
-
-
+
+
+ {{ agent.name }}
+ {{ agent.type }}
+
+
+
+
+
+
+
-
-
-
-
-
-
- | {{ t('admin.permRoles.headers.name') }} |
- {{ t('admin.permRoles.headers.description') }} |
- {{ t('admin.permRoles.headers.members') }} |
- {{ t('admin.permRoles.headers.apps') }} |
- {{ t('admin.user.headers.actions') }} |
-
-
-
-
- |
- {{ role.name }}
-
-
- {{ t('admin.permRoles.badge.default') }}
-
-
-
- {{ t('admin.permRoles.badge.admin') }}
-
-
- |
- {{ role.description || '-' }} |
-
-
-
- {{ t('admin.permRoles.memberCount', { count: role.member_count }) }}
-
- |
-
- {{
- role.is_platform_admin
- ? t('admin.permRoles.allApps')
- : (role.agent_names || []).join('、') || '-'
- }}
- |
-
-
-
- |
-
-
-
-
-
-
-
-
- {{ t('admin.permRoles.matrixHint') }}
-
-
-
-
-
-
-
-
-
+
-
+
{
@update:draft="roleDraft = $event"
/>
-
-
{
@cancel="cancelMembersConfirm"
@confirm="applyMembers"
/>
-
+
+
+
diff --git a/frontend/src/features/admin/modules/permissions/components/RoleEditModal.vue b/frontend/src/features/admin/modules/permissions/components/RoleEditModal.vue
index f355f7df..c14e5670 100644
--- a/frontend/src/features/admin/modules/permissions/components/RoleEditModal.vue
+++ b/frontend/src/features/admin/modules/permissions/components/RoleEditModal.vue
@@ -1,13 +1,23 @@
/**
* features/admin/modules/permissions/components/RoleEditModal.vue
* 用途:新建/编辑权限组:名称、应用入口,以及挂在各应用下的功能权限。
- * 依赖:permissionRole.types、rolePackage.utils、vue-i18n、lucide-vue-next。
- * 逻辑:PermissionsPage 打开;应用按对话形态分组;能力默认折叠,点右侧展开后再勾选。
+ * 依赖:permissionRole.types、rolePackage.utils、vue-i18n、element-plus。
+ * 逻辑:PermissionsPage 打开;应用按对话形态分组;能力默认折叠,点右侧展开后再勾选。样式跟权限页已引入的 Element 皮肤走。
*/
-
-
-
-
- {{ isCreate ? t('admin.permRoles.edit.createTitle') : t('admin.permRoles.edit.title') }}
-
-
{{ t('admin.permRoles.edit.subtitle') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ t('admin.permRoles.edit.apps') }}
-
-
- {{ isPlatformAdmin ? t('admin.permRoles.edit.adminAllApps') : t('admin.permRoles.edit.appsHint') }}
-
-
-
+
+
+
+
+
+ {{ t('admin.permRoles.edit.apps') }}
+
{{ t('admin.permRoles.edit.selectedCount', { count: selectedCount }) }}
-
-
-
-
-
-
-
-
- {{ t('admin.permRoles.edit.noMatch') }}
-
-
- {{ group.label }}
-
-
-
-
-
-
-
+
+
+
+ {{ t('admin.cancel') }}
+
+ {{ t('admin.save') }}
+
+
+
diff --git a/frontend/src/features/admin/modules/permissions/components/RoleMembersConfirmDialog.vue b/frontend/src/features/admin/modules/permissions/components/RoleMembersConfirmDialog.vue
index 3ff8fa11..cbcbd2cd 100644
--- a/frontend/src/features/admin/modules/permissions/components/RoleMembersConfirmDialog.vue
+++ b/frontend/src/features/admin/modules/permissions/components/RoleMembersConfirmDialog.vue
@@ -1,14 +1,16 @@
/**
* features/admin/modules/permissions/components/RoleMembersConfirmDialog.vue
* 用途:选人确定后展示将改入/移出的人及来源角色,确认才写库。
- * 依赖:permissionRole.types、vue-i18n。
- * 逻辑:PermissionsPage 在 UserPickerDialog 之后打开;取消不改变成员。
+ * 依赖:permissionRole.types、vue-i18n、element-plus 对话框。
+ * 逻辑:PermissionsPage 在 UserPickerDialog 之后打开;取消不改变成员。样式跟权限页已引入的 Element 皮肤走。
*/
-
-
-
-
{{ t('admin.permRoles.confirm.title') }}
-
- {{ t('admin.permRoles.confirm.subtitle', { name: preview.role_name }) }}
-
-
-
-
-
- {{ t('admin.permRoles.confirm.added', { count: preview.added.length }) }}
-
-
- -
- {{ personLine(person) }}
-
- {{ t('admin.permRoles.confirm.stolenHint') }}
-
-
-
+
+
+
+ {{ t('admin.permRoles.confirm.subtitle', { name: preview.role_name }) }}
+
+
+
+ {{ t('admin.permRoles.confirm.added', { count: preview.added.length }) }}
-
-
- {{ t('admin.permRoles.confirm.removed', { count: preview.removed.length }) }}
-
-
- - {{ personLine(person) }}
-
-
- {{ t('admin.permRoles.confirm.backToDefault') }}
-
+
+ -
+ {{ personLine(person) }}
+
+ {{ t('admin.permRoles.confirm.stolenHint') }}
+
+
+
+
+
+
+ {{ t('admin.permRoles.confirm.removed', { count: preview.removed.length }) }}
-
- {{ t('admin.permRoles.confirm.noChanges') }}
-
-
-
+
+ {{ t('admin.permRoles.confirm.noChanges') }}
+
-
+
+ {{ t('admin.cancel') }}
+
+ {{ t('admin.permRoles.confirm.apply') }}
+
+
+
+
+
diff --git a/frontend/src/features/admin/modules/permissions/composables/usePermissionsAdmin.ts b/frontend/src/features/admin/modules/permissions/composables/usePermissionsAdmin.ts
index 413db0ba..58db0f02 100644
--- a/frontend/src/features/admin/modules/permissions/composables/usePermissionsAdmin.ts
+++ b/frontend/src/features/admin/modules/permissions/composables/usePermissionsAdmin.ts
@@ -1,12 +1,14 @@
/**
* features/admin/modules/permissions/composables/usePermissionsAdmin.ts
* 用途:应用权限页:权限组 CRUD/选人确认,以及用户×应用核对矩阵。
- * 依赖:admin.api、UserPickerDialog 数据、rolePackage.utils、useMessage。
+ * 依赖:admin.api、UserPickerDialog 数据、rolePackage.utils、useMessage、element-plus 的确认框。
* 逻辑:已种子权限组时矩阵只读、禁止按人打勾;未种子时保留历史批量勾选。
- * 保存角色仅在应用/能力勾选变化时弹出「重写入口」确认。
+ * 保存仅在应用/能力勾选变化时用 ElMessageBox 确认;删除也先确认。
+ * 首屏用 isLoading 盖整张卡片,之后刷新列表只用 isListLoading。
*/
import { computed, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
+import { ElMessageBox } from 'element-plus';
import * as XLSX from 'xlsx';
import {
applyAdminPermissionRoleMembers,
@@ -52,6 +54,7 @@ export function usePermissionsAdmin() {
const permissionFilters = ref
(createEmptyPermissionFilters());
const selectedUserIds = ref([]);
const isLoading = ref(true);
+ const isListLoading = ref(false);
const isSaving = ref(false);
const permissionPage = ref(1);
const permissionPageSize = ref(10);
@@ -69,7 +72,6 @@ export function usePermissionsAdmin() {
feature_permissions: {},
});
const editingRoleCode = ref('');
- const showRoleSaveConfirm = ref(false);
const pickerRole = ref(null);
const showPicker = ref(false);
@@ -178,6 +180,7 @@ export function usePermissionsAdmin() {
/**
* 并行拉取角色包、目录与核对矩阵数据。
+ * 核心逻辑:只在首屏把 isLoading 设为 true,让整张卡片转圈;列表刷新不走这里。
*/
const loadAll = async (): Promise => {
isLoading.value = true;
@@ -186,6 +189,20 @@ export function usePermissionsAdmin() {
isLoading.value = false;
};
+ /**
+ * 列表已经画出来之后再刷新,只把加载态记在表格上。
+ * 核心逻辑:不改变 task 里的接口,只包一层 isListLoading。
+ * @param task - 现有的角色或用户列表刷新
+ */
+ const refreshVisibleLists = async (task: () => Promise): Promise => {
+ isListLoading.value = true;
+ try {
+ await task();
+ } finally {
+ isListLoading.value = false;
+ }
+ };
+
const toggleUserSelection = (userId: number): void => {
const index = selectedUserIds.value.indexOf(userId);
if (index === -1) {
@@ -232,7 +249,7 @@ export function usePermissionsAdmin() {
agent_ids: batchPermissionForm.value.agent_ids,
action: batchPermissionForm.value.action,
});
- await loadUsers();
+ await refreshVisibleLists(() => loadUsers());
showBatchPermissionModal.value = false;
selectedUserIds.value = [];
} catch (e) {
@@ -287,6 +304,11 @@ export function usePermissionsAdmin() {
XLSX.writeFile(wb, 'user_permissions.csv');
};
+ /**
+ * 导入权限 CSV。隐藏的文件框选中文件后由页面传入 change 事件。
+ * 核心逻辑:角色包启用时拒绝按人导入;成功后只刷新用户矩阵。
+ * @param event - 文件 input 的 change 事件
+ */
const importPermissions = async (event: Event): Promise => {
if (rolesConfigured.value) {
msg.warning(t('admin.permRoles.directGrantDisabled'));
@@ -302,7 +324,7 @@ export function usePermissionsAdmin() {
isSaving.value = true;
try {
await importAdminPermissions(formData);
- await loadUsers();
+ await refreshVisibleLists(() => loadUsers());
} catch (e) {
console.error(e);
msg.error((e as Error).message || t('admin.msg.requestFailed'));
@@ -344,9 +366,11 @@ export function usePermissionsAdmin() {
showRoleEditor.value = true;
};
+ /**
+ * 关闭权限组编辑框。
+ */
const closeRoleEditor = (): void => {
showRoleEditor.value = false;
- showRoleSaveConfirm.value = false;
};
/**
@@ -375,8 +399,9 @@ export function usePermissionsAdmin() {
/**
* 已有成员且应用/能力勾选变化时先确认;只改名称或说明直接保存。
+ * 核心逻辑:确认框取消时 MessageBox reject,这里直接返回,不调用保存。
*/
- const requestSaveRole = (): void => {
+ const requestSaveRole = async (): Promise => {
if (!roleDraft.value.name.trim()) {
msg.warning(t('admin.permRoles.msg.nameRequired'));
return;
@@ -391,12 +416,27 @@ export function usePermissionsAdmin() {
feature_permissions: (payload.feature_permissions as Record) || {},
});
if (editingExisting.value && editingMemberCount.value > 0 && grantsChanged) {
- showRoleSaveConfirm.value = true;
- return;
+ try {
+ await ElMessageBox.confirm(
+ t('admin.permRoles.saveConfirm.message', { count: editingMemberCount.value }),
+ t('admin.permRoles.saveConfirm.title'),
+ {
+ type: 'warning',
+ confirmButtonText: t('admin.save'),
+ cancelButtonText: t('admin.cancel'),
+ },
+ );
+ } catch {
+ return;
+ }
}
- void persistRole();
+ await persistRole();
};
+ /**
+ * 把当前草稿写入权限组。新建走创建接口,编辑走更新接口。
+ * 核心逻辑:校验已在 requestSaveRole 完成;成功后关弹窗并只刷新表格。
+ */
const persistRole = async (): Promise => {
isSaving.value = true;
try {
@@ -406,9 +446,8 @@ export function usePermissionsAdmin() {
} else {
await createAdminPermissionRole(payload);
}
- showRoleSaveConfirm.value = false;
showRoleEditor.value = false;
- await Promise.all([loadRoles(), loadUsers()]);
+ await refreshVisibleLists(() => Promise.all([loadRoles(), loadUsers()]));
msg.success(t('admin.permRoles.msg.saved'));
} catch (e) {
console.error(e);
@@ -419,17 +458,28 @@ export function usePermissionsAdmin() {
};
/**
- * 删除无人使用的非内置权限组。
+ * 删除非内置、非管理员权限组。
+ * 核心逻辑:先用 Element 确认框询问,取消则不请求;确定后再调删除接口并刷新角色表。
+ * @param role - 当前行的权限组
*/
const removeRole = async (role: PermissionRoleRow): Promise => {
if (role.is_system || role.is_platform_admin) {
msg.warning(t('admin.permRoles.msg.systemLocked'));
return;
}
+ try {
+ await ElMessageBox.confirm(role.name || role.code, t('common.deleteDialog.defaultTitle'), {
+ type: 'warning',
+ confirmButtonText: t('common.deleteDialog.confirm'),
+ cancelButtonText: t('common.deleteDialog.cancel'),
+ });
+ } catch {
+ return;
+ }
isSaving.value = true;
try {
await deleteAdminPermissionRole(role.code);
- await loadRoles();
+ await refreshVisibleLists(() => loadRoles());
msg.success(t('admin.permRoles.msg.deleted'));
} catch (e) {
console.error(e);
@@ -488,7 +538,7 @@ export function usePermissionsAdmin() {
await applyAdminPermissionRoleMembers(pickerRole.value.code, pickerSelectedIds.value);
showMembersConfirm.value = false;
membersPreview.value = null;
- await Promise.all([loadRoles(), loadUsers(), loadPickerUsers()]);
+ await refreshVisibleLists(() => Promise.all([loadRoles(), loadUsers(), loadPickerUsers()]));
msg.success(t('admin.permRoles.msg.membersUpdated'));
} catch (e) {
console.error(e);
@@ -515,6 +565,7 @@ export function usePermissionsAdmin() {
permissionTotalPages,
allUsersSelectedOnPage,
isLoading,
+ isListLoading,
isSaving,
activeTab,
rolesConfigured,
@@ -524,7 +575,6 @@ export function usePermissionsAdmin() {
editingExisting,
roleDraft,
editingMemberCount,
- showRoleSaveConfirm,
pickerRole,
showPicker,
pickerSelectedIds,
diff --git a/frontend/src/features/admin/modules/platform-apps/PlatformAppsPage.vue b/frontend/src/features/admin/modules/platform-apps/PlatformAppsPage.vue
index 5b26d45d..c5d1f0e3 100644
--- a/frontend/src/features/admin/modules/platform-apps/PlatformAppsPage.vue
+++ b/frontend/src/features/admin/modules/platform-apps/PlatformAppsPage.vue
@@ -1,17 +1,49 @@
/**
* features/admin/modules/platform-apps/PlatformAppsPage.vue
- * 用途:平台应用说明(新手指南)管理——按 Agent 维护指南资料上传、启停与排序。
- * 依赖:admin.api 指南 CRUD/上传、vue-i18n、lucide 图标。
- * 逻辑:Admin 路由挂载;选择应用后拉取指南列表,弹窗内上传并保存元数据。
+ * 用途:平台应用说明(新手指南)管理。按应用筛选指南,维护上传、启停与排序。
+ * 依赖:AdminListPage、useElementProvider、element-plus、admin.api 指南 CRUD/上传、vue-i18n。
+ * 逻辑:Admin 路由挂载。选择应用后拉取指南列表。创建/编辑用对话框,删除用 Element 确认框。
*/
-
-
-
-
- {{ t('admin.nav.platformApps') }}
-
-
- {{ t('admin.platformApps.subtitle') }}
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ {{ t('admin.nav.platformApps') }}
+ {{ t('admin.platformApps.subtitle') }}
+
+
+
+ {{ t('admin.platformApps.addGuide') }}
+
+
+
+
+
+
+
-
+
+
+
+
+ {{ row.file_name }}
+
+
+
+
+
+ {{ getGuideUsageLabel(row.guide_usage || 'general') }}
+
+
+
+ {{ currentAgentName }}
+
+
+ {{ formatSize(row.file_size) }}
+
+
+
+
+
+ {{ row.status === 1 ? t('admin.platformApps.statusEnabled') : t('admin.platformApps.statusDisabled') }}
+
+
+
+
+
+
+ {{ t('common.edit') }}
+
+
+ {{ t('common.delete') }}
+
+
+
+
+
-
- {{ t('admin.platformApps.selectAgentFirst') }}
-
-
-
- {{ t('admin.platformApps.emptyGuides') }}
-
-
-
-
-
-
- | {{ t('admin.platformApps.colType') }} |
- {{ t('admin.platformApps.colFileName') }} |
- {{ t('admin.platformApps.guideUsage') }} |
- {{ t('admin.platformApps.colAgent') }} |
- {{ t('admin.platformApps.colFileSize') }} |
- {{ t('admin.platformApps.colSort') }} |
- {{ t('admin.platformApps.colStatus') }} |
- {{ t('admin.platformApps.colActions') }} |
-
-
-
-
- |
-
- |
-
- {{ guide.file_name }}
- {{ guide.remark }}
- |
-
- {{ getGuideUsageLabel(guide.guide_usage || 'general') }}
- |
-
-
- {{ currentAgentName }}
-
- |
- {{ formatSize(guide.file_size) }} |
- {{ guide.sort_order }} |
-
-
- |
-
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
{{ isEditing ? t('admin.platformApps.editGuide') : t('admin.platformApps.addGuide') }}
-
-
-
-
-
-
-
-
-
{{ t('admin.platformApps.uploading') }}
-
-
{{ uploadError }}
-
{{ t('admin.platformApps.uploadReady') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ t('admin.platformApps.guideUsageHint') }}
-
-
-
-
-
{{ t('admin.platformApps.sortOrderHint') }}
-
-
-
-
-
-
-
-
-
-
-
+
+ {{ t('admin.platformApps.uploadFile') }}
+
+
+
{{ t('admin.platformApps.uploading') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+ {{ t('admin.cancel') }}
+
+ {{ t('admin.platformApps.save') }}
+
+
+
+
+
+
diff --git a/frontend/src/features/admin/modules/procurement-contract/ProcurementContractPage.vue b/frontend/src/features/admin/modules/procurement-contract/ProcurementContractPage.vue
index 95558295..eda4a171 100644
--- a/frontend/src/features/admin/modules/procurement-contract/ProcurementContractPage.vue
+++ b/frontend/src/features/admin/modules/procurement-contract/ProcurementContractPage.vue
@@ -1,13 +1,43 @@
/**
* features/admin/modules/procurement-contract/ProcurementContractPage.vue
- * 用途:采购合同审查管理——模板库 / 风险规则 / 审查历史(Tab),含鉴权下载。
- * 依赖:procurement-contract.api、contract-ocr-match-tokens、ContractRiskRulesPanel、DeleteConfirmDialog、useMessage、vue-i18n。
- * 逻辑:Admin 路由挂载;会话 Agent 读模板列表走 /api/procurement-contract。
+ * 用途:采购合同审查管理。一张卡片里放模板库、风险规则、审查历史三个页签。
+ * 依赖:AdminListPage、AdminListTabs、useElementProvider、element-plus、procurement-contract.api、
+ * contract-ocr-match-tokens、ContractRiskRulesPanel、useMessage、vue-i18n。
+ * 逻辑:Admin 路由挂载。页签用 AdminListTabs,筛选和表格走 AdminListPage。上传、区域配置、详情用对话框。
+ * 删除用 Element 确认框。下载和保存仍走原有接口,参数不变。
*/
-
-
-
-
{{ t('admin.procurementContract.title') }}
-
{{ t('admin.procurementContract.subtitle') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- | {{ t('admin.procurementContract.colName') }} |
- {{ t('admin.procurementContract.colVersion') }} |
- {{ t('admin.procurementContract.colFile') }} |
- {{ t('admin.procurementContract.colStatus') }} |
- {{ t('admin.procurementContract.colDefault') }} |
- {{ t('admin.procurementContract.colActions') }} |
-
-
-
-
- | {{ t('admin.procurementContract.loading') }} |
-
-
- | {{ t('admin.procurementContract.emptyTemplates') }} |
-
-
- | {{ row.name }} |
- {{ row.version }} |
- {{ row.file_name }} |
-
-
- {{ statusLabel(row.status) }}
-
- |
-
-
- {{ defaultLabel(row.is_default) }}
-
- |
-
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- | {{ t('admin.procurementContract.colReviewNo') }} |
- {{ t('admin.procurementContract.colMode') }} |
- {{ t('admin.procurementContract.colContract') }} |
- {{ t('admin.procurementContract.colContractNo') }} |
- {{ t('admin.procurementContract.colSupplier') }} |
- {{ t('admin.procurementContract.colTemplate') }} |
- {{ t('admin.procurementContract.colSource') }} |
- {{ t('admin.procurementContract.colUser') }} |
- {{ t('admin.procurementContract.colFinishedAt') }} |
- {{ t('admin.procurementContract.colStatus') }} |
- {{ t('admin.procurementContract.colRisk') }} |
- {{ t('admin.procurementContract.colActions') }} |
-
-
-
-
- | {{ t('admin.procurementContract.loading') }} |
-
-
- | {{ t('admin.procurementContract.emptyReviews') }} |
-
-
- | {{ row.review_no }} |
-
- {{ modeLabel(row.review_mode) }}
- |
- {{ row.contract_file_name }} |
- {{ row.contract_no || '—' }} |
- {{ row.supplier_name || '—' }} |
- {{ row.template_name || '—' }} |
-
- {{ sourceLabel(row.template_source) }}
- |
- {{ row.user_name || row.user_id }} |
- {{ reviewFinishedAt(row.finished_at) }} |
-
- {{ statusLabel(row.status) }}
- |
-
- {{ reviewRisk(row)?.level === 'high' ? t('admin.procurementContract.riskHigh') : reviewRisk(row)?.level === 'medium' ? t('admin.procurementContract.riskMedium') : t('admin.procurementContract.riskLow') }} {{ reviewRisk(row)?.count }}
- -
- |
-
-
- |
-
-
-
-
-
-
{{ t('admin.procurementContract.total', { n: reviewTotal }) }}
-
-
-
-
-
-
-
-
-
+
+
+ {{ t('admin.procurementContract.title') }}
+ {{ t('admin.procurementContract.subtitle') }}
+
+
+
+ {{ t('admin.procurementContract.uploadTemplate') }}
+
+
+ {{ t('admin.procurementContract.addRule') }}
+
+
+
+
+
+
+
+
-
-
-
+
+
+
- {{ editingTemplate?.file_name }}
- {{ t('admin.procurementContract.editFileHint') }}
-
+
+
+
+
+
+
+
+
+
+
{{ t('admin.procurementContract.total', { n: reviewTotal }) }}
+
+
+
+
+
+
+
+ {{ t('admin.procurementContract.ruleStatTotal') }} {{ rulesPanelRef?.ruleStats?.total ?? 0 }}
+ · {{ t('admin.procurementContract.ruleStatEnabled') }} {{ rulesPanelRef?.ruleStats?.enabled ?? 0 }}
+ · {{ t('admin.procurementContract.ruleStatHighRisk') }} {{ rulesPanelRef?.ruleStats?.highRisk ?? 0 }}
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+ {{ modeLabel(row.review_mode) }}
+
+
+
+
+ {{ row.contract_no || '—' }}
+
+
+ {{ row.supplier_name || '—' }}
+
+
+ {{ row.template_name || '—' }}
+
+
+
+
+ {{ sourceLabel(row.template_source) }}
+
+
+
+
+ {{ row.user_name || row.user_id }}
+
+
+ {{ reviewFinishedAt(row.finished_at) }}
+
+
+
+ {{ statusLabel(row.status) }}
+
+
+
+
+
+ {{ reviewRiskTag(row as ContractReviewRow)?.text }}
+
+ -
+
+
+
+
+
+ {{ t('admin.procurementContract.detail') }}
+
+
+
+
+
+
+
+
+
+
{{ uploadFile.name }}
+
{{ t('admin.procurementContract.uploadZoneReplace') }}
+
+
+
+ {{ t('admin.procurementContract.uploadZonePrefix') }}
+ {{ t('admin.procurementContract.uploadZoneAction') }}
+
+
{{ t('admin.procurementContract.noFileSelected') }}
+
+
+
+
{{ editingTemplate?.file_name }}
+
{{ t('admin.procurementContract.editFileHint') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
- {{ t('admin.procurementContract.uploadCallout') }}
-
+
+
+
+
+ {{ t('admin.cancel') }}
+
+ {{ isEditMode ? t('admin.procurementContract.saveChanges') : t('admin.procurementContract.saveToLibrary') }}
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+ {{ t('admin.procurementContract.regionBodyStart') }}:{{ regionPreview.body_start_anchor || '—' }}
+ {{ t('admin.procurementContract.regionBodyEnd') }}:{{ regionPreview.body_end_anchor || '—' }}
+ {{ t('admin.procurementContract.regionSignatureTerms') }}:{{ regionPreview.signature_terms_found?.join(', ') || '—' }}
+ {{ t('admin.procurementContract.regionAttachmentStart') }}:{{ regionPreview.attachment_anchor || '—' }}
+
+
+
+
+ {{ t('admin.procurementContract.regionRestoreV4') }}
+
+
+ {{ t('admin.procurementContract.regionPreview') }}
+
+
+ {{ t('admin.cancel') }}
+
+
+ {{ t('admin.procurementContract.saveChanges') }}
+
+
+
-
-
+
+
+
+
+
diff --git a/frontend/src/features/admin/modules/procurement-contract/components/ContractRiskRulesPanel.vue b/frontend/src/features/admin/modules/procurement-contract/components/ContractRiskRulesPanel.vue
index 7902693b..c65dca41 100644
--- a/frontend/src/features/admin/modules/procurement-contract/components/ContractRiskRulesPanel.vue
+++ b/frontend/src/features/admin/modules/procurement-contract/components/ContractRiskRulesPanel.vue
@@ -1,13 +1,33 @@
/**
* features/admin/modules/procurement-contract/components/ContractRiskRulesPanel.vue
- * 用途:采购合同风险红线规则列表与新增/编辑(含迁移种子默认规则)。
- * 依赖:procurement-contract.api、DeleteConfirmDialog、useMessage、vue-i18n。
- * 逻辑:由 ProcurementContractPage「风险规则」Tab 挂载;CRUD 走 Admin rules API。
+ * 用途:采购合同风险规则表格、编辑对话框和删除确认。
+ * 依赖:procurement-contract.api、element-plus、useMessage、vue-i18n。
+ * 逻辑:由 ProcurementContractPage「风险规则」页签放入 AdminListPage 的表格区。
+ * 进入页签或切换状态筛选时拉列表;「新增规则」在页面页头。本组件不再套卡片。
+ * 样式随页面已引入的 Element 皮肤。
*/
-
-
-
-
-
-
{{ card.label }}
-
{{ card.value }}
-
-
-
-
+
+
+ {{ row.title }}
+
+
+
+ {{ categoryLabel(row.clause_category) }}
+
+
+
+
+
+ {{ keywordText(row as ContractRiskRuleRow) }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- | {{ t('admin.procurementContract.colRuleTitle') }} |
- {{ t('admin.procurementContract.colCategory') }} |
- {{ t('admin.procurementContract.colKeywords') }} |
- {{ t('admin.procurementContract.colTrigger') }} |
- {{ t('admin.procurementContract.colRisk') }} |
- {{ t('admin.procurementContract.colStatus') }} |
- {{ t('admin.procurementContract.colSort') }} |
- {{ t('admin.procurementContract.colActions') }} |
-
-
-
-
- |
- {{ t('admin.procurementContract.loading') }}
- |
-
-
- |
- {{ t('admin.procurementContract.emptyRules') }}
- |
-
-
- |
- {{ row.title }}
- |
-
-
- {{ categoryLabel(row.clause_category) }}
-
- |
-
- {{ keywordText(row) }}
- |
- {{ triggerLabel(row.trigger_type) }} |
-
-
- {{ riskLabel(row.risk_level) }}
-
- |
-
-
- {{ statusLabel(row.status) }}
-
- |
- {{ row.sort_order }} |
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ {{ t('admin.cancel') }}
+
+ {{ t('admin.procurementContract.saveChanges') }}
+
+
+
+
+
diff --git a/frontend/src/features/admin/modules/questions/QuestionsPage.vue b/frontend/src/features/admin/modules/questions/QuestionsPage.vue
index 89f34ae7..ab9e291a 100644
--- a/frontend/src/features/admin/modules/questions/QuestionsPage.vue
+++ b/frontend/src/features/admin/modules/questions/QuestionsPage.vue
@@ -1,490 +1,276 @@
/**
-
* features/admin/modules/questions/QuestionsPage.vue
-
- * 常用问题管理:Tab「常用问题」+「热点发现」(离线聚合候选)。
-
- * 依赖:useQuestionsAdmin、HotFaqCandidatesPanel、QuestionFormModal。
-
- * 逻辑:路由 /admin/questions;热点候选晋升后写入 QuickQuestion 并由 Phase 1 FAQ 在线命中。
-
+ * 用途:常用问题管理页。一张卡片里放标题、添加按钮、页签、筛选和表格。
+ * 依赖:AdminListPage、AdminListTabs、useQuestionsAdmin、useElementProvider、element-plus、QuestionFormModal、HotFaqCandidatesPanel。
+ * 逻辑:路由 /admin/questions。骨架用 AdminListPage,页签用 AdminListTabs。
+ * 筛选、表格留在本页;热点候选由页签内容区的面板自己渲染。删除在 composable 里用 Element 确认框。
*/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- | {{ t('admin.question.headers.title') }} |
-
- {{ t('admin.question.headers.agent') }} |
-
- {{ t('admin.question.headers.content') }} |
-
- {{ t('admin.question.headers.answer') }} |
-
- {{ t('admin.question.headers.cache') }} |
-
- {{ t('admin.question.headers.hits') }} |
-
- {{ t('admin.question.headers.order') }} |
-
- {{ t('admin.question.headers.actions') }} |
-
-
-
-
-
-
-
-
-
- | {{ t('admin.question.noData') }} |
-
-
-
-
-
-
-
-
-
- {{ q.title }}
-
-
-
- {{ t('admin.question.badges.stale') }}
-
-
-
-
-
- {{ t('admin.question.badges.disabled') }}
-
-
-
-
-
- |
-
-
-
-
-
- {{ q.agent_name || 'Unknown' }}
-
-
-
- |
-
-
-
-
-
- {{ truncateQuestionPreview(q.question) }}
-
-
-
- |
-
-
-
-
-
- {{ truncateAnswerPreview(q.answer) }}
-
-
-
- —
-
- |
-
-
-
-
-
-
-
- {{ t('admin.question.badges.cacheOn') }}
-
-
-
-
-
- {{ t('admin.question.badges.cacheOff') }}
-
-
-
- |
-
- {{ q.hit_count || 0 }} |
-
- {{ q.sort_order }} |
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
-
+
+
+
+
+ {{ (row as AdminQuickQuestionRow).title }}
+
+ {{ t('admin.question.badges.stale') }}
+
+
+ {{ t('admin.question.badges.disabled') }}
+
+
+
+
+
+
+ {{ (row as AdminQuickQuestionRow).agent_name || 'Unknown' }}
+
+
+
+
+
+ {{ truncateQuestionPreview((row as AdminQuickQuestionRow).question) }}
+
+
+
+
+
+
+ {{ truncateAnswerPreview((row as AdminQuickQuestionRow).answer || '') }}
+
+ —
+
+
+
+
+
+ {{
+ (row as AdminQuickQuestionRow).cache_enabled
+ ? t('admin.question.badges.cacheOn')
+ : t('admin.question.badges.cacheOff')
+ }}
+
+
+
+
+ {{ (row as AdminQuickQuestionRow).hit_count || 0 }}
+
+
+ {{ (row as AdminQuickQuestionRow).sort_order }}
+
+
+
+
+ {{ t('admin.question.actions.edit') }}
+
+
+ {{ t('admin.question.actions.delete') }}
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
diff --git a/frontend/src/features/admin/modules/questions/components/HotFaqCandidatesPanel.vue b/frontend/src/features/admin/modules/questions/components/HotFaqCandidatesPanel.vue
index 11a78dde..d82685ad 100644
--- a/frontend/src/features/admin/modules/questions/components/HotFaqCandidatesPanel.vue
+++ b/frontend/src/features/admin/modules/questions/components/HotFaqCandidatesPanel.vue
@@ -1,14 +1,29 @@
/**
* features/admin/modules/questions/components/HotFaqCandidatesPanel.vue
- * 热点 FAQ 候选列表:离线聚合结果展示、刷新、晋升、忽略。
- * 依赖:useHotFaqCandidates。
- * 逻辑:QuestionsPage「热点发现」Tab 挂载本组件。
+ * 用途:热点 FAQ 候选列表。展示离线聚合结果,并提供刷新、晋升、忽略。
+ * 依赖:useHotFaqCandidates、element-plus 的表格、筛选和按钮。
+ * 逻辑:QuestionsPage「热点发现」页签把本组件放在内容区,不再套一层 AdminListPage。样式随页面入口引入。
*/
-
-
+
+
{{ t('admin.hotFaq.intro') }}
-
-
-
- {{ t('admin.hotFaq.rules.selection') }}
- {{ (rules as any).selection?.description }}
-
-
- - {{ t('admin.hotFaq.rules.windowDays', { n: (rules as any).selection?.window_days }) }}
- - {{ t('admin.hotFaq.rules.minCount', { n: (rules as any).selection?.min_count }) }}
- - {{ t('admin.hotFaq.rules.minUsers', { n: (rules as any).selection?.min_users }) }}
+
+
+
+ {{ t('admin.hotFaq.rules.selection') }}
+ {{ ruleValue('selection', 'description') }}
+
+
+ - {{ t('admin.hotFaq.rules.windowDays', { n: ruleValue('selection', 'window_days') }) }}
+ - {{ t('admin.hotFaq.rules.minCount', { n: ruleValue('selection', 'min_count') }) }}
+ - {{ t('admin.hotFaq.rules.minUsers', { n: ruleValue('selection', 'min_users') }) }}
-
- {{ t('admin.hotFaq.rules.answer') }}
- {{ (rules as any).answer?.description }}
-
+
+ {{ t('admin.hotFaq.rules.answer') }}
+ {{ ruleValue('answer', 'description') }}
+
-
-
-
-
-
-
-
- {{ t('admin.hotFaq.stats.summary', {
- count: stats.total_candidates ?? 0,
- asks: stats.total_ask_count_7d ?? 0,
- }) }}
-
-
-
-
+
+
+
+
+
+
+ {{ t('admin.hotFaq.stats.summary', {
+ count: stats.total_candidates ?? 0,
+ asks: stats.total_ask_count_7d ?? 0,
+ }) }}
+
+
+ {{ t('admin.hotFaq.actions.dryRun') }}
+
+
+ {{ t('admin.hotFaq.actions.refresh') }}
+
-
-
-
-
-
-
- | {{ t('admin.hotFaq.headers.query') }} |
- {{ t('admin.hotFaq.headers.agent') }} |
- {{ t('admin.hotFaq.headers.answer') }} |
- {{ t('admin.hotFaq.headers.asks') }} |
- {{ t('admin.hotFaq.headers.users') }} |
- {{ t('admin.hotFaq.headers.tokens') }} |
- {{ t('admin.hotFaq.headers.dominance') }} |
- {{ t('admin.hotFaq.headers.actions') }} |
-
-
-
-
- | {{ t('admin.hotFaq.noData') }} |
-
-
- |
- {{ row.canonical_query }}
-
- {{ row.sample_queries.slice(0, 2).join(' / ') }}
-
- |
-
-
- {{ row.agent_name || row.agent_id }}
-
- |
-
-
- {{ truncatePreview(row.answer) }}
-
- |
- {{ row.ask_count_7d }} |
- {{ row.user_count_7d }} |
- {{ row.avg_tokens }} |
-
- {{ row.answer_dominance != null ? `${Math.round(row.answer_dominance * 100)}%` : '—' }}
- |
-
-
-
-
-
- |
-
-
-
-
+
+
+
+ {{ (row as HotFaqCandidateRow).canonical_query }}
+
+ {{ (row as HotFaqCandidateRow).sample_queries?.slice(0, 2).join(' / ') }}
+
+
+
+
+
+
+ {{ (row as HotFaqCandidateRow).agent_name || (row as HotFaqCandidateRow).agent_id }}
+
+
+
+
+
+
+ {{ truncatePreview((row as HotFaqCandidateRow).answer) }}
+
+
+
+
+ {{ (row as HotFaqCandidateRow).ask_count_7d }}
+
+
+ {{ (row as HotFaqCandidateRow).user_count_7d }}
+
+
+ {{ (row as HotFaqCandidateRow).avg_tokens }}
+
+
+
+ {{
+ (row as HotFaqCandidateRow).answer_dominance != null
+ ? `${Math.round(((row as HotFaqCandidateRow).answer_dominance || 0) * 100)}%`
+ : '—'
+ }}
+
+
+
+
+
+ {{ t('admin.hotFaq.actions.promote') }}
+
+
+ {{ t('admin.hotFaq.actions.dismiss') }}
+
+
+
+
+
+
diff --git a/frontend/src/features/admin/modules/questions/components/QuestionFormModal.vue b/frontend/src/features/admin/modules/questions/components/QuestionFormModal.vue
index 31439e28..6d3daeff 100644
--- a/frontend/src/features/admin/modules/questions/components/QuestionFormModal.vue
+++ b/frontend/src/features/admin/modules/questions/components/QuestionFormModal.vue
@@ -1,13 +1,27 @@
/**
* features/admin/modules/questions/components/QuestionFormModal.vue
- * 常用问题 / FAQ 缓存创建与编辑居中弹窗。
- * 依赖:QuestionFormState、admin 通用 modal 样式。
- * 逻辑:QuestionsPage 打开本组件;提交时 emit save,由 composable 调 API。
- * is_enabled 仅控制工作台首页入口;cache_enabled 单独控制聊天是否跳过 Dify。
+ * 用途:常用问题 / FAQ 缓存的创建与编辑对话框。字段多,宽 680px,两列短字段。
+ * 依赖:element-plus 对话框和表单、QuestionFormState、AdminAgentOption。
+ * 逻辑:QuestionsPage 打开本组件。提交时 emit save 或 review,由 useQuestionsAdmin 调接口。样式跟页面已引入的 Element 皮肤走。
+ * is_enabled 仅控制工作台首页入口;cache_enabled 单独控制聊天是否跳过 Dify。
*/
-
-
-
-
- {{ form.id ? t('admin.question.edit') : t('admin.question.add') }}
-
-
{{ t('admin.question.formHint') }}
-
+
+
+
{{ t('admin.question.formHint') }}
+
+
+ {{ t('admin.question.stale.bannerBody', {
+ doc: form.stale_kb_document_title || t('admin.question.stale.unknownDoc'),
+ reason: staleReasonLabel,
+ }) }}
+
+ {{ t('admin.question.stale.bannerHint') }}
+
-
-
-
{{ t('admin.question.stale.bannerTitle') }}
-
- {{ t('admin.question.stale.bannerBody', {
- doc: form.stale_kb_document_title || t('admin.question.stale.unknownDoc'),
- reason: form.stale_reason === 'kb_document_deleted'
- ? t('admin.question.stale.reasonDeleted')
- : t('admin.question.stale.reasonUpdated'),
- }) }}
-
-
{{ t('admin.question.stale.bannerHint') }}
-
+
+ {{ t('admin.question.sections.basic') }}
+
+
-
+
+ {{ t('admin.cancel') }}
+
+ {{ t('admin.question.stale.completeReview') }}
+
+
+ {{ form.id ? t('admin.update') : t('admin.add') }}
+
+
+
+
diff --git a/frontend/src/features/admin/modules/questions/composables/useQuestionsAdmin.ts b/frontend/src/features/admin/modules/questions/composables/useQuestionsAdmin.ts
index c979b672..05beab08 100644
--- a/frontend/src/features/admin/modules/questions/composables/useQuestionsAdmin.ts
+++ b/frontend/src/features/admin/modules/questions/composables/useQuestionsAdmin.ts
@@ -1,11 +1,12 @@
/**
* features/admin/modules/questions/composables/useQuestionsAdmin.ts
- * 常用问题 / FAQ 缓存管理:列表筛选、创建/编辑弹窗、删除。
- * 依赖:admin.api、question.types、useMessage。
- * 逻辑:QuestionsPage 调用本 composable 驱动表格与居中表单弹窗。
+ * 用途:常用问题 / FAQ 缓存管理:列表筛选、创建/编辑弹窗、删除。
+ * 依赖:admin.api、question.types、useMessage、element-plus 的确认框。
+ * 逻辑:QuestionsPage 调用本 composable 驱动表格与表单弹窗。删除用 ElMessageBox,不再使用 DeleteConfirmDialog。
*/
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
+import { ElMessageBox } from 'element-plus';
import {
deleteAdminQuickQuestion,
listAdminAgents,
@@ -40,10 +41,6 @@ export function useQuestionsAdmin() {
const filterStaleOnly = ref(false);
const searchKeyword = ref('');
- const showDeleteConfirmDialog = ref(false);
- const deleteConfirmMessage = ref('');
- let deleteConfirmAction: (() => Promise
| void) | null = null;
-
const staleCount = computed(() => questions.value.filter((q) => Boolean(q.stale_at)).length);
const filteredQuestions = computed(() => {
@@ -85,26 +82,6 @@ export function useQuestionsAdmin() {
isLoading.value = false;
};
- const openDeleteConfirm = (message: string, action: () => Promise | void): void => {
- deleteConfirmMessage.value = message;
- deleteConfirmAction = action;
- showDeleteConfirmDialog.value = true;
- };
-
- const closeDeleteConfirm = (): void => {
- showDeleteConfirmDialog.value = false;
- deleteConfirmAction = null;
- };
-
- const confirmDelete = async (): Promise => {
- if (!deleteConfirmAction) return;
- try {
- await deleteConfirmAction();
- } finally {
- closeDeleteConfirm();
- }
- };
-
/**
* 重置表单为空白状态。
*/
@@ -225,16 +202,28 @@ export function useQuestionsAdmin() {
}
};
- const deleteQuestion = (id: number): void => {
- openDeleteConfirm(t('admin.question.confirmDelete'), async () => {
- try {
- await deleteAdminQuickQuestion(id);
- await loadQuestions();
- } catch (e) {
- console.error(e);
- msg.error((e as Error).message || t('admin.msg.requestFailed'));
- }
- });
+ /**
+ * 删除指定常用问题。先用 Element 确认框询问,取消则不请求。
+ * 核心逻辑:MessageBox 在取消时 reject,这里吞掉;确定后再调删除接口并刷新列表。
+ * @param id - 常用问题主键
+ */
+ const deleteQuestion = async (id: number): Promise => {
+ try {
+ await ElMessageBox.confirm(t('admin.question.confirmDelete'), t('common.deleteDialog.defaultTitle'), {
+ type: 'warning',
+ confirmButtonText: t('common.deleteDialog.confirm'),
+ cancelButtonText: t('common.deleteDialog.cancel'),
+ });
+ } catch {
+ return;
+ }
+ try {
+ await deleteAdminQuickQuestion(id);
+ await loadQuestions();
+ } catch (e) {
+ console.error(e);
+ msg.error((e as Error).message || t('admin.msg.requestFailed'));
+ }
};
return {
@@ -245,8 +234,6 @@ export function useQuestionsAdmin() {
isLoading,
isSaving,
showFormModal,
- showDeleteConfirmDialog,
- deleteConfirmMessage,
filterAgentId,
filterCacheOnly,
filterStaleOnly,
@@ -259,8 +246,6 @@ export function useQuestionsAdmin() {
saveQuestion,
saveReviewQuestion,
deleteQuestion,
- closeDeleteConfirm,
- confirmDelete,
truncateQuestionPreview,
truncateAnswerPreview,
};
diff --git a/frontend/src/features/admin/modules/users/UsersPage.vue b/frontend/src/features/admin/modules/users/UsersPage.vue
index 4e3c403b..59ea3b26 100644
--- a/frontend/src/features/admin/modules/users/UsersPage.vue
+++ b/frontend/src/features/admin/modules/users/UsersPage.vue
@@ -2,7 +2,7 @@
* features/admin/modules/users/UsersPage.vue
* 用途:用户管理独立页面(服务端筛选分页、用户/部门列排序、批量操作)。
* 依赖:useUsersAdmin、useElementProvider、element-plus、用户相关 Modal、adminRoleLabel、getUserAvatarLabel。
- * 逻辑:路由 /admin/users;本页是 Element Plus 试点,筛选、表格、分页、工具栏和三个业务弹窗走组件库。
+ * 逻辑:路由 /admin/users。列表骨架用 AdminListPage;筛选、表格、分页和三个业务弹窗仍由本页组装。
* 删除和改角色用 Element 确认框。列表经 listAdminUsersPage 按页拉取。
*/