@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,137 @@
|
|
|
1
|
+
# 90-Anti Patterns
|
|
2
|
+
|
|
3
|
+
本文件是 AI 生成代码前的硬性检查清单。
|
|
4
|
+
|
|
5
|
+
## 不要混淆 form-options 和 form-config
|
|
6
|
+
|
|
7
|
+
正确:
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<VxePlusForm :form-options="formOptions" />
|
|
11
|
+
<VxePlusTable :form-config="tableFormConfig" />
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
错误:
|
|
15
|
+
|
|
16
|
+
```vue
|
|
17
|
+
<VxePlusForm :form-config="formOptions" />
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`VxePlusForm` 的 prop 是 `formOptions`,模板写法是 `form-options`。`VxePlusTable` 的 `form-config` 是表格查询配置。
|
|
21
|
+
|
|
22
|
+
## 不要把历史 helper 扩散到新代码
|
|
23
|
+
|
|
24
|
+
新生成页面不要引入新的 `useForm()` 二次封装层,也不要把 `commonVxeInput`、`commonFormSelect`、`getFormData` 当作推荐样板复制。
|
|
25
|
+
|
|
26
|
+
允许的例外:编辑既有文件时,该文件已经大量使用 helper,为了减少无关改动可以局部沿用。
|
|
27
|
+
|
|
28
|
+
## 不要给月份选择器使用 valueFormat: 'MM'
|
|
29
|
+
|
|
30
|
+
`VxeDatePicker type="month"` 使用 `valueFormat: 'MM'` 会导致选中后无法回显。
|
|
31
|
+
|
|
32
|
+
错误:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
{
|
|
36
|
+
type: 'month',
|
|
37
|
+
valueFormat: 'MM',
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
正确:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
{
|
|
45
|
+
type: 'month',
|
|
46
|
+
valueFormat: 'yyyy-MM',
|
|
47
|
+
labelFormat: 'MM',
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
原因:`valueFormat` 不只是显示格式,还参与 modelValue 解析和面板选中匹配。`xe-utils.toStringDate('06', 'MM')` 会得到 `Invalid Date`,因为纯月份没有年份,无法还原为有效 Date。只想显示月份时,用 `labelFormat: 'MM'`。
|
|
52
|
+
|
|
53
|
+
## 不要无条件提交整份 formData
|
|
54
|
+
|
|
55
|
+
复杂表单里有隐藏字段、联动字段、辅助字段;但有些详情保存又确实要求完整对象。提交形态必须按后端接口或同服务样例判断:
|
|
56
|
+
|
|
57
|
+
- 查询请求:优先让 `VxePlusTable :form-config="{ id, data }"` 自动组装。
|
|
58
|
+
- 详情保存:按接口需要提交完整 `formData` 或字段白名单。
|
|
59
|
+
- 选择弹窗回填:只提交/回填明确映射字段。
|
|
60
|
+
|
|
61
|
+
不要机械写 `getFormData(baseFields.value, formData)`,也不要机械 `{ ...formData }`。
|
|
62
|
+
|
|
63
|
+
## 不要随意给旧数据加兼容逻辑
|
|
64
|
+
|
|
65
|
+
项目原则:没有旧数据需要兼容时,不做兼容操作。字段名、请求 shape、回填字段应该按当前业务约定精确实现。
|
|
66
|
+
|
|
67
|
+
## 不要把弹窗字段映射写成猜测
|
|
68
|
+
|
|
69
|
+
弹窗选择中:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
fields: 'feeTypeName,cgFeeTypeCode'
|
|
73
|
+
dialogFields: 'estimationFeeTypeName,ceEstimationFeeTypeCode'
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
两边数量和顺序必须一致。字段不确定时,先查弹窗组件返回行结构。
|
|
77
|
+
|
|
78
|
+
## 不要在简单弹窗里重复套标题容器
|
|
79
|
+
|
|
80
|
+
简单弹窗优先使用 `vxe-modal` 或封装弹窗自身的标题。不要为了再显示一个标题而额外包一层 `BxContainer`。
|
|
81
|
+
|
|
82
|
+
## 不要在 BxContainer 插槽里随意塞操作按钮
|
|
83
|
+
|
|
84
|
+
查询按钮跟随查询容器;表格按钮走 `toolbarButtons` 或权限按钮。除非产品明确要求 header slot 按钮,不要把生成页面的操作按钮塞进 `BxContainer` 插槽。
|
|
85
|
+
|
|
86
|
+
## 不要绕过共享附件流程
|
|
87
|
+
|
|
88
|
+
附件上传/查看优先走项目封装,例如 `useFileUpload().openFileBFSS0001`。不要为普通附件场景重新写局部 mock 弹窗。
|
|
89
|
+
|
|
90
|
+
## 不要忘记表格 id 对请求 block 的影响
|
|
91
|
+
|
|
92
|
+
`VxePlusTable` 会根据 `id` 推导表格 block:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
id="BMBR01_result" -> tableId = "result"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
如果后端 block 名和表格 id 不匹配,优先调整 `id` 或与后端返回 block 对齐,不要在 `transformResponse` 里猜完整 EiInfo。
|
|
99
|
+
|
|
100
|
+
## 不要在 transformParams 中丢弃默认 EiInfo
|
|
101
|
+
|
|
102
|
+
错误:
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
function transformParams() {
|
|
106
|
+
const ei = new EiInfo()
|
|
107
|
+
ei.set('inqu_status-0-x', formData.x)
|
|
108
|
+
return ei
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
正确:
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
function transformParams(formEi) {
|
|
116
|
+
formEi.set('inqu_status-0-x', formData.x)
|
|
117
|
+
return formEi
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
除非明确要丢弃默认分页、排序、筛选、表单字段,否则不要 new 空 EiInfo 替换。
|
|
122
|
+
|
|
123
|
+
## 不要盲目依赖 commitProxy('save')
|
|
124
|
+
|
|
125
|
+
当前组件内部 proxy save 主要处理 `insertRecords`,update/delete 不是完整通用保存流程。复杂保存显式构造 `EiInfo`,按接口 block 提交。
|
|
126
|
+
|
|
127
|
+
## 不要在可编辑表保存前跳过校验
|
|
128
|
+
|
|
129
|
+
保存前至少执行当前页面已有的表格校验。常见入口包括底层 grid 的 `validate` / `fullValidate`,或同模块封装的 `tableValidator`。
|
|
130
|
+
|
|
131
|
+
## 不要滥用动态页面样例
|
|
132
|
+
|
|
133
|
+
`ABBP0201.vue`、`A1P11011.vue` 这类页面能力强,但复杂度也高。普通查询页、新增编辑页不要直接照搬它们的组织方式。先从标准查询页和当前模块相邻页面开始。
|
|
134
|
+
|
|
135
|
+
## 不要把 demo 页当业务最佳实践
|
|
136
|
+
|
|
137
|
+
`project/base/src/views/demo/index.vue` 适合查组件能力和参数形态,但它不是业务页面结构规范。
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# VxePlus AI Knowledge Base
|
|
2
|
+
|
|
3
|
+
本目录是给 AI 生成和修改 BRMS `project/*` 业务页面时使用的知识库,不是面向人的入门教程。
|
|
4
|
+
|
|
5
|
+
目标是让 AI 在没有完整阅读全仓库的情况下,仍能遵守 `VxePlusForm`、`VxePlusTable`、EiInfo 请求、业务页面结构的主要契约。文档会优先写“生成约束、可复制模式、禁止模式、内嵌样例”,少写概念铺垫。
|
|
6
|
+
|
|
7
|
+
这份知识库应尽量自包含:示例代码直接写在文档里,真实来源文件复制在 [sources](./sources/README.md) 下。工程路径只作为来源结构保留,不作为理解本文档的前置依赖。
|
|
8
|
+
|
|
9
|
+
## AI 使用顺序
|
|
10
|
+
|
|
11
|
+
1. 先读 [01-mental-model.md](./01-mental-model.md):判断页面属于查询表格、弹窗选择、详情表单、可编辑表格还是复合页面。
|
|
12
|
+
2. 写表单前读 [02-vxe-plus-form.md](./02-vxe-plus-form.md):只复制直接组件契约,不复制历史二次封装。
|
|
13
|
+
3. 写表格前读 [03-vxe-plus-table.md](./03-vxe-plus-table.md):确认 `id`、`form-config`、`service-config`、编辑列、按钮事件。
|
|
14
|
+
4. 写请求前必须读 [05-request-and-eiinfo.md](./05-request-and-eiinfo.md):确认 EiInfo block、分页、响应 block、保存提交方式。
|
|
15
|
+
5. 找样例读 [04-example-map.md](./04-example-map.md):按场景复制内嵌样例,再按来源路径核对真实业务差异。
|
|
16
|
+
6. 交付前读 [90-anti-patterns.md](./90-anti-patterns.md):检查高频错误。
|
|
17
|
+
|
|
18
|
+
## 最高优先级约束
|
|
19
|
+
|
|
20
|
+
- `VxePlusForm` 独立表单使用 `:form-options`。
|
|
21
|
+
- `VxePlusTable` 的查询表单配置使用 `:form-config`,它不是独立 `VxePlusForm` 的属性。
|
|
22
|
+
- 新写代码不要引入新的 `useForm` 二次封装层。历史页面里的 `src/hooks/useForm.ts` 只能作为识别既有代码的词典,不作为推荐样板。
|
|
23
|
+
- 表格请求优先走 `serviceConfig` + `transformParams` / `transformResponse`。复杂保存优先显式构造 `EiInfo`。
|
|
24
|
+
- 没有用户明确要求兼容旧数据时,不写字段回退、旧格式兼容、双路径兼容。
|
|
25
|
+
|
|
26
|
+
## 框架源码边界
|
|
27
|
+
|
|
28
|
+
`libs/components` 属于整体组件框架源码,不复制进本知识库的离线样例包。本文档会记录必要契约;需要核对框架实现时,再回到真实工程查看:
|
|
29
|
+
|
|
30
|
+
- `libs/components/src/components/form/src/form.tsx`
|
|
31
|
+
- `libs/components/src/components/table/src/table.tsx`
|
|
32
|
+
- `libs/components/src/hooks/useTableData.ts`
|
|
33
|
+
- `libs/components/src/hooks/useToolbarConfig.ts`
|
|
34
|
+
- `libs/components/src/types/index.ts`
|
|
35
|
+
|
|
36
|
+
## 离线业务样例入口
|
|
37
|
+
|
|
38
|
+
- 标准查询表单 + 表格:[BMBR01.vue](./sources/project/base/src/views/BM/BR/BMBR01.vue)
|
|
39
|
+
- 直接写 `itemRender` 的查询和表格请求:[SMSW0101.vue](./sources/project/base/src/views/SM/SW/SMSW0101.vue)
|
|
40
|
+
- 动态可编辑表格:[A1P01601.vue](./sources/project/base/src/views/A1/P0/A1P01601.vue)
|
|
41
|
+
- 后端驱动表单/表格:[A1P11011.vue](./sources/project/base/src/views/A1/P1/A1P11011.vue)
|
|
42
|
+
- 复杂详情复合页面:[PMPC0101 directory](./sources/project/base/src/views/PM/PC/component/PMPC0101/)
|
|
43
|
+
- 组件能力演示:[demo/index.vue](./sources/project/base/src/views/demo/index.vue)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Base View Example Snapshot
|
|
2
|
+
|
|
3
|
+
本目录是 `vxe-plus-knowledge` 的离线业务示例包。复制整个 `doc/components/vxe-plus-knowledge` 目录时,应连同本目录一起复制。
|
|
4
|
+
|
|
5
|
+
这里只复制 `project/base/src/views` 下的业务示例。`libs/components` 属于整体框架源码,不放入本示例包。
|
|
6
|
+
|
|
7
|
+
路径尽量保留原工程结构,便于 AI 通过文档里的相对链接直接打开来源文件。
|
|
8
|
+
|
|
9
|
+
## Business Examples
|
|
10
|
+
|
|
11
|
+
- [BMBR01 standard query page](./project/base/src/views/BM/BR/BMBR01.vue)
|
|
12
|
+
- [BMBR01 form config](./project/base/src/views/BM/BR/component/BMBR01/formConfig.ts)
|
|
13
|
+
- [BMBR01 columns](./project/base/src/views/BM/BR/component/BMBR01/columns.ts)
|
|
14
|
+
- [SMSW0101 direct itemRender and EiInfo submit](./project/base/src/views/SM/SW/SMSW0101.vue)
|
|
15
|
+
- [A1P01601 editable table](./project/base/src/views/A1/P0/A1P01601.vue)
|
|
16
|
+
- [A1P11011 backend-driven page](./project/base/src/views/A1/P1/A1P11011.vue)
|
|
17
|
+
- [ABBP0201 complex page](./project/base/src/views/AB/BP/ABBP0201.vue)
|
|
18
|
+
- [AMAF0601 bidding form config](./project/base/src/views/AM/AF/component/AMAF0601/Bidding/formConfig.ts)
|
|
19
|
+
- [AMAF0601 record columns](./project/base/src/views/AM/AF/component/AMAF0601/Record/columns.ts)
|
|
20
|
+
- [PMPC0101 complex detail directory](./project/base/src/views/PM/PC/component/PMPC0101/)
|
|
21
|
+
- [component demo page](./project/base/src/views/demo/index.vue)
|
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: 谢力
|
|
3
|
+
* @Date: 2026-03-03 09:30:50
|
|
4
|
+
* @LastEditors: Please set LastEditors
|
|
5
|
+
* @LastEditTime: 2026-03-12 14:55:54
|
|
6
|
+
-->
|
|
7
|
+
<template>
|
|
8
|
+
<div v-if="visible" class="flex-col bx-h-100">
|
|
9
|
+
<BxRoundedContainer class="flex-col flex-1 mb0">
|
|
10
|
+
<BxContainer class="flex-1" :title="title" auto auto-content-height>
|
|
11
|
+
<VxePlusTable
|
|
12
|
+
id="A1P01601_result"
|
|
13
|
+
ref="xGrid"
|
|
14
|
+
:auto-load="true"
|
|
15
|
+
:is-edit="true"
|
|
16
|
+
:edit-rules="editRules"
|
|
17
|
+
:toolbar-buttons="toolbarButtons"
|
|
18
|
+
:columns="columns"
|
|
19
|
+
:service-config="serviceConfig"
|
|
20
|
+
:transform-params="transformParams"
|
|
21
|
+
:show-checkbox="true"
|
|
22
|
+
height="auto"
|
|
23
|
+
:left-buttons="['ADD']"
|
|
24
|
+
:pager-config="{ pageSize: 20 }"
|
|
25
|
+
v-on="gridEvents"
|
|
26
|
+
/>
|
|
27
|
+
</BxContainer>
|
|
28
|
+
</BxRoundedContainer>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script setup lang="ts">
|
|
33
|
+
import { computed, onMounted, reactive, ref } from 'vue'
|
|
34
|
+
import type { VxeGridProps } from 'vxe-table'
|
|
35
|
+
import { EiBlock, EiInfo } from '@eplat/ei'
|
|
36
|
+
import { useRoute, useRouter } from 'vue-router'
|
|
37
|
+
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
38
|
+
import { multiply } from 'xe-utils'
|
|
39
|
+
import Dialog from './component/A1P01601/dialog.vue'
|
|
40
|
+
import { createEiBlock, getCodeSetByService, sendService } from '@/utils/eiTools'
|
|
41
|
+
import { isEmpty, isNumber } from '@/utils/is'
|
|
42
|
+
import { convertToCamelCase } from '@/utils'
|
|
43
|
+
import { useTabsStore } from '@/stores/modules/tabs'
|
|
44
|
+
import { useGlobalStore } from '@/stores/modules/global'
|
|
45
|
+
import { useTable } from '@/hooks/useTable'
|
|
46
|
+
|
|
47
|
+
const xGrid = ref<any>(null)
|
|
48
|
+
|
|
49
|
+
const router = useRouter()
|
|
50
|
+
const route = useRoute()
|
|
51
|
+
const globalStore = useGlobalStore()
|
|
52
|
+
const tabStore = useTabsStore()
|
|
53
|
+
|
|
54
|
+
const visible = ref(false)
|
|
55
|
+
const columnList = ref<any[]>([])
|
|
56
|
+
const title = ref('记录集')
|
|
57
|
+
|
|
58
|
+
const { createColumns, createEditRules, validator } = useTable()
|
|
59
|
+
|
|
60
|
+
const columns = computed(() => {
|
|
61
|
+
return createColumns(columnList.value.map((col) => {
|
|
62
|
+
return {
|
|
63
|
+
...col,
|
|
64
|
+
width: (col as any).width ?? '',
|
|
65
|
+
} as any
|
|
66
|
+
})).value
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const editRules = computed(() => createEditRules(columns.value))
|
|
70
|
+
|
|
71
|
+
function tableValidator(...args: any[]) {
|
|
72
|
+
return (validator as any)(...args)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function reload() {
|
|
76
|
+
xGrid.value.reload()
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const queryParams = computed(() => {
|
|
80
|
+
const routeQuery = route.query || {}
|
|
81
|
+
const p0DataCollectConfigHeadId = routeQuery.p0DataCollectConfigHeadId || routeQuery[`inqu_status-0-p0DataCollectConfigHeadId`]
|
|
82
|
+
return {
|
|
83
|
+
p0DataCollectConfigHeadId,
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
const toolbarButtons = ref<NonNullable<VxeGridProps['toolbarConfig']>['buttons']>([
|
|
88
|
+
{
|
|
89
|
+
name: '新增',
|
|
90
|
+
code: 'ADD',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: '保存',
|
|
94
|
+
code: 'SAVE',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: '删除',
|
|
98
|
+
code: 'DELETE',
|
|
99
|
+
},
|
|
100
|
+
])
|
|
101
|
+
|
|
102
|
+
const gridEvents = reactive({
|
|
103
|
+
toolbarButtonClick: ({ code, $grid }) => {
|
|
104
|
+
switch (code) {
|
|
105
|
+
// 新增
|
|
106
|
+
case 'ADD':
|
|
107
|
+
handleAdd($grid)
|
|
108
|
+
break
|
|
109
|
+
// 保存
|
|
110
|
+
case 'SAVE':
|
|
111
|
+
handleSave()
|
|
112
|
+
break
|
|
113
|
+
// 删除
|
|
114
|
+
case 'DELETE':
|
|
115
|
+
handleDelete($grid)
|
|
116
|
+
break
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
const serviceConfig = reactive({
|
|
122
|
+
serviceName: 'A1P01601',
|
|
123
|
+
queryMethod: 'queryDetail',
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
function transformParams(formEi) {
|
|
127
|
+
formEi.set(`inqu_status-0-p0DataCollectConfigHeadId`, queryParams.value.p0DataCollectConfigHeadId)
|
|
128
|
+
return formEi
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// 新增
|
|
132
|
+
async function handleAdd($grid) {
|
|
133
|
+
try {
|
|
134
|
+
const obj = columns.value?.reduce((ob, cur) => {
|
|
135
|
+
if (cur?.field) {
|
|
136
|
+
ob[cur.field] = ''
|
|
137
|
+
}
|
|
138
|
+
return ob
|
|
139
|
+
}, {})
|
|
140
|
+
const checkedRow = {
|
|
141
|
+
...obj,
|
|
142
|
+
p0DataCollectConfigLineId: '',
|
|
143
|
+
}
|
|
144
|
+
const { row: newRow } = await $grid.insertAt(checkedRow)
|
|
145
|
+
$grid.setEditRow(newRow)
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// 保存
|
|
153
|
+
async function handleSave() {
|
|
154
|
+
try {
|
|
155
|
+
const $grid = xGrid.value.getGridInstance()
|
|
156
|
+
await tableValidator(xGrid, true)
|
|
157
|
+
const { tableData } = $grid.getTableData()
|
|
158
|
+
await sendService({
|
|
159
|
+
serviceName: 'A1P01601',
|
|
160
|
+
methodName: 'save',
|
|
161
|
+
eiBlocks: [
|
|
162
|
+
createEiBlock(tableData.map((item) => {
|
|
163
|
+
return {
|
|
164
|
+
...item,
|
|
165
|
+
p0DataCollectConfigHeadId: queryParams.value.p0DataCollectConfigHeadId,
|
|
166
|
+
}
|
|
167
|
+
}), 'result'),
|
|
168
|
+
],
|
|
169
|
+
})
|
|
170
|
+
ElMessage.success('保存成功')
|
|
171
|
+
reload()
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// 删除
|
|
179
|
+
async function handleDelete($grid) {
|
|
180
|
+
const checkboxRecords = $grid.getCheckboxRecords()
|
|
181
|
+
if (!checkboxRecords.length) {
|
|
182
|
+
ElMessage.warning(`请选中一条数据`)
|
|
183
|
+
return
|
|
184
|
+
}
|
|
185
|
+
try {
|
|
186
|
+
await ElMessageBox.confirm(`确定要删除吗?`)
|
|
187
|
+
const rows = checkboxRecords.filter((row) => {
|
|
188
|
+
return !isEmpty(row.p0DataCollectConfigLineId)
|
|
189
|
+
})
|
|
190
|
+
if (rows.length) {
|
|
191
|
+
await sendService({
|
|
192
|
+
serviceName: 'A1P01601',
|
|
193
|
+
methodName: 'delete',
|
|
194
|
+
eiBlocks: [
|
|
195
|
+
createEiBlock(rows.map((item) => {
|
|
196
|
+
return {
|
|
197
|
+
p0DataCollectConfigLineId: item.p0DataCollectConfigLineId,
|
|
198
|
+
}
|
|
199
|
+
}), 'result'),
|
|
200
|
+
],
|
|
201
|
+
})
|
|
202
|
+
ElMessage.success('删除成功')
|
|
203
|
+
reload()
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
$grid.removeCheckboxRow()
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function showErrorMessage(message) {
|
|
215
|
+
ElMessageBox.alert(message, '', {
|
|
216
|
+
confirmButtonText: '确认',
|
|
217
|
+
showClose: false,
|
|
218
|
+
callback: () => {
|
|
219
|
+
const path = globalStore.tabsFullPath ? route.fullPath : route.path
|
|
220
|
+
tabStore.removeTabs(path as string)
|
|
221
|
+
router.go(-1)
|
|
222
|
+
},
|
|
223
|
+
})
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function getJsonByfieldAttrJson(item: any) {
|
|
227
|
+
const obj = {
|
|
228
|
+
visible: true,
|
|
229
|
+
minWidth: 120,
|
|
230
|
+
} as any
|
|
231
|
+
if (isEmpty(item.fieldAttrJson)) {
|
|
232
|
+
return obj
|
|
233
|
+
}
|
|
234
|
+
try {
|
|
235
|
+
const json = JSON.parse(item.fieldAttrJson)
|
|
236
|
+
if (isNumber(json.width)) {
|
|
237
|
+
obj.width = Number.parseFloat(json.width)
|
|
238
|
+
}
|
|
239
|
+
if (json.required) {
|
|
240
|
+
obj.required = json.required !== '0'
|
|
241
|
+
}
|
|
242
|
+
if (json.visible) {
|
|
243
|
+
obj.visible = json.visible !== '0'
|
|
244
|
+
}
|
|
245
|
+
if (json.isEdit) {
|
|
246
|
+
obj.isEdit = json.isEdit !== '0'
|
|
247
|
+
}
|
|
248
|
+
if (json.number) {
|
|
249
|
+
obj.isNumber = json.number === '1' || json.number === 1
|
|
250
|
+
}
|
|
251
|
+
if (item.fieldLabel === 'select') {
|
|
252
|
+
obj.codeSet = json.codeSet
|
|
253
|
+
obj.condition = json?.selectConfig?.condition
|
|
254
|
+
if (json.cascadeConfig) {
|
|
255
|
+
obj.cascadeFields = json.cascadeConfig.cascadeFields
|
|
256
|
+
obj.cascadePromiseFnFields = json.cascadeConfig.cascadePromiseFnFields
|
|
257
|
+
obj.cascadePromiseFnItemFields = json.cascadeConfig.cascadePromiseFnItemFields
|
|
258
|
+
obj.cascadePromiseFn = (params: any) => getCodeSetByService({
|
|
259
|
+
serviceName: json.cascadeConfig.api.split('.')[0],
|
|
260
|
+
methodName: json.cascadeConfig.api.split('.')[1],
|
|
261
|
+
params,
|
|
262
|
+
label: json.cascadeConfig.label,
|
|
263
|
+
value: json.cascadeConfig.value,
|
|
264
|
+
})
|
|
265
|
+
}
|
|
266
|
+
if (json.selectConfig) {
|
|
267
|
+
obj.fields = json.selectConfig.fields
|
|
268
|
+
obj.selectFields = json.selectConfig.selectFields
|
|
269
|
+
}
|
|
270
|
+
if (json.codeSetType === 'api') {
|
|
271
|
+
const ei = new EiInfo()
|
|
272
|
+
if (json.condition) {
|
|
273
|
+
Object.keys(json.condition).forEach((str) => {
|
|
274
|
+
ei.set(str, json.condition[str])
|
|
275
|
+
})
|
|
276
|
+
}
|
|
277
|
+
obj.promiseFn = () => getCodeSetByService({
|
|
278
|
+
serviceName: json.codeSet.split('.')[0],
|
|
279
|
+
methodName: json.codeSet.split('.')[1],
|
|
280
|
+
params: ei,
|
|
281
|
+
label: json.optionLabel,
|
|
282
|
+
value: json.optionValue,
|
|
283
|
+
})
|
|
284
|
+
obj.codeSet = `com.brms.custom.${item.fieldSort}`
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (item.fieldLabel === 'dialog') {
|
|
288
|
+
obj.componentParam = json.dialogConfig.componentParam
|
|
289
|
+
obj.fields = json.dialogConfig.fields
|
|
290
|
+
obj.dialogFields = json.dialogConfig.dialogFields
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
console.error('getJsonByfieldAttrJson error: ', error)
|
|
295
|
+
}
|
|
296
|
+
return obj
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
async function queryColumnList() {
|
|
300
|
+
try {
|
|
301
|
+
visible.value = false
|
|
302
|
+
const eiBlocks = [
|
|
303
|
+
createEiBlock({
|
|
304
|
+
p0DataCollectConfigHeadId: queryParams.value.p0DataCollectConfigHeadId,
|
|
305
|
+
}, 'inqu_status'),
|
|
306
|
+
]
|
|
307
|
+
const pageBlock = new EiBlock('result')
|
|
308
|
+
pageBlock.setAttr({
|
|
309
|
+
offset: 0,
|
|
310
|
+
limit: 999,
|
|
311
|
+
})
|
|
312
|
+
eiBlocks.push(pageBlock)
|
|
313
|
+
const res = await sendService({
|
|
314
|
+
serviceName: 'A1P01601',
|
|
315
|
+
methodName: 'queryDetail',
|
|
316
|
+
eiBlocks,
|
|
317
|
+
blockName: true,
|
|
318
|
+
}) as any
|
|
319
|
+
// inqu_status 主信息,result明细信息,result1 数据项(FORM或GRID),result2 列名信息
|
|
320
|
+
const list = res.get('result2') ?? (res.getBlock('result2')?.getMappedRows() || [])
|
|
321
|
+
console.log('queryColumnList', list)
|
|
322
|
+
const titleLabel = list.find(item => item.fieldLabel === 'titleLabel')
|
|
323
|
+
title.value = titleLabel?.fieldName
|
|
324
|
+
tabStore.setTabName(`基础配置详情(${title.value})`)
|
|
325
|
+
const resList = list.filter(item => !['titleLabel', 'seq'].includes(item.fieldLabel) && !isEmpty(item.fieldCode))
|
|
326
|
+
const resultOb = resList.reduce((ob, row, index) => {
|
|
327
|
+
const field = convertToCamelCase(row.fieldCode || '')
|
|
328
|
+
ob[field] = ob[field] || {
|
|
329
|
+
sortId: index,
|
|
330
|
+
data: [],
|
|
331
|
+
}
|
|
332
|
+
ob[field].data.push(row)
|
|
333
|
+
return ob
|
|
334
|
+
}, {})
|
|
335
|
+
console.log('resultOb', resultOb)
|
|
336
|
+
const echoList = Object.keys(resultOb).map(code => resultOb[code]).sort((a, b) => a.sortId >= b.sortId ? 1 : -1).map((item) => {
|
|
337
|
+
return item.data[0]
|
|
338
|
+
})
|
|
339
|
+
columnList.value = echoList.sort((a, b) => {
|
|
340
|
+
const aIndex = Number.parseFloat(a.fieldSort?.split('.')?.[1] || 0)
|
|
341
|
+
const bIndex = Number.parseFloat(b.fieldSort?.split('.')?.[1] || 0)
|
|
342
|
+
return aIndex >= bIndex ? 1 : -1
|
|
343
|
+
}).map((item) => {
|
|
344
|
+
const field = convertToCamelCase(item.fieldCode || '')
|
|
345
|
+
const json = getJsonByfieldAttrJson(item)
|
|
346
|
+
const isEdit = json.isEdit ?? true
|
|
347
|
+
const required = json.required ?? false
|
|
348
|
+
const obj = {
|
|
349
|
+
minWidth: json.minWidth,
|
|
350
|
+
width: json.width,
|
|
351
|
+
field,
|
|
352
|
+
title: item.fieldName,
|
|
353
|
+
visible: json.visible,
|
|
354
|
+
isEdit,
|
|
355
|
+
required,
|
|
356
|
+
}
|
|
357
|
+
if (item.fieldLabel === 'percentage') {
|
|
358
|
+
return {
|
|
359
|
+
...obj,
|
|
360
|
+
editRender: {
|
|
361
|
+
name: 'BxInputPercentage',
|
|
362
|
+
props: { max: 100 },
|
|
363
|
+
},
|
|
364
|
+
formatter: ({ cellValue }) => !isEmpty(cellValue) ? `${multiply(Number.parseFloat(cellValue), 100)}%` : '',
|
|
365
|
+
validator: ({ itemValue }) => {
|
|
366
|
+
if (isEmpty(itemValue))
|
|
367
|
+
return Promise.resolve(true)
|
|
368
|
+
const n = Number.parseFloat(String(itemValue))
|
|
369
|
+
if (Number.isNaN(n))
|
|
370
|
+
return Promise.reject(new Error('请输入有效数字'))
|
|
371
|
+
if (n < 0 || n > 1)
|
|
372
|
+
return Promise.reject(new Error('百分比需在0~100之间'))
|
|
373
|
+
return Promise.resolve(true)
|
|
374
|
+
},
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
if (item.fieldLabel === 'input') {
|
|
378
|
+
if (json.isNumber) {
|
|
379
|
+
return {
|
|
380
|
+
...obj,
|
|
381
|
+
editRender: {
|
|
382
|
+
name: 'VxeInput',
|
|
383
|
+
props: {
|
|
384
|
+
type: 'number',
|
|
385
|
+
min: 0,
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
validator: ({ itemValue }) => {
|
|
389
|
+
if (isEmpty(itemValue))
|
|
390
|
+
return Promise.resolve(true)
|
|
391
|
+
const n = Number.parseFloat(String(itemValue))
|
|
392
|
+
if (Number.isNaN(n))
|
|
393
|
+
return Promise.reject(new Error('请输入数字'))
|
|
394
|
+
return Promise.resolve(true)
|
|
395
|
+
},
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return {
|
|
399
|
+
editType: 'input',
|
|
400
|
+
...obj,
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
if (item.fieldLabel === 'seq') {
|
|
404
|
+
return {
|
|
405
|
+
type: 'seq',
|
|
406
|
+
width: 60,
|
|
407
|
+
editType: 'input',
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (item.fieldLabel === 'select') {
|
|
411
|
+
return {
|
|
412
|
+
...obj,
|
|
413
|
+
editRender: {
|
|
414
|
+
name: 'tableSelect',
|
|
415
|
+
props: {
|
|
416
|
+
...json,
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
if (item.fieldLabel === 'datePicker') {
|
|
422
|
+
return {
|
|
423
|
+
...obj,
|
|
424
|
+
editRender: {
|
|
425
|
+
name: 'VxeDatePicker',
|
|
426
|
+
props: {
|
|
427
|
+
...json,
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
if (item.fieldLabel === 'dialog') {
|
|
433
|
+
return {
|
|
434
|
+
...obj,
|
|
435
|
+
editRender: {
|
|
436
|
+
name: 'tableSelectDialog',
|
|
437
|
+
props: {
|
|
438
|
+
component: Dialog,
|
|
439
|
+
...json,
|
|
440
|
+
title: `${title.value}-${item.fieldName}`,
|
|
441
|
+
},
|
|
442
|
+
},
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
return {
|
|
446
|
+
editType: 'input',
|
|
447
|
+
...obj,
|
|
448
|
+
}
|
|
449
|
+
})
|
|
450
|
+
console.log('columnList.value', columnList.value)
|
|
451
|
+
console.log('columnList.value.show', columnList.value.filter(item => item.visible))
|
|
452
|
+
if (!columnList.value.length) {
|
|
453
|
+
showErrorMessage('未查询到列,请先配置')
|
|
454
|
+
return Promise.reject('没有查询到数据')
|
|
455
|
+
}
|
|
456
|
+
return Promise.resolve(columnList.value)
|
|
457
|
+
}
|
|
458
|
+
catch {
|
|
459
|
+
columnList.value = []
|
|
460
|
+
return Promise.resolve(columnList.value)
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
onMounted(async () => {
|
|
465
|
+
if (isEmpty(queryParams.value.p0DataCollectConfigHeadId)) {
|
|
466
|
+
showErrorMessage('非法进入')
|
|
467
|
+
return
|
|
468
|
+
}
|
|
469
|
+
try {
|
|
470
|
+
await queryColumnList()
|
|
471
|
+
visible.value = true
|
|
472
|
+
}
|
|
473
|
+
catch {
|
|
474
|
+
|
|
475
|
+
}
|
|
476
|
+
})
|
|
477
|
+
|
|
478
|
+
defineExpose({
|
|
479
|
+
reload,
|
|
480
|
+
})
|
|
481
|
+
</script>
|
|
482
|
+
|
|
483
|
+
<style scoped></style>
|