@agile-team/wl-skills-kit 2.11.1 → 2.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +1 -1
- package/bin/wl-skills.js +27 -3
- package/files/.wl-skills/docs/jh-pagination.md +505 -505
- package/files/.wl-skills/docs/request.md +940 -940
- package/files/.wl-skills/guides/architecture.md +1 -1
- package/files/.wl-skills/skills/core/convention-audit/SKILL.md +3 -3
- package/files/.wl-skills/skills/core/spec-doc-parse/SKILL.md +332 -332
- package/files/.wl-skills/skills/core/spec-doc-parse/USAGE.md +97 -97
- package/files/.wl-skills/skills/sync/permission-sync/USAGE.md +107 -107
- package/files/.wl-skills/src/components/global/C_ParentView/index.vue +3 -3
- package/files/.wl-skills/src/components/global/C_RightToolbar/index.vue +157 -157
- package/files/.wl-skills/src/components/global/C_SvgIcon/index.vue +31 -31
- package/files/.wl-skills/src/components/global/C_SvgIcon/svgicon.js +10 -10
- package/files/.wl-skills/src/components/global/C_TagStatus/README.md +264 -264
- package/files/.wl-skills/src/components/global/C_TagStatus/config.ts +192 -192
- package/files/.wl-skills/src/components/global/C_TagStatus/index.vue +106 -106
- package/files/.wl-skills/src/components/global/C_TagStatus/types.ts +64 -64
- package/files/.wl-skills/src/components/global/C_Tree/README.md +153 -153
- package/files/.wl-skills/src/components/global/C_Tree/index.scss +42 -42
- package/files/.wl-skills/src/components/global/C_Tree/index.vue +78 -78
- package/files/.wl-skills/src/components/global/C_Tree/types.ts +59 -59
- package/files/.wl-skills/src/components/local/c_formModal/README.md +235 -235
- package/files/.wl-skills/src/components/local/c_formModal/data.ts +95 -95
- package/files/.wl-skills/src/components/local/c_formModal/index.scss +8 -8
- package/files/.wl-skills/src/components/local/c_formModal/index.vue +107 -107
- package/files/.wl-skills/src/components/local/c_formSections/data.ts +175 -175
- package/files/.wl-skills/src/components/local/c_formSections/index.scss +280 -280
- package/files/.wl-skills/src/components/local/c_formSections/index.vue +429 -429
- package/files/.wl-skills/src/components/local/c_listModal/data.ts +41 -41
- package/files/.wl-skills/src/components/local/c_listModal/index.vue +136 -136
- package/files/.wl-skills/src/components/local/c_spliterTitle/index.scss +25 -25
- package/files/.wl-skills/src/components/local/c_spliterTitle/index.vue +21 -21
- package/files/.wl-skills/src/components/remote/AGGrid/README.md +530 -530
- package/files/.wl-skills/src/components/remote/BaseForm/README.md +508 -508
- package/files/.wl-skills/src/components/remote/BaseQuery/README.md +865 -865
- package/files/.wl-skills/src/components/remote/BaseTable/README.md +941 -941
- package/files/.wl-skills/src/components/remote/BaseToolbar/README.md +496 -496
- package/files/.wl-skills/src/types/page.ts +24 -24
- package/files/.wl-skills/standards/04-coding-basics.md +39 -1
- package/files/.wl-skills/standards/09-typescript.md +26 -3
- package/files/.wl-skills/standards/index.md +2 -2
- package/files/.wl-skills/templates/README.md +44 -44
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/api.md +54 -54
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/data.ts +346 -346
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/index.scss +1 -1
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add/index.vue +28 -28
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add-form/data.ts +115 -115
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add-form/index.scss +44 -44
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-add-form/index.vue +43 -43
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change/data.ts +338 -338
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change/index.scss +1 -1
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change/index.vue +28 -28
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change-form/data.ts +115 -115
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change-form/index.scss +44 -44
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-apply-change-form/index.vue +43 -43
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/api.md +88 -88
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/data.ts +601 -601
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/index.scss +1 -1
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-archive/index.vue +64 -64
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/api.md +67 -67
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/data.ts +286 -286
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/index.scss +139 -139
- package/files/.wl-skills/templates/produce/aiflow/mmwr-customer-detail/index.vue +318 -318
- package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/api.md +98 -98
- package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/data.ts +543 -543
- package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/index.scss +1 -1
- package/files/.wl-skills/templates/produce/aiflow/mmwr-temp-customer-archive/index.vue +52 -52
- package/files/.wl-skills/templates/sale/demo/add-demo/data.ts +518 -518
- package/files/.wl-skills/templates/sale/demo/billet-flame-cut-plan/data.ts +524 -524
- package/files/.wl-skills/templates/sale/demo/billet-flame-cut-plan/index.scss +154 -154
- package/files/.wl-skills/templates/sale/demo/billet-flame-cut-plan/index.vue +117 -117
- package/files/.wl-skills/templates/sale/demo/domestic-trade-order/data.ts +308 -308
- package/files/.wl-skills/templates/sale/demo/domestic-trade-order/index.scss +99 -99
- package/files/.wl-skills/templates/sale/demo/domestic-trade-order/index.vue +77 -77
- package/files/.wl-skills/templates/sale/demo/heat-batch-return/data.ts +367 -367
- package/files/.wl-skills/templates/sale/demo/heat-batch-return/index.scss +100 -100
- package/files/.wl-skills/templates/sale/demo/heat-batch-return/index.vue +170 -170
- package/files/.wl-skills/templates/sale/demo/heat-batch-return/meltDialog.vue +320 -320
- package/files/.wl-skills/templates/sale/demo/metallurgical-spec/data.ts +824 -824
- package/lib/ast-rules.js +304 -9
- package/mcp/config.js +46 -46
- package/mcp/registry.js +6 -1
- package/mcp/tools/projectTools.js +9 -1
- package/package.json +2 -2
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
# 使用指南:spec-doc-parse(规范文档解构)
|
|
2
|
-
|
|
3
|
-
> **谁读这个文档**:团队成员(产品/前端/后端)
|
|
4
|
-
> **AI 触发文件**:同目录 `SKILL.md`(无需手动阅读)
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## 这个 Skill 解决什么问题
|
|
9
|
-
|
|
10
|
-
把 **wl-skills-design 产出的标准《需求设计说明书》**(`.wl-skills/docs/spec/` 下的 IPO 表、功能编码、流程五要素)**完整解构**为一份《页面清单》(page-spec JSON),作为后续 `api-contract` 和 `page-codegen` 的输入。
|
|
11
|
-
|
|
12
|
-
一句话:**design 负责「写标准文档」,spec-doc-parse 负责「读懂标准文档、转成可生成代码的结构」。**
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## 双线分工(重要)
|
|
17
|
-
|
|
18
|
-
团队里有两条独立的输入线,**互不污染**:
|
|
19
|
-
|
|
20
|
-
| 线 | Skill | 输入 | 何时用 |
|
|
21
|
-
|----|-------|------|--------|
|
|
22
|
-
| **原型线** | `prototype-scan` | Axure 原型 / 截图 / 口述 / 零散详设 | 只有原型、没有规范文档时 |
|
|
23
|
-
| **规范线** | `spec-doc-parse`(本 Skill) | wl-skills-design 标准说明书 | 已有 `.wl-skills/docs/spec/` 标准文档时 |
|
|
24
|
-
|
|
25
|
-
> 两条线最终都汇聚到**同一份 page-spec JSON**,下游代码生成完全一样。
|
|
26
|
-
> 所以:**有标准说明书就走规范线,精度最高(95-100%);只有原型走原型线。**
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## 何时使用
|
|
31
|
-
|
|
32
|
-
- 拿到 wl-skills-design 生成的 `.wl-skills/docs/spec/{项目代号}/4.x-xxx.md`,要把它变成页面
|
|
33
|
-
- 说明书里有功能编码(如 PMMB001)、IPO 表、流程图说明
|
|
34
|
-
- 想把整卷说明书一次性解构成页面清单,再批量生成代码
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
## 触发关键词
|
|
39
|
-
|
|
40
|
-
`解析说明书` / `解析需求文档` / `规范文档转页面` / `根据说明书生成` / `IPO 转页面` / `功能编码`
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## 标准对话示例
|
|
45
|
-
|
|
46
|
-
### 示例 1:解析单个子模块
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
你:解析 .wl-skills/docs/spec/huaxin/4.1-target.md,生成页面清单。
|
|
50
|
-
AI:[读取 SKILL.md → 输出 Pre-flight]
|
|
51
|
-
Pre-flight:
|
|
52
|
-
├─ 识别结构:doc-skeleton 单子模块(4.1 目标管理)
|
|
53
|
-
├─ 来源:.wl-skills/docs/spec/huaxin/4.1-target.md
|
|
54
|
-
├─ 输出:reports/SPEC_PARSE_target_20260531.md
|
|
55
|
-
└─ 不会生成代码
|
|
56
|
-
[解析中...]
|
|
57
|
-
完成,解析报告:
|
|
58
|
-
- 功能 3 个 / 页面 5 个 / 待确认 2 项 / 自动修复 1 项 / 阻断 0 项
|
|
59
|
-
请确认 2 项待确认后进入 api-contract。
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### 示例 2:误用原型线的自动纠偏
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
你:扫描 .wl-skills/docs/spec/huaxin/4.1-target.md 生成页面。
|
|
66
|
-
AI:检测到输入是 wl-skills-design 标准说明书(含功能编码 + IPO 表)。
|
|
67
|
-
→ 这属于「规范线」,已自动切换到 spec-doc-parse(精度更高)。
|
|
68
|
-
[继续按规范线解析]
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## 它会产出什么
|
|
74
|
-
|
|
75
|
-
1. **page-spec JSON**(与 prototype-scan 同格式)—— 喂给 page-codegen 直接生成 Vue 页面
|
|
76
|
-
2. **解析报告**(`reports/SPEC_PARSE_*.md`)—— 功能清单 + 待确认清单 + 自动修复记录 + 阻断清单
|
|
77
|
-
3. **权限码候选**(写在 notes)—— 供 permission-sync 注册
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## 自闭环能力(这个 Skill 的特点)
|
|
82
|
-
|
|
83
|
-
| 能力 | 说明 |
|
|
84
|
-
|------|------|
|
|
85
|
-
| **自验证** | Pre-flight 校验文档结构 + Parse Validation 五项检查 |
|
|
86
|
-
| **自修复** | 活动编码旧格式、英文名空白、dictCode 缺失等无损问题自动修正 |
|
|
87
|
-
| **纠偏** | 架构性问题(功能编码错误、未知服务缩写)不捏造,标记 BLOCK |
|
|
88
|
-
| **报告** | 每次解析输出完整报告,待确认/阻断项可追溯 |
|
|
89
|
-
| **闭环** | 产物可被 convention-audit 的 spec 对齐模式回扫,生成 GAP 报告 |
|
|
90
|
-
|
|
91
|
-
---
|
|
92
|
-
|
|
93
|
-
## 边界提醒
|
|
94
|
-
|
|
95
|
-
- 本 Skill **不处理** Axure 原型、截图 —— 那是 `prototype-scan` 的职责
|
|
96
|
-
- 本 Skill **不生成代码** —— 代码由 `page-codegen` 承接
|
|
97
|
-
- 本 Skill **不捏造**架构决策 —— 触发事件、接口、编码缺失一律标注待确认
|
|
1
|
+
# 使用指南:spec-doc-parse(规范文档解构)
|
|
2
|
+
|
|
3
|
+
> **谁读这个文档**:团队成员(产品/前端/后端)
|
|
4
|
+
> **AI 触发文件**:同目录 `SKILL.md`(无需手动阅读)
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 这个 Skill 解决什么问题
|
|
9
|
+
|
|
10
|
+
把 **wl-skills-design 产出的标准《需求设计说明书》**(`.wl-skills/docs/spec/` 下的 IPO 表、功能编码、流程五要素)**完整解构**为一份《页面清单》(page-spec JSON),作为后续 `api-contract` 和 `page-codegen` 的输入。
|
|
11
|
+
|
|
12
|
+
一句话:**design 负责「写标准文档」,spec-doc-parse 负责「读懂标准文档、转成可生成代码的结构」。**
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 双线分工(重要)
|
|
17
|
+
|
|
18
|
+
团队里有两条独立的输入线,**互不污染**:
|
|
19
|
+
|
|
20
|
+
| 线 | Skill | 输入 | 何时用 |
|
|
21
|
+
|----|-------|------|--------|
|
|
22
|
+
| **原型线** | `prototype-scan` | Axure 原型 / 截图 / 口述 / 零散详设 | 只有原型、没有规范文档时 |
|
|
23
|
+
| **规范线** | `spec-doc-parse`(本 Skill) | wl-skills-design 标准说明书 | 已有 `.wl-skills/docs/spec/` 标准文档时 |
|
|
24
|
+
|
|
25
|
+
> 两条线最终都汇聚到**同一份 page-spec JSON**,下游代码生成完全一样。
|
|
26
|
+
> 所以:**有标准说明书就走规范线,精度最高(95-100%);只有原型走原型线。**
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 何时使用
|
|
31
|
+
|
|
32
|
+
- 拿到 wl-skills-design 生成的 `.wl-skills/docs/spec/{项目代号}/4.x-xxx.md`,要把它变成页面
|
|
33
|
+
- 说明书里有功能编码(如 PMMB001)、IPO 表、流程图说明
|
|
34
|
+
- 想把整卷说明书一次性解构成页面清单,再批量生成代码
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 触发关键词
|
|
39
|
+
|
|
40
|
+
`解析说明书` / `解析需求文档` / `规范文档转页面` / `根据说明书生成` / `IPO 转页面` / `功能编码`
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 标准对话示例
|
|
45
|
+
|
|
46
|
+
### 示例 1:解析单个子模块
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
你:解析 .wl-skills/docs/spec/huaxin/4.1-target.md,生成页面清单。
|
|
50
|
+
AI:[读取 SKILL.md → 输出 Pre-flight]
|
|
51
|
+
Pre-flight:
|
|
52
|
+
├─ 识别结构:doc-skeleton 单子模块(4.1 目标管理)
|
|
53
|
+
├─ 来源:.wl-skills/docs/spec/huaxin/4.1-target.md
|
|
54
|
+
├─ 输出:reports/SPEC_PARSE_target_20260531.md
|
|
55
|
+
└─ 不会生成代码
|
|
56
|
+
[解析中...]
|
|
57
|
+
完成,解析报告:
|
|
58
|
+
- 功能 3 个 / 页面 5 个 / 待确认 2 项 / 自动修复 1 项 / 阻断 0 项
|
|
59
|
+
请确认 2 项待确认后进入 api-contract。
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 示例 2:误用原型线的自动纠偏
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
你:扫描 .wl-skills/docs/spec/huaxin/4.1-target.md 生成页面。
|
|
66
|
+
AI:检测到输入是 wl-skills-design 标准说明书(含功能编码 + IPO 表)。
|
|
67
|
+
→ 这属于「规范线」,已自动切换到 spec-doc-parse(精度更高)。
|
|
68
|
+
[继续按规范线解析]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 它会产出什么
|
|
74
|
+
|
|
75
|
+
1. **page-spec JSON**(与 prototype-scan 同格式)—— 喂给 page-codegen 直接生成 Vue 页面
|
|
76
|
+
2. **解析报告**(`reports/SPEC_PARSE_*.md`)—— 功能清单 + 待确认清单 + 自动修复记录 + 阻断清单
|
|
77
|
+
3. **权限码候选**(写在 notes)—— 供 permission-sync 注册
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 自闭环能力(这个 Skill 的特点)
|
|
82
|
+
|
|
83
|
+
| 能力 | 说明 |
|
|
84
|
+
|------|------|
|
|
85
|
+
| **自验证** | Pre-flight 校验文档结构 + Parse Validation 五项检查 |
|
|
86
|
+
| **自修复** | 活动编码旧格式、英文名空白、dictCode 缺失等无损问题自动修正 |
|
|
87
|
+
| **纠偏** | 架构性问题(功能编码错误、未知服务缩写)不捏造,标记 BLOCK |
|
|
88
|
+
| **报告** | 每次解析输出完整报告,待确认/阻断项可追溯 |
|
|
89
|
+
| **闭环** | 产物可被 convention-audit 的 spec 对齐模式回扫,生成 GAP 报告 |
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 边界提醒
|
|
94
|
+
|
|
95
|
+
- 本 Skill **不处理** Axure 原型、截图 —— 那是 `prototype-scan` 的职责
|
|
96
|
+
- 本 Skill **不生成代码** —— 代码由 `page-codegen` 承接
|
|
97
|
+
- 本 Skill **不捏造**架构决策 —— 触发事件、接口、编码缺失一律标注待确认
|
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
# permission-sync · 使用示例
|
|
2
|
-
|
|
3
|
-
> 给团队成员看的快速上手文档。AI 触发协议见 `SKILL.md`。
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 一句话理解
|
|
8
|
-
|
|
9
|
-
**permission-sync = 角色管理 + 角色授权 + 挂动作 + 加 v-permission**
|
|
10
|
-
|
|
11
|
-
整条链路覆盖"页面建好后,怎么让指定角色的人能看见、能点按钮"的全过程。
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## 三种典型对话
|
|
16
|
-
|
|
17
|
-
### 1. 创建角色
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
用户:创建一个测试角色,code 是 test_qa
|
|
21
|
-
AI : [触发 permission-sync]
|
|
22
|
-
[Pre-flight] 模式 = role-manage
|
|
23
|
-
调用 wls_role_query 检查 → code=test_qa 不存在
|
|
24
|
-
调用 wls_role_upsert
|
|
25
|
-
✅ 创建成功
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### 2. 给角色分配菜单
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
用户:给『档案普通人员』分配『客户档案』和『客户申请』两个菜单
|
|
32
|
-
AI : [触发 permission-sync]
|
|
33
|
-
[Pre-flight] 模式 = role-assign
|
|
34
|
-
⚠️ 注意:saveRoleMenus 是全量覆盖,原有菜单会被替换
|
|
35
|
-
是否继续?(yes/no)
|
|
36
|
-
用户:yes
|
|
37
|
-
AI : 调用 wls_role_assign_menus
|
|
38
|
-
✅ 角色授权成功
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### 3. 给页面挂动作 + 加权限字段(数据驱动,无需改模板)
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
用户:给『客户档案』页面加上 新增/编辑/删除 三个按钮
|
|
45
|
-
AI : [触发 permission-sync]
|
|
46
|
-
[Pre-flight] 模式 = action-attach
|
|
47
|
-
1. wls_action_query 查询已有动作 → 无
|
|
48
|
-
2. wls_action_upsert 注册到后端:customer_add / customer_edit / customer_remove
|
|
49
|
-
3. 在 src/views/customer/list/data.ts 找到工具栏按钮配置,
|
|
50
|
-
给每个对应按钮的 ActionButtonDesc 添加 permission 字段:
|
|
51
|
-
{ name: 'add', label: '新增', permission: ['customer_add'], ... }
|
|
52
|
-
✅ 完成(已写报告 reports/PERMISSION_SYNC_20260429.md)
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
> **为什么不用 v-permission 指令?**
|
|
56
|
-
> 本项目 `BaseToolbar` 内部读取 `ActionButtonDesc.permission` 字段做权限控制,
|
|
57
|
-
> 只需在 `data.ts` 的按钮配置对象里加字段,不需要改 `.vue` 模板,也不依赖全局指令注册。
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## 常见问题
|
|
62
|
-
|
|
63
|
-
### Q1:角色授权时,为什么 menuIds 要传完整列表?
|
|
64
|
-
|
|
65
|
-
后端 `saveRoleMenus` 是**全量覆盖**接口。你传 `[A, B]`,原先 `[A, B, C]` 就会变成 `[A, B]`,C 丢失。
|
|
66
|
-
|
|
67
|
-
**正确做法**:先查角色现有菜单 → 合并新菜单 → 一起传。
|
|
68
|
-
|
|
69
|
-
### Q2:权限码写在 `data.ts` 哪里?不需要改模板吗?
|
|
70
|
-
|
|
71
|
-
对,**不需要改模板(`.vue` 文件)**。`BaseToolbar` 从 `ActionButtonDesc` 的 `permission` 字段读取权限码,在渲染时内部做拦截,标准结构如下:
|
|
72
|
-
|
|
73
|
-
```ts
|
|
74
|
-
// data.ts
|
|
75
|
-
{
|
|
76
|
-
name: 'edit',
|
|
77
|
-
label: '编辑',
|
|
78
|
-
permission: ['qmmcProcessCodeMain_update'], // ← 就加这一行
|
|
79
|
-
onClick: (row: any) => modalRef.value?.edit(row.id)
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
`permission` 是数组,支持多权限码 OR 逻辑(有其中任意一个权限码即显示按钮)。
|
|
84
|
-
|
|
85
|
-
### Q3:权限码用短形式还是长形式?
|
|
86
|
-
|
|
87
|
-
参照项目既有用法。新项目建议短形式(`customer_add`),与平台示例数据一致。
|
|
88
|
-
|
|
89
|
-
### Q4:能批量删除角色/动作吗?
|
|
90
|
-
|
|
91
|
-
**不能**。permission-sync 仅新增不删除(防误删)。删除请走后端管理界面手动操作。
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## 配置要点
|
|
96
|
-
|
|
97
|
-
只需 `.wl-skills/skills/sync/env.local.json` 的根字段:
|
|
98
|
-
|
|
99
|
-
```json
|
|
100
|
-
{
|
|
101
|
-
"gatewayPath": "http://你的网关:端口",
|
|
102
|
-
"sysAppNo": "应用编码",
|
|
103
|
-
"token": "Bearer Token"
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
不需要额外配置 `parentRoleId` / `parentPermissionId` 之类——所有父级 id 由 AI 在执行流程中通过查询接口动态获取。
|
|
1
|
+
# permission-sync · 使用示例
|
|
2
|
+
|
|
3
|
+
> 给团队成员看的快速上手文档。AI 触发协议见 `SKILL.md`。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 一句话理解
|
|
8
|
+
|
|
9
|
+
**permission-sync = 角色管理 + 角色授权 + 挂动作 + 加 v-permission**
|
|
10
|
+
|
|
11
|
+
整条链路覆盖"页面建好后,怎么让指定角色的人能看见、能点按钮"的全过程。
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 三种典型对话
|
|
16
|
+
|
|
17
|
+
### 1. 创建角色
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
用户:创建一个测试角色,code 是 test_qa
|
|
21
|
+
AI : [触发 permission-sync]
|
|
22
|
+
[Pre-flight] 模式 = role-manage
|
|
23
|
+
调用 wls_role_query 检查 → code=test_qa 不存在
|
|
24
|
+
调用 wls_role_upsert
|
|
25
|
+
✅ 创建成功
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 2. 给角色分配菜单
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
用户:给『档案普通人员』分配『客户档案』和『客户申请』两个菜单
|
|
32
|
+
AI : [触发 permission-sync]
|
|
33
|
+
[Pre-flight] 模式 = role-assign
|
|
34
|
+
⚠️ 注意:saveRoleMenus 是全量覆盖,原有菜单会被替换
|
|
35
|
+
是否继续?(yes/no)
|
|
36
|
+
用户:yes
|
|
37
|
+
AI : 调用 wls_role_assign_menus
|
|
38
|
+
✅ 角色授权成功
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 3. 给页面挂动作 + 加权限字段(数据驱动,无需改模板)
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
用户:给『客户档案』页面加上 新增/编辑/删除 三个按钮
|
|
45
|
+
AI : [触发 permission-sync]
|
|
46
|
+
[Pre-flight] 模式 = action-attach
|
|
47
|
+
1. wls_action_query 查询已有动作 → 无
|
|
48
|
+
2. wls_action_upsert 注册到后端:customer_add / customer_edit / customer_remove
|
|
49
|
+
3. 在 src/views/customer/list/data.ts 找到工具栏按钮配置,
|
|
50
|
+
给每个对应按钮的 ActionButtonDesc 添加 permission 字段:
|
|
51
|
+
{ name: 'add', label: '新增', permission: ['customer_add'], ... }
|
|
52
|
+
✅ 完成(已写报告 reports/PERMISSION_SYNC_20260429.md)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
> **为什么不用 v-permission 指令?**
|
|
56
|
+
> 本项目 `BaseToolbar` 内部读取 `ActionButtonDesc.permission` 字段做权限控制,
|
|
57
|
+
> 只需在 `data.ts` 的按钮配置对象里加字段,不需要改 `.vue` 模板,也不依赖全局指令注册。
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 常见问题
|
|
62
|
+
|
|
63
|
+
### Q1:角色授权时,为什么 menuIds 要传完整列表?
|
|
64
|
+
|
|
65
|
+
后端 `saveRoleMenus` 是**全量覆盖**接口。你传 `[A, B]`,原先 `[A, B, C]` 就会变成 `[A, B]`,C 丢失。
|
|
66
|
+
|
|
67
|
+
**正确做法**:先查角色现有菜单 → 合并新菜单 → 一起传。
|
|
68
|
+
|
|
69
|
+
### Q2:权限码写在 `data.ts` 哪里?不需要改模板吗?
|
|
70
|
+
|
|
71
|
+
对,**不需要改模板(`.vue` 文件)**。`BaseToolbar` 从 `ActionButtonDesc` 的 `permission` 字段读取权限码,在渲染时内部做拦截,标准结构如下:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
// data.ts
|
|
75
|
+
{
|
|
76
|
+
name: 'edit',
|
|
77
|
+
label: '编辑',
|
|
78
|
+
permission: ['qmmcProcessCodeMain_update'], // ← 就加这一行
|
|
79
|
+
onClick: (row: any) => modalRef.value?.edit(row.id)
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`permission` 是数组,支持多权限码 OR 逻辑(有其中任意一个权限码即显示按钮)。
|
|
84
|
+
|
|
85
|
+
### Q3:权限码用短形式还是长形式?
|
|
86
|
+
|
|
87
|
+
参照项目既有用法。新项目建议短形式(`customer_add`),与平台示例数据一致。
|
|
88
|
+
|
|
89
|
+
### Q4:能批量删除角色/动作吗?
|
|
90
|
+
|
|
91
|
+
**不能**。permission-sync 仅新增不删除(防误删)。删除请走后端管理界面手动操作。
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 配置要点
|
|
96
|
+
|
|
97
|
+
只需 `.wl-skills/skills/sync/env.local.json` 的根字段:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"gatewayPath": "http://你的网关:端口",
|
|
102
|
+
"sysAppNo": "应用编码",
|
|
103
|
+
"token": "Bearer Token"
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
不需要额外配置 `parentRoleId` / `parentPermissionId` 之类——所有父级 id 由 AI 在执行流程中通过查询接口动态获取。
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<template >
|
|
2
|
-
<router-view />
|
|
3
|
-
</template>
|
|
1
|
+
<template >
|
|
2
|
+
<router-view />
|
|
3
|
+
</template>
|