@agile-team/wl-skills-kit 2.3.4 → 2.3.6
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 +44 -0
- package/README.md +16 -10
- package/files/.cursor/mcp.json +8 -8
- package/files/.github/guides/README.md +13 -13
- package/files/.github/guides/architecture.md +555 -555
- package/files/.github/guides/mcp-setup.md +109 -109
- package/files/.github/guides/usage.md +184 -184
- package/files/.github/reports/README.md +65 -65
- package/files/.github/reports/SYS_DICT_INFO.md +50 -50
- package/files/.github/reports/SYS_MENU_INFO.md +247 -247
- package/files/.github/reports/SYS_PERMISSION_INFO.md +20 -20
- package/files/.github/reports//347/273/204/344/273/266/346/217/220/345/217/226/345/273/272/350/256/256.md +33 -33
- package/files/.github/reports//350/247/204/350/214/203/345/256/241/346/237/245/346/212/245/345/221/212.md +44 -44
- package/files/.github/skills/_compat/README.md +108 -108
- package/files/.github/skills/_compat/headers/agents.txt +8 -8
- package/files/.github/skills/_compat/headers/claude-code.txt +7 -7
- package/files/.github/skills/_compat/headers/cline.txt +7 -7
- package/files/.github/skills/_compat/headers/cursor-mdc.txt +16 -16
- package/files/.github/skills/_compat/headers/cursor-rules.txt +7 -7
- package/files/.github/skills/_compat/headers/github-copilot.txt +1 -1
- package/files/.github/skills/_compat/headers/kiro.txt +10 -10
- package/files/.github/skills/_compat/headers/qoder.txt +8 -8
- package/files/.github/skills/_compat/headers/trae.txt +11 -11
- package/files/.github/skills/_compat/headers/windsurf.txt +7 -7
- package/files/.github/skills/_registry.md +81 -81
- package/files/.github/skills/core/api-contract/SKILL.md +344 -344
- package/files/.github/skills/core/api-contract/USAGE.md +110 -110
- package/files/.github/skills/core/convention-audit/SKILL.md +189 -189
- package/files/.github/skills/core/convention-audit/USAGE.md +99 -99
- package/files/.github/skills/core/page-codegen/SKILL.md +973 -973
- package/files/.github/skills/core/page-codegen/USAGE.md +102 -102
- package/files/.github/skills/core/page-codegen/templates/_index.md +46 -46
- package/files/.github/skills/core/page-codegen/templates/domains/_CONTRIBUTING.md +107 -107
- package/files/.github/skills/core/page-codegen/templates/domains/produce/TPL-OPERATION-STATION.md +442 -442
- package/files/.github/skills/core/page-codegen/templates/domains/sale/README.md +26 -26
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-CHANGE-HISTORY.md +276 -276
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-DETAIL-TABS.md +1145 -1145
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-DRIVEN.md +309 -309
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-FORM-ROUTE.md +436 -436
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-LIST.md +191 -191
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-MASTER-DETAIL.md +148 -148
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-RECORD-FORM.md +376 -376
- package/files/.github/skills/core/page-codegen/templates/universal/TPL-TREE-LIST.md +186 -186
- package/files/.github/skills/core/prototype-scan/SKILL.md +498 -498
- package/files/.github/skills/core/prototype-scan/USAGE.md +95 -95
- package/files/.github/skills/core/template-extract/SKILL.md +139 -139
- package/files/.github/skills/core/template-extract/USAGE.md +93 -93
- package/files/.github/skills/domain/README.md +51 -51
- package/files/.github/skills/sync/env.local.json +0 -5
- package/files/.github/skills/sync/menu-sync/SKILL.md +263 -263
- package/files/.github/skills/sync/menu-sync/USAGE.md +104 -104
- package/files/.github/skills/sync/menu-sync/env/env.local.json +7 -7
- package/files/.github/skills/sync/menu-sync/env/guide.md +99 -99
- package/files/.github/skills/sync/permission-sync/SKILL.md +239 -0
- package/files/.github/skills/sync/permission-sync/USAGE.md +93 -0
- package/files/.github/standards/01-toolchain.md +57 -57
- package/files/.github/standards/02-code-structure.md +111 -111
- package/files/.github/standards/03-comments.md +53 -53
- package/files/.github/standards/04-coding-basics.md +33 -33
- package/files/.github/standards/05-logging.md +38 -38
- package/files/.github/standards/06-security.md +44 -44
- package/files/.github/standards/07-config.md +52 -52
- package/files/.github/standards/08-git.md +60 -60
- package/files/.github/standards/09-typescript.md +71 -71
- package/files/.github/standards/10-pinia.md +57 -57
- package/files/.github/standards/11-form-validation.md +81 -81
- package/files/.github/standards/12-base-table.md +153 -153
- package/files/.github/standards/13-platform-components.md +123 -123
- package/files/.github/standards/index.md +89 -89
- package/files/.kiro/settings/mcp.json +8 -8
- package/files/.mcp.json +8 -8
- package/files/.vscode/mcp.json +9 -9
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/data.ts +196 -196
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.scss +150 -150
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.vue +79 -79
- package/files/docs/jh-date-range.md +257 -257
- package/files/docs/jh-date.md +222 -222
- package/files/docs/jh-dept-picker.md +190 -190
- package/files/docs/jh-drag-row.md +590 -590
- package/files/docs/jh-file-upload.md +216 -216
- package/files/docs/jh-picker.md +218 -218
- package/files/docs/jh-select.md +148 -148
- package/files/docs/jh-text.md +248 -248
- package/files/docs/jh-user-picker.md +197 -197
- package/files/src/components/global/C_RightToolbar/data.ts +228 -228
- package/files/src/components/global/C_RightToolbar/index.scss +44 -44
- package/files/src/components/global/C_Splitter/index.scss +61 -61
- package/files/src/components/global/C_SvgIcon/index.scss +15 -15
- package/files/src/components/global/C_TagStatus/index.scss +20 -20
- package/files/src/components/global/C_Tree/data.ts +61 -61
- package/files/src/components/local/c_listModal/index.scss +4 -4
- package/mcp/api/roleApi.js +60 -0
- package/mcp/server.js +125 -5
- package/mcp/tools/permissionSync.js +321 -0
- package/package.json +1 -1
- package/files/.github/skills/sync/permission-sync/SKILL.draft.md +0 -91
|
@@ -1,309 +1,309 @@
|
|
|
1
|
-
# TPL-DRIVEN:配置驱动模板页(TEMPLATE_DRIVEN 模式代码生成模板)
|
|
2
|
-
|
|
3
|
-
> **本文件是 page-codegen 的正式代码生成模板。**
|
|
4
|
-
> 适用场景:项目中已有可复用的 Template 组件(如 `FinishingAchievementTemplate`),
|
|
5
|
-
> 当前页面的交互骨架与该组件完全一致时,`data.ts` 只需导出 config 对象,`index.vue` 极简到 3~5 行。
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 核心模式:config-only + 3 行 index.vue
|
|
10
|
-
|
|
11
|
-
这类页面的代码精简到极致:
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
data.ts → 只导出一个 xxxConfig 常量(纯 TypeScript 对象,无任何业务逻辑)
|
|
15
|
-
index.vue → 只有 <XxxTemplate :config="config" />,总计 3~5 行
|
|
16
|
-
index.scss → 空文件或极少样式(模板组件内部已处理样式)
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
所有业务逻辑(查询、表格列、API 调用、确认框、刷新等)全部在 Template 组件内部处理。
|
|
20
|
-
页面文件只是向模板传递"这个页面的具体配置"。
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## 通用生成规范(适用于任意 Template 组件)
|
|
25
|
-
|
|
26
|
-
### 步骤 1:确认 Template 组件的 types.ts
|
|
27
|
-
|
|
28
|
-
生成 config 对象前,必须先读取该模板的类型定义文件:
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
src/components/template/{XxxTemplate}/types.ts
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
`data.ts` 的 config 对象结构必须完全遵循 `types.ts` 的 interface 定义,不得猜测字段。
|
|
35
|
-
|
|
36
|
-
### 步骤 2:生成 data.ts(纯 config 对象)
|
|
37
|
-
|
|
38
|
-
```typescript
|
|
39
|
-
// src/views/[域]/[模块]/[子模块]/[kebab-页面名]/data.ts
|
|
40
|
-
import type { XxxTemplateConfig } from "@/components/template/XxxTemplate/types";
|
|
41
|
-
|
|
42
|
-
export const [camelPageName]Config: XxxTemplateConfig = {
|
|
43
|
-
// 按 types.ts 的 interface 逐字段填写
|
|
44
|
-
// 所有 API path 格式:"/[服务缩写]/[资源名]/[操作]"
|
|
45
|
-
api: {
|
|
46
|
-
list: "/[svc]/[resource]/list",
|
|
47
|
-
// ... 其余 API 按 types.ts 定义
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
// 其他配置字段按 types.ts 补全
|
|
51
|
-
};
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
> **严格约束**:
|
|
55
|
-
> - ❌ 禁止在 data.ts 中写任何函数、class、ref、reactive
|
|
56
|
-
> - ❌ 禁止导入 `AbstractPageQueryHook` 或任何 hook 基类
|
|
57
|
-
> - ✅ 只有 import type + export const
|
|
58
|
-
|
|
59
|
-
### 步骤 3:生成 index.vue(3~5 行)
|
|
60
|
-
|
|
61
|
-
```vue
|
|
62
|
-
<!-- src/views/[域]/[模块]/[子模块]/[kebab-页面名]/index.vue -->
|
|
63
|
-
<template>
|
|
64
|
-
<XxxTemplate :config="[camelPageName]Config" />
|
|
65
|
-
</template>
|
|
66
|
-
|
|
67
|
-
<script setup lang="ts">
|
|
68
|
-
import XxxTemplate from "@/components/template/XxxTemplate/index.vue";
|
|
69
|
-
import { [camelPageName]Config } from "./data";
|
|
70
|
-
</script>
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
> ⚠️ 注意:模板组件自身已包含 `app-container app-page-container` 外层,
|
|
74
|
-
> index.vue **不要再套一层 div**,避免双层容器导致布局错位。
|
|
75
|
-
> 若不确定,读模板组件的 index.vue 确认其根元素结构。
|
|
76
|
-
|
|
77
|
-
### 步骤 4:生成 index.scss
|
|
78
|
-
|
|
79
|
-
通常为空文件或只有极少页面级样式覆盖:
|
|
80
|
-
|
|
81
|
-
```scss
|
|
82
|
-
// src/views/[域]/[模块]/[子模块]/[kebab-页面名]/index.scss
|
|
83
|
-
// 如无特殊覆盖样式,保留空文件即可
|
|
84
|
-
// 模板组件内部已处理所有通用样式
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### 步骤 5:pages.ts 注册(与其他模式相同)
|
|
88
|
-
|
|
89
|
-
```typescript
|
|
90
|
-
// router/pages.ts 追加
|
|
91
|
-
["[kebab-页面名]", "[页面中文名]"],
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## 何时使用 TEMPLATE_DRIVEN(识别规则)
|
|
97
|
-
|
|
98
|
-
**必须同时满足以下两个条件**:
|
|
99
|
-
|
|
100
|
-
1. 项目 `src/components/template/` 目录下已存在可复用的 Template 组件
|
|
101
|
-
2. 当前页面与该模板的交互骨架**完全一致**(查询/操作/表格结构均与模板期望的 config 结构匹配)
|
|
102
|
-
|
|
103
|
-
**不确定时的决策**:
|
|
104
|
-
|
|
105
|
-
```
|
|
106
|
-
✅ 交互完全一致,template/types.ts 字段全部能对应 → 使用 TEMPLATE_DRIVEN
|
|
107
|
-
⚠️ 交互相似但有额外自定义逻辑 → 使用 LIST(更安全,不要强套模板)
|
|
108
|
-
❌ 项目无 Template 组件 → 不适用,直接用 LIST/DETAIL_TABS 等标准模板
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
## 已知配置驱动模板一览(cx-ui-produce 项目特定)
|
|
114
|
-
|
|
115
|
-
> ⚠️ 以下是 cx-ui-produce 项目已有的 Template 组件,仅在该项目中适用。
|
|
116
|
-
> 其他项目需根据自己项目的 `src/components/template/` 目录确认。
|
|
117
|
-
|
|
118
|
-
### 1. ResultQueryTemplate(轧钢实绩查询类)
|
|
119
|
-
|
|
120
|
-
**适用范围**:`production-mmwr/sjtj/` 下的各工序实绩查询页(查询+表格+导出,无新增/编辑/删除)
|
|
121
|
-
|
|
122
|
-
**识别特征**:
|
|
123
|
-
- 原型中只有查询区 + 数据表格 + 导出按钮
|
|
124
|
-
- 无 CRUD 操作,纯查询
|
|
125
|
-
- 字段较多,表格列数 10+
|
|
126
|
-
|
|
127
|
-
**生成规则**:
|
|
128
|
-
|
|
129
|
-
```typescript
|
|
130
|
-
// data.ts — 只导出一个 config 对象
|
|
131
|
-
import type { ResultQueryConfig } from "@/components/template/ResultQueryTemplate/types";
|
|
132
|
-
import { BusLogicDataType } from "@/types/page";
|
|
133
|
-
|
|
134
|
-
export const [pageName]Config: ResultQueryConfig = {
|
|
135
|
-
api: {
|
|
136
|
-
list: "/[服务缩写]/[资源名]/list",
|
|
137
|
-
export: "/[服务缩写]/[资源名]/export" // 有导出时才加
|
|
138
|
-
},
|
|
139
|
-
queryItems: [
|
|
140
|
-
{ name: "[field]", label: "[中文名]", placeholder: "请输入" },
|
|
141
|
-
{
|
|
142
|
-
name: "[dateField]",
|
|
143
|
-
type: "range",
|
|
144
|
-
startName: "[startDate]",
|
|
145
|
-
endName: "[endDate]",
|
|
146
|
-
label: "[日期名]",
|
|
147
|
-
logicType: BusLogicDataType.date,
|
|
148
|
-
rangeSeparator: "至"
|
|
149
|
-
}
|
|
150
|
-
],
|
|
151
|
-
columns: [
|
|
152
|
-
{ label: "[列名]", name: "[fieldName]", minWidth: 120 }
|
|
153
|
-
]
|
|
154
|
-
};
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
```vue
|
|
158
|
-
<!-- index.vue -->
|
|
159
|
-
<template>
|
|
160
|
-
<ResultQueryTemplate :config="[pageName]Config" />
|
|
161
|
-
</template>
|
|
162
|
-
|
|
163
|
-
<script setup lang="ts">
|
|
164
|
-
import ResultQueryTemplate from "@/components/template/ResultQueryTemplate/index.vue";
|
|
165
|
-
import { [pageName]Config } from "./data";
|
|
166
|
-
</script>
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
---
|
|
170
|
-
|
|
171
|
-
### 2. FinishingAchievementTemplate(精整实绩类)
|
|
172
|
-
|
|
173
|
-
**适用范围**:`production-mmwr/jzsj/` 下的各精整工序实绩管理页(喷砂、倒棱、矫直、剥皮、检验、酸洗、包装)
|
|
174
|
-
|
|
175
|
-
**识别特征**:
|
|
176
|
-
- 原型标题含"实绩"二字且在精整工序列表中
|
|
177
|
-
- 有固定的查询区 + 实绩录入 + 汇总数据结构
|
|
178
|
-
- 字段结构高度统一(同一套模板 7 个页面共用)
|
|
179
|
-
|
|
180
|
-
**生成规则**:读 `src/components/template/FinishingAchievementTemplate/types.ts`,按 `FinishingAchievementConfig` interface 生成 config 对象。
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
### 3. ApplicationDeterminationTemplate(申请判定类)
|
|
185
|
-
|
|
186
|
-
**适用范围**:`production-mmwr/` 下的申请判定类页面(如 mmwr-application-determination-jz)
|
|
187
|
-
|
|
188
|
-
**识别特征**:原型中有"申请"列表 + "判定"操作的双状态工作流页面
|
|
189
|
-
|
|
190
|
-
---
|
|
191
|
-
|
|
192
|
-
### 4. SamplingCommissionTemplate(取样委托类)
|
|
193
|
-
|
|
194
|
-
**适用范围**:`production-mmwr/jhgl/` 下的取样委托管理页
|
|
195
|
-
|
|
196
|
-
**识别特征**:原型中有"委托单"列表 + 取样记录结构
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
## AI 操作规范
|
|
201
|
-
|
|
202
|
-
1. **识别阶段**:page-spec 前置检查时,若页面落入以上任一范围或项目有对应 Template 组件,将交互模式标记为 `TEMPLATE_DRIVEN` 并注明具体模板名
|
|
203
|
-
2. **生成阶段**:只生成 `data.ts`(config 对象)+ `index.vue`(3~5行)+ `index.scss`(空或极少样式)
|
|
204
|
-
3. **禁止行为**:
|
|
205
|
-
- ❌ 不得手写 `createPage()` + `AbstractPageQueryHook` 结构
|
|
206
|
-
- ❌ 不得添加独立的 `BaseQuery` / `BaseTable` / `jh-pagination`(模板内部已处理)
|
|
207
|
-
- ❌ 不得将其他业务场景的页面识别为 TEMPLATE_DRIVEN 并强套 config 格式
|
|
208
|
-
4. **不确定时**:使用 LIST 模板代替,更安全
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
## 已知配置驱动模板一览
|
|
214
|
-
|
|
215
|
-
> ⚠️ **以下模板是基于高度相似的特定业务场景提炼的**,仅适用于列出的具体页面类型。不得因为"看起来相似"就套用到其他业务场景,否则会出现功能异常。
|
|
216
|
-
|
|
217
|
-
### 1. ResultQueryTemplate(轧钢实绩查询类)
|
|
218
|
-
|
|
219
|
-
**适用范围**:`production-mmwr/sjtj/` 下的各工序实绩查询页(查询+表格+导出,无新增/编辑/删除)
|
|
220
|
-
|
|
221
|
-
**识别特征**:
|
|
222
|
-
- 原型中只有查询区 + 数据表格 + 导出按钮
|
|
223
|
-
- 无 CRUD 操作,纯查询
|
|
224
|
-
- 字段较多,表格列数 10+
|
|
225
|
-
|
|
226
|
-
**生成规则**:
|
|
227
|
-
|
|
228
|
-
```typescript
|
|
229
|
-
// data.ts — 只导出一个 config 对象
|
|
230
|
-
import type { ResultQueryConfig } from "@/components/template/ResultQueryTemplate/types";
|
|
231
|
-
import { BusLogicDataType } from "@/types/page";
|
|
232
|
-
|
|
233
|
-
export const [pageName]Config: ResultQueryConfig = {
|
|
234
|
-
api: {
|
|
235
|
-
list: "/[服务缩写]/[资源名]/list",
|
|
236
|
-
export: "/[服务缩写]/[资源名]/export" // 有导出时才加
|
|
237
|
-
},
|
|
238
|
-
queryItems: [
|
|
239
|
-
// 同 Template A 的 queryDef 格式
|
|
240
|
-
{ name: "[field]", label: "[中文名]", placeholder: "请输入" },
|
|
241
|
-
{
|
|
242
|
-
name: "[dateField]",
|
|
243
|
-
type: "range",
|
|
244
|
-
startName: "[startDate]",
|
|
245
|
-
endName: "[endDate]",
|
|
246
|
-
label: "[日期名]",
|
|
247
|
-
logicType: BusLogicDataType.date,
|
|
248
|
-
rangeSeparator: "至"
|
|
249
|
-
}
|
|
250
|
-
],
|
|
251
|
-
columns: [
|
|
252
|
-
// 同 Template A 的 columnsDef 格式(无 selection/index/操作列)
|
|
253
|
-
{ label: "[列名]", name: "[fieldName]", minWidth: 120 }
|
|
254
|
-
]
|
|
255
|
-
};
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
```vue
|
|
259
|
-
<!-- index.vue -->
|
|
260
|
-
<template>
|
|
261
|
-
<ResultQueryTemplate :config="[pageName]Config" />
|
|
262
|
-
</template>
|
|
263
|
-
|
|
264
|
-
<script setup lang="ts">
|
|
265
|
-
import ResultQueryTemplate from "@/components/template/ResultQueryTemplate/index.vue";
|
|
266
|
-
import { [pageName]Config } from "./data";
|
|
267
|
-
</script>
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
|
|
272
|
-
### 2. FinishingAchievementTemplate(精整实绩类)
|
|
273
|
-
|
|
274
|
-
**适用范围**:`production-mmwr/jzsj/` 下的各精整工序实绩管理页(喷砂、倒棱、矫直、剥皮、检验、酸洗、包装)
|
|
275
|
-
|
|
276
|
-
**识别特征**:
|
|
277
|
-
- 原型标题含"实绩"二字且在精整工序列表中
|
|
278
|
-
- 有固定的查询区 + 实绩录入 + 汇总数据结构
|
|
279
|
-
- 字段结构高度统一(同一套模板 7 个页面共用)
|
|
280
|
-
|
|
281
|
-
**生成规则**:参考 `src/components/template/FinishingAchievementTemplate/` 内的 `types.ts` 定义,只生成对应的 config 配置。
|
|
282
|
-
|
|
283
|
-
---
|
|
284
|
-
|
|
285
|
-
### 3. ApplicationDeterminationTemplate(申请判定类)
|
|
286
|
-
|
|
287
|
-
**适用范围**:`production-mmwr/` 下的申请判定类页面(如 mmwr-application-determination-jz、mmwr-application-determination-sj)
|
|
288
|
-
|
|
289
|
-
**识别特征**:原型中有"申请"列表 + "判定"操作的双状态工作流页面
|
|
290
|
-
|
|
291
|
-
---
|
|
292
|
-
|
|
293
|
-
### 4. SamplingCommissionTemplate(取样委托类)
|
|
294
|
-
|
|
295
|
-
**适用范围**:`production-mmwr/jhgl/` 下的取样委托管理页(如 mmwr-sampling-commission-jz、mmwr-sampling-commission-sj)
|
|
296
|
-
|
|
297
|
-
**识别特征**:原型中有"委托单"列表 + 取样记录结构
|
|
298
|
-
|
|
299
|
-
---
|
|
300
|
-
|
|
301
|
-
## AI 操作规范
|
|
302
|
-
|
|
303
|
-
1. **识别阶段**:在 page-spec 前置检查时,若页面落入以上任一范围,将交互模式标记为 `TEMPLATE_DRIVEN` 并注明具体模板名
|
|
304
|
-
2. **生成阶段**:只生成 `data.ts`(config 对象)+ `index.vue`(2-3行)+ `index.scss`(空或极少样式)
|
|
305
|
-
3. **禁止行为**:
|
|
306
|
-
- ❌ 不得手写 `createPage()` + `AbstractPageQueryHook` 结构
|
|
307
|
-
- ❌ 不得添加独立的 `BaseQuery` / `BaseTable` / `jh-pagination`(模板内部已处理)
|
|
308
|
-
- ❌ 不得将其他业务场景的页面识别为 TEMPLATE_DRIVEN 并套用以上 config 格式
|
|
309
|
-
4. **不确定时**:如果不确定是否适用配置驱动模板,使用 Template A(LIST)代替,更安全
|
|
1
|
+
# TPL-DRIVEN:配置驱动模板页(TEMPLATE_DRIVEN 模式代码生成模板)
|
|
2
|
+
|
|
3
|
+
> **本文件是 page-codegen 的正式代码生成模板。**
|
|
4
|
+
> 适用场景:项目中已有可复用的 Template 组件(如 `FinishingAchievementTemplate`),
|
|
5
|
+
> 当前页面的交互骨架与该组件完全一致时,`data.ts` 只需导出 config 对象,`index.vue` 极简到 3~5 行。
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 核心模式:config-only + 3 行 index.vue
|
|
10
|
+
|
|
11
|
+
这类页面的代码精简到极致:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
data.ts → 只导出一个 xxxConfig 常量(纯 TypeScript 对象,无任何业务逻辑)
|
|
15
|
+
index.vue → 只有 <XxxTemplate :config="config" />,总计 3~5 行
|
|
16
|
+
index.scss → 空文件或极少样式(模板组件内部已处理样式)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
所有业务逻辑(查询、表格列、API 调用、确认框、刷新等)全部在 Template 组件内部处理。
|
|
20
|
+
页面文件只是向模板传递"这个页面的具体配置"。
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 通用生成规范(适用于任意 Template 组件)
|
|
25
|
+
|
|
26
|
+
### 步骤 1:确认 Template 组件的 types.ts
|
|
27
|
+
|
|
28
|
+
生成 config 对象前,必须先读取该模板的类型定义文件:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
src/components/template/{XxxTemplate}/types.ts
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`data.ts` 的 config 对象结构必须完全遵循 `types.ts` 的 interface 定义,不得猜测字段。
|
|
35
|
+
|
|
36
|
+
### 步骤 2:生成 data.ts(纯 config 对象)
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// src/views/[域]/[模块]/[子模块]/[kebab-页面名]/data.ts
|
|
40
|
+
import type { XxxTemplateConfig } from "@/components/template/XxxTemplate/types";
|
|
41
|
+
|
|
42
|
+
export const [camelPageName]Config: XxxTemplateConfig = {
|
|
43
|
+
// 按 types.ts 的 interface 逐字段填写
|
|
44
|
+
// 所有 API path 格式:"/[服务缩写]/[资源名]/[操作]"
|
|
45
|
+
api: {
|
|
46
|
+
list: "/[svc]/[resource]/list",
|
|
47
|
+
// ... 其余 API 按 types.ts 定义
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
// 其他配置字段按 types.ts 补全
|
|
51
|
+
};
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
> **严格约束**:
|
|
55
|
+
> - ❌ 禁止在 data.ts 中写任何函数、class、ref、reactive
|
|
56
|
+
> - ❌ 禁止导入 `AbstractPageQueryHook` 或任何 hook 基类
|
|
57
|
+
> - ✅ 只有 import type + export const
|
|
58
|
+
|
|
59
|
+
### 步骤 3:生成 index.vue(3~5 行)
|
|
60
|
+
|
|
61
|
+
```vue
|
|
62
|
+
<!-- src/views/[域]/[模块]/[子模块]/[kebab-页面名]/index.vue -->
|
|
63
|
+
<template>
|
|
64
|
+
<XxxTemplate :config="[camelPageName]Config" />
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<script setup lang="ts">
|
|
68
|
+
import XxxTemplate from "@/components/template/XxxTemplate/index.vue";
|
|
69
|
+
import { [camelPageName]Config } from "./data";
|
|
70
|
+
</script>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
> ⚠️ 注意:模板组件自身已包含 `app-container app-page-container` 外层,
|
|
74
|
+
> index.vue **不要再套一层 div**,避免双层容器导致布局错位。
|
|
75
|
+
> 若不确定,读模板组件的 index.vue 确认其根元素结构。
|
|
76
|
+
|
|
77
|
+
### 步骤 4:生成 index.scss
|
|
78
|
+
|
|
79
|
+
通常为空文件或只有极少页面级样式覆盖:
|
|
80
|
+
|
|
81
|
+
```scss
|
|
82
|
+
// src/views/[域]/[模块]/[子模块]/[kebab-页面名]/index.scss
|
|
83
|
+
// 如无特殊覆盖样式,保留空文件即可
|
|
84
|
+
// 模板组件内部已处理所有通用样式
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 步骤 5:pages.ts 注册(与其他模式相同)
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
// router/pages.ts 追加
|
|
91
|
+
["[kebab-页面名]", "[页面中文名]"],
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 何时使用 TEMPLATE_DRIVEN(识别规则)
|
|
97
|
+
|
|
98
|
+
**必须同时满足以下两个条件**:
|
|
99
|
+
|
|
100
|
+
1. 项目 `src/components/template/` 目录下已存在可复用的 Template 组件
|
|
101
|
+
2. 当前页面与该模板的交互骨架**完全一致**(查询/操作/表格结构均与模板期望的 config 结构匹配)
|
|
102
|
+
|
|
103
|
+
**不确定时的决策**:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
✅ 交互完全一致,template/types.ts 字段全部能对应 → 使用 TEMPLATE_DRIVEN
|
|
107
|
+
⚠️ 交互相似但有额外自定义逻辑 → 使用 LIST(更安全,不要强套模板)
|
|
108
|
+
❌ 项目无 Template 组件 → 不适用,直接用 LIST/DETAIL_TABS 等标准模板
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 已知配置驱动模板一览(cx-ui-produce 项目特定)
|
|
114
|
+
|
|
115
|
+
> ⚠️ 以下是 cx-ui-produce 项目已有的 Template 组件,仅在该项目中适用。
|
|
116
|
+
> 其他项目需根据自己项目的 `src/components/template/` 目录确认。
|
|
117
|
+
|
|
118
|
+
### 1. ResultQueryTemplate(轧钢实绩查询类)
|
|
119
|
+
|
|
120
|
+
**适用范围**:`production-mmwr/sjtj/` 下的各工序实绩查询页(查询+表格+导出,无新增/编辑/删除)
|
|
121
|
+
|
|
122
|
+
**识别特征**:
|
|
123
|
+
- 原型中只有查询区 + 数据表格 + 导出按钮
|
|
124
|
+
- 无 CRUD 操作,纯查询
|
|
125
|
+
- 字段较多,表格列数 10+
|
|
126
|
+
|
|
127
|
+
**生成规则**:
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
// data.ts — 只导出一个 config 对象
|
|
131
|
+
import type { ResultQueryConfig } from "@/components/template/ResultQueryTemplate/types";
|
|
132
|
+
import { BusLogicDataType } from "@/types/page";
|
|
133
|
+
|
|
134
|
+
export const [pageName]Config: ResultQueryConfig = {
|
|
135
|
+
api: {
|
|
136
|
+
list: "/[服务缩写]/[资源名]/list",
|
|
137
|
+
export: "/[服务缩写]/[资源名]/export" // 有导出时才加
|
|
138
|
+
},
|
|
139
|
+
queryItems: [
|
|
140
|
+
{ name: "[field]", label: "[中文名]", placeholder: "请输入" },
|
|
141
|
+
{
|
|
142
|
+
name: "[dateField]",
|
|
143
|
+
type: "range",
|
|
144
|
+
startName: "[startDate]",
|
|
145
|
+
endName: "[endDate]",
|
|
146
|
+
label: "[日期名]",
|
|
147
|
+
logicType: BusLogicDataType.date,
|
|
148
|
+
rangeSeparator: "至"
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
columns: [
|
|
152
|
+
{ label: "[列名]", name: "[fieldName]", minWidth: 120 }
|
|
153
|
+
]
|
|
154
|
+
};
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
```vue
|
|
158
|
+
<!-- index.vue -->
|
|
159
|
+
<template>
|
|
160
|
+
<ResultQueryTemplate :config="[pageName]Config" />
|
|
161
|
+
</template>
|
|
162
|
+
|
|
163
|
+
<script setup lang="ts">
|
|
164
|
+
import ResultQueryTemplate from "@/components/template/ResultQueryTemplate/index.vue";
|
|
165
|
+
import { [pageName]Config } from "./data";
|
|
166
|
+
</script>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
### 2. FinishingAchievementTemplate(精整实绩类)
|
|
172
|
+
|
|
173
|
+
**适用范围**:`production-mmwr/jzsj/` 下的各精整工序实绩管理页(喷砂、倒棱、矫直、剥皮、检验、酸洗、包装)
|
|
174
|
+
|
|
175
|
+
**识别特征**:
|
|
176
|
+
- 原型标题含"实绩"二字且在精整工序列表中
|
|
177
|
+
- 有固定的查询区 + 实绩录入 + 汇总数据结构
|
|
178
|
+
- 字段结构高度统一(同一套模板 7 个页面共用)
|
|
179
|
+
|
|
180
|
+
**生成规则**:读 `src/components/template/FinishingAchievementTemplate/types.ts`,按 `FinishingAchievementConfig` interface 生成 config 对象。
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
### 3. ApplicationDeterminationTemplate(申请判定类)
|
|
185
|
+
|
|
186
|
+
**适用范围**:`production-mmwr/` 下的申请判定类页面(如 mmwr-application-determination-jz)
|
|
187
|
+
|
|
188
|
+
**识别特征**:原型中有"申请"列表 + "判定"操作的双状态工作流页面
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
### 4. SamplingCommissionTemplate(取样委托类)
|
|
193
|
+
|
|
194
|
+
**适用范围**:`production-mmwr/jhgl/` 下的取样委托管理页
|
|
195
|
+
|
|
196
|
+
**识别特征**:原型中有"委托单"列表 + 取样记录结构
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## AI 操作规范
|
|
201
|
+
|
|
202
|
+
1. **识别阶段**:page-spec 前置检查时,若页面落入以上任一范围或项目有对应 Template 组件,将交互模式标记为 `TEMPLATE_DRIVEN` 并注明具体模板名
|
|
203
|
+
2. **生成阶段**:只生成 `data.ts`(config 对象)+ `index.vue`(3~5行)+ `index.scss`(空或极少样式)
|
|
204
|
+
3. **禁止行为**:
|
|
205
|
+
- ❌ 不得手写 `createPage()` + `AbstractPageQueryHook` 结构
|
|
206
|
+
- ❌ 不得添加独立的 `BaseQuery` / `BaseTable` / `jh-pagination`(模板内部已处理)
|
|
207
|
+
- ❌ 不得将其他业务场景的页面识别为 TEMPLATE_DRIVEN 并强套 config 格式
|
|
208
|
+
4. **不确定时**:使用 LIST 模板代替,更安全
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## 已知配置驱动模板一览
|
|
214
|
+
|
|
215
|
+
> ⚠️ **以下模板是基于高度相似的特定业务场景提炼的**,仅适用于列出的具体页面类型。不得因为"看起来相似"就套用到其他业务场景,否则会出现功能异常。
|
|
216
|
+
|
|
217
|
+
### 1. ResultQueryTemplate(轧钢实绩查询类)
|
|
218
|
+
|
|
219
|
+
**适用范围**:`production-mmwr/sjtj/` 下的各工序实绩查询页(查询+表格+导出,无新增/编辑/删除)
|
|
220
|
+
|
|
221
|
+
**识别特征**:
|
|
222
|
+
- 原型中只有查询区 + 数据表格 + 导出按钮
|
|
223
|
+
- 无 CRUD 操作,纯查询
|
|
224
|
+
- 字段较多,表格列数 10+
|
|
225
|
+
|
|
226
|
+
**生成规则**:
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
// data.ts — 只导出一个 config 对象
|
|
230
|
+
import type { ResultQueryConfig } from "@/components/template/ResultQueryTemplate/types";
|
|
231
|
+
import { BusLogicDataType } from "@/types/page";
|
|
232
|
+
|
|
233
|
+
export const [pageName]Config: ResultQueryConfig = {
|
|
234
|
+
api: {
|
|
235
|
+
list: "/[服务缩写]/[资源名]/list",
|
|
236
|
+
export: "/[服务缩写]/[资源名]/export" // 有导出时才加
|
|
237
|
+
},
|
|
238
|
+
queryItems: [
|
|
239
|
+
// 同 Template A 的 queryDef 格式
|
|
240
|
+
{ name: "[field]", label: "[中文名]", placeholder: "请输入" },
|
|
241
|
+
{
|
|
242
|
+
name: "[dateField]",
|
|
243
|
+
type: "range",
|
|
244
|
+
startName: "[startDate]",
|
|
245
|
+
endName: "[endDate]",
|
|
246
|
+
label: "[日期名]",
|
|
247
|
+
logicType: BusLogicDataType.date,
|
|
248
|
+
rangeSeparator: "至"
|
|
249
|
+
}
|
|
250
|
+
],
|
|
251
|
+
columns: [
|
|
252
|
+
// 同 Template A 的 columnsDef 格式(无 selection/index/操作列)
|
|
253
|
+
{ label: "[列名]", name: "[fieldName]", minWidth: 120 }
|
|
254
|
+
]
|
|
255
|
+
};
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
```vue
|
|
259
|
+
<!-- index.vue -->
|
|
260
|
+
<template>
|
|
261
|
+
<ResultQueryTemplate :config="[pageName]Config" />
|
|
262
|
+
</template>
|
|
263
|
+
|
|
264
|
+
<script setup lang="ts">
|
|
265
|
+
import ResultQueryTemplate from "@/components/template/ResultQueryTemplate/index.vue";
|
|
266
|
+
import { [pageName]Config } from "./data";
|
|
267
|
+
</script>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
### 2. FinishingAchievementTemplate(精整实绩类)
|
|
273
|
+
|
|
274
|
+
**适用范围**:`production-mmwr/jzsj/` 下的各精整工序实绩管理页(喷砂、倒棱、矫直、剥皮、检验、酸洗、包装)
|
|
275
|
+
|
|
276
|
+
**识别特征**:
|
|
277
|
+
- 原型标题含"实绩"二字且在精整工序列表中
|
|
278
|
+
- 有固定的查询区 + 实绩录入 + 汇总数据结构
|
|
279
|
+
- 字段结构高度统一(同一套模板 7 个页面共用)
|
|
280
|
+
|
|
281
|
+
**生成规则**:参考 `src/components/template/FinishingAchievementTemplate/` 内的 `types.ts` 定义,只生成对应的 config 配置。
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
### 3. ApplicationDeterminationTemplate(申请判定类)
|
|
286
|
+
|
|
287
|
+
**适用范围**:`production-mmwr/` 下的申请判定类页面(如 mmwr-application-determination-jz、mmwr-application-determination-sj)
|
|
288
|
+
|
|
289
|
+
**识别特征**:原型中有"申请"列表 + "判定"操作的双状态工作流页面
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
### 4. SamplingCommissionTemplate(取样委托类)
|
|
294
|
+
|
|
295
|
+
**适用范围**:`production-mmwr/jhgl/` 下的取样委托管理页(如 mmwr-sampling-commission-jz、mmwr-sampling-commission-sj)
|
|
296
|
+
|
|
297
|
+
**识别特征**:原型中有"委托单"列表 + 取样记录结构
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## AI 操作规范
|
|
302
|
+
|
|
303
|
+
1. **识别阶段**:在 page-spec 前置检查时,若页面落入以上任一范围,将交互模式标记为 `TEMPLATE_DRIVEN` 并注明具体模板名
|
|
304
|
+
2. **生成阶段**:只生成 `data.ts`(config 对象)+ `index.vue`(2-3行)+ `index.scss`(空或极少样式)
|
|
305
|
+
3. **禁止行为**:
|
|
306
|
+
- ❌ 不得手写 `createPage()` + `AbstractPageQueryHook` 结构
|
|
307
|
+
- ❌ 不得添加独立的 `BaseQuery` / `BaseTable` / `jh-pagination`(模板内部已处理)
|
|
308
|
+
- ❌ 不得将其他业务场景的页面识别为 TEMPLATE_DRIVEN 并套用以上 config 格式
|
|
309
|
+
4. **不确定时**:如果不确定是否适用配置驱动模板,使用 Template A(LIST)代替,更安全
|