@agile-team/wl-skills-kit 2.3.7 → 2.4.0

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +495 -404
  2. package/README.md +286 -261
  3. package/bin/wl-skills.js +796 -503
  4. package/docs/ai/345/205/250/346/231/257/345/210/206/346/236/220.md +144 -0
  5. package/docs/input-spec-api.md +263 -0
  6. package/docs/input-spec-detailed-design.md +238 -0
  7. package/docs/input-spec-page-spec.md +371 -0
  8. package/docs/input-spec-prototype.md +176 -0
  9. package/docs//345/205/250/347/233/230/345/210/206/346/236/220/344/270/216/346/231/272/350/203/275/344/275/223/346/220/255/345/273/272/346/214/207/345/215/227.md +267 -0
  10. package/files/.github/copilot-instructions.md +3 -3
  11. package/files/.github/guides/architecture.md +11 -11
  12. package/files/.github/guides/usage.md +5 -4
  13. package/files/.github/skills/_compat/headers/cursor-mdc.txt +1 -1
  14. package/files/.github/skills/_compat/headers/kiro.txt +1 -1
  15. package/files/.github/skills/_compat/headers/trae.txt +1 -1
  16. package/files/.github/skills/_pipeline.md +91 -0
  17. package/files/.github/skills/_registry.md +4 -2
  18. package/files/.github/skills/core/convention-audit/SKILL.md +241 -65
  19. package/files/.github/skills/core/page-codegen/SKILL.md +3 -3
  20. package/files/.github/skills/core/page-codegen/USAGE.md +1 -1
  21. package/files/.github/skills/core/page-codegen/templates/domains/_CONTRIBUTING.md +1 -1
  22. package/files/.github/skills/core/template-extract/SKILL.md +1 -1
  23. package/files/.github/skills/sync/env.local.json +20 -18
  24. package/files/.github/standards/02-code-structure.md +34 -4
  25. package/files/.github/standards/08-git.md +24 -0
  26. package/files/.github/standards/12-base-table.md +44 -0
  27. package/files/.github/standards/index.md +2 -2
  28. package/mcp/server.js +411 -330
  29. package/mcp/tools/projectTools.js +228 -0
  30. package/package.json +40 -39
@@ -0,0 +1,371 @@
1
+ # page-spec JSON 参考手册 — 页面规格定义完全指南
2
+
3
+ > **受众**:前端开发者
4
+ > **目的**:理解 page-spec JSON 的完整结构,支持三个场景:
5
+ > 1. 审核 AI(prototype-scan)自动生成的 page-spec 是否正确
6
+ > 2. 手写 page-spec(跳过原型扫描,直接描述页面结构)
7
+ > 3. 在 page-codegen 前做最后一次人工校验
8
+
9
+ ---
10
+
11
+ ## 什么是 page-spec
12
+
13
+ `page-spec` 是 AI 代码生成链路中的"中间语言":
14
+
15
+ ```
16
+ 原型/详设 → prototype-scan → page-spec JSON → page-codegen → 代码
17
+ ```
18
+
19
+ - **面向机器**(page-codegen 读取),但**人类可读**
20
+ - 一个 JSON 对象 = 一个页面的完整规格说明
21
+ - 每个页面的字段顺序、按钮顺序、类型全部固化在这里
22
+
23
+ ---
24
+
25
+ ## 完整字段参考
26
+
27
+ ### 顶层基本信息
28
+
29
+ ```jsonc
30
+ {
31
+ "pageName": "客户档案", // 必填:页面中文名
32
+ "kebabName": "customer-archive", // 必填:目录名(kebab-case,小写+连字符)
33
+ "pattern": "LIST", // 必填:页面交互模式(见下方枚举)
34
+ "path": "views/mmwr/customer/khda/customer-archive/", // 必填:完整视图路径
35
+ "pagesTs": ["customer-archive", "客户档案"], // 必填:pages.ts 注册项 [路由名, 中文名]
36
+ "platformComponents": ["BaseQuery", "BaseTable", "jh-pagination"], // 必填:用到的平台组件
37
+ "newComponents": [] // 必填:需新建的业务组件(空数组=不需要)
38
+ }
39
+ ```
40
+
41
+ #### `pattern` 枚举值
42
+
43
+ | 值 | 含义 | 典型场景 |
44
+ |---|---|---|
45
+ | `LIST` | 标准列表页(查询 + 工具栏 + 表格) | 90% 的管理列表 |
46
+ | `MASTER_DETAIL` | 主从详情(列表 + 侧边/底部详情区) | 有关联详情的数据 |
47
+ | `TREE_LIST` | 左树右表(树形导航 + 右侧表格) | 分类/层级管理 |
48
+ | `FORM_TAB` | Tab 表单页(多 Tab 分区展示/编辑) | 单条记录的详情页 |
49
+ | `COMPOSITE` | 复合型(多种模式组合) | 特殊复杂页面 |
50
+
51
+ ---
52
+
53
+ ### query — 查询条件字段
54
+
55
+ ```jsonc
56
+ "query": [
57
+ // 文本输入
58
+ { "field": "customerName", "label": "客户名称", "type": "input" },
59
+
60
+ // 字典下拉
61
+ { "field": "customerType", "label": "客户类型", "type": "dict", "dictCode": "customer_type" },
62
+
63
+ // 日期范围(必须有 startName 和 endName)
64
+ {
65
+ "field": "createDate",
66
+ "label": "建立日期",
67
+ "type": "dateRange",
68
+ "startName": "createDateStart",
69
+ "endName": "createDateEnd"
70
+ },
71
+
72
+ // 单个日期
73
+ { "field": "planDate", "label": "计划日期", "type": "date" },
74
+
75
+ // 数字输入
76
+ { "field": "qty", "label": "数量", "type": "number" },
77
+
78
+ // 自定义下拉(非字典,选项固定)
79
+ { "field": "category", "label": "分类", "type": "select", "options": [{ "label": "A类", "value": "A" }] },
80
+
81
+ // 树形选择(部门/组织)
82
+ { "field": "deptId", "label": "所属部门", "type": "treeSelect" }
83
+ ]
84
+ ```
85
+
86
+ **`type` 枚举**:`input` | `dict` | `date` | `dateRange` | `number` | `select` | `treeSelect`
87
+
88
+ **注意事项**:
89
+ - 顺序严格按原型/详设从左到右、从上到下排列
90
+ - `dateRange` 类型的 `startName` / `endName` 是发给后端的实际字段名
91
+ - `dict` 类型必须有 `dictCode`(全小写下划线,如 `customer_type`)
92
+
93
+ ---
94
+
95
+ ### toolbar — 工具栏按钮
96
+
97
+ ```jsonc
98
+ "toolbar": [
99
+ { "label": "新增", "type": "primary", "action": "openModal" },
100
+ { "label": "批量删除", "type": "danger", "action": "batchDelete" },
101
+ { "label": "导出", "type": "plain", "action": "export" },
102
+ { "label": "导入", "type": "plain", "action": "import" }
103
+ ]
104
+ ```
105
+
106
+ #### `type` 与原型颜色对应
107
+
108
+ | 原型颜色 | type 值 | 说明 |
109
+ |---|---|---|
110
+ | 蓝色填充按钮 | `primary` | 主要操作:新增、保存、提交 |
111
+ | 线框/白底按钮 | `plain` | 次要操作:导出、导入、刷新 |
112
+ | 红色按钮 | `danger` | 危险操作:删除、作废 |
113
+ | 灰色/默认 | `default` | 辅助操作 |
114
+
115
+ #### `action` 枚举
116
+
117
+ | 值 | 含义 |
118
+ |---|---|
119
+ | `openModal` | 打开新增弹窗(最常用) |
120
+ | `batchDelete` | 批量删除已选行 |
121
+ | `export` | 导出当前查询结果 |
122
+ | `import` | 导入(打开导入对话框) |
123
+ | `refresh` | 手动刷新列表 |
124
+ | 自定义字符串 | 如 `submit` / `approve`,在 notes 中描述具体行为 |
125
+
126
+ ---
127
+
128
+ ### columns — 表格列
129
+
130
+ ```jsonc
131
+ "columns": [
132
+ // 普通文本列
133
+ { "field": "customerCode", "label": "客户编码", "width": 120 },
134
+
135
+ // 字典列(值自动渲染为字典标签)
136
+ { "field": "customerType", "label": "客户类型", "width": 120, "dict": "customer_type" },
137
+
138
+ // 可点击列(蓝色链接,点击跳转或打开详情)
139
+ { "field": "customerName", "label": "客户名称", "width": 180, "clickable": true },
140
+
141
+ // 日期列
142
+ { "field": "createDate", "label": "建立日期", "width": 120 },
143
+
144
+ // 数字列(右对齐)
145
+ { "field": "qty", "label": "数量", "width": 80 }
146
+ ]
147
+ ```
148
+
149
+ **注意事项**:
150
+ - 顺序严格按原型表头从左到右排列(不含复选框列和序号列,这两列框架自动添加)
151
+ - 可点击列(蓝色链接文字)必须标注 `"clickable": true`,否则会生成为普通文本
152
+ - 宽度单位为 px,不确定时可省略(AI/代码模板有默认值)
153
+
154
+ ---
155
+
156
+ ### operations — 操作列按钮
157
+
158
+ ```jsonc
159
+ "operations": [
160
+ { "label": "查看", "action": "view" },
161
+ { "label": "编辑", "action": "edit" },
162
+ { "label": "删除", "action": "delete" }
163
+ ]
164
+ ```
165
+
166
+ **顺序**:原型操作列按钮从左到右的顺序,AI 严格遵守。
167
+
168
+ **常见 action 值**:`view` | `edit` | `delete` | 自定义(在 notes 描述行为)
169
+
170
+ ---
171
+
172
+ ### subTables — 内嵌子表
173
+
174
+ 适用于页面中存在关联子表(如"工单明细"、"产品清单")的情况:
175
+
176
+ ```jsonc
177
+ "subTables": [
178
+ {
179
+ "name": "businessInfo", // 子表的 camelCase 名
180
+ "label": "业务信息", // 子表的中文标题
181
+ "editable": true, // 是否可增删行(有新增/删除按钮)
182
+ "inlineEdit": false, // 是否行内编辑(单元格可直接编辑)
183
+ "columns": [
184
+ { "field": "salesType", "label": "销售别", "width": 80, "dict": "sales_type" },
185
+ { "field": "remark", "label": "备注", "width": 200 }
186
+ ],
187
+ "operations": [
188
+ { "label": "删除", "action": "removeRow" }
189
+ ]
190
+ }
191
+ ]
192
+ ```
193
+
194
+ #### `editable` / `inlineEdit` 判断规则
195
+
196
+ | 原型特征 | editable | inlineEdit |
197
+ |---|---|---|
198
+ | 表格上方有"新增"按钮,行内有"删除"链接 | `true` | `false` |
199
+ | 表格单元格可直接编辑(显示输入框/下拉) | `true` | `true` |
200
+ | 纯展示,无任何编辑入口 | `false` | `false` |
201
+ | 只有"导入"按钮填充数据 | `false` | `false` |
202
+
203
+ ---
204
+
205
+ ### formSections — 表单区块(FORM_TAB 页面 / 弹窗表单)
206
+
207
+ ```jsonc
208
+ "formSections": [
209
+ {
210
+ "name": "basicInfo", // 区块的 camelCase 标识
211
+ "label": "基本信息", // 区块的中文标题
212
+ "fields": [
213
+ { "field": "customerName", "label": "客户名称", "type": "input", "required": true },
214
+ { "field": "customerType", "label": "客户类型", "type": "dict", "dictCode": "customer_type", "required": true },
215
+ { "field": "remark", "label": "备注", "type": "textarea", "required": false }
216
+ ]
217
+ },
218
+ {
219
+ "name": "statusInfo",
220
+ "label": "状态信息",
221
+ "fields": [
222
+ { "field": "createTime", "label": "创建时间", "type": "text", "required": false, "readonly": true }
223
+ ]
224
+ }
225
+ ]
226
+ ```
227
+
228
+ **字段 `type` 枚举**:`input` | `textarea` | `dict` | `date` | `dateRange` | `number` | `select` | `treeSelect` | `text`(只读展示)
229
+
230
+ ---
231
+
232
+ ### features — 页面特殊交互开关
233
+
234
+ ```jsonc
235
+ "features": {
236
+ "tabSwitch": false, // 是否有 Tab 切换(分类/视图 Tab,如临时/正式客户)
237
+ "tabItems": [], // Tab 项列表(tabSwitch=true 时必填)
238
+ // 格式:[{ "label": "临时客户", "value": "temp" }, ...]
239
+
240
+ "viewSwitch": false, // 是否有视角/视图切换(RadioButton,如管理视角/使用视角)
241
+ "viewItems": [], // 视角列表(viewSwitch=true 时必填)
242
+ // 格式:[{ "label": "管理视角", "value": "management" }, ...]
243
+
244
+ "hiddenMenu": false // 是否隐藏菜单(从列表跳转进入,不在菜单显示)
245
+ }
246
+ ```
247
+
248
+ **tabSwitch vs viewSwitch 的区别**:
249
+ - `tabSwitch`:Tab 组件(`el-tabs`),切换时整个查询区+表格都变
250
+ - `viewSwitch`:RadioButton 组,通常只改变表格列或查询条件(同一批数据的不同展示视角)
251
+
252
+ **viewSwitch 时的 columns**:
253
+ 当 `viewSwitch: true` 时,不同视角的列定义不同,使用 `viewColumns` 字段:
254
+
255
+ ```jsonc
256
+ "viewColumns": {
257
+ "management": [
258
+ { "field": "xxx", "label": "管理字段" }
259
+ ],
260
+ "usage": [
261
+ { "field": "yyy", "label": "使用字段" }
262
+ ]
263
+ }
264
+ ```
265
+
266
+ ---
267
+
268
+ ### notes — 补充说明
269
+
270
+ ```jsonc
271
+ "notes": [
272
+ "客户分类/客户级别的下拉选项按产品线动态变化(客户类型改变后联动)",
273
+ "点击客户编码跳转到'客户详情'页(隐藏菜单页,path: views/mmwr/customer/detail/)",
274
+ "状态信息区(核实状态、创建人等)为只读展示,无编辑入口",
275
+ "删除需二次确认:'确认删除客户[customerName]吗?'"
276
+ ]
277
+ ```
278
+
279
+ `notes` 用于记录**无法完全结构化**的业务规则,包括:
280
+ - 联动逻辑(A 字段改变影响 B 字段的选项)
281
+ - 特殊权限控制(某按钮仅特定角色可见)
282
+ - 跳转关系(点击某字段跳转到哪个页面)
283
+ - 二次确认提示文字
284
+ - 弹窗/抽屉的特殊行为
285
+
286
+ ---
287
+
288
+ ## 完整示例
289
+
290
+ ```json
291
+ {
292
+ "pageName": "客户档案",
293
+ "kebabName": "customer-archive",
294
+ "pattern": "LIST",
295
+ "path": "views/mmwr/customer/khda/customer-archive/",
296
+ "pagesTs": ["customer-archive", "客户档案"],
297
+ "platformComponents": ["BaseQuery", "BaseTable", "jh-pagination"],
298
+ "newComponents": [],
299
+ "query": [
300
+ { "field": "customerName", "label": "客户名称", "type": "input" },
301
+ { "field": "customerType", "label": "客户类型", "type": "dict", "dictCode": "customer_type" },
302
+ { "field": "enableStatus", "label": "启用状态", "type": "dict", "dictCode": "enable_status" },
303
+ { "field": "createDate", "label": "建立日期", "type": "dateRange", "startName": "createDateStart", "endName": "createDateEnd" }
304
+ ],
305
+ "toolbar": [
306
+ { "label": "新增", "type": "primary", "action": "openModal" },
307
+ { "label": "导出", "type": "plain", "action": "export" }
308
+ ],
309
+ "columns": [
310
+ { "field": "customerCode", "label": "客户编码", "width": 120, "clickable": true },
311
+ { "field": "customerName", "label": "客户名称", "width": 200 },
312
+ { "field": "customerType", "label": "客户类型", "width": 120, "dict": "customer_type" },
313
+ { "field": "enableStatus", "label": "启用状态", "width": 100, "dict": "enable_status" },
314
+ { "field": "createDate", "label": "建立日期", "width": 120 }
315
+ ],
316
+ "operations": [
317
+ { "label": "编辑", "action": "edit" },
318
+ { "label": "删除", "action": "delete" }
319
+ ],
320
+ "subTables": [],
321
+ "formSections": [],
322
+ "features": {
323
+ "tabSwitch": false,
324
+ "tabItems": [],
325
+ "viewSwitch": false,
326
+ "viewItems": [],
327
+ "hiddenMenu": false
328
+ },
329
+ "notes": [
330
+ "客户编码点击后跳转到客户详情页(隐藏菜单页)",
331
+ "删除需二次确认"
332
+ ]
333
+ }
334
+ ```
335
+
336
+ ---
337
+
338
+ ## 自检清单(提交 page-codegen 前)
339
+
340
+ - [ ] `query` — 字段数量与原型/详设一致,顺序一致
341
+ - [ ] `query` — 所有 `dict` 类型都有 `dictCode`(下划线格式)
342
+ - [ ] `query` — 所有 `dateRange` 类型都有 `startName` / `endName`
343
+ - [ ] `toolbar` — 按钮数量与顺序与原型一致
344
+ - [ ] `toolbar` — `type` 值与按钮颜色匹配(蓝=primary,红=danger,白框=plain)
345
+ - [ ] `columns` — 字段数量与表头一致,顺序一致(不含复选框/序号列)
346
+ - [ ] `columns` — 可点击列标注了 `"clickable": true`
347
+ - [ ] `columns` — 字典列标注了 `"dict": "xxx"`
348
+ - [ ] `operations` — 操作按钮数量与顺序与原型一致
349
+ - [ ] `subTables` — 每个子表的 `editable` / `inlineEdit` 已正确标注
350
+ - [ ] `features.tabSwitch` — 若页面有 Tab,`tabItems` 列表已完整填写
351
+ - [ ] `features.viewSwitch` — 若页面有视角切换,`viewItems` 和 `viewColumns` 已完整填写
352
+ - [ ] `features.hiddenMenu` — 隐藏菜单页面已正确标注 `true`
353
+ - [ ] `notes` — 特殊联动/跳转/权限规则已记录
354
+
355
+ ---
356
+
357
+ ## 手写 page-spec 的使用场景
358
+
359
+ **适合手写(跳过 prototype-scan)的情况**:
360
+ - 没有 Axure 原型,也没有详设文档,只有口头/自然语言描述
361
+ - 页面结构极简(如只有几个字段的配置页),不值得走完整扫描流程
362
+ - 需要修正 AI 扫描结果时,直接编辑 JSON 比重新描述更精确
363
+
364
+ **手写后直接传给 page-codegen**:
365
+
366
+ ```
367
+ 用户:以下是 page-spec,请直接生成代码:
368
+ { "pageName": "xxx", ... }
369
+ ```
370
+
371
+ page-codegen 接受手写 page-spec 作为直接输入,不需要经过 prototype-scan。
@@ -0,0 +1,176 @@
1
+ # 原型输入规范 — 如何制作让 AI 精确识别的原型
2
+
3
+ > **受众**:设计师 / 产品经理
4
+ > **目的**:规范 Axure 原型的制作要求,使 AI(prototype-scan Skill)能 100% 准确提取页面结构,不遗漏、不错序、不丢失交互
5
+
6
+ ---
7
+
8
+ ## 为什么原型质量决定代码精度
9
+
10
+ AI 代码生成的链路:
11
+
12
+ ```
13
+ 原型 → prototype-scan → page-spec JSON → page-codegen → 代码
14
+ ```
15
+
16
+ 第一步的精度损失会被后续步骤放大。原型每丢失一个字段,就需要开发者手动补充;每有一个交互描述模糊,就意味着 AI 必须猜测或占位。
17
+
18
+ **不同原型完整度的输出精度预期**:
19
+
20
+ | 原型完整程度 | 字段不遗漏 | 英文名准确 | 字典/交互准确 | 综合精度 |
21
+ |---|---|---|---|---|
22
+ | 标准规范原型(本文要求) | ✅ 100% | ✅ 直接读 | ✅ 90%+ | **95-100%** |
23
+ | 字段名仅中文、无字典标注 | ✅ 100% | ⚠️ AI 推断 | ⚠️ AI 推断 | 85-90% |
24
+ | 字段不全、颜色不规范 | ⚠️ 可能遗漏 | ⚠️ AI 推断 | ❌ AI 猜测 | 70-80% |
25
+ | 截图 / 手绘 / 无结构 | ❌ 大概率遗漏 | ❌ AI 猜测 | ❌ AI 猜测 | 50-70% |
26
+
27
+ ---
28
+
29
+ ## 推荐输入格式
30
+
31
+ **首选**:Axure RP 导出 HTML 原型包(整个目录),AI 直接扫描 HTML 文件
32
+ **次选**:Axure 截图 + 页面清单(精度略低,约 80-90%)
33
+ **不推荐**:手绘图、不清晰截图(AI 精度无法保证)
34
+
35
+ > 如无原型,可使用"详细设计文档"作为输入,精度更高——见 [input-spec-detailed-design.md](input-spec-detailed-design.md)
36
+
37
+ ---
38
+
39
+ ## 合格原型自检清单
40
+
41
+ 提交原型前,请逐项确认:
42
+
43
+ ### 页面基本信息
44
+ - [ ] 每个页面有唯一的中文页面名(如"客户档案",不要用"页面1")
45
+ - [ ] 页面路径/导航层级清晰,能判断哪些页面是通过导航进入(菜单可见)、哪些是从列表跳转进入(隐藏菜单)
46
+ - [ ] 页面是否有 Tab 切换(如"临时客户"/"正式客户")已标注清楚
47
+
48
+ ### 查询区
49
+ - [ ] 所有查询字段全部展开显示(不要收起或折叠)
50
+ - [ ] 每个字段有清晰的中文标签文字(标签文字 = 字段名,不能只有输入框没有标签)
51
+ - [ ] 下拉选择类字段旁边或注释中注明字典名称(如"状态:ORDER_STATUS")
52
+ - [ ] 日期范围字段标注起止标签(如"开始日期 - 结束日期")
53
+ - [ ] 查询字段顺序就是最终期望的顺序(AI 会严格按原型顺序生成)
54
+
55
+ ### 工具栏按钮
56
+ - [ ] 所有操作按钮均可见,按最终期望顺序从左到右排列
57
+ - [ ] **按钮颜色规范**(AI 根据颜色决定按钮类型):
58
+ - 蓝色填充 → `primary`(主要操作:新增、保存、提交)
59
+ - 线框/白底 → `plain`(次要操作:导出、导入、刷新)
60
+ - 红色 → `danger`(危险操作:删除、作废)
61
+ - 灰色/默认 → `default`(辅助操作)
62
+ - [ ] 按钮文字使用最终期望的业务文字("新增申请"不要写成"新增")
63
+
64
+ ### 表格列
65
+ - [ ] 所有列均可见、未被隐藏
66
+ - [ ] 列顺序就是最终期望的显示顺序(AI 会严格按原型顺序生成)
67
+ - [ ] **可点击列(蓝色链接列)** 用蓝色文字或下划线标注(AI 会将其识别为可点击查看详情的列)
68
+ - [ ] 状态类列(如"审批状态")旁边或注释中注明字典名称
69
+ - [ ] 宽度参考值在标注中提供(不强制,但能提升精度)
70
+
71
+ ### 操作列(行内按钮)
72
+ - [ ] 每行的操作按钮全部展示("编辑"、"删除"、"查看"等)
73
+ - [ ] 按钮文字使用业务文字("作废"不要写成"删除")
74
+ - [ ] 操作顺序就是最终期望的顺序
75
+
76
+ ### 弹窗 / 详情页
77
+ - [ ] 弹窗中的所有表单字段全部展开(不要折叠)
78
+ - [ ] 必填字段有 `*` 号标注
79
+ - [ ] 下拉选择类字段注明字典名称
80
+ - [ ] 只读字段有视觉区分(置灰 / 标注"只读")
81
+ - [ ] 弹窗标题与对应操作一致("新增客户" / "编辑客户" / "查看客户")
82
+
83
+ ### 特殊交互
84
+ - [ ] **Tab 切换**:若页面有 Tab,每个 Tab 标签的文字清晰(如"临时客户"/"正式客户"),且每个 Tab 下的表格列单独展示
85
+ - [ ] **视角切换**(RadioButton 组):若不同视角下表格列不同,每个视角各展示一遍
86
+ - [ ] **主从表**:主表和子表的关联关系需标注(点击主表某行,子表加载对应数据)
87
+ - [ ] **左树右表**:树节点点击后,右侧表格联动的规则需标注(按节点 ID 查询 / 按节点 code 查询)
88
+
89
+ ### Axure 注释(推荐添加)
90
+ - [ ] 复杂业务逻辑(非通用 CRUD)在注释中说明(如"点击'转化'按钮,临时客户变为正式客户,原记录保留")
91
+ - [ ] 动态联动字段注释(如"客户类型改变后,客户分类下拉选项联动变化")
92
+ - [ ] 特殊权限控制(如"'删除'按钮仅管理员可见")
93
+
94
+ ---
95
+
96
+ ## 典型错误示例
97
+
98
+ ### ❌ 错误:颜色不规范
99
+
100
+ ```
101
+ [导出] [删除] [新增] ← 三个按钮都是灰色
102
+ ```
103
+
104
+ AI 无法区分主次,全部生成 `type: "default"`,实际应为:
105
+
106
+ ```
107
+ [新增](蓝色) [导出](线框) [删除](红色)
108
+ ```
109
+
110
+ ### ❌ 错误:字段顺序不是最终期望
111
+
112
+ 原型中表格列是"编码、名称、状态、类型",但实际期望是"编码、名称、类型、状态"——如果原型和期望顺序不同,AI 生成的顺序就是错的,需要开发者手动调整。
113
+
114
+ **原则:原型即规范,AI 严格按原型顺序生成。**
115
+
116
+ ### ❌ 错误:状态字段没有字典标注
117
+
118
+ ```
119
+ | 状态 | ... | ← 状态列没有标注用哪个字典
120
+ ```
121
+
122
+ AI 会推断一个 dictCode(如 `order_status`),但可能与实际不符,联调时字典值显示乱。
123
+
124
+ **正确做法**:在注释或字段旁标注"字典:ORDER_STATUS"。
125
+
126
+ ### ❌ 错误:Tab 切换只展示了一个 Tab 的内容
127
+
128
+ 如果页面有"临时客户"和"正式客户"两个 Tab,但原型只展示了"临时客户"Tab 的表格列,AI 会以为两个 Tab 的列相同。
129
+
130
+ **正确做法**:每个 Tab 各展示一次完整的表格列截图/内容。
131
+
132
+ ---
133
+
134
+ ## 字段英文名的最佳实践
135
+
136
+ AI 会从中文标签推断英文字段名(camelCase),推断准确率约 80-90%。
137
+
138
+ 为确保 100% 准确,有两个方式:
139
+
140
+ **方式 1(推荐)**:在 Axure 注释中批量写出字段映射表:
141
+
142
+ ```
143
+ 字段映射(请 AI 按此映射使用):
144
+ 客户名称 → customerName
145
+ 客户类型 → customerType(字典:customer_type)
146
+ 启用状态 → enableStatus(字典:enable_status)
147
+ 建立日期 → createDate(日期范围:createDateStart / createDateEnd)
148
+ ```
149
+
150
+ **方式 2**:切换为"详细设计文档"输入模式(见 [input-spec-detailed-design.md](input-spec-detailed-design.md)),精度更高。
151
+
152
+ ---
153
+
154
+ ## 页面与 page-spec 的映射关系
155
+
156
+ 理解 AI 如何读取原型,帮助你更好地制作原型:
157
+
158
+ | 原型要素 | AI 映射到 page-spec | 影响代码位置 |
159
+ |---|---|---|
160
+ | 查询区字段(顺序) | `query[]` | data.ts `queryDef()` 顺序 |
161
+ | 工具栏按钮(顺序+颜色) | `toolbar[]` + `type` | data.ts `toolbarDef()` |
162
+ | 表格列(顺序) | `columns[]` | data.ts `columnsDef()` |
163
+ | 操作列按钮 | `operations[]` | 操作列 `onClick` 函数 |
164
+ | Tab 标签 | `features.tabItems` | index.vue `el-tabs` |
165
+ | 视角切换 RadioButton | `features.viewItems` | index.vue `el-radio-group` |
166
+ | 弹窗表单字段 | `formSections[].fields[]` | c_formModal `modalConfig` |
167
+ | 跳转子页面 | `features.hiddenMenu: true` | pages.ts 注册 |
168
+ | 蓝色可点击列 | `columns[].clickable: true` | `defaultSlot` + `h()` 渲染 |
169
+
170
+ ---
171
+
172
+ ## 提交原型的方式
173
+
174
+ 1. **Axure 整包**:将 Axure 导出的 HTML 目录整体放入项目(或共享链接),告知 AI 原型路径
175
+ 2. **部分截图 + 字段表**:截图 + 手动整理字段映射表(参见上方"字段英文名最佳实践")
176
+ 3. **切换为详设模式**:不使用原型,直接写详设文档(见 [input-spec-detailed-design.md](input-spec-detailed-design.md))