@brms/ai-skills 0.1.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.
- package/README.md +256 -0
- package/bin/brms-skills.mjs +411 -0
- package/package.json +30 -0
- package/skills/brms-prototype-generator/SKILL.md +129 -0
- package/skills/brms-prototype-generator/agents/openai.yaml +7 -0
- package/skills/brms-prototype-generator/examples/few-shot-examples.md +577 -0
- package/skills/brms-prototype-generator/references/01-list-query.md +444 -0
- package/skills/brms-prototype-generator/references/02-form-entry.md +129 -0
- package/skills/brms-prototype-generator/references/03-detail-display.md +125 -0
- package/skills/brms-prototype-generator/references/04-composite-page-package.md +339 -0
- package/skills/brms-prototype-generator/references/05-dialog-patterns.md +113 -0
- package/skills/brms-prototype-generator/references/06-backend-request-patterns.md +118 -0
- package/skills/brms-prototype-generator/references/resource-index.md +46 -0
- package/skills/brms-prototype-generator/references/system-prompt.md +242 -0
- package/skills/brms-prototype-generator/scripts/analyze-doc.mjs +554 -0
- package/skills/brms-prototype-generator/scripts/check-project.mjs +228 -0
- package/skills/brms-prototype-generator/scripts/discover-targets.mjs +158 -0
- package/skills/brms-prototype-generator/scripts/install-codex.mjs +74 -0
- package/skills/brms-prototype-generator/scripts/plan-pages.mjs +390 -0
- package/skills/brms-prototype-generator/scripts/validate-generated.mjs +838 -0
- package/skills/brms-prototype-generator/templates/user-input-template.md +182 -0
- package/skills/brms-vxe-plus-developer/SKILL.md +105 -0
- package/skills/brms-vxe-plus-developer/agents/openai.yaml +7 -0
- package/skills/brms-vxe-plus-developer/references/prototype-to-real.md +54 -0
- package/skills/brms-vxe-plus-developer/references/real-base-development.md +110 -0
- package/skills/brms-vxe-plus-developer/references/resource-index.md +43 -0
- package/skills/brms-vxe-plus-developer/references/review-checklist.md +49 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/01-mental-model.md +150 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/02-vxe-plus-form.md +302 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/03-vxe-plus-table.md +253 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/04-example-map.md +488 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/05-request-and-eiinfo.md +170 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/90-anti-patterns.md +137 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/README.md +43 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/README.md +21 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/A1/P0/A1P01601.vue +483 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/A1/P1/A1P11011.vue +444 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/AB/BP/ABBP0201.vue +1648 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/AM/AF/component/AMAF0601/Bidding/formConfig.ts +228 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/AM/AF/component/AMAF0601/Record/columns.ts +110 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/BM/BR/BMBR01.vue +130 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/BM/BR/component/BMBR01/columns.ts +94 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/BM/BR/component/BMBR01/formConfig.ts +108 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Change/formConfig.ts +123 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Change/index.vue +103 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Clause/columns.ts +48 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Clause/index.vue +202 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Correcte/formConfig.ts +117 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Correcte/index.vue +103 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Explain/Pay/Payment/formConfig.ts +90 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Explain/Pay/Payment/index.vue +42 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Explain/Pay/columns.ts +376 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Explain/Pay/index.vue +619 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Explain/Settle/Domestic/formConfig.ts +73 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Explain/Settle/Domestic/index.vue +47 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Explain/Settle/Foreign/formConfig.ts +141 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Explain/Settle/Foreign/index.vue +42 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Explain/Settle/columns.ts +123 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Explain/Settle/index.vue +593 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Explain/index.vue +68 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Fee/columns.ts +150 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Fee/index.vue +235 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Files/columns.ts +63 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Files/index.vue +117 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Goods/columns.ts +327 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Goods/index.vue +790 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Main/Base/Approve/formConfig.ts +341 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Main/Base/Approve/index.vue +63 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Main/Base/Approve2/formConfig.ts +232 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Main/Base/Approve2/index.vue +27 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Main/Base/Diff/columns.ts +46 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Main/Base/Diff/index.vue +92 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Main/Base/formConfig.ts +979 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Main/Base/index.vue +62 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Main/Other/formConfig.ts +179 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Main/Other/index.vue +140 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Main/Sign/formConfig.ts +118 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Main/Sign/index.vue +44 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Main/index.vue +168 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Party/Major/formConfig.ts +257 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Party/Major/index.vue +47 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Party/columns.ts +256 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Party/index.vue +738 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Price/formConfig.ts +174 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Price/index.vue +51 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/PM/PC/component/PMPC0101/Top/index.vue +924 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/SM/SW/SMSW0101.vue +567 -0
- package/skills/brms-vxe-plus-developer/references/vxe-plus-knowledge/sources/project/base/src/views/demo/index.vue +448 -0
- package/skills/brms-vxe-plus-developer/scripts/check-project.mjs +259 -0
- package/skills/brms-vxe-plus-developer/scripts/check-vxe-plus-page.mjs +137 -0
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
# Few-Shot 示例
|
|
2
|
+
|
|
3
|
+
AI 生成代码时的直接模板。每个示例都是基于真实可编译页面提炼的完整 Vue SFC。
|
|
4
|
+
|
|
5
|
+
**使用方式:** AI 选择最匹配的示例做模板,替换业务字段名、服务名、中文字段。
|
|
6
|
+
|
|
7
|
+
**生成约束:**
|
|
8
|
+
|
|
9
|
+
- 不生成操作列,不创建 `action` / `operation` / `operate` / `操作` 列。
|
|
10
|
+
- 不在 `createColumns` 中生成 checkbox 列;需要勾选时使用 `VxePlusTable :show-checkbox="true"`。
|
|
11
|
+
- 普通列使用 `useTable().createColumns([...], { width: undefined })` 自动撑开。
|
|
12
|
+
- 结果区 `BxContainer` 不使用 `custom-btn-auto`,查询/重置只放在查询区。
|
|
13
|
+
- 示例中的布局、列定义、弹窗结构可复用;默认把旧片段里的 `serviceConfig`、`EiCommunicator` 或真实后台调用改成本地 mock 数据和命名 async TODO 方法。
|
|
14
|
+
- 只有产品文档明确给出 serviceName/methodName 时,才保留或生成 `serviceConfig`、`EiCommunicator` 和 `EiInfo`,并按 `references/06-backend-request-patterns.md` 添加 `// @brms-explicit-interface ...` 标记。
|
|
15
|
+
- mock 后台占位方法必须显示 `ElMessage.info('TODO: 接入后台接口')`,并通过本地数组查询、保存、删除,保证原型可点击。
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 示例 1:简单列表查询页
|
|
20
|
+
|
|
21
|
+
### 对应模式
|
|
22
|
+
|
|
23
|
+
`references/01-list-query.md` — 双卡片布局
|
|
24
|
+
|
|
25
|
+
### 用户输入摘要
|
|
26
|
+
|
|
27
|
+
"需要一个汇率管理页面 FMXR01。查询条件:币种代码(文本输入)、生效日期范围。表格列:序号、币种代码、币种名称、汇率、生效日期。支持新增和删除。"
|
|
28
|
+
|
|
29
|
+
### 生成代码
|
|
30
|
+
|
|
31
|
+
```vue
|
|
32
|
+
<template>
|
|
33
|
+
<div class="flex-col flex h-full">
|
|
34
|
+
<!-- 搜索卡片 -->
|
|
35
|
+
<BxRoundedContainer>
|
|
36
|
+
<BxContainer title="查询条件" custom-btn-auto @btn-click="handleSearchBtn" />
|
|
37
|
+
<VxePlusForm ref="formRef" :form-options="formOption" />
|
|
38
|
+
</BxRoundedContainer>
|
|
39
|
+
|
|
40
|
+
<!-- 结果卡片 -->
|
|
41
|
+
<BxRoundedContainer class="flex-1 flex flex-col">
|
|
42
|
+
<BxContainer class="flex-initial" title="结果集" />
|
|
43
|
+
<VxePlusTable
|
|
44
|
+
class="flex-1"
|
|
45
|
+
id="FMXR01_result"
|
|
46
|
+
ref="gridRef"
|
|
47
|
+
:columns="columns"
|
|
48
|
+
:form-config="formConfig"
|
|
49
|
+
:service-config="serviceConfig"
|
|
50
|
+
:toolbar-buttons="toolbarButtons"
|
|
51
|
+
:show-checkbox="true"
|
|
52
|
+
:is-edit="true"
|
|
53
|
+
v-on="gridEvents"
|
|
54
|
+
/>
|
|
55
|
+
</BxRoundedContainer>
|
|
56
|
+
</div>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script setup lang="ts">
|
|
60
|
+
import { reactive, ref } from 'vue';
|
|
61
|
+
import { useTable } from '@/hooks/useTable';
|
|
62
|
+
import type { VxeGridProps } from 'vxe-table';
|
|
63
|
+
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
64
|
+
import to from 'await-to-js';
|
|
65
|
+
|
|
66
|
+
const gridRef = ref();
|
|
67
|
+
const formRef = ref();
|
|
68
|
+
|
|
69
|
+
const formData = reactive({
|
|
70
|
+
currencyCodeLike: '',
|
|
71
|
+
effectiveDateBegin: '',
|
|
72
|
+
effectiveDateEnd: '',
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const formOption = reactive({
|
|
76
|
+
id: 'inqu_status',
|
|
77
|
+
data: formData,
|
|
78
|
+
items: [
|
|
79
|
+
{ field: 'currencyCodeLike', title: '币种代码', span: 12, itemRender: { name: 'VxeInput' } },
|
|
80
|
+
{
|
|
81
|
+
field: 'effectiveDate',
|
|
82
|
+
title: '生效日期',
|
|
83
|
+
span: 12,
|
|
84
|
+
itemRender: {
|
|
85
|
+
name: 'dateRange',
|
|
86
|
+
props: {
|
|
87
|
+
startDate: 'effectiveDateBegin',
|
|
88
|
+
endDate: 'effectiveDateEnd',
|
|
89
|
+
type: 'date',
|
|
90
|
+
format: 'yyyy-MM-dd',
|
|
91
|
+
valueFormat: 'yyyy-MM-dd',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const columns = useTable().createColumns(
|
|
99
|
+
[
|
|
100
|
+
{ type: 'seq', width: 60, fixed: 'left' },
|
|
101
|
+
{ field: 'currencyCode', title: '币种代码' },
|
|
102
|
+
{ field: 'currencyName', title: '币种名称' },
|
|
103
|
+
{ field: 'exchangeRate', title: '汇率' },
|
|
104
|
+
{ field: 'effectiveDate', title: '生效日期' },
|
|
105
|
+
],
|
|
106
|
+
{ width: undefined },
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const formConfig = reactive({
|
|
110
|
+
id: 'inqu_status',
|
|
111
|
+
data: formData,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const serviceConfig = reactive({
|
|
115
|
+
serviceName: 'FMXR01',
|
|
116
|
+
queryMethod: 'query',
|
|
117
|
+
insertMethod: 'add',
|
|
118
|
+
updateMethod: 'save',
|
|
119
|
+
deleteMethod: 'delete',
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// 表格工具栏按钮
|
|
123
|
+
const toolbarButtons = ref<NonNullable<VxeGridProps['toolbarConfig']>['buttons']>([
|
|
124
|
+
{ name: '新增', code: 'add', status: 'primary' },
|
|
125
|
+
{ name: '删除', code: 'del', status: 'danger' },
|
|
126
|
+
]);
|
|
127
|
+
|
|
128
|
+
// 表格事件:工具栏按钮点击
|
|
129
|
+
const gridEvents = {
|
|
130
|
+
toolbarButtonClick: async ({ code, $grid }: any) => {
|
|
131
|
+
if (code === 'add') {
|
|
132
|
+
const { row: newRow } = await $grid.insertAt({});
|
|
133
|
+
$grid.setEditRow(newRow);
|
|
134
|
+
}
|
|
135
|
+
if (code === 'del') {
|
|
136
|
+
const rows = $grid.getCheckboxRecords();
|
|
137
|
+
if (rows.length === 0) {
|
|
138
|
+
ElMessage.warning('请先勾选要删除的记录');
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const [err] = await to(
|
|
142
|
+
ElMessageBox.confirm('确定删除所选记录吗?', '提示', {
|
|
143
|
+
confirmButtonText: '确定',
|
|
144
|
+
cancelButtonText: '取消',
|
|
145
|
+
type: 'warning',
|
|
146
|
+
}),
|
|
147
|
+
);
|
|
148
|
+
if (err) return;
|
|
149
|
+
await $grid.remove(rows);
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// 搜索卡片按钮:查询 / 重置
|
|
155
|
+
function handleSearchBtn({ code }: { code: string }) {
|
|
156
|
+
if (code === 'QUERY') gridRef.value?.reload();
|
|
157
|
+
if (code === 'RESET') formRef.value?.reset();
|
|
158
|
+
}
|
|
159
|
+
</script>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 示例 2:Tab 切换列表页
|
|
165
|
+
|
|
166
|
+
### 对应模式
|
|
167
|
+
|
|
168
|
+
`references/01-list-query.md` — 变体 B
|
|
169
|
+
|
|
170
|
+
### 用户输入摘要
|
|
171
|
+
|
|
172
|
+
"需要一个审批列表页面 BMBF11,有'待办'和'已办'两个 tab。查询条件:审批类型(下拉)、发起人(文本)、发起时间(日期范围)。"
|
|
173
|
+
|
|
174
|
+
### 生成代码
|
|
175
|
+
|
|
176
|
+
```vue
|
|
177
|
+
<template>
|
|
178
|
+
<div class="flex-col flex h-full">
|
|
179
|
+
<BxRoundedContainer>
|
|
180
|
+
<BxContainer title="查询条件" custom-btn-auto @btn-click="handleSearchBtn" />
|
|
181
|
+
<VxePlusForm ref="formRef" :form-options="formOption" />
|
|
182
|
+
</BxRoundedContainer>
|
|
183
|
+
|
|
184
|
+
<BxRoundedContainer class="flex-1 flex flex-col">
|
|
185
|
+
<BxContainer class="flex-initial" title="结果集" />
|
|
186
|
+
<vxe-tabs v-model="tabName" class="flex-1" padding>
|
|
187
|
+
<vxe-tab-pane title="待办列表" name="1">
|
|
188
|
+
<VxePlusTable
|
|
189
|
+
id="todo_result"
|
|
190
|
+
ref="todoGrid"
|
|
191
|
+
:columns="todoColumns"
|
|
192
|
+
:form-config="formConfig"
|
|
193
|
+
:service-config="todoServiceConfig"
|
|
194
|
+
/>
|
|
195
|
+
</vxe-tab-pane>
|
|
196
|
+
<vxe-tab-pane title="已办列表" name="2">
|
|
197
|
+
<VxePlusTable
|
|
198
|
+
id="done_result"
|
|
199
|
+
ref="doneGrid"
|
|
200
|
+
:columns="doneColumns"
|
|
201
|
+
:form-config="formConfig"
|
|
202
|
+
:service-config="doneServiceConfig"
|
|
203
|
+
/>
|
|
204
|
+
</vxe-tab-pane>
|
|
205
|
+
</vxe-tabs>
|
|
206
|
+
</BxRoundedContainer>
|
|
207
|
+
</div>
|
|
208
|
+
</template>
|
|
209
|
+
|
|
210
|
+
<script setup lang="ts">
|
|
211
|
+
import { reactive, ref } from 'vue';
|
|
212
|
+
import { useTable } from '@/hooks/useTable';
|
|
213
|
+
import { EiCommunicator, EiInfo } from '@eplat/ei';
|
|
214
|
+
|
|
215
|
+
const tabName = ref('1');
|
|
216
|
+
const todoGrid = ref();
|
|
217
|
+
const doneGrid = ref();
|
|
218
|
+
const formRef = ref();
|
|
219
|
+
|
|
220
|
+
const formData = reactive({
|
|
221
|
+
approveTypeId: '',
|
|
222
|
+
submiterName: '',
|
|
223
|
+
submitTimeBegin: '',
|
|
224
|
+
submitTimeEnd: '',
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
function getApproveTypeList() {
|
|
228
|
+
return new Promise((resolve) => {
|
|
229
|
+
EiCommunicator.send('BMBF999901', 'queryApproveTypeList', new EiInfo()).then((res: any) => {
|
|
230
|
+
resolve(
|
|
231
|
+
res.getAttr().approveTypeList.map((item: any) => ({
|
|
232
|
+
value: item.approveTypeId,
|
|
233
|
+
label: item.approveTypeName,
|
|
234
|
+
})),
|
|
235
|
+
);
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const formOption = reactive({
|
|
241
|
+
id: 'inqu_status',
|
|
242
|
+
data: formData,
|
|
243
|
+
items: [
|
|
244
|
+
{
|
|
245
|
+
field: 'approveTypeId',
|
|
246
|
+
title: '审批类型',
|
|
247
|
+
span: 12,
|
|
248
|
+
itemRender: {
|
|
249
|
+
name: 'formSelect',
|
|
250
|
+
props: { codeSet: 'BMBF999901', promiseFn: getApproveTypeList },
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
field: 'submiterName',
|
|
255
|
+
title: '发起人',
|
|
256
|
+
span: 12,
|
|
257
|
+
itemRender: { name: 'VxeInput' },
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
field: 'submitTime',
|
|
261
|
+
title: '发起时间',
|
|
262
|
+
span: 12,
|
|
263
|
+
itemRender: {
|
|
264
|
+
name: 'dateRange',
|
|
265
|
+
props: {
|
|
266
|
+
startDate: 'submitTimeBegin',
|
|
267
|
+
endDate: 'submitTimeEnd',
|
|
268
|
+
type: 'date',
|
|
269
|
+
format: 'yyyy-MM-dd',
|
|
270
|
+
valueFormat: 'yyyy-MM-dd',
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
const baseColumns = [
|
|
278
|
+
{ field: 'approveTypeName', title: '审批类型' },
|
|
279
|
+
{ field: 'taskName', title: '审批主题' },
|
|
280
|
+
{ field: 'submitTime', title: '递交时间' },
|
|
281
|
+
{ field: 'submiterName', title: '递交人' },
|
|
282
|
+
];
|
|
283
|
+
|
|
284
|
+
const todoColumns = useTable().createColumns([{ type: 'seq', width: 60 }, ...baseColumns], {
|
|
285
|
+
width: undefined,
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
const doneColumns = useTable().createColumns(
|
|
289
|
+
[
|
|
290
|
+
{ type: 'seq', width: 60 },
|
|
291
|
+
...baseColumns,
|
|
292
|
+
{ field: 'approvalResultName', title: '审批结果', width: 100 },
|
|
293
|
+
],
|
|
294
|
+
{ width: undefined },
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
const formConfig = reactive({
|
|
298
|
+
id: 'inqu_status',
|
|
299
|
+
data: formData,
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
const todoServiceConfig = reactive({ serviceName: 'BMBF1301', queryMethod: 'pageQueryTodoList' });
|
|
303
|
+
const doneServiceConfig = reactive({ serviceName: 'BMBF1301', queryMethod: 'pageQueryDoneList' });
|
|
304
|
+
|
|
305
|
+
// 搜索卡片按钮:查询 / 重置
|
|
306
|
+
function handleSearchBtn({ code }: { code: string }) {
|
|
307
|
+
if (code === 'QUERY') {
|
|
308
|
+
if (tabName.value === '1') todoGrid.value?.reload();
|
|
309
|
+
else doneGrid.value?.reload();
|
|
310
|
+
}
|
|
311
|
+
if (code === 'RESET') formRef.value?.reset();
|
|
312
|
+
}
|
|
313
|
+
</script>
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## 示例 3:表单录入页
|
|
319
|
+
|
|
320
|
+
### 对应模式
|
|
321
|
+
|
|
322
|
+
`references/02-form-entry.md`
|
|
323
|
+
|
|
324
|
+
### 用户输入摘要
|
|
325
|
+
|
|
326
|
+
"需要一个港口信息维护页面 DMLB03。表单字段:港口代码(必填)、港口名称(必填)、所属国家(下拉)、港口类型(下拉)、备注。支持新增和编辑。"
|
|
327
|
+
|
|
328
|
+
### 生成代码
|
|
329
|
+
|
|
330
|
+
```vue
|
|
331
|
+
<template>
|
|
332
|
+
<div class="flex-col flex h-full">
|
|
333
|
+
<BxRoundedContainer>
|
|
334
|
+
<BxContainer :title="isEdit ? '编辑港口' : '新增港口'" />
|
|
335
|
+
<VxePlusForm ref="formRef" :form-options="formOption" />
|
|
336
|
+
<div class="flex justify-center gap-4 py-4">
|
|
337
|
+
<el-button type="primary" @click="handleSave">保存</el-button>
|
|
338
|
+
<el-button @click="handleCancel">取消</el-button>
|
|
339
|
+
</div>
|
|
340
|
+
</BxRoundedContainer>
|
|
341
|
+
</div>
|
|
342
|
+
</template>
|
|
343
|
+
|
|
344
|
+
<script setup lang="ts">
|
|
345
|
+
import { onMounted, reactive, ref } from 'vue';
|
|
346
|
+
import { useRoute, useRouter } from 'vue-router';
|
|
347
|
+
import { EiCommunicator, EiInfo, EiBlock } from '@eplat/ei';
|
|
348
|
+
import { ElMessage } from 'element-plus';
|
|
349
|
+
import to from 'await-to-js';
|
|
350
|
+
|
|
351
|
+
const route = useRoute();
|
|
352
|
+
const router = useRouter();
|
|
353
|
+
const formRef = ref();
|
|
354
|
+
const isEdit = ref(false);
|
|
355
|
+
|
|
356
|
+
const formData = reactive({
|
|
357
|
+
portCode: '',
|
|
358
|
+
portName: '',
|
|
359
|
+
countryCode: '',
|
|
360
|
+
portType: '',
|
|
361
|
+
remark: '',
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
const formOption = reactive({
|
|
365
|
+
id: 'form_data',
|
|
366
|
+
data: formData,
|
|
367
|
+
items: [
|
|
368
|
+
{
|
|
369
|
+
field: 'portCode',
|
|
370
|
+
title: '港口代码',
|
|
371
|
+
span: 12,
|
|
372
|
+
itemRender: { name: 'VxeInput' },
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
field: 'portName',
|
|
376
|
+
title: '港口名称',
|
|
377
|
+
span: 12,
|
|
378
|
+
itemRender: { name: 'VxeInput' },
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
field: 'countryCode',
|
|
382
|
+
title: '所属国家',
|
|
383
|
+
span: 12,
|
|
384
|
+
itemRender: { name: 'formSelect', props: { codeSet: 'DMLB03.countryList' } },
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
field: 'portType',
|
|
388
|
+
title: '港口类型',
|
|
389
|
+
span: 12,
|
|
390
|
+
itemRender: { name: 'formSelect', props: { codeSet: 'DMLB03.portType' } },
|
|
391
|
+
},
|
|
392
|
+
{ field: 'remark', title: '备注', span: 24, itemRender: { name: 'VxeInput' } },
|
|
393
|
+
],
|
|
394
|
+
rules: {
|
|
395
|
+
portCode: [{ required: true, message: '请输入港口代码' }],
|
|
396
|
+
portName: [{ required: true, message: '请输入港口名称' }],
|
|
397
|
+
},
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
onMounted(async () => {
|
|
401
|
+
const id = route.query.id as string;
|
|
402
|
+
if (!id) return;
|
|
403
|
+
isEdit.value = true;
|
|
404
|
+
|
|
405
|
+
const ei = new EiInfo();
|
|
406
|
+
ei.set('portCode', id);
|
|
407
|
+
const [err, res] = await to(EiCommunicator.send('DMLB03', 'queryByCode', ei));
|
|
408
|
+
if (err) return;
|
|
409
|
+
const row = res.getBlock('result').getMappedRows()[0];
|
|
410
|
+
Object.assign(formData, row);
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
async function handleSave() {
|
|
414
|
+
const ei = new EiInfo();
|
|
415
|
+
ei.addBlock(EiBlock.build('form_data', [{ ...formData }]));
|
|
416
|
+
const method = isEdit.value ? 'save' : 'add';
|
|
417
|
+
|
|
418
|
+
const [err] = await to(EiCommunicator.send('DMLB03', method, ei));
|
|
419
|
+
if (err) {
|
|
420
|
+
ElMessage.error('保存失败');
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
ElMessage.success('保存成功');
|
|
424
|
+
router.back();
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
function handleCancel() {
|
|
428
|
+
router.back();
|
|
429
|
+
}
|
|
430
|
+
</script>
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## 示例 4:组合页面包
|
|
436
|
+
|
|
437
|
+
### 对应模式
|
|
438
|
+
|
|
439
|
+
`references/04-composite-page-package.md` — 多页面组合原型/页面包
|
|
440
|
+
|
|
441
|
+
### 用户输入摘要
|
|
442
|
+
|
|
443
|
+
"根据 function.md 生成矿权管理原型。文档包含区域公司结构管理、矿权项目维护、矿权信息维护、综合查询、项目资料上传、任务管理、到期提醒、合规报告计划,并给出了页面间导航关系。"
|
|
444
|
+
|
|
445
|
+
### 生成前规划
|
|
446
|
+
|
|
447
|
+
先不要生成单个超大页面。应拆成页面包:
|
|
448
|
+
|
|
449
|
+
| 编码 | 页面标题 | 页面类型 | 文件路径 | 菜单 |
|
|
450
|
+
| ------ | ---------------- | -------------- | --------------------------------------------- | -------- |
|
|
451
|
+
| MNRG01 | 区域公司结构管理 | 主从维护页 | `<target-project>/src/views/MN/RG/MNRG01.vue` | 矿权管理 |
|
|
452
|
+
| MNRG02 | 矿权项目维护 | 列表维护页 | `<target-project>/src/views/MN/RG/MNRG02.vue` | 矿权管理 |
|
|
453
|
+
| MNRG03 | 矿权信息维护 | 列表维护页 | `<target-project>/src/views/MN/RG/MNRG03.vue` | 矿权管理 |
|
|
454
|
+
| MNRG04 | 矿权信息综合查询 | 查询汇总页 | `<target-project>/src/views/MN/RG/MNRG04.vue` | 矿权管理 |
|
|
455
|
+
| MNRG05 | 项目资料上传 | 附件管理页 | `<target-project>/src/views/MN/RG/MNRG05.vue` | 矿权管理 |
|
|
456
|
+
| MNRG06 | 矿权任务管理 | 任务维护页 | `<target-project>/src/views/MN/RG/MNRG06.vue` | 矿权管理 |
|
|
457
|
+
| MNRG07 | 任务到期提醒 | 通知设置页 | `<target-project>/src/views/MN/RG/MNRG07.vue` | 矿权管理 |
|
|
458
|
+
| MNRG08 | 合规报告计划 | 报告计划维护页 | `<target-project>/src/views/MN/RG/MNRG08.vue` | 矿权管理 |
|
|
459
|
+
|
|
460
|
+
共享数据建议放在:
|
|
461
|
+
|
|
462
|
+
```text
|
|
463
|
+
<target-project>/src/views/MN/RG/data.ts
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
### 生成方式选择
|
|
467
|
+
|
|
468
|
+
识别到 8 个完整页面后,先让用户选择生成方式,不要直接生成全部文件:
|
|
469
|
+
|
|
470
|
+
| 方式 | 建议 |
|
|
471
|
+
| ----------------------------------------------- | ---------------------------------------------------- |
|
|
472
|
+
| `single-agent-package` 整包一次性生成 | 不推荐,页面数量较多,容易遗漏局部规则 |
|
|
473
|
+
| `coordinator-sequential` 总控逐页顺序生成 | 当前环境没有子智能体时使用 |
|
|
474
|
+
| `coordinator-subagents` 总控 + 子智能体逐页生成 | 推荐,8 个页面分别生成,总控统一共享数据、菜单和验证 |
|
|
475
|
+
|
|
476
|
+
如果用户选择 `coordinator-subagents`,总控先创建全局页面包规划和共享数据契约,然后给每个子智能体下发页面任务包。子智能体只生成一个 Vue 页面文件,不修改 `data.ts`、菜单配置、`localMenu.ts`、其他页面或文档。
|
|
477
|
+
|
|
478
|
+
页面任务包示例:
|
|
479
|
+
|
|
480
|
+
```text
|
|
481
|
+
页面任务:MNRG02 矿权项目维护
|
|
482
|
+
文件:<target-project>/src/views/MN/RG/MNRG02.vue
|
|
483
|
+
类型:列表维护页
|
|
484
|
+
共享数据:projects, companies, regionCompanies
|
|
485
|
+
跳转:点击项目名称或“查看矿权”业务入口时跳转 /web/MN/RG/MNRG03,并传递 projectCode、projectName
|
|
486
|
+
布局:标准查询区 + 结果表格;结果标题不要 custom-btn-auto;不生成操作列;选择使用 :show-checkbox="true"
|
|
487
|
+
禁止修改:data.ts、routers/config/*.ts、localMenu.ts、MNRG01.vue、MNRG03.vue...、文档;如果目标项目没有静态路由配置,也禁止创建 routers/config
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### 跨页面跳转示例
|
|
491
|
+
|
|
492
|
+
项目维护页点击“查看矿权”:
|
|
493
|
+
|
|
494
|
+
```ts
|
|
495
|
+
function handleViewMineralRight(row: any) {
|
|
496
|
+
router.push({
|
|
497
|
+
path: '/web/MN/RG/MNRG03',
|
|
498
|
+
query: {
|
|
499
|
+
projectCode: row.projectCode,
|
|
500
|
+
projectName: row.projectName,
|
|
501
|
+
},
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
矿权信息维护页读取项目筛选条件:
|
|
507
|
+
|
|
508
|
+
```ts
|
|
509
|
+
const route = useRoute();
|
|
510
|
+
|
|
511
|
+
onMounted(() => {
|
|
512
|
+
if (route.query.projectCode) formData.projectCode = String(route.query.projectCode);
|
|
513
|
+
});
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
### 菜单注册示例
|
|
517
|
+
|
|
518
|
+
当目标项目支持静态路由时,生成文件:`<target-project>/src/routers/config/mnrg-20260530143000.ts`。不要修改 `localMenu.ts`。如果目标项目没有静态路由配置,跳过该文件并输出权限中心菜单配置交接清单。
|
|
519
|
+
|
|
520
|
+
```typescript
|
|
521
|
+
export default [
|
|
522
|
+
{
|
|
523
|
+
path: '/MNMenu',
|
|
524
|
+
name: 'MNMenu',
|
|
525
|
+
meta: {
|
|
526
|
+
icon: 'Folder',
|
|
527
|
+
title: '矿权管理',
|
|
528
|
+
isLink: '',
|
|
529
|
+
isHide: false,
|
|
530
|
+
isFull: false,
|
|
531
|
+
isAffix: false,
|
|
532
|
+
isKeepAlive: true,
|
|
533
|
+
},
|
|
534
|
+
children: [
|
|
535
|
+
{
|
|
536
|
+
path: '/MN/RG/MNRG01',
|
|
537
|
+
name: 'MNRG01',
|
|
538
|
+
component: '/MN/RG/MNRG01',
|
|
539
|
+
meta: {
|
|
540
|
+
icon: 'Menu',
|
|
541
|
+
title: '区域公司结构管理',
|
|
542
|
+
isLink: '',
|
|
543
|
+
isHide: false,
|
|
544
|
+
isFull: false,
|
|
545
|
+
isAffix: false,
|
|
546
|
+
isKeepAlive: true,
|
|
547
|
+
},
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
path: '/MN/RG/MNRG02',
|
|
551
|
+
name: 'MNRG02',
|
|
552
|
+
component: '/MN/RG/MNRG02',
|
|
553
|
+
meta: {
|
|
554
|
+
icon: 'Menu',
|
|
555
|
+
title: '矿权项目维护',
|
|
556
|
+
isLink: '',
|
|
557
|
+
isHide: false,
|
|
558
|
+
isFull: false,
|
|
559
|
+
isAffix: false,
|
|
560
|
+
isKeepAlive: true,
|
|
561
|
+
},
|
|
562
|
+
},
|
|
563
|
+
],
|
|
564
|
+
},
|
|
565
|
+
];
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
### 实现要点
|
|
569
|
+
|
|
570
|
+
- 一级章节生成独立页面,新增/编辑/上传/附件列表优先做页面内弹窗。
|
|
571
|
+
- 附录导航关系必须体现在按钮或行操作中。
|
|
572
|
+
- 共享 mock 数据只抽取一次,页面通过 import 复用。
|
|
573
|
+
- 主从页使用左右 `BxRoundedContainer`,卡片内标题 `flex-initial`、表格 `flex-1`,参考 `demo/list.vue` 的结果卡片。
|
|
574
|
+
- 不生成操作列和 checkbox 列;表格选择用 `:show-checkbox="true"`,查看/跳转用业务字段点击或 `cell-click`。
|
|
575
|
+
- 项目列表、公司列表等结果区标题不要加 `custom-btn-auto`,避免重复查询按钮。
|
|
576
|
+
- 目标项目支持静态路由时,每次生成独立菜单文件,如 `<target-project>/src/routers/config/mnrg-20260530143000.ts`,不要修改 `localMenu.ts`;不支持时输出权限中心配置交接信息。
|
|
577
|
+
- 最后一次性更新菜单并运行类型检查。
|