@agile-team/wl-skills-kit 1.2.1 → 2.1.1
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 +137 -0
- package/README.md +180 -357
- package/bin/wl-skills.js +206 -44
- package/files/.github/copilot-instructions.md +104 -43
- package/files/.github/guides/README.md +13 -0
- package/files/.github/guides/architecture.md +555 -0
- package/files/.github/guides/usage.md +166 -0
- package/files/.github/reports/README.md +65 -0
- package/files/.github/reports/SYS_DICT_INFO.md +19 -0
- package/files/.github/reports/SYS_PERMISSION_INFO.md +20 -0
- package/files/.github/reports//347/273/204/344/273/266/346/217/220/345/217/226/345/273/272/350/256/256.md +33 -0
- package/files/.github/reports//350/247/204/350/214/203/345/256/241/346/237/245/346/212/245/345/221/212.md +44 -0
- package/files/.github/skills/_compat/README.md +108 -0
- package/files/.github/skills/_compat/editors.json +61 -0
- package/files/.github/skills/_compat/headers/agents.txt +8 -0
- package/files/.github/skills/_compat/headers/claude-code.txt +7 -0
- package/files/.github/skills/_compat/headers/cline.txt +7 -0
- package/files/.github/skills/_compat/headers/cursor-mdc.txt +16 -0
- package/files/.github/skills/_compat/headers/cursor-rules.txt +7 -0
- package/files/.github/skills/_compat/headers/github-copilot.txt +1 -0
- package/files/.github/skills/_compat/headers/kiro.txt +10 -0
- package/files/.github/skills/_compat/headers/trae.txt +11 -0
- package/files/.github/skills/_compat/headers/windsurf.txt +7 -0
- package/files/.github/skills/_registry.md +81 -0
- package/files/.github/skills/{api-contract → core/api-contract}/SKILL.md +126 -29
- package/files/.github/skills/core/api-contract/USAGE.md +110 -0
- package/files/.github/skills/core/convention-audit/SKILL.md +189 -0
- package/files/.github/skills/core/convention-audit/USAGE.md +99 -0
- package/files/.github/skills/{page-codegen → core/page-codegen}/SKILL.md +64 -21
- package/files/.github/skills/core/page-codegen/USAGE.md +102 -0
- package/files/.github/skills/core/page-codegen/templates/_index.md +46 -0
- package/files/.github/skills/core/page-codegen/templates/domains/_CONTRIBUTING.md +107 -0
- package/files/.github/skills/{page-codegen → 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 -0
- package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-DETAIL-TABS.md +94 -39
- package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-DRIVEN.md +124 -124
- package/files/.github/skills/core/prototype-scan/USAGE.md +95 -0
- package/files/.github/skills/core/template-extract/SKILL.md +139 -0
- package/files/.github/skills/core/template-extract/USAGE.md +93 -0
- package/files/.github/skills/domain/README.md +51 -0
- package/files/.github/skills/ops/code-fix/SKILL.draft.md +108 -0
- package/files/.github/skills/sync/dict-sync/SKILL.draft.md +100 -0
- package/files/.github/skills/{menu-sync → sync/menu-sync}/SKILL.md +258 -258
- package/files/.github/skills/sync/menu-sync/USAGE.md +104 -0
- package/files/.github/skills/{menu-sync → sync/menu-sync}/env/guide.md +83 -83
- package/files/.github/skills/sync/permission-sync/SKILL.draft.md +91 -0
- package/files/.github/standards/01-toolchain.md +57 -0
- package/files/.github/standards/02-code-structure.md +111 -0
- package/files/.github/standards/03-comments.md +53 -0
- package/files/.github/standards/04-coding-basics.md +33 -0
- package/files/.github/standards/05-logging.md +38 -0
- package/files/.github/standards/06-security.md +44 -0
- package/files/.github/standards/07-config.md +52 -0
- package/files/.github/standards/08-git.md +60 -0
- package/files/.github/standards/09-typescript.md +71 -0
- package/files/.github/standards/10-pinia.md +57 -0
- package/files/.github/standards/11-form-validation.md +81 -0
- package/files/.github/standards/12-base-table.md +116 -0
- package/files/.github/standards/13-platform-components.md +123 -0
- package/files/.github/standards/index.md +89 -0
- 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/package.json +6 -2
- package/files/.github/docs/menu-sync-design.md +0 -264
- package/files/.github/docs/use-skill.md +0 -382
- package/files/.github/docs/wl-skills-kit.md +0 -266
- package/files/.github/skills/convention-extract/SKILL.md +0 -236
- /package/files/.github/{docs → reports}/SYS_MENU_INFO.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-CHANGE-HISTORY.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-FORM-ROUTE.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-LIST.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-MASTER-DETAIL.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-RECORD-FORM.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-TREE-LIST.md +0 -0
- /package/files/.github/skills/{prototype-scan → core/prototype-scan}/SKILL.md +0 -0
- /package/files/.github/skills/{menu-sync → sync/menu-sync}/env/env.local.json +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# 销售域专属模板(待沉淀)
|
|
2
|
+
|
|
3
|
+
本目录用于沉淀**销售域**特有的页面模板,目前为空。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 待提取候选
|
|
8
|
+
|
|
9
|
+
如果销售域出现 3+ 页面遵循的非标准交互模式,可考虑提取。当前观察到的可能候选:
|
|
10
|
+
|
|
11
|
+
- 国内贸易订单 + 期货订单 + 国外订单 → 是否存在共性"订单录入页"模式?
|
|
12
|
+
- 客户档案 + 信用档案 + 资信档案 → 是否存在共性"多档案合一管理"模式?
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 如何提取
|
|
17
|
+
|
|
18
|
+
使用 `skills/core/template-extract/SKILL.md` 自动提取。详见 `templates/domains/_CONTRIBUTING.md`。
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 提交模板时
|
|
23
|
+
|
|
24
|
+
1. 文件命名 `TPL-{NAME}.md` 放在本目录
|
|
25
|
+
2. 同步更新 `templates/_index.md` 注册条目
|
|
26
|
+
3. 删除本说明文件(README.md),让本目录成为正式模板目录
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
> 见 SKILL.md 主文件(约束 + 按钮规则 + Mock 规范等共用规则)。
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
> 适用场景:编辑/维护页面,上半区为多 Tab 表单(基本信息/客户信息/其他信息),下半区为子项表格。
|
|
7
6
|
> 布局核心:`C_Splitter direction="vertical"` 垂直分割上下区域。
|
|
8
7
|
> **参考标杆**:`src/views/sale/demo/add-demo/`、`src/views/sale/demo/domestic-trade-order-mainten/`
|
|
@@ -117,7 +116,7 @@ import {
|
|
|
117
116
|
handleCancel,
|
|
118
117
|
addItem,
|
|
119
118
|
loadItems,
|
|
120
|
-
initPage
|
|
119
|
+
initPage,
|
|
121
120
|
} from "./data";
|
|
122
121
|
|
|
123
122
|
onMounted(() => initPage());
|
|
@@ -144,7 +143,7 @@ export const API_CONFIG = {
|
|
|
144
143
|
update: "/[服务缩写]/[主资源]/update",
|
|
145
144
|
itemList: "/[服务缩写]/[子资源]/list",
|
|
146
145
|
itemSave: "/[服务缩写]/[子资源]/save",
|
|
147
|
-
itemRemove: "/[服务缩写]/[子资源]/remove"
|
|
146
|
+
itemRemove: "/[服务缩写]/[子资源]/remove",
|
|
148
147
|
} as const;
|
|
149
148
|
|
|
150
149
|
// ===== 表单状态 =====
|
|
@@ -161,7 +160,12 @@ export const rules: FormRules = {
|
|
|
161
160
|
|
|
162
161
|
// ===== 表单字段配置(驱动 template 动态渲染) =====
|
|
163
162
|
export const basicFields = [
|
|
164
|
-
{
|
|
163
|
+
{
|
|
164
|
+
name: "orderNo",
|
|
165
|
+
label: "订单号",
|
|
166
|
+
placeholder: "系统自动生成",
|
|
167
|
+
disabled: true,
|
|
168
|
+
},
|
|
165
169
|
{ name: "customerName", label: "客户名称", required: true },
|
|
166
170
|
{
|
|
167
171
|
name: "orderType",
|
|
@@ -169,10 +173,10 @@ export const basicFields = [
|
|
|
169
173
|
type: "select",
|
|
170
174
|
options: [
|
|
171
175
|
{ label: "期货合同", value: "期货合同" },
|
|
172
|
-
{ label: "现货合同", value: "现货合同" }
|
|
173
|
-
]
|
|
176
|
+
{ label: "现货合同", value: "现货合同" },
|
|
177
|
+
],
|
|
174
178
|
},
|
|
175
|
-
{ name: "createDate", label: "创建日期", type: "date" }
|
|
179
|
+
{ name: "createDate", label: "创建日期", type: "date" },
|
|
176
180
|
];
|
|
177
181
|
|
|
178
182
|
// ===== 子项表格 =====
|
|
@@ -191,10 +195,10 @@ export const itemColumns: TableColumnDesc<any>[] = [
|
|
|
191
195
|
{
|
|
192
196
|
name: "remove",
|
|
193
197
|
label: "删除",
|
|
194
|
-
onClick: (row: any) => removeItem(row)
|
|
195
|
-
}
|
|
196
|
-
]
|
|
197
|
-
}
|
|
198
|
+
onClick: (row: any) => removeItem(row),
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
},
|
|
198
202
|
];
|
|
199
203
|
|
|
200
204
|
// ===== 数据加载 =====
|
|
@@ -202,7 +206,7 @@ export async function loadItems() {
|
|
|
202
206
|
const res = await getAction(API_CONFIG.itemList, {
|
|
203
207
|
mainId: form.id,
|
|
204
208
|
current: itemPage.current,
|
|
205
|
-
size: itemPage.size
|
|
209
|
+
size: itemPage.size,
|
|
206
210
|
});
|
|
207
211
|
const data = res.result || res.data;
|
|
208
212
|
itemList.value = data?.records || data?.list || [];
|
|
@@ -331,7 +335,13 @@ export async function initPage() {
|
|
|
331
335
|
:close-on-click-modal="false"
|
|
332
336
|
@close="handleClose"
|
|
333
337
|
>
|
|
334
|
-
<el-form
|
|
338
|
+
<el-form
|
|
339
|
+
ref="formRef"
|
|
340
|
+
:model="form"
|
|
341
|
+
:rules="rules"
|
|
342
|
+
label-width="100px"
|
|
343
|
+
:disabled="mode === 'view'"
|
|
344
|
+
>
|
|
335
345
|
<el-row :gutter="20">
|
|
336
346
|
<el-col :span="12">
|
|
337
347
|
<el-form-item label="[字段名]" prop="[fieldKey]">
|
|
@@ -346,8 +356,16 @@ export async function initPage() {
|
|
|
346
356
|
</el-row>
|
|
347
357
|
</el-form>
|
|
348
358
|
<template #footer>
|
|
349
|
-
<el-button @click="handleClose">{{
|
|
350
|
-
|
|
359
|
+
<el-button @click="handleClose">{{
|
|
360
|
+
mode === "view" ? "关闭" : "取消"
|
|
361
|
+
}}</el-button>
|
|
362
|
+
<el-button
|
|
363
|
+
v-if="mode !== 'view'"
|
|
364
|
+
type="primary"
|
|
365
|
+
:loading="loading"
|
|
366
|
+
@click="handleSubmit"
|
|
367
|
+
>确定</el-button
|
|
368
|
+
>
|
|
351
369
|
</template>
|
|
352
370
|
</el-dialog>
|
|
353
371
|
</template>
|
|
@@ -366,11 +384,15 @@ const loading = ref(false);
|
|
|
366
384
|
const formRef = ref<FormInstance>();
|
|
367
385
|
|
|
368
386
|
const title = computed(() =>
|
|
369
|
-
mode.value === "add"
|
|
387
|
+
mode.value === "add"
|
|
388
|
+
? "新增[实体名]"
|
|
389
|
+
: mode.value === "edit"
|
|
390
|
+
? "编辑[实体名]"
|
|
391
|
+
: "查看[实体名]",
|
|
370
392
|
);
|
|
371
393
|
|
|
372
394
|
const initialForm = () => ({
|
|
373
|
-
id: ""
|
|
395
|
+
id: "",
|
|
374
396
|
// [表单字段初始值]
|
|
375
397
|
});
|
|
376
398
|
|
|
@@ -459,7 +481,7 @@ const {
|
|
|
459
481
|
queryItems,
|
|
460
482
|
columns,
|
|
461
483
|
toolbars,
|
|
462
|
-
select
|
|
484
|
+
select,
|
|
463
485
|
} = Page;
|
|
464
486
|
|
|
465
487
|
onMounted(() => select());
|
|
@@ -570,7 +592,12 @@ export function createPage(editModalRef?: any) {
|
|
|
570
592
|
```vue
|
|
571
593
|
<template>
|
|
572
594
|
<div class="app-container app-page-container">
|
|
573
|
-
<BaseQuery
|
|
595
|
+
<BaseQuery
|
|
596
|
+
:form="queryParam"
|
|
597
|
+
:items="queryItems"
|
|
598
|
+
@select="select"
|
|
599
|
+
@reset="select"
|
|
600
|
+
/>
|
|
574
601
|
<BaseToolbar :items="toolbars" />
|
|
575
602
|
<el-tabs v-model="activeView">
|
|
576
603
|
<el-tab-pane label="管理视角" name="management">
|
|
@@ -598,7 +625,12 @@ export function createPage(editModalRef?: any) {
|
|
|
598
625
|
</template>
|
|
599
626
|
|
|
600
627
|
<script setup lang="ts">
|
|
601
|
-
import {
|
|
628
|
+
import {
|
|
629
|
+
createPage,
|
|
630
|
+
modalConfig,
|
|
631
|
+
managementColumns,
|
|
632
|
+
usageColumns,
|
|
633
|
+
} from "./data";
|
|
602
634
|
import c_formModal from "@/components/local/c_formModal/index.vue";
|
|
603
635
|
|
|
604
636
|
const editModalRef = ref();
|
|
@@ -614,6 +646,7 @@ onMounted(() => select());
|
|
|
614
646
|
```
|
|
615
647
|
|
|
616
648
|
**要点**:
|
|
649
|
+
|
|
617
650
|
- ❌ 不使用 `el-radio-group` + 手动 `handleViewChange` 切换 columns
|
|
618
651
|
- ✅ 使用 `el-tabs` + 每个 pane 内放独立 BaseTable
|
|
619
652
|
- ✅ 两个表格共享同一 `list` 数据源和 `tableRef`
|
|
@@ -681,6 +714,7 @@ const FORM_ROUTE = "/aiflow/mmwrCustomerApplyAddForm";
|
|
|
681
714
|
```
|
|
682
715
|
|
|
683
716
|
如何确定 FORM_ROUTE:
|
|
717
|
+
|
|
684
718
|
- `subModuleKey`:取自 pages.ts 中 `gProd("xxx", { subModuleKey: [...] })` 的 key
|
|
685
719
|
- `menuPath`:取自后端菜单表的「菜单路径」字段(camelCase)
|
|
686
720
|
- 不确定时,在浏览器点击侧边栏已有菜单项,观察 URL 格式
|
|
@@ -758,10 +792,14 @@ const Page = createPage();
|
|
|
758
792
|
<span class="page-title">客户申请详情</span>
|
|
759
793
|
<span class="page-tag page-tag--add">新增</span>
|
|
760
794
|
<span class="page-tag page-tag--status">未审核</span>
|
|
761
|
-
<el-checkbox v-model="onlyRequired" class="only-required-check"
|
|
795
|
+
<el-checkbox v-model="onlyRequired" class="only-required-check"
|
|
796
|
+
>只看必填项</el-checkbox
|
|
797
|
+
>
|
|
762
798
|
</div>
|
|
763
799
|
<div class="page-toolbar">
|
|
764
|
-
<el-button type="danger" @click="handleSaveAndChange"
|
|
800
|
+
<el-button type="danger" @click="handleSaveAndChange"
|
|
801
|
+
>保存并变更</el-button
|
|
802
|
+
>
|
|
765
803
|
<el-button type="warning" @click="handleSave">保存</el-button>
|
|
766
804
|
<el-button @click="handleCancel">取消</el-button>
|
|
767
805
|
</div>
|
|
@@ -810,7 +848,11 @@ onMounted(() => {
|
|
|
810
848
|
```vue
|
|
811
849
|
<!-- 表格列:v-if 按 mode 控制 -->
|
|
812
850
|
<el-table-column v-if="isChange" label="使用组织" prop="useOrg" />
|
|
813
|
-
<el-table-column
|
|
851
|
+
<el-table-column
|
|
852
|
+
v-if="!isChange && !isView"
|
|
853
|
+
label="免息天数"
|
|
854
|
+
prop="interestFreeDays"
|
|
855
|
+
/>
|
|
814
856
|
|
|
815
857
|
<!-- 操作列:变更模式多一个编辑按钮 -->
|
|
816
858
|
<el-table-column v-if="!isView" label="操作" :width="isChange ? 120 : 80">
|
|
@@ -821,12 +863,24 @@ onMounted(() => {
|
|
|
821
863
|
</el-table-column>
|
|
822
864
|
|
|
823
865
|
<!-- 底部新增行链接(变更模式) -->
|
|
824
|
-
<div
|
|
866
|
+
<div
|
|
867
|
+
v-if="isChange && !isView"
|
|
868
|
+
class="add-row-link"
|
|
869
|
+
@click="addRow"
|
|
870
|
+
>+新增行</div>
|
|
825
871
|
|
|
826
872
|
<!-- Tab 顺序差异:用 v-if 控制渲染位置 -->
|
|
827
|
-
<el-tab-pane
|
|
873
|
+
<el-tab-pane
|
|
874
|
+
v-if="isChange"
|
|
875
|
+
label="地址信息"
|
|
876
|
+
name="addressInfo"
|
|
877
|
+
>...</el-tab-pane>
|
|
828
878
|
<el-tab-pane label="联系人信息" name="contactInfo">...</el-tab-pane>
|
|
829
|
-
<el-tab-pane
|
|
879
|
+
<el-tab-pane
|
|
880
|
+
v-if="!isChange"
|
|
881
|
+
label="地址信息"
|
|
882
|
+
name="addressInfo"
|
|
883
|
+
>...</el-tab-pane>
|
|
830
884
|
|
|
831
885
|
<!-- 状态信息区(所有模式均显示,disabled 只读展示) -->
|
|
832
886
|
<div class="status-info-section">
|
|
@@ -975,7 +1029,7 @@ spec.features.hiddenMenu === true:
|
|
|
975
1029
|
|
|
976
1030
|
### 菜单配置
|
|
977
1031
|
|
|
978
|
-
> 菜单配置统一生成到 `.github/
|
|
1032
|
+
> 菜单配置统一生成到 `.github/reports/SYS_MENU_INFO.md`(集中式),生成规则见 SKILL.md 主文件的「SYS_MENU_INFO 生成规则」章节。
|
|
979
1033
|
|
|
980
1034
|
---
|
|
981
1035
|
|
|
@@ -984,6 +1038,7 @@ spec.features.hiddenMenu === true:
|
|
|
984
1038
|
在项目根目录 `mock/` 下生成,`vite-plugin-mock`(`mockPath: "./mock"`)自动加载,**无需手动注册**。
|
|
985
1039
|
|
|
986
1040
|
**要求**:
|
|
1041
|
+
|
|
987
1042
|
- URL 和字段与 api.md 完全一致
|
|
988
1043
|
- 使用 `MockMethod[]` 类型 + `mockjs` 生成数据
|
|
989
1044
|
- 分页查询返回 `{ code, msg, data: { records, total, size, current } }` 结构
|
|
@@ -999,7 +1054,7 @@ const Random = Mock.Random;
|
|
|
999
1054
|
|
|
1000
1055
|
// 字典选项:从 api.md 字典表复制
|
|
1001
1056
|
const DICT = {
|
|
1002
|
-
status_code: ["值1", "值2"]
|
|
1057
|
+
status_code: ["值1", "值2"],
|
|
1003
1058
|
};
|
|
1004
1059
|
|
|
1005
1060
|
// 单条记录生成器:字段对齐 api.md Response
|
|
@@ -1008,7 +1063,7 @@ function genRecord() {
|
|
|
1008
1063
|
id: Random.id(),
|
|
1009
1064
|
fieldName: Random.cword(2, 4),
|
|
1010
1065
|
statusField: Random.pick(DICT.status_code),
|
|
1011
|
-
createTime: Random.datetime("yyyy-MM-dd HH:mm:ss")
|
|
1066
|
+
createTime: Random.datetime("yyyy-MM-dd HH:mm:ss"),
|
|
1012
1067
|
};
|
|
1013
1068
|
}
|
|
1014
1069
|
|
|
@@ -1031,10 +1086,10 @@ const mockApi: MockMethod[] = [
|
|
|
1031
1086
|
records: dataPool.slice(start, start + size),
|
|
1032
1087
|
total: dataPool.length,
|
|
1033
1088
|
size,
|
|
1034
|
-
current
|
|
1035
|
-
}
|
|
1089
|
+
current,
|
|
1090
|
+
},
|
|
1036
1091
|
};
|
|
1037
|
-
}
|
|
1092
|
+
},
|
|
1038
1093
|
},
|
|
1039
1094
|
{
|
|
1040
1095
|
url: "/dev-api/[服务缩写]/[资源名]/getById",
|
|
@@ -1042,21 +1097,21 @@ const mockApi: MockMethod[] = [
|
|
|
1042
1097
|
response: ({ query }: any) => ({
|
|
1043
1098
|
code: 200,
|
|
1044
1099
|
msg: "操作成功",
|
|
1045
|
-
data: dataPool.find((d) => d.id === query.id) || dataPool[0]
|
|
1046
|
-
})
|
|
1100
|
+
data: dataPool.find((d) => d.id === query.id) || dataPool[0],
|
|
1101
|
+
}),
|
|
1047
1102
|
},
|
|
1048
1103
|
{
|
|
1049
1104
|
url: "/dev-api/[服务缩写]/[资源名]/remove",
|
|
1050
1105
|
method: "delete",
|
|
1051
1106
|
response: ({ query, body }: any) => {
|
|
1052
1107
|
const id = query?.id || body?.id;
|
|
1053
|
-
const ids = id ? [id] :
|
|
1108
|
+
const ids = id ? [id] : query?.ids?.split(",") || body?.ids || [];
|
|
1054
1109
|
ids.forEach((rid: string) => {
|
|
1055
1110
|
const idx = dataPool.findIndex((d) => d.id === rid);
|
|
1056
1111
|
if (idx > -1) dataPool.splice(idx, 1);
|
|
1057
1112
|
});
|
|
1058
1113
|
return { code: 200, msg: "删除成功", data: null };
|
|
1059
|
-
}
|
|
1114
|
+
},
|
|
1060
1115
|
},
|
|
1061
1116
|
{
|
|
1062
1117
|
url: "/dev-api/[服务缩写]/[资源名]/save",
|
|
@@ -1065,7 +1120,7 @@ const mockApi: MockMethod[] = [
|
|
|
1065
1120
|
const newRecord = { ...genRecord(), ...body, id: Random.id() };
|
|
1066
1121
|
dataPool.unshift(newRecord);
|
|
1067
1122
|
return { code: 200, msg: "保存成功", data: { id: newRecord.id } };
|
|
1068
|
-
}
|
|
1123
|
+
},
|
|
1069
1124
|
},
|
|
1070
1125
|
{
|
|
1071
1126
|
url: "/dev-api/[服务缩写]/[资源名]/update",
|
|
@@ -1074,8 +1129,8 @@ const mockApi: MockMethod[] = [
|
|
|
1074
1129
|
const idx = dataPool.findIndex((d) => d.id === body?.id);
|
|
1075
1130
|
if (idx > -1) Object.assign(dataPool[idx], body);
|
|
1076
1131
|
return { code: 200, msg: "更新成功", data: null };
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1132
|
+
},
|
|
1133
|
+
},
|
|
1079
1134
|
];
|
|
1080
1135
|
|
|
1081
1136
|
export default mockApi;
|
package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-DRIVEN.md
RENAMED
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
# TEMPLATE_DRIVEN:配置驱动模板页(识别参考)
|
|
2
|
-
|
|
3
|
-
> ⚠️ **本文件为识别参考,不是代码生成模板。**
|
|
4
|
-
> 配置驱动页面已由现有业务模板组件封装,AI **只需生成 config 配置对象**,不得套用 TPL-A 至 TPL-G 的结构重新手写页面逻辑。
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## 什么是配置驱动模板页
|
|
9
|
-
|
|
10
|
-
这类页面的 `index.vue` 极为简单,只有 1-3 行:
|
|
11
|
-
|
|
12
|
-
```vue
|
|
13
|
-
<template>
|
|
14
|
-
<div class="app-container app-page-container">
|
|
15
|
-
<XxxTemplate :config="xxxConfig" />
|
|
16
|
-
</div>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script setup lang="ts">
|
|
20
|
-
import { xxxConfig } from "./data";
|
|
21
|
-
</script>
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
所有业务逻辑(查询、表格列、导出、翻译等)全部由模板组件内部处理,`data.ts` 只需导出一个 `config` 对象。
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## 已知配置驱动模板一览
|
|
29
|
-
|
|
30
|
-
> ⚠️ **以下模板是基于高度相似的特定业务场景提炼的**,仅适用于列出的具体页面类型。不得因为"看起来相似"就套用到其他业务场景,否则会出现功能异常。
|
|
31
|
-
|
|
32
|
-
### 1. ResultQueryTemplate(轧钢实绩查询类)
|
|
33
|
-
|
|
34
|
-
**适用范围**:`production-mmwr/sjtj/` 下的各工序实绩查询页(查询+表格+导出,无新增/编辑/删除)
|
|
35
|
-
|
|
36
|
-
**识别特征**:
|
|
37
|
-
- 原型中只有查询区 + 数据表格 + 导出按钮
|
|
38
|
-
- 无 CRUD 操作,纯查询
|
|
39
|
-
- 字段较多,表格列数 10+
|
|
40
|
-
|
|
41
|
-
**生成规则**:
|
|
42
|
-
|
|
43
|
-
```typescript
|
|
44
|
-
// data.ts — 只导出一个 config 对象
|
|
45
|
-
import type { ResultQueryConfig } from "@/components/template/ResultQueryTemplate/types";
|
|
46
|
-
import { BusLogicDataType } from "@/types/page";
|
|
47
|
-
|
|
48
|
-
export const [pageName]Config: ResultQueryConfig = {
|
|
49
|
-
api: {
|
|
50
|
-
list: "/[服务缩写]/[资源名]/list",
|
|
51
|
-
export: "/[服务缩写]/[资源名]/export" // 有导出时才加
|
|
52
|
-
},
|
|
53
|
-
queryItems: [
|
|
54
|
-
// 同 Template A 的 queryDef 格式
|
|
55
|
-
{ name: "[field]", label: "[中文名]", placeholder: "请输入" },
|
|
56
|
-
{
|
|
57
|
-
name: "[dateField]",
|
|
58
|
-
type: "range",
|
|
59
|
-
startName: "[startDate]",
|
|
60
|
-
endName: "[endDate]",
|
|
61
|
-
label: "[日期名]",
|
|
62
|
-
logicType: BusLogicDataType.date,
|
|
63
|
-
rangeSeparator: "至"
|
|
64
|
-
}
|
|
65
|
-
],
|
|
66
|
-
columns: [
|
|
67
|
-
// 同 Template A 的 columnsDef 格式(无 selection/index/操作列)
|
|
68
|
-
{ label: "[列名]", name: "[fieldName]", minWidth: 120 }
|
|
69
|
-
]
|
|
70
|
-
};
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
```vue
|
|
74
|
-
<!-- index.vue -->
|
|
75
|
-
<template>
|
|
76
|
-
<ResultQueryTemplate :config="[pageName]Config" />
|
|
77
|
-
</template>
|
|
78
|
-
|
|
79
|
-
<script setup lang="ts">
|
|
80
|
-
import ResultQueryTemplate from "@/components/template/ResultQueryTemplate/index.vue";
|
|
81
|
-
import { [pageName]Config } from "./data";
|
|
82
|
-
</script>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
### 2. FinishingAchievementTemplate(精整实绩类)
|
|
88
|
-
|
|
89
|
-
**适用范围**:`production-mmwr/jzsj/` 下的各精整工序实绩管理页(喷砂、倒棱、矫直、剥皮、检验、酸洗、包装)
|
|
90
|
-
|
|
91
|
-
**识别特征**:
|
|
92
|
-
- 原型标题含"实绩"二字且在精整工序列表中
|
|
93
|
-
- 有固定的查询区 + 实绩录入 + 汇总数据结构
|
|
94
|
-
- 字段结构高度统一(同一套模板 7 个页面共用)
|
|
95
|
-
|
|
96
|
-
**生成规则**:参考 `src/components/template/FinishingAchievementTemplate/` 内的 `types.ts` 定义,只生成对应的 config 配置。
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
### 3. ApplicationDeterminationTemplate(申请判定类)
|
|
101
|
-
|
|
102
|
-
**适用范围**:`production-mmwr/` 下的申请判定类页面(如 mmwr-application-determination-jz、mmwr-application-determination-sj)
|
|
103
|
-
|
|
104
|
-
**识别特征**:原型中有"申请"列表 + "判定"操作的双状态工作流页面
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
### 4. SamplingCommissionTemplate(取样委托类)
|
|
109
|
-
|
|
110
|
-
**适用范围**:`production-mmwr/jhgl/` 下的取样委托管理页(如 mmwr-sampling-commission-jz、mmwr-sampling-commission-sj)
|
|
111
|
-
|
|
112
|
-
**识别特征**:原型中有"委托单"列表 + 取样记录结构
|
|
113
|
-
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
## AI 操作规范
|
|
117
|
-
|
|
118
|
-
1. **识别阶段**:在 page-spec 前置检查时,若页面落入以上任一范围,将交互模式标记为 `TEMPLATE_DRIVEN` 并注明具体模板名
|
|
119
|
-
2. **生成阶段**:只生成 `data.ts`(config 对象)+ `index.vue`(2-3行)+ `index.scss`(空或极少样式)
|
|
120
|
-
3. **禁止行为**:
|
|
121
|
-
- ❌ 不得手写 `createPage()` + `AbstractPageQueryHook` 结构
|
|
122
|
-
- ❌ 不得添加独立的 `BaseQuery` / `BaseTable` / `jh-pagination`(模板内部已处理)
|
|
123
|
-
- ❌ 不得将其他业务场景的页面识别为 TEMPLATE_DRIVEN 并套用以上 config 格式
|
|
124
|
-
4. **不确定时**:如果不确定是否适用配置驱动模板,使用 Template A(LIST)代替,更安全
|
|
1
|
+
# TEMPLATE_DRIVEN:配置驱动模板页(识别参考)
|
|
2
|
+
|
|
3
|
+
> ⚠️ **本文件为识别参考,不是代码生成模板。**
|
|
4
|
+
> 配置驱动页面已由现有业务模板组件封装,AI **只需生成 config 配置对象**,不得套用 TPL-A 至 TPL-G 的结构重新手写页面逻辑。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 什么是配置驱动模板页
|
|
9
|
+
|
|
10
|
+
这类页面的 `index.vue` 极为简单,只有 1-3 行:
|
|
11
|
+
|
|
12
|
+
```vue
|
|
13
|
+
<template>
|
|
14
|
+
<div class="app-container app-page-container">
|
|
15
|
+
<XxxTemplate :config="xxxConfig" />
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { xxxConfig } from "./data";
|
|
21
|
+
</script>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
所有业务逻辑(查询、表格列、导出、翻译等)全部由模板组件内部处理,`data.ts` 只需导出一个 `config` 对象。
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 已知配置驱动模板一览
|
|
29
|
+
|
|
30
|
+
> ⚠️ **以下模板是基于高度相似的特定业务场景提炼的**,仅适用于列出的具体页面类型。不得因为"看起来相似"就套用到其他业务场景,否则会出现功能异常。
|
|
31
|
+
|
|
32
|
+
### 1. ResultQueryTemplate(轧钢实绩查询类)
|
|
33
|
+
|
|
34
|
+
**适用范围**:`production-mmwr/sjtj/` 下的各工序实绩查询页(查询+表格+导出,无新增/编辑/删除)
|
|
35
|
+
|
|
36
|
+
**识别特征**:
|
|
37
|
+
- 原型中只有查询区 + 数据表格 + 导出按钮
|
|
38
|
+
- 无 CRUD 操作,纯查询
|
|
39
|
+
- 字段较多,表格列数 10+
|
|
40
|
+
|
|
41
|
+
**生成规则**:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
// data.ts — 只导出一个 config 对象
|
|
45
|
+
import type { ResultQueryConfig } from "@/components/template/ResultQueryTemplate/types";
|
|
46
|
+
import { BusLogicDataType } from "@/types/page";
|
|
47
|
+
|
|
48
|
+
export const [pageName]Config: ResultQueryConfig = {
|
|
49
|
+
api: {
|
|
50
|
+
list: "/[服务缩写]/[资源名]/list",
|
|
51
|
+
export: "/[服务缩写]/[资源名]/export" // 有导出时才加
|
|
52
|
+
},
|
|
53
|
+
queryItems: [
|
|
54
|
+
// 同 Template A 的 queryDef 格式
|
|
55
|
+
{ name: "[field]", label: "[中文名]", placeholder: "请输入" },
|
|
56
|
+
{
|
|
57
|
+
name: "[dateField]",
|
|
58
|
+
type: "range",
|
|
59
|
+
startName: "[startDate]",
|
|
60
|
+
endName: "[endDate]",
|
|
61
|
+
label: "[日期名]",
|
|
62
|
+
logicType: BusLogicDataType.date,
|
|
63
|
+
rangeSeparator: "至"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
columns: [
|
|
67
|
+
// 同 Template A 的 columnsDef 格式(无 selection/index/操作列)
|
|
68
|
+
{ label: "[列名]", name: "[fieldName]", minWidth: 120 }
|
|
69
|
+
]
|
|
70
|
+
};
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```vue
|
|
74
|
+
<!-- index.vue -->
|
|
75
|
+
<template>
|
|
76
|
+
<ResultQueryTemplate :config="[pageName]Config" />
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<script setup lang="ts">
|
|
80
|
+
import ResultQueryTemplate from "@/components/template/ResultQueryTemplate/index.vue";
|
|
81
|
+
import { [pageName]Config } from "./data";
|
|
82
|
+
</script>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
### 2. FinishingAchievementTemplate(精整实绩类)
|
|
88
|
+
|
|
89
|
+
**适用范围**:`production-mmwr/jzsj/` 下的各精整工序实绩管理页(喷砂、倒棱、矫直、剥皮、检验、酸洗、包装)
|
|
90
|
+
|
|
91
|
+
**识别特征**:
|
|
92
|
+
- 原型标题含"实绩"二字且在精整工序列表中
|
|
93
|
+
- 有固定的查询区 + 实绩录入 + 汇总数据结构
|
|
94
|
+
- 字段结构高度统一(同一套模板 7 个页面共用)
|
|
95
|
+
|
|
96
|
+
**生成规则**:参考 `src/components/template/FinishingAchievementTemplate/` 内的 `types.ts` 定义,只生成对应的 config 配置。
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### 3. ApplicationDeterminationTemplate(申请判定类)
|
|
101
|
+
|
|
102
|
+
**适用范围**:`production-mmwr/` 下的申请判定类页面(如 mmwr-application-determination-jz、mmwr-application-determination-sj)
|
|
103
|
+
|
|
104
|
+
**识别特征**:原型中有"申请"列表 + "判定"操作的双状态工作流页面
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### 4. SamplingCommissionTemplate(取样委托类)
|
|
109
|
+
|
|
110
|
+
**适用范围**:`production-mmwr/jhgl/` 下的取样委托管理页(如 mmwr-sampling-commission-jz、mmwr-sampling-commission-sj)
|
|
111
|
+
|
|
112
|
+
**识别特征**:原型中有"委托单"列表 + 取样记录结构
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## AI 操作规范
|
|
117
|
+
|
|
118
|
+
1. **识别阶段**:在 page-spec 前置检查时,若页面落入以上任一范围,将交互模式标记为 `TEMPLATE_DRIVEN` 并注明具体模板名
|
|
119
|
+
2. **生成阶段**:只生成 `data.ts`(config 对象)+ `index.vue`(2-3行)+ `index.scss`(空或极少样式)
|
|
120
|
+
3. **禁止行为**:
|
|
121
|
+
- ❌ 不得手写 `createPage()` + `AbstractPageQueryHook` 结构
|
|
122
|
+
- ❌ 不得添加独立的 `BaseQuery` / `BaseTable` / `jh-pagination`(模板内部已处理)
|
|
123
|
+
- ❌ 不得将其他业务场景的页面识别为 TEMPLATE_DRIVEN 并套用以上 config 格式
|
|
124
|
+
4. **不确定时**:如果不确定是否适用配置驱动模板,使用 Template A(LIST)代替,更安全
|