cloud-web-corejs 1.0.54-dev.687 → 1.0.54-dev.688

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.
@@ -0,0 +1,1356 @@
1
+ # 后台字段(动态生成)JSON 说明
2
+
3
+ > 适用场景:表格布局容器(`table`)启用 **后台字段(动态生成)**(`dynamicSchemaEnabled`)后,后台脚本返回字段定义,前端运行时生成并渲染表单控件。
4
+ >
5
+ > 相关代码:`form-render/container-item/dynamicFieldMixin.js`
6
+
7
+ ---
8
+
9
+ ## 1. 调用流程
10
+
11
+ ```
12
+ 表单渲染
13
+ → table 容器请求 dynamicSchemaScriptCode 脚本
14
+ → 解析响应为「字段定义数组」
15
+ → 按生成模式(append/replace/anchor)插入行布局
16
+ → 各字段控件初始化(下拉/状态等可能再次请求选项数据)
17
+ ```
18
+
19
+ ### 1.1 请求参数(前端 → 后台字段脚本)
20
+
21
+ ```json
22
+ {
23
+ "formData": {
24
+ "id": "10001",
25
+ "billType": "PO"
26
+ },
27
+ "bizType": "A"
28
+ }
29
+ ```
30
+
31
+ | 字段 | 说明 |
32
+ |------|------|
33
+ | `formData` | 当前表单数据(`formModel`),固定传入 |
34
+ | 其余字段 | 由容器属性「脚本返回对应的参数值」脚本动态返回 |
35
+
36
+ ### 1.2 响应外层结构
37
+
38
+ ```json
39
+ {
40
+ "success": true,
41
+ "message": "ok",
42
+ "objx": []
43
+ }
44
+ ```
45
+
46
+ ### 1.3 objx 解析规则(未配置转换脚本时)
47
+
48
+ 按以下优先级取字段定义数组:
49
+
50
+ | 优先级 | 结构 |
51
+ |--------|------|
52
+ | 1 | `objx` 本身为数组 |
53
+ | 2 | `objx.fields` 为数组 |
54
+ | 3 | `objx.columns` 为数组 |
55
+
56
+ 配置了 **转换脚本** 时,入参为完整 `res`,需返回数组或 `{ fields: [...] }`。
57
+
58
+ ---
59
+
60
+ ## 2. 通用字段定义 Schema
61
+
62
+ 每条字段定义会被转成 xform 控件 schema:
63
+
64
+ ```json
65
+ {
66
+ "type": "input",
67
+ "keyName": "contractNo",
68
+ "label": "合同编号",
69
+ "required": true,
70
+ "readonly": false,
71
+ "disabled": false,
72
+ "hidden": false,
73
+ "defaultValue": "",
74
+ "placeholder": "请输入",
75
+ "colspan": 1,
76
+ "optionItems": [],
77
+ "options": {}
78
+ }
79
+ ```
80
+
81
+ ### 2.1 顶层公共属性
82
+
83
+ | 属性 | 必填 | 类型 | 说明 |
84
+ |------|------|------|------|
85
+ | `type` | 否 | string | 控件类型,默认 `input` |
86
+ | `keyName` | **是*** | string | 字段绑定名(写入 formModel)。也可用 `field` / `name`,优先级:`keyName` > `field` > `name` |
87
+ | `label` | 否 | string | 显示标签 |
88
+ | `required` | 否 | boolean | 是否必填 |
89
+ | `readonly` | 否 | boolean | 是否只读 |
90
+ | `disabled` | 否 | boolean | 是否禁用 |
91
+ | `hidden` | 否 | boolean | 是否隐藏 |
92
+ | `defaultValue` | 否 | any | 默认值 |
93
+ | `placeholder` | 否 | string | 占位符(控件支持时生效) |
94
+ | `colspan` | 否 | number | 占列数,默认 `1` |
95
+ | `optionItems` | 否 | array | 静态选项(select/radio/checkbox 等) |
96
+ | `options` | 否 | object | 控件扩展配置,合并进 `widget.options` |
97
+
98
+ > *`keyName` / `field` / `name` 至少提供一个,否则该条定义会被忽略。
99
+
100
+ ### 2.2 选项类控件三种数据来源
101
+
102
+ 适用于:`select`、`radio`、`checkbox`、`status`
103
+
104
+ | 模式 | options 关键配置 | 说明 |
105
+ |------|------------------|------|
106
+ | 静态选项 | `optionItems` 或 `statusParam` | 后台字段脚本一次性下发 |
107
+ | 后台脚本 | `formScriptEnabled: true` + `formScriptCode` | 控件初始化时再次请求脚本 |
108
+ | 系统词汇 | `commonAttributeEnabled: true` + `commonAttributeCode` | 请求 `/user/common_attribute/listItems` |
109
+
110
+ **互斥规则:** `formScriptEnabled` 与 `commonAttributeEnabled` 不能同时为 `true`。
111
+
112
+ **词汇下拉/状态 labelKey/valueKey:**
113
+
114
+ ```json
115
+ {
116
+ "labelKey": "value",
117
+ "valueKey": "sn"
118
+ }
119
+ ```
120
+
121
+ **脚本下拉 labelKey/valueKey(默认):**
122
+
123
+ ```json
124
+ {
125
+ "labelKey": "label",
126
+ "valueKey": "value"
127
+ }
128
+ ```
129
+
130
+ **选项脚本返回格式:**
131
+
132
+ ```json
133
+ {
134
+ "success": true,
135
+ "objx": {
136
+ "records": [
137
+ { "label": "选项A", "value": "A" }
138
+ ]
139
+ }
140
+ }
141
+ ```
142
+
143
+ 或直接数组:
144
+
145
+ ```json
146
+ {
147
+ "success": true,
148
+ "objx": [
149
+ { "label": "选项A", "value": "A" }
150
+ ]
151
+ }
152
+ ```
153
+
154
+ **词汇接口返回格式:**
155
+
156
+ ```json
157
+ [
158
+ { "sn": "1", "value": "草稿", "code": "ORDER_STATUS", "enabled": true, "sortNo": 1 },
159
+ { "sn": "2", "value": "已提交", "code": "ORDER_STATUS", "enabled": true, "sortNo": 2 }
160
+ ]
161
+ ```
162
+
163
+ ---
164
+
165
+ ## 3. 各控件类型 JSON 说明
166
+
167
+ ### 3.1 单行输入(type: `input`)
168
+
169
+ ```json
170
+ {
171
+ "type": "input",
172
+ "keyName": "contractNo",
173
+ "label": "合同编号",
174
+ "required": true,
175
+ "placeholder": "请输入合同编号",
176
+ "defaultValue": "",
177
+ "colspan": 1,
178
+ "options": {
179
+ "type": "text",
180
+ "clearable": true,
181
+ "showPassword": false,
182
+ "minLength": null,
183
+ "maxLength": 50,
184
+ "showWordLimit": true,
185
+ "prefixIcon": "",
186
+ "suffixIcon": "",
187
+ "validation": "",
188
+ "validationHint": ""
189
+ }
190
+ }
191
+ ```
192
+
193
+ | options 字段 | 类型 | 默认值 | 说明 |
194
+ |-------------|------|--------|------|
195
+ | `type` | string | `text` | 输入类型:`text` / `password` 等 |
196
+ | `clearable` | boolean | true | 可清空 |
197
+ | `showPassword` | boolean | false | 密码框 |
198
+ | `minLength` | number | null | 最小长度 |
199
+ | `maxLength` | number | null | 最大长度 |
200
+ | `showWordLimit` | boolean | false | 显示字数统计 |
201
+ | `prefixIcon` | string | - | 前缀图标 |
202
+ | `suffixIcon` | string | - | 后缀图标 |
203
+ | `validation` | string | - | 校验规则表达式 |
204
+ | `validationHint` | string | - | 校验失败提示 |
205
+
206
+ ---
207
+
208
+ ### 3.2 多行输入(type: `textarea`)
209
+
210
+ ```json
211
+ {
212
+ "type": "textarea",
213
+ "keyName": "remark",
214
+ "label": "备注",
215
+ "placeholder": "请输入备注",
216
+ "defaultValue": "",
217
+ "colspan": 2,
218
+ "options": {
219
+ "rows": 3,
220
+ "minLength": null,
221
+ "maxLength": 500,
222
+ "showWordLimit": true
223
+ }
224
+ }
225
+ ```
226
+
227
+ | options 字段 | 类型 | 默认值 | 说明 |
228
+ |-------------|------|--------|------|
229
+ | `rows` | number | 3 | 可见行数 |
230
+ | `minLength` | number | null | 最小长度 |
231
+ | `maxLength` | number | null | 最大长度 |
232
+ | `showWordLimit` | boolean | false | 显示字数统计 |
233
+
234
+ ---
235
+
236
+ ### 3.3 计数器(type: `number`)
237
+
238
+ ```json
239
+ {
240
+ "type": "number",
241
+ "keyName": "totalQty",
242
+ "label": "数量",
243
+ "required": true,
244
+ "defaultValue": 0,
245
+ "colspan": 1,
246
+ "options": {
247
+ "min": 0,
248
+ "max": 999999,
249
+ "precision": 0,
250
+ "step": 1,
251
+ "controlsPosition": "right",
252
+ "formulaEnabled": false,
253
+ "formula": ""
254
+ }
255
+ }
256
+ ```
257
+
258
+ | options 字段 | 类型 | 默认值 | 说明 |
259
+ |-------------|------|--------|------|
260
+ | `min` | number | - | 最小值 |
261
+ | `max` | number | - | 最大值 |
262
+ | `precision` | number | 0 | 小数精度 |
263
+ | `step` | number | 1 | 步长 |
264
+ | `controlsPosition` | string | `right` | 按钮位置 |
265
+ | `formulaEnabled` | boolean | false | 启用公式 |
266
+ | `formula` | string | - | 公式表达式 |
267
+
268
+ ---
269
+
270
+ ### 3.4 单选项(type: `radio`)
271
+
272
+ #### 静态选项
273
+
274
+ ```json
275
+ {
276
+ "type": "radio",
277
+ "keyName": "urgentFlag",
278
+ "label": "是否加急",
279
+ "defaultValue": "0",
280
+ "colspan": 1,
281
+ "optionItems": [
282
+ { "label": "否", "value": "0", "disabled": false },
283
+ { "label": "是", "value": "1", "disabled": false }
284
+ ],
285
+ "options": {
286
+ "formScriptEnabled": false,
287
+ "commonAttributeEnabled": false,
288
+ "displayStyle": "inline",
289
+ "buttonStyle": false,
290
+ "border": false
291
+ }
292
+ }
293
+ ```
294
+
295
+ #### 后台脚本加载选项
296
+
297
+ ```json
298
+ {
299
+ "type": "radio",
300
+ "keyName": "payType",
301
+ "label": "付款方式",
302
+ "options": {
303
+ "formScriptEnabled": true,
304
+ "commonAttributeEnabled": false,
305
+ "formScriptCode": "payTypeList",
306
+ "labelKey": "label",
307
+ "valueKey": "value",
308
+ "formScriptParam": "return { parentCode: this.formModel.billType }",
309
+ "displayStyle": "inline"
310
+ }
311
+ }
312
+ ```
313
+
314
+ #### 系统词汇
315
+
316
+ ```json
317
+ {
318
+ "type": "radio",
319
+ "keyName": "yesNo",
320
+ "label": "是否",
321
+ "defaultValue": "1",
322
+ "options": {
323
+ "formScriptEnabled": false,
324
+ "commonAttributeEnabled": true,
325
+ "commonAttributeCode": "YES_NO",
326
+ "labelKey": "value",
327
+ "valueKey": "sn"
328
+ }
329
+ }
330
+ ```
331
+
332
+ | options 字段 | 说明 |
333
+ |-------------|------|
334
+ | `displayStyle` | `inline` 行内 / `block` 块级 |
335
+ | `buttonStyle` | 按钮风格 |
336
+ | `border` | 是否带边框 |
337
+
338
+ ---
339
+
340
+ ### 3.5 多选项(type: `checkbox`)
341
+
342
+ #### 静态选项
343
+
344
+ ```json
345
+ {
346
+ "type": "checkbox",
347
+ "keyName": "notifyTypes",
348
+ "label": "通知方式",
349
+ "defaultValue": ["SMS", "EMAIL"],
350
+ "colspan": 2,
351
+ "optionItems": [
352
+ { "label": "短信", "value": "SMS" },
353
+ { "label": "邮件", "value": "EMAIL" },
354
+ { "label": "站内信", "value": "MSG" }
355
+ ],
356
+ "options": {
357
+ "formScriptEnabled": false,
358
+ "commonAttributeEnabled": false,
359
+ "displayStyle": "inline"
360
+ }
361
+ }
362
+ ```
363
+
364
+ #### 后台脚本 / 系统词汇
365
+
366
+ 配置方式与 `radio`、`select` 相同,将 `formScriptEnabled` 或 `commonAttributeEnabled` 放入 `options` 即可。
367
+
368
+ ---
369
+
370
+ ### 3.6 下拉选项(type: `select`)
371
+
372
+ #### 静态选项
373
+
374
+ ```json
375
+ {
376
+ "type": "select",
377
+ "keyName": "payType",
378
+ "label": "付款方式",
379
+ "required": true,
380
+ "defaultValue": "CASH",
381
+ "placeholder": "请选择",
382
+ "colspan": 1,
383
+ "optionItems": [
384
+ { "label": "现金", "value": "CASH", "disabled": false },
385
+ { "label": "转账", "value": "TRANSFER", "disabled": false }
386
+ ],
387
+ "options": {
388
+ "formScriptEnabled": false,
389
+ "commonAttributeEnabled": false,
390
+ "clearable": true,
391
+ "filterable": true,
392
+ "multiple": false,
393
+ "multipleLimit": 0
394
+ }
395
+ }
396
+ ```
397
+
398
+ #### 后台脚本加载选项
399
+
400
+ ```json
401
+ {
402
+ "type": "select",
403
+ "keyName": "subPayType",
404
+ "label": "子付款方式",
405
+ "options": {
406
+ "formScriptEnabled": true,
407
+ "commonAttributeEnabled": false,
408
+ "formScriptCode": "subPayTypeList",
409
+ "labelKey": "label",
410
+ "valueKey": "value",
411
+ "formScriptParam": "return { parentPayType: this.formModel.payType }",
412
+ "clearable": true,
413
+ "filterable": true
414
+ }
415
+ }
416
+ ```
417
+
418
+ **选项脚本请求参数(前端自动发起):**
419
+
420
+ ```json
421
+ {
422
+ "formCode": "PO_ORDER_FORM",
423
+ "formVersion": "1.0",
424
+ "taBm": "subPayType",
425
+ "data": {
426
+ "parentPayType": "CASH"
427
+ }
428
+ }
429
+ ```
430
+
431
+ #### 系统词汇
432
+
433
+ ```json
434
+ {
435
+ "type": "select",
436
+ "keyName": "orderStatus",
437
+ "label": "订单状态",
438
+ "defaultValue": "1",
439
+ "options": {
440
+ "formScriptEnabled": false,
441
+ "commonAttributeEnabled": true,
442
+ "commonAttributeCode": "ORDER_STATUS",
443
+ "labelKey": "value",
444
+ "valueKey": "sn",
445
+ "clearable": true,
446
+ "filterable": true
447
+ }
448
+ }
449
+ ```
450
+
451
+ #### 自定义字段名的脚本返回
452
+
453
+ ```json
454
+ {
455
+ "type": "select",
456
+ "keyName": "deptCode",
457
+ "label": "部门",
458
+ "options": {
459
+ "formScriptEnabled": true,
460
+ "formScriptCode": "deptList",
461
+ "labelKey": "deptName",
462
+ "valueKey": "deptCode"
463
+ }
464
+ }
465
+ ```
466
+
467
+ 对应脚本返回:
468
+
469
+ ```json
470
+ {
471
+ "success": true,
472
+ "objx": {
473
+ "records": [
474
+ { "deptName": "采购部", "deptCode": "D001" },
475
+ { "deptName": "财务部", "deptCode": "D002" }
476
+ ]
477
+ }
478
+ }
479
+ ```
480
+
481
+ | options 字段 | 说明 |
482
+ |-------------|------|
483
+ | `clearable` | 可清空 |
484
+ | `filterable` | 可搜索 |
485
+ | `multiple` | 是否多选 |
486
+ | `multipleLimit` | 多选上限,0=不限 |
487
+ | `allowCreate` | 允许创建新条目 |
488
+ | `remote` | 远程搜索 |
489
+ | `showCollapseTags` | 多选时折叠标签 |
490
+
491
+ ---
492
+
493
+ ### 3.7 日期(type: `date`)
494
+
495
+ ```json
496
+ {
497
+ "type": "date",
498
+ "keyName": "orderDate",
499
+ "label": "订单日期",
500
+ "required": true,
501
+ "defaultValue": null,
502
+ "placeholder": "请选择日期",
503
+ "colspan": 1,
504
+ "options": {
505
+ "type": "date",
506
+ "format": "yyyy-MM-dd",
507
+ "valueFormat": "yyyy-MM-dd",
508
+ "clearable": true,
509
+ "editable": false,
510
+ "readonly": false,
511
+ "minDate": null,
512
+ "maxDate": null,
513
+ "utcTransformEnabled": false
514
+ }
515
+ }
516
+ ```
517
+
518
+ | options.type | 说明 |
519
+ |-------------|------|
520
+ | `date` | 日期 |
521
+ | `datetime` | 日期时间 |
522
+ | `month` | 月份 |
523
+ | `year` | 年份 |
524
+
525
+ | options 字段 | 说明 |
526
+ |-------------|------|
527
+ | `format` | 显示格式 |
528
+ | `valueFormat` | 绑定值格式 |
529
+ | `minDate` / `maxDate` | 可选范围 |
530
+ | `utcTransformEnabled` | UTC 转换 |
531
+
532
+ ---
533
+
534
+ ### 3.8 文本(type: `text`)
535
+
536
+ 只读展示字段,绑定 formModel 中的值并展示(非输入框)。
537
+
538
+ ```json
539
+ {
540
+ "type": "text",
541
+ "keyName": "createByName",
542
+ "label": "创建人",
543
+ "defaultValue": "",
544
+ "colspan": 1,
545
+ "options": {
546
+ "colorClass": "",
547
+ "formatType": null,
548
+ "renderHandle": null,
549
+ "autoValueEnabled": false,
550
+ "autoValueHanlde": null,
551
+ "utcTransformEnabled": false
552
+ }
553
+ }
554
+ ```
555
+
556
+ | options 字段 | 说明 |
557
+ |-------------|------|
558
+ | `colorClass` | 文字颜色样式类 |
559
+ | `formatType` | 格式化类型 |
560
+ | `renderHandle` | 自定义渲染脚本 |
561
+ | `autoValueEnabled` | 启用自动取值 |
562
+ | `autoValueHanlde` | 自动取值脚本 |
563
+
564
+ ---
565
+
566
+ ### 3.9 凭证(type: `vabUpload`)
567
+
568
+ 附件上传控件,绑定值为文件数组。
569
+
570
+ ```json
571
+ {
572
+ "type": "vabUpload",
573
+ "keyName": "attachments",
574
+ "label": "附件",
575
+ "required": false,
576
+ "colspan": 2,
577
+ "options": {
578
+ "limit": 10,
579
+ "hideRemoveButton": false,
580
+ "entityTableCode": "PO_ORDER",
581
+ "entityTableDesc": "采购订单",
582
+ "hiddenFileInfo": false,
583
+ "hiddenFileName": false,
584
+ "showFileSize": true,
585
+ "showFileCreateBy": false,
586
+ "showFileCreateDate": false,
587
+ "widgetSize": 2,
588
+ "formScriptEnabled": true,
589
+ "formScriptCode": "getList",
590
+ "formScriptParam": "return { id: dataId }"
591
+ }
592
+ }
593
+ ```
594
+
595
+ | options 字段 | 类型 | 说明 |
596
+ |-------------|------|------|
597
+ | `limit` | number | 最大文件数,`1` 为单文件 |
598
+ | `hideRemoveButton` | boolean | 隐藏删除按钮 |
599
+ | `entityTableCode` | string | 业务表编码(附件关联) |
600
+ | `entityTableDesc` | string | 业务表描述 |
601
+ | `hiddenFileInfo` | boolean | 隐藏文件信息区 |
602
+ | `hiddenFileName` | boolean | 隐藏文件名 |
603
+ | `showFileSize` | boolean | 显示文件大小 |
604
+ | `showFileCreateBy` | boolean | 显示上传人 |
605
+ | `showFileCreateDate` | boolean | 显示上传时间 |
606
+ | `widgetSize` | number | 展示尺寸 |
607
+ | `formScriptCode` | string | 加载已有附件的脚本,默认 `getList` |
608
+
609
+ **凭证加载脚本请求参数:**
610
+
611
+ ```json
612
+ {
613
+ "formCode": "PO_ORDER_FORM",
614
+ "formVersion": "1.0",
615
+ "taBm": "attachments",
616
+ "data": {
617
+ "id": "10001"
618
+ }
619
+ }
620
+ ```
621
+
622
+ **凭证加载脚本返回(objx 为文件数组):**
623
+
624
+ ```json
625
+ {
626
+ "success": true,
627
+ "objx": [
628
+ {
629
+ "id": "file001",
630
+ "fileName": "合同.pdf",
631
+ "fileUrl": "https://xxx/contract.pdf",
632
+ "fileSize": 102400,
633
+ "createBy": "张三",
634
+ "createDate": "2026-06-15 10:00:00"
635
+ }
636
+ ]
637
+ }
638
+ ```
639
+
640
+ > 仅在表单已有 `dataId`(编辑态)时,`onCreated` 默认脚本才会加载历史附件。
641
+
642
+ ---
643
+
644
+ ### 3.10 搜索框(type: `vabsearch`)
645
+
646
+ 弹窗选择控件。存值字段为 `keyName`,显示名称通常存于 `vabSearchName` 对应字段。
647
+
648
+ ```json
649
+ {
650
+ "type": "vabsearch",
651
+ "keyName": "supplierCode",
652
+ "label": "供应商",
653
+ "required": true,
654
+ "colspan": 1,
655
+ "options": {
656
+ "vabSearchName": "supplierName",
657
+ "readonly": true,
658
+ "multipleChoices": false,
659
+ "dialogModel": "1",
660
+ "searchDialogConfig": {
661
+ "formCode": "SUPPLIER_LIST",
662
+ "formName": "供应商列表",
663
+ "valueSourceField": "supplierCode",
664
+ "labelSourceField": "supplierName",
665
+ "multipleChoices": false,
666
+ "tableEnabled": true,
667
+ "dialogQueryParam": "return { status: '1' }",
668
+ "dialogCustomParam": "return { title: '选择供应商' }"
669
+ }
670
+ }
671
+ }
672
+ ```
673
+
674
+ | options 字段 | 说明 |
675
+ |-------------|------|
676
+ | `vabSearchName` | 显示名称存入 formModel 的字段名(如 `supplierName`) |
677
+ | `readonly` | 输入框只读(通常 true) |
678
+ | `multipleChoices` | 是否多选 |
679
+ | `dialogModel` | 弹框模式 |
680
+ | `valueField` | 多选时的值字段(可选) |
681
+
682
+ **searchDialogConfig 字段:**
683
+
684
+ | 字段 | 说明 |
685
+ |------|------|
686
+ | `formCode` | 弹窗列表表单编码(必填) |
687
+ | `valueSourceField` | 选中行的值字段(写入 keyName) |
688
+ | `labelSourceField` | 选中行的显示字段(写入 vabSearchName) |
689
+ | `multipleChoices` | 是否多选 |
690
+ | `tableEnabled` | 启用表格模式 |
691
+ | `dialogQueryParam` | 弹窗查询参数脚本 |
692
+ | `dialogCustomParam` | 弹窗额外参数脚本 |
693
+ | `confirmCallback` | 确认回调脚本 |
694
+
695
+ **选中后 formModel 示例:**
696
+
697
+ ```json
698
+ {
699
+ "supplierCode": "SUP001",
700
+ "supplierName": "某某供应商有限公司"
701
+ }
702
+ ```
703
+
704
+ **多选搜索框示例(type 也可用 `multiSearch`):**
705
+
706
+ ```json
707
+ {
708
+ "type": "vabsearch",
709
+ "keyName": "supplierList",
710
+ "label": "供应商(多选)",
711
+ "options": {
712
+ "vabSearchName": "supplierName",
713
+ "multipleChoices": true,
714
+ "valueField": "supplierCode",
715
+ "searchDialogConfig": {
716
+ "formCode": "SUPPLIER_LIST",
717
+ "valueSourceField": "supplierCode",
718
+ "labelSourceField": "supplierName",
719
+ "multipleChoices": true
720
+ }
721
+ }
722
+ }
723
+ ```
724
+
725
+ ---
726
+
727
+ ### 3.11 状态(type: `status`)
728
+
729
+ 根据字段值展示带颜色标签的状态文本(非输入控件)。
730
+
731
+ #### 静态状态配置
732
+
733
+ ```json
734
+ {
735
+ "type": "status",
736
+ "keyName": "orderStatus",
737
+ "label": "订单状态",
738
+ "defaultValue": "1",
739
+ "colspan": 1,
740
+ "options": {
741
+ "formScriptEnabled": false,
742
+ "commonAttributeEnabled": false,
743
+ "optionItemValueType": 0,
744
+ "labelKey": "label",
745
+ "valueKey": "value",
746
+ "statusParam": [
747
+ { "label": "草稿", "value": "1", "type": "info" },
748
+ { "label": "已提交", "value": "2", "type": "warning" },
749
+ { "label": "已审核", "value": "3", "type": "success" },
750
+ { "label": "已驳回", "value": "4", "type": "danger" }
751
+ ]
752
+ }
753
+ }
754
+ ```
755
+
756
+ **statusParam 字段说明:**
757
+
758
+ | 字段 | 说明 |
759
+ |------|------|
760
+ | `label` | 显示名称 |
761
+ | `value` | 状态值(与 formModel 中 keyName 对应) |
762
+ | `type` | 颜色:`""`(蓝) / `success`(绿) / `warning`(橙) / `info`(灰) / `danger`(红) |
763
+
764
+ **optionItemValueType 值类型:**
765
+
766
+ | 值 | 说明 |
767
+ |----|------|
768
+ | `0` | 文本 |
769
+ | `1` | 数值 |
770
+ | `2` | 布尔(自动生成 是/否 两项) |
771
+
772
+ 数值型示例:
773
+
774
+ ```json
775
+ {
776
+ "type": "status",
777
+ "keyName": "auditStatus",
778
+ "label": "审核状态",
779
+ "defaultValue": 0,
780
+ "options": {
781
+ "optionItemValueType": 1,
782
+ "statusParam": [
783
+ { "label": "待审核", "value": 0, "type": "warning" },
784
+ { "label": "已通过", "value": 1, "type": "success" },
785
+ { "label": "已拒绝", "value": 2, "type": "danger" }
786
+ ]
787
+ }
788
+ }
789
+ ```
790
+
791
+ #### 后台脚本加载状态项
792
+
793
+ ```json
794
+ {
795
+ "type": "status",
796
+ "keyName": "wfStatus",
797
+ "label": "流程状态",
798
+ "options": {
799
+ "formScriptEnabled": true,
800
+ "commonAttributeEnabled": false,
801
+ "formScriptCode": "wfStatusList",
802
+ "labelKey": "label",
803
+ "valueKey": "value",
804
+ "formScriptParam": "return { processId: this.formModel.processId }"
805
+ }
806
+ }
807
+ ```
808
+
809
+ 脚本返回的选项会写入 `statusParam`(与 select 选项加载机制相同)。
810
+
811
+ #### 系统词汇加载状态
812
+
813
+ ```json
814
+ {
815
+ "type": "status",
816
+ "keyName": "billStatus",
817
+ "label": "单据状态",
818
+ "options": {
819
+ "formScriptEnabled": false,
820
+ "commonAttributeEnabled": true,
821
+ "commonAttributeCode": "BILL_STATUS",
822
+ "labelKey": "value",
823
+ "valueKey": "sn"
824
+ }
825
+ }
826
+ ```
827
+
828
+ > 词汇模式下状态标签不显示颜色样式(仅纯文本),静态 `statusParam` 才支持 `type` 颜色。
829
+
830
+ ---
831
+
832
+ ## 4. 完整综合示例
833
+
834
+ ```json
835
+ {
836
+ "success": true,
837
+ "message": "ok",
838
+ "objx": [
839
+ {
840
+ "type": "input",
841
+ "keyName": "contractNo",
842
+ "label": "合同编号",
843
+ "required": true,
844
+ "colspan": 1
845
+ },
846
+ {
847
+ "type": "textarea",
848
+ "keyName": "remark",
849
+ "label": "备注",
850
+ "colspan": 2,
851
+ "options": { "rows": 3, "maxLength": 500, "showWordLimit": true }
852
+ },
853
+ {
854
+ "type": "number",
855
+ "keyName": "totalQty",
856
+ "label": "数量",
857
+ "defaultValue": 1,
858
+ "colspan": 1,
859
+ "options": { "min": 0, "precision": 0 }
860
+ },
861
+ {
862
+ "type": "radio",
863
+ "keyName": "urgentFlag",
864
+ "label": "是否加急",
865
+ "defaultValue": "0",
866
+ "optionItems": [
867
+ { "label": "否", "value": "0" },
868
+ { "label": "是", "value": "1" }
869
+ ],
870
+ "colspan": 1
871
+ },
872
+ {
873
+ "type": "checkbox",
874
+ "keyName": "notifyTypes",
875
+ "label": "通知方式",
876
+ "defaultValue": [],
877
+ "optionItems": [
878
+ { "label": "短信", "value": "SMS" },
879
+ { "label": "邮件", "value": "EMAIL" }
880
+ ],
881
+ "colspan": 2
882
+ },
883
+ {
884
+ "type": "select",
885
+ "keyName": "payType",
886
+ "label": "付款方式",
887
+ "options": {
888
+ "formScriptEnabled": true,
889
+ "formScriptCode": "payTypeList",
890
+ "labelKey": "label",
891
+ "valueKey": "value"
892
+ },
893
+ "colspan": 1
894
+ },
895
+ {
896
+ "type": "date",
897
+ "keyName": "orderDate",
898
+ "label": "订单日期",
899
+ "colspan": 1,
900
+ "options": {
901
+ "format": "yyyy-MM-dd",
902
+ "valueFormat": "yyyy-MM-dd"
903
+ }
904
+ },
905
+ {
906
+ "type": "text",
907
+ "keyName": "createByName",
908
+ "label": "创建人",
909
+ "colspan": 1
910
+ },
911
+ {
912
+ "type": "vabUpload",
913
+ "keyName": "attachments",
914
+ "label": "附件",
915
+ "colspan": 2,
916
+ "options": {
917
+ "limit": 10,
918
+ "entityTableCode": "PO_ORDER",
919
+ "formScriptCode": "getList"
920
+ }
921
+ },
922
+ {
923
+ "type": "vabsearch",
924
+ "keyName": "supplierCode",
925
+ "label": "供应商",
926
+ "required": true,
927
+ "colspan": 1,
928
+ "options": {
929
+ "vabSearchName": "supplierName",
930
+ "searchDialogConfig": {
931
+ "formCode": "SUPPLIER_LIST",
932
+ "valueSourceField": "supplierCode",
933
+ "labelSourceField": "supplierName",
934
+ "multipleChoices": false
935
+ }
936
+ }
937
+ },
938
+ {
939
+ "type": "status",
940
+ "keyName": "orderStatus",
941
+ "label": "订单状态",
942
+ "defaultValue": "1",
943
+ "colspan": 1,
944
+ "options": {
945
+ "statusParam": [
946
+ { "label": "草稿", "value": "1", "type": "info" },
947
+ { "label": "已提交", "value": "2", "type": "warning" },
948
+ { "label": "已审核", "value": "3", "type": "success" }
949
+ ]
950
+ }
951
+ }
952
+ ]
953
+ }
954
+ ```
955
+
956
+ ---
957
+
958
+ ## 5. 完整综合 Java 示例代码
959
+
960
+ 脚本编码建议:`getDynamicSchemaFields`(配置在 table 容器「后台字段 → 脚本编码」)
961
+ 返回类型:`List<Map<String, Object>>`,平台自动包装为响应 `objx` 数组。
962
+
963
+ ### 5.1 脚本约定
964
+
965
+ | 项目 | 说明 |
966
+ |------|------|
967
+ | 返回类型 | `List<Map<String, Object>>`,每个 Map 为一条字段定义 |
968
+ | 嵌套配置 | 控件扩展属性放在 `options`(`Map`)中 |
969
+ | 静态选项 | `select` / `radio` / `checkbox` 可直接 `put("optionItems", list)` |
970
+ | 请求入参 | 前端请求体含 `formData`(当前表单数据)及容器「脚本返回对应的参数值」 |
971
+ | 二次请求 | 下拉/状态等 `formScriptCode`、凭证 `getList` 需**单独维护**选项脚本 |
972
+
973
+ 读取表单数据示例(变量名以平台脚本引擎为准):
974
+
975
+ ```java
976
+ // Map data = ...; // 平台注入的请求体
977
+ Map<String, Object> formData = (Map<String, Object>) data.get("formData");
978
+ String billType = formData != null ? String.valueOf(formData.get("billType")) : null;
979
+ ```
980
+
981
+ ### 5.2 主脚本:返回全部字段定义
982
+
983
+ ```java
984
+ import java.util.ArrayList;
985
+ import java.util.HashMap;
986
+ import java.util.List;
987
+ import java.util.Map;
988
+
989
+ List<Map<String, Object>> fields = new ArrayList<>();
990
+
991
+ // ========== 1. 单行输入 input ==========
992
+ Map<String, Object> f1 = new HashMap<>();
993
+ f1.put("type", "input");
994
+ f1.put("keyName", "contractNo");
995
+ f1.put("label", "合同编号");
996
+ f1.put("required", true);
997
+ f1.put("placeholder", "请输入合同编号");
998
+ f1.put("colspan", 1);
999
+ Map<String, Object> f1Opt = new HashMap<>();
1000
+ f1Opt.put("type", "text");
1001
+ f1Opt.put("clearable", true);
1002
+ f1Opt.put("maxLength", 50);
1003
+ f1Opt.put("showWordLimit", true);
1004
+ f1.put("options", f1Opt);
1005
+ fields.add(f1);
1006
+
1007
+ // ========== 2. 多行输入 textarea ==========
1008
+ Map<String, Object> f2 = new HashMap<>();
1009
+ f2.put("type", "textarea");
1010
+ f2.put("keyName", "remark");
1011
+ f2.put("label", "备注");
1012
+ f2.put("colspan", 2);
1013
+ Map<String, Object> f2Opt = new HashMap<>();
1014
+ f2Opt.put("rows", 3);
1015
+ f2Opt.put("maxLength", 500);
1016
+ f2Opt.put("showWordLimit", true);
1017
+ f2.put("options", f2Opt);
1018
+ fields.add(f2);
1019
+
1020
+ // ========== 3. 计数器 number ==========
1021
+ Map<String, Object> f3 = new HashMap<>();
1022
+ f3.put("type", "number");
1023
+ f3.put("keyName", "totalQty");
1024
+ f3.put("label", "数量");
1025
+ f3.put("defaultValue", 1);
1026
+ f3.put("colspan", 1);
1027
+ Map<String, Object> f3Opt = new HashMap<>();
1028
+ f3Opt.put("min", 0);
1029
+ f3Opt.put("max", 999999);
1030
+ f3Opt.put("precision", 0);
1031
+ f3Opt.put("step", 1);
1032
+ f3.put("options", f3Opt);
1033
+ fields.add(f3);
1034
+
1035
+ // ========== 4. 单选项 radio(静态 optionItems) ==========
1036
+ Map<String, Object> f4 = new HashMap<>();
1037
+ f4.put("type", "radio");
1038
+ f4.put("keyName", "urgentFlag");
1039
+ f4.put("label", "是否加急");
1040
+ f4.put("defaultValue", "0");
1041
+ f4.put("colspan", 1);
1042
+ List<Map<String, Object>> f4Items = new ArrayList<>();
1043
+ Map<String, Object> f4Item1 = new HashMap<>();
1044
+ f4Item1.put("label", "否");
1045
+ f4Item1.put("value", "0");
1046
+ f4Items.add(f4Item1);
1047
+ Map<String, Object> f4Item2 = new HashMap<>();
1048
+ f4Item2.put("label", "是");
1049
+ f4Item2.put("value", "1");
1050
+ f4Items.add(f4Item2);
1051
+ f4.put("optionItems", f4Items);
1052
+ Map<String, Object> f4Opt = new HashMap<>();
1053
+ f4Opt.put("formScriptEnabled", false);
1054
+ f4Opt.put("commonAttributeEnabled", false);
1055
+ f4Opt.put("displayStyle", "inline");
1056
+ f4.put("options", f4Opt);
1057
+ fields.add(f4);
1058
+
1059
+ // ========== 5. 多选项 checkbox(静态 optionItems) ==========
1060
+ Map<String, Object> f5 = new HashMap<>();
1061
+ f5.put("type", "checkbox");
1062
+ f5.put("keyName", "notifyTypes");
1063
+ f5.put("label", "通知方式");
1064
+ f5.put("defaultValue", new ArrayList<>());
1065
+ f5.put("colspan", 2);
1066
+ List<Map<String, Object>> f5Items = new ArrayList<>();
1067
+ Map<String, Object> f5Item1 = new HashMap<>();
1068
+ f5Item1.put("label", "短信");
1069
+ f5Item1.put("value", "SMS");
1070
+ f5Items.add(f5Item1);
1071
+ Map<String, Object> f5Item2 = new HashMap<>();
1072
+ f5Item2.put("label", "邮件");
1073
+ f5Item2.put("value", "EMAIL");
1074
+ f5Items.add(f5Item2);
1075
+ f5.put("optionItems", f5Items);
1076
+ fields.add(f5);
1077
+
1078
+ // ========== 6. 下拉选项 select(表单脚本加载选项) ==========
1079
+ Map<String, Object> f6 = new HashMap<>();
1080
+ f6.put("type", "select");
1081
+ f6.put("keyName", "payType");
1082
+ f6.put("label", "付款方式");
1083
+ f6.put("required", true);
1084
+ f6.put("colspan", 1);
1085
+ Map<String, Object> f6Opt = new HashMap<>();
1086
+ f6Opt.put("formScriptEnabled", true);
1087
+ f6Opt.put("commonAttributeEnabled", false);
1088
+ f6Opt.put("formScriptCode", "payTypeList");
1089
+ f6Opt.put("labelKey", "label");
1090
+ f6Opt.put("valueKey", "value");
1091
+ // formScriptParam 为前端 JS 脚本字符串,非 Java
1092
+ f6Opt.put("formScriptParam", "return { billType: this.formModel.billType }");
1093
+ f6Opt.put("clearable", true);
1094
+ f6Opt.put("filterable", true);
1095
+ f6.put("options", f6Opt);
1096
+ fields.add(f6);
1097
+
1098
+ // ========== 6b. 下拉选项 select(系统词汇) ==========
1099
+ Map<String, Object> f6b = new HashMap<>();
1100
+ f6b.put("type", "select");
1101
+ f6b.put("keyName", "orderStatus");
1102
+ f6b.put("label", "订单状态");
1103
+ f6b.put("defaultValue", "1");
1104
+ f6b.put("colspan", 1);
1105
+ Map<String, Object> f6bOpt = new HashMap<>();
1106
+ f6bOpt.put("formScriptEnabled", false);
1107
+ f6bOpt.put("commonAttributeEnabled", true);
1108
+ f6bOpt.put("commonAttributeCode", "ORDER_STATUS");
1109
+ f6bOpt.put("labelKey", "value");
1110
+ f6bOpt.put("valueKey", "sn");
1111
+ f6b.put("options", f6bOpt);
1112
+ fields.add(f6b);
1113
+
1114
+ // ========== 7. 日期 date ==========
1115
+ Map<String, Object> f7 = new HashMap<>();
1116
+ f7.put("type", "date");
1117
+ f7.put("keyName", "orderDate");
1118
+ f7.put("label", "订单日期");
1119
+ f7.put("colspan", 1);
1120
+ Map<String, Object> f7Opt = new HashMap<>();
1121
+ f7Opt.put("type", "date");
1122
+ f7Opt.put("format", "yyyy-MM-dd");
1123
+ f7Opt.put("valueFormat", "yyyy-MM-dd");
1124
+ f7Opt.put("clearable", true);
1125
+ f7.put("options", f7Opt);
1126
+ fields.add(f7);
1127
+
1128
+ // ========== 8. 文本 text(只读展示) ==========
1129
+ Map<String, Object> f8 = new HashMap<>();
1130
+ f8.put("type", "text");
1131
+ f8.put("keyName", "createByName");
1132
+ f8.put("label", "创建人");
1133
+ f8.put("colspan", 1);
1134
+ Map<String, Object> f8Opt = new HashMap<>();
1135
+ f8Opt.put("colorClass", "");
1136
+ f8.put("utcTransformEnabled", false);
1137
+ f8.put("options", f8Opt);
1138
+ fields.add(f8);
1139
+
1140
+ // ========== 9. 凭证 vabUpload ==========
1141
+ Map<String, Object> f9 = new HashMap<>();
1142
+ f9.put("type", "vabUpload");
1143
+ f9.put("keyName", "attachments");
1144
+ f9.put("label", "附件");
1145
+ f9.put("colspan", 2);
1146
+ Map<String, Object> f9Opt = new HashMap<>();
1147
+ f9Opt.put("limit", 10);
1148
+ f9Opt.put("entityTableCode", "PO_ORDER");
1149
+ f9Opt.put("entityTableDesc", "采购订单");
1150
+ f9Opt.put("hideRemoveButton", false);
1151
+ f9Opt.put("showFileSize", true);
1152
+ f9Opt.put("formScriptCode", "getList");
1153
+ f9.put("options", f9Opt);
1154
+ fields.add(f9);
1155
+
1156
+ // ========== 10. 搜索框 vabsearch ==========
1157
+ Map<String, Object> f10 = new HashMap<>();
1158
+ f10.put("type", "vabsearch");
1159
+ f10.put("keyName", "supplierCode");
1160
+ f10.put("label", "供应商");
1161
+ f10.put("required", true);
1162
+ f10.put("colspan", 1);
1163
+ Map<String, Object> f10Opt = new HashMap<>();
1164
+ f10Opt.put("vabSearchName", "supplierName");
1165
+ f10Opt.put("readonly", true);
1166
+ f10Opt.put("multipleChoices", false);
1167
+ Map<String, Object> f10Dialog = new HashMap<>();
1168
+ f10Dialog.put("formCode", "SUPPLIER_LIST");
1169
+ f10Dialog.put("valueSourceField", "supplierCode");
1170
+ f10Dialog.put("labelSourceField", "supplierName");
1171
+ f10Dialog.put("multipleChoices", false);
1172
+ f10Opt.put("searchDialogConfig", f10Dialog);
1173
+ f10.put("options", f10Opt);
1174
+ fields.add(f10);
1175
+
1176
+ // ========== 11. 状态 status(静态 statusParam + 颜色) ==========
1177
+ Map<String, Object> f11 = new HashMap<>();
1178
+ f11.put("type", "status");
1179
+ f11.put("keyName", "wfStatus");
1180
+ f11.put("label", "流程状态");
1181
+ f11.put("defaultValue", "1");
1182
+ f11.put("colspan", 1);
1183
+ Map<String, Object> f11Opt = new HashMap<>();
1184
+ f11Opt.put("formScriptEnabled", false);
1185
+ f11Opt.put("commonAttributeEnabled", false);
1186
+ f11Opt.put("optionItemValueType", 0);
1187
+ f11Opt.put("labelKey", "label");
1188
+ f11Opt.put("valueKey", "value");
1189
+ List<Map<String, Object>> f11Status = new ArrayList<>();
1190
+ Map<String, Object> s1 = new HashMap<>();
1191
+ s1.put("label", "草稿");
1192
+ s1.put("value", "1");
1193
+ s1.put("type", "info");
1194
+ f11Status.add(s1);
1195
+ Map<String, Object> s2 = new HashMap<>();
1196
+ s2.put("label", "已提交");
1197
+ s2.put("value", "2");
1198
+ s2.put("type", "warning");
1199
+ f11Status.add(s2);
1200
+ Map<String, Object> s3 = new HashMap<>();
1201
+ s3.put("label", "已审核");
1202
+ s3.put("value", "3");
1203
+ s3.put("type", "success");
1204
+ f11Status.add(s3);
1205
+ f11Opt.put("statusParam", f11Status);
1206
+ f11.put("options", f11Opt);
1207
+ fields.add(f11);
1208
+
1209
+ return fields;
1210
+ ```
1211
+
1212
+ ### 5.3 附属脚本:下拉选项 payTypeList
1213
+
1214
+ 字段定义里 `formScriptCode: "payTypeList"` 时,控件初始化会**二次请求**该脚本。
1215
+
1216
+ ```java
1217
+ import java.util.ArrayList;
1218
+ import java.util.HashMap;
1219
+ import java.util.List;
1220
+ import java.util.Map;
1221
+
1222
+ // 请求 taBm = payType,data 含 formScriptParam 脚本返回的参数
1223
+ List<Map<String, Object>> list = new ArrayList<>();
1224
+
1225
+ Map<String, Object> item1 = new HashMap<>();
1226
+ item1.put("label", "现金");
1227
+ item1.put("value", "CASH");
1228
+ list.add(item1);
1229
+
1230
+ Map<String, Object> item2 = new HashMap<>();
1231
+ item2.put("label", "银行转账");
1232
+ item2.put("value", "TRANSFER");
1233
+ list.add(item2);
1234
+
1235
+ Map<String, Object> item3 = new HashMap<>();
1236
+ item3.put("label", "承兑汇票");
1237
+ item3.put("value", "ACCEPT");
1238
+ list.add(item3);
1239
+
1240
+ return list;
1241
+ ```
1242
+
1243
+ ### 5.4 附属脚本:凭证 getList
1244
+
1245
+ 字段 `attachments` 在编辑态(有 dataId)时,通过 `formScriptCode: "getList"` 加载历史附件。
1246
+
1247
+ ```java
1248
+ import java.util.ArrayList;
1249
+ import java.util.HashMap;
1250
+ import java.util.List;
1251
+ import java.util.Map;
1252
+
1253
+ // 请求 data.id = 单据主键
1254
+ List<Map<String, Object>> files = new ArrayList<>();
1255
+
1256
+ Map<String, Object> file1 = new HashMap<>();
1257
+ file1.put("id", "file001");
1258
+ file1.put("fileName", "合同.pdf");
1259
+ file1.put("fileUrl", "https://xxx/contract.pdf");
1260
+ file1.put("fileSize", 102400);
1261
+ file1.put("createBy", "张三");
1262
+ file1.put("createDate", "2026-06-15 10:00:00");
1263
+ files.add(file1);
1264
+
1265
+ return files;
1266
+ ```
1267
+
1268
+ ### 5.5 按业务条件动态裁剪字段
1269
+
1270
+ ```java
1271
+ import java.util.ArrayList;
1272
+ import java.util.HashMap;
1273
+ import java.util.List;
1274
+ import java.util.Map;
1275
+
1276
+ List<Map<String, Object>> fields = new ArrayList<>();
1277
+
1278
+ Map<String, Object> formData = (Map<String, Object>) data.get("formData");
1279
+ String billType = formData != null ? String.valueOf(formData.get("billType")) : "";
1280
+
1281
+ // 所有单据都有合同编号
1282
+ Map<String, Object> contractNo = new HashMap<>();
1283
+ contractNo.put("type", "input");
1284
+ contractNo.put("keyName", "contractNo");
1285
+ contractNo.put("label", "合同编号");
1286
+ contractNo.put("required", true);
1287
+ contractNo.put("colspan", 1);
1288
+ fields.add(contractNo);
1289
+
1290
+ // 仅采购单显示供应商搜索框
1291
+ if ("PO".equals(billType)) {
1292
+ Map<String, Object> supplier = new HashMap<>();
1293
+ supplier.put("type", "vabsearch");
1294
+ supplier.put("keyName", "supplierCode");
1295
+ supplier.put("label", "供应商");
1296
+ supplier.put("colspan", 1);
1297
+ Map<String, Object> opt = new HashMap<>();
1298
+ opt.put("vabSearchName", "supplierName");
1299
+ Map<String, Object> dialog = new HashMap<>();
1300
+ dialog.put("formCode", "SUPPLIER_LIST");
1301
+ dialog.put("valueSourceField", "supplierCode");
1302
+ dialog.put("labelSourceField", "supplierName");
1303
+ opt.put("searchDialogConfig", dialog);
1304
+ supplier.put("options", opt);
1305
+ fields.add(supplier);
1306
+ }
1307
+
1308
+ return fields;
1309
+ ```
1310
+
1311
+ ### 5.6 使用前替换占位
1312
+
1313
+ | 占位 | 说明 |
1314
+ |------|------|
1315
+ | `getDynamicSchemaFields` | table 容器「脚本编码」 |
1316
+ | `payTypeList` | 下拉选项二次请求脚本 |
1317
+ | `ORDER_STATUS` | 系统词汇编码 |
1318
+ | `SUPPLIER_LIST` | 搜索弹框表单编码 |
1319
+ | `PO_ORDER` | 凭证 entityTableCode |
1320
+ | 各字段 `keyName` | 与 formModel / 保存接口字段一致 |
1321
+
1322
+ 联调建议:先返回 `input` + `select`(静态 optionItems) 两列验证通路,再逐步放开其余类型。
1323
+
1324
+ ---
1325
+
1326
+ ## 6. 布局说明
1327
+
1328
+ | 容器配置 | 说明 |
1329
+ |---------|------|
1330
+ | `dynamicSchemaColumns` | 每行列数,默认 4 |
1331
+ | `dynamicSchemaMode: append` | 追加到已有行之后 |
1332
+ | `dynamicSchemaMode: replace` | 清空已有行后替换 |
1333
+ | `dynamicSchemaMode: anchor` | 插入到占位锚点行 |
1334
+ | 字段 `colspan` | 占几列,超出自动换行 |
1335
+
1336
+ ---
1337
+
1338
+ ## 7. 注意事项
1339
+
1340
+ 1. **type 必须已注册**:未在设计器字段库中注册的 type 会被跳过。
1341
+ 2. **keyName 唯一**:不要与表单已有字段重复。
1342
+ 3. **动态规则分离**:运行时显隐/必填/只读等规则在「表单设置 → 动态字段规则」配置,不在本 JSON 中动态下发(初始 `hidden/required` 等仍可在定义里设置)。
1343
+ 4. **formScriptParam / dialogQueryParam 等**:均为 JS 脚本字符串,不是 JSON 对象。
1344
+ 5. **选项脚本与词汇互斥**:同一控件只能启用一种选项来源。
1345
+ 6. **凭证仅编辑态加载**:无 `dataId` 时不请求历史附件。
1346
+
1347
+ ---
1348
+
1349
+ ## 8. 相关文件
1350
+
1351
+ | 文件 | 说明 |
1352
+ |------|------|
1353
+ | `form-render/container-item/dynamicFieldMixin.js` | 运行时解析与生成 |
1354
+ | `form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue` | 设计器配置面板 |
1355
+ | `form-designer/widget-panel/widgetsConfig.js` | 各控件默认 schema |
1356
+ | `src/docs/表格动态列后台脚本示例.md` | 同平台 bd_api 脚本写法参考(列定义版) |