@microi.net/cli 4.9.5 → 4.9.7

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.
Files changed (133) hide show
  1. package/.codebuddy-plugin/marketplace.json +2 -2
  2. package/.codebuddy-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/.workbuddy-plugin/marketplace.json +2 -2
  5. package/.workbuddy-plugin/plugin.json +1 -1
  6. package/README.md +7 -12
  7. package/assets/build-meta.json +6 -5
  8. package/package.json +1 -1
  9. package/scripts/mcp-server.js +83 -83
  10. package/scripts/microi-cli.js +80 -92
  11. package/scripts/microi-codex-broker.js +418 -0
  12. package/scripts/microi-codex-router.js +159 -65
  13. package/scripts/microi-skills.meta.json +349 -190
  14. package/skills/.microi-skills-version.json +2 -2
  15. package/skills/.progressive-disclosure-manifest.json +3566 -0
  16. package/skills/ai-engine/SKILL.md +1 -1
  17. package/skills/ai-platform-governance/SKILL.md +22 -167
  18. package/skills/ai-platform-governance/references/progressive-01-/345/212/237/350/203/275/345/274/200/345/205/263.md +190 -0
  19. package/skills/app-store/SKILL.md +1 -1
  20. package/skills/business-blueprint/SKILL.md +1 -1
  21. package/skills/datasource-engine/SKILL.md +1 -1
  22. package/skills/dos-orm/SKILL.md +1 -1
  23. package/skills/job-engine/SKILL.md +1 -1
  24. package/skills/message-notification/SKILL.md +1 -1
  25. package/skills/microi-ai-application/SKILL.md +1 -1
  26. package/skills/microi-client-frontend/SKILL.md +18 -435
  27. package/skills/microi-client-frontend/references/progressive-01-3-/345/212/250/346/200/201/346/214/211/351/222/256/347/263/273/347/273/237.md +144 -0
  28. package/skills/microi-client-frontend/references/progressive-02-8-/350/277/220/350/241/214/346/227/266/351/253/230/351/242/221/345/235/221/345/244/215/347/233/230.md +178 -0
  29. package/skills/microi-client-frontend/references/progressive-03-vue3-/345/211/215/347/253/257/345/276/256/346/234/215/345/212/241/345/256/277/344/270/273/350/247/204/345/210/231.md +144 -0
  30. package/skills/microi-codex/SKILL.md +4 -4
  31. package/skills/microi-codex-installer/SKILL.md +25 -36
  32. package/skills/microi-datasource-mapping/SKILL.md +1 -1
  33. package/skills/microi-db-schema/SKILL.md +4 -4
  34. package/skills/microi-db-schema/references/schema-overview.md +1 -1
  35. package/skills/microi-db-schema/references/schema.md +1 -1
  36. package/skills/microi-db-schema/references/table-catalog.md +1 -1
  37. package/skills/microi-deployment/SKILL.md +1 -1
  38. package/skills/microi-docs-coverage/SKILL.md +1 -1
  39. package/skills/microi-form-engine/SKILL.md +2 -2
  40. package/skills/microi-form-layout/SKILL.md +20 -226
  41. package/skills/microi-form-layout/references/progressive-01-3-/344/270/211/347/247/215/345/210/206/347/273/204/347/232/204/345/255/230/345/202/250/344/270/216/351/205/215/347/275/256.md +235 -0
  42. package/skills/microi-frontend-sdk/SKILL.md +18 -152
  43. package/skills/microi-frontend-sdk/references/progressive-01-token-/345/275/223/345/211/215/347/231/273/345/275/225/347/224/250/346/210/267/344/270/216/345/275/223/345/211/215/347/273/210/347/253/257/347/231/273/345/275/225/345/215/217/350/256/256.md +171 -0
  44. package/skills/microi-left-right-layout/SKILL.md +1 -1
  45. package/skills/microi-microservice/SKILL.md +8 -1
  46. package/skills/microi-microservice/references/runtime-delivery.md +4 -0
  47. package/skills/microi-mobile-app-quality/SKILL.md +23 -289
  48. package/skills/microi-mobile-app-quality/references/progressive-01-4-/351/207/215/350/246/201/346/214/211/351/222/256/345/277/205/351/241/273/345/270/246/345/233/276/346/240/207.md +209 -0
  49. package/skills/microi-mobile-app-quality/references/progressive-02-9-/344/270/273/351/242/230/345/210/207/346/215/242/345/277/205/351/241/273/347/234/237/345/256/236/344/270/224/345/205/250/345/261/200/347/224/237/346/225/210.md +117 -0
  50. package/skills/microi-solution-quotation/SKILL.md +1 -1
  51. package/skills/microi-system-delivery/SKILL.md +17 -381
  52. package/skills/microi-system-delivery/references/progressive-01-/346/240/207/345/207/206/345/267/245/344/275/234/346/265/201.md +186 -0
  53. package/skills/microi-system-delivery/references/progressive-02-/350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/345/277/205/351/241/273/350/246/206/347/233/226/347/232/204/345/235/221.md +210 -0
  54. package/skills/microi-ui/SKILL.md +20 -170
  55. package/skills/microi-ui/references/progressive-01-/347/247/273/345/212/250/347/253/257/345/234/272/346/231/257/350/223/235/345/233/276.md +183 -0
  56. package/skills/microi-uniapp-frontend/SKILL.md +27 -336
  57. package/skills/microi-uniapp-frontend/references/progressive-01-/347/247/273/345/212/250/347/253/257/345/210/206/347/261/273-/345/217/214/346/240/217/345/210/227/350/241/250/347/213/254/347/253/213/346/273/232/345/212/250.md +225 -0
  58. package/skills/microi-uniapp-frontend/references/progressive-02-/345/205/263/351/224/256/344/270/232/345/212/241/350/265/204/344/272/247/344/270/215/345/276/227/351/273/230/350/256/244/351/200/211/344/270/255.md +154 -0
  59. package/skills/module-engine/SKILL.md +1 -1
  60. package/skills/ocr-engine/SKILL.md +1 -1
  61. package/skills/page-engine/SKILL.md +24 -272
  62. package/skills/page-engine/references/progressive-01-/346/211/200/346/234/211/347/273/204/344/273/266/347/261/273/345/236/213.md +234 -0
  63. package/skills/page-engine/references/progressive-02-/347/211/210/346/234/254/345/216/206/345/217/262-/345/271/266/345/217/221/344/277/235/345/255/230/344/270/216/345/233/236/346/273/232.md +60 -0
  64. package/skills/performance-testing/SKILL.md +1 -1
  65. package/skills/playwright-e2e/SKILL.md +25 -591
  66. package/skills/playwright-e2e/references/progressive-01-/345/205/250/350/207/252/345/212/250/347/231/273/345/275/225-/345/205/215/351/252/214/350/257/201/347/240/201-/344/275/206/344/270/215/345/205/215/345/257/206/347/240/201-/345/277/205/350/257/273.md +173 -0
  67. package/skills/playwright-e2e/references/progressive-02-/346/226/207/345/255/227/345/257/271/346/257/224/345/272/246/344/270/216/345/217/257/350/257/273/346/200/247/350/207/252/345/212/250/345/214/226/346/243/200/346/237/245-/345/277/205/345/201/232.md +183 -0
  68. package/skills/playwright-e2e/references/progressive-03-microi-helper-/346/250/241/346/235/277.md +221 -0
  69. package/skills/playwright-e2e/references/progressive-04-ci-/345/273/272/350/256/256.md +69 -0
  70. package/skills/print-engine/SKILL.md +1 -1
  71. package/skills/production-readonly-audit/SKILL.md +1 -1
  72. package/skills/report-engine/SKILL.md +1 -1
  73. package/skills/scripts/optimize-progressive-disclosure.mjs +204 -0
  74. package/skills/scripts/refresh-progressive-disclosure.mjs +64 -0
  75. package/skills/scripts/validate-progressive-disclosure.mjs +52 -0
  76. package/skills/search-engine/SKILL.md +1 -1
  77. package/skills/spider-engine/SKILL.md +1 -1
  78. package/skills/translate-engine/SKILL.md +1 -1
  79. package/skills/ui-design/SKILL.md +27 -1462
  80. package/skills/ui-design/references/progressive-01-/351/242/234/350/211/262/344/275/223/347/263/273-css-variables-/346/224/257/346/214/201/344/270/273/351/242/230/345/210/207/346/215/242.md +218 -0
  81. package/skills/ui-design/references/progressive-02-/345/255/227/344/275/223.md +155 -0
  82. package/skills/ui-design/references/progressive-03-/345/212/250/346/225/210/350/247/204/350/214/203-/344/270/260/345/257/214/344/275/206/344/270/215/345/215/241.md +235 -0
  83. package/skills/ui-design/references/progressive-04-/347/273/204/344/273/266/351/243/216/346/240/274/351/200/237/346/237/245.md +152 -0
  84. package/skills/ui-design/references/progressive-05-/347/247/273/345/212/250/347/253/257/344/270/223/347/224/250/350/247/204/350/214/203.md +238 -0
  85. package/skills/ui-design/references/progressive-06-/344/270/273/351/242/230/345/210/207/346/215/242/345/256/236/347/216/260.md +194 -0
  86. package/skills/ui-design/references/progressive-07-/351/200/237/346/237/245-/344/273/216/345/244/264/346/220/255/345/273/272/344/270/200/344/270/252/347/247/273/345/212/250/347/253/257/351/241/265/351/235/242.md +207 -0
  87. package/skills/ui-design/references/progressive-08-/350/241/250/345/215/225/345/210/206/347/273/204/350/247/204/350/214/203-tabs-vs-collapsegroup-/345/274/272/345/210/266.md +142 -0
  88. package/skills/uniapp-mall-assets/SKILL.md +1 -1
  89. package/skills/unity-integration/SKILL.md +1 -1
  90. package/skills/v8-api-config/SKILL.md +1 -1
  91. package/skills/v8-cache-pattern/SKILL.md +1 -1
  92. package/skills/v8-crud-api/SKILL.md +21 -246
  93. package/skills/v8-crud-api/references/progressive-01-/346/237/245/350/257/242/345/210/227/350/241/250-/345/210/206/351/241/265.md +226 -0
  94. package/skills/v8-crud-api/references/progressive-02-where-/346/235/241/344/273/266/350/257/255/346/263/225/351/200/237/346/237/245.md +49 -0
  95. package/skills/v8-debugging/SKILL.md +1 -1
  96. package/skills/v8-explorer-tree/SKILL.md +1 -1
  97. package/skills/v8-export-import/SKILL.md +16 -426
  98. package/skills/v8-export-import/references/progressive-01-excellayout-/351/253/230/347/272/247/350/207/252/347/224/261/345/270/203/345/261/200.md +211 -0
  99. package/skills/v8-export-import/references/progressive-02-powerpoint-/345/257/274/345/207/272.md +202 -0
  100. package/skills/v8-export-import/references/progressive-03-/345/256/211/345/205/250-/346/200/247/350/203/275/346/263/250/346/204/217.md +42 -0
  101. package/skills/v8-file-upload/SKILL.md +17 -355
  102. package/skills/v8-file-upload/references/progressive-01-/345/205/254/346/234/211/346/241/266-vs-/347/247/201/346/234/211/346/241/266.md +227 -0
  103. package/skills/v8-file-upload/references/progressive-02-office-/346/226/207/344/273/266/345/234/250/347/272/277/347/274/226/350/276/221/347/211/210/346/234/254/345/217/267/350/247/204/345/210/231.md +149 -0
  104. package/skills/v8-formengine-http/SKILL.md +1 -1
  105. package/skills/v8-frontend-events/SKILL.md +20 -206
  106. package/skills/v8-frontend-events/references/progressive-01-/345/210/227/350/241/250/344/272/213/344/273/266.md +219 -0
  107. package/skills/v8-http-integration/SKILL.md +15 -237
  108. package/skills/v8-http-integration/references/progressive-01-get-/350/257/267/346/261/202.md +220 -0
  109. package/skills/v8-http-integration/references/progressive-02-/351/224/231/350/257/257/345/244/204/347/220/206/346/250/241/345/274/217.md +44 -0
  110. package/skills/v8-image-processing/SKILL.md +1 -1
  111. package/skills/v8-menu-buttons/SKILL.md +16 -512
  112. package/skills/v8-menu-buttons/references/progressive-01-2-/346/214/211/351/222/256/345/257/271/350/261/241-schema.md +221 -0
  113. package/skills/v8-menu-buttons/references/progressive-02-8-/346/250/241/345/274/217-f-/345/220/216/345/217/260/344/273/273/345/212/241/346/214/211/351/222/256-/351/225/277/344/273/273/345/212/241.md +224 -0
  114. package/skills/v8-menu-buttons/references/progressive-03-10-/345/217/215/346/250/241/345/274/217-/351/201/277/345/205/215.md +104 -0
  115. package/skills/v8-mongodb/SKILL.md +1 -1
  116. package/skills/v8-mq-mqtt/SKILL.md +12 -176
  117. package/skills/v8-mq-mqtt/references/progressive-01-v8-mqtt-iot-/347/211/251/350/201/224/347/275/221.md +181 -0
  118. package/skills/v8-saas-multi-tenant/SKILL.md +1 -1
  119. package/skills/v8-security/SKILL.md +17 -330
  120. package/skills/v8-security/references/progressive-01-2-/346/235/203/351/231/220/346/240/241/351/252/214.md +199 -0
  121. package/skills/v8-security/references/progressive-02-7-/346/227/245/345/277/227/350/256/260/345/275/225.md +158 -0
  122. package/skills/v8-sql-query/SKILL.md +1 -1
  123. package/skills/v8-table-event/SKILL.md +17 -237
  124. package/skills/v8-table-event/references/progressive-01-informv8-js-/350/241/250/345/215/225/346/211/223/345/274/200/344/272/213/344/273/266.md +216 -0
  125. package/skills/v8-table-event/references/progressive-02-/345/211/215/347/253/257/344/272/213/344/273/266/345/220/215-v8-eventname-/345/217/257/350/203/275/347/232/204/345/200/274.md +46 -0
  126. package/skills/v8-template-engine/SKILL.md +1 -1
  127. package/skills/v8-utilities/SKILL.md +1 -1
  128. package/skills/v8-workflow/SKILL.md +20 -161
  129. package/skills/v8-workflow/references/progressive-01-/350/212/202/347/202/271/345/274/200/345/247/213-v8-/344/272/213/344/273/266.md +180 -0
  130. package/skills/workspace-conventions/SKILL.md +36 -369
  131. package/skills/workspace-conventions/references/progressive-01-/347/211/210/346/234/254/346/233/264/346/226/260/346/227/245/345/277/227/344/277/235/346/212/244/350/247/204/345/210/231-/345/274/272/345/210/266.md +208 -0
  132. package/skills/workspace-conventions/references/progressive-02-microi-net-api-/346/234/254/345/234/260/345/220/257/345/212/250/347/272/246/345/256/232.md +196 -0
  133. package/skills/workspace-conventions/references/progressive-03-cli-/344/270/216-ide-/346/217/222/344/273/266/351/224/231/347/211/210/345/205/261/345/255/230/347/272/246/345/256/232.md +27 -0
@@ -3,7 +3,7 @@ name: v8-frontend-events
3
3
  description: Microi 前端 V8 事件与客户端能力指南。用于编写浏览器端字段、按钮、列表事件,或使用 V8.EventName、V8.Form、V8.Print 蓝牙打印(佳博 GP-M322、ZICOX CC4、TSPL、CPCL、ESC/POS、BLE、SPP)、扫码、弹窗、表单联动和界面交互。
4
4
  ---
5
5
 
6
- > **Codex 强制前置:** 当前宿主为 Codex 时,在使用本 Skill 前必须先完整读取 `../microi-codex-installer/SKILL.md`,完成“Codex 每任务最新版硬门禁”;门禁未通过不得继续本 Skill。非 Codex 宿主跳过此项。
6
+ > **Codex 非阻塞自动更新:** 当前宿主为 Codex 时,吾码 CLI、Codex 插件与工作区 AI/MCP 由后台自动更新;需要诊断时读取 `../microi-codex-installer/SKILL.md`。更新失败、等待空闲或尚未重载均不得阻断当前、正在进行或新建任务。非 Codex 宿主跳过此项。
7
7
 
8
8
  # Microi V8 前端事件大全
9
9
 
@@ -13,6 +13,8 @@ description: Microi 前端 V8 事件与客户端能力指南。用于编写浏
13
13
  > **菜单按钮事件**(MoreBtns/FormBtns 等)见 `v8-menu-buttons/SKILL.md`。
14
14
  > 本文重点是 **字段事件、按钮事件、列表事件、模板引擎、其它前端钩子**。
15
15
 
16
+ <!-- microi-progressive:begin -->
17
+ <!-- microi-progressive:chunk id=v8-frontend-events-000 sha256=df2662a9a006d35d989d7ff7316890ffff2c08e422d0e88033f44cdd40210c88 -->
16
18
  ## 能力路由
17
19
 
18
20
  - 查询前端 V8 全部上下文、导航、表单、列表、网络、引擎与工具入口时,读取 `../v8-utilities/references/client-api-index.md`。
@@ -21,6 +23,8 @@ description: Microi 前端 V8 事件与客户端能力指南。用于编写浏
21
23
  - 扫码使用 `V8.Method.ScanCode`,结果从 Promise/回调取得;`V8.ScanCodeRes` 只作兼容结果槽,详见客户端 API 索引。
22
24
  - 登录后的敏感操作使用 `V8.Identity.Verify` 完成 Passkey/严格人脸交互;前端只取得一次性 Ticket,后端接口引擎必须重算 `ActionHash` 并原子消费,不能把前端成功当作授权。
23
25
 
26
+ <!-- /microi-progressive:chunk -->
27
+ <!-- microi-progressive:chunk id=v8-frontend-events-001 sha256=a9f8e1aed64db4b57ff762eb557c0d764b5f703a722dc080d273c4111afe234f -->
24
28
  ## 字段事件(在【字段属性】中配置)
25
29
 
26
30
  ### FieldValueChange — 值变更事件(最常用)
@@ -105,6 +109,8 @@ V8.OpenAnyTable({
105
109
 
106
110
  `ReadOnlyButton` 的产品文案是【禁用插槽按钮】:只控制按钮是否可点击,不等同于字段只读,应保留用于权限和状态控制。
107
111
 
112
+ <!-- /microi-progressive:chunk -->
113
+ <!-- microi-progressive:chunk id=v8-frontend-events-002 sha256=986a67e78b0274941c6f2ab6589b06b8545f8f3261d4972dc56d4061b019d799 -->
108
114
  ## 按钮事件
109
115
 
110
116
  ### V8BtnRun — 按钮点击执行(菜单按钮、表单按钮)
@@ -143,219 +149,20 @@ return V8.Form.Status === '待审核' && V8.CurrentUser.RoleName.indexOf('审批
143
149
  代码在列表可用、进入嵌套表单后会报 `await is only valid in async functions`。回归测试
144
150
  至少覆盖“主表详情 → 定制子表 → 子记录详情”链路中的含 `await` 显隐代码。
145
151
 
146
- ## 列表事件
147
-
148
- ### TableRowClick — 行点击
149
-
150
- ```javascript
151
- // V8.Form === 被点击的行
152
- console.log('点击行:', V8.Form.Id);
153
- // 自定义跳转
154
- V8.OpenAnyForm({ TableName: 'OrderDetail', Id: V8.Form.Id, FormMode: 'View' });
155
- ```
156
-
157
- ### OpenTableBefore — 打开列表前(拦截/初始化筛选)
158
-
159
- ```javascript
160
- // 固定弹出表格的可选数据范围;搜索、高级筛选、分页不会移除此条件
161
- V8.OpenTableSetWhere(V8.Field.CustomerId, [
162
- ['OwnerId', '=', V8.CurrentUser.Id]
163
- ]);
164
- ```
165
-
166
- ### OpenTableSubmit — 列表查询提交前(追加条件)
167
-
168
- ```javascript
169
- // V8.Param 是即将发起查询的参数
170
- V8.Param._Where = V8.Param._Where || [];
171
- V8.Param._Where.push(['DeptId', '=', V8.CurrentUser.DeptId]);
172
- ```
173
-
174
- ### PageTab — 页签切换
175
-
176
- ```javascript
177
- // PageTab:"待办"
178
- V8.SearchSet({ Status: '待办' });
179
- V8.RefreshTable({ _PageIndex: 1 });
180
- ```
181
-
152
+ <!-- /microi-progressive:chunk -->
153
+ <!-- microi-progressive:chunk id=v8-frontend-events-003 sha256=68aab95ab02bfca93b69eaea1c188650cb7ef13f8566bee81a63c660a4437512 -->
182
154
  ## 模板引擎事件
183
155
 
184
156
  `TableTemplateEngine` / `FormTemplateEngine` — 见 `v8-template-engine/SKILL.md`。
185
157
 
158
+ <!-- /microi-progressive:chunk -->
159
+ <!-- microi-progressive:chunk id=v8-frontend-events-004 sha256=2db34699ad5433a8c8b194c9ce9909ed4d420d257dd8c6532238215402499c82 -->
186
160
  ## 工作流事件(前端)
187
161
 
188
162
  `WFNodeEnd` — 流程节点结束后前端通知。详见 `v8-workflow/SKILL.md`。
189
163
 
190
- ## 常用前端 API
191
-
192
- | API | 说明 |
193
- |-----|------|
194
- | `V8.Tips(msg, ok?)` | 浮层提示。`ok=true` 绿色 |
195
- | `V8.ConfirmTips(msg, cb)` | 回调式确认弹窗;内容按 HTML 渲染,只能传可信/已转义文本 |
196
- | `V8.FormSet(field, value)` | 普通表单会触发目标字段 V8;列表上下文只更新当前行/模板 |
197
- | `V8.FieldSet(field, prop, value)` | 设置字段属性;跨上下文只依赖顶层 Visible/Required/Readonly/Data |
198
- | `V8.FormSubmit({CloseForm:true})` | 提交当前表单 |
199
- | `V8.RefreshTable({_PageIndex:1})` | 刷新表格(-1 保持当前页) |
200
- | `V8.SearchSet({field: value})` | 设置筛选条件 |
201
- | `V8.OpenAnyForm({...})` | 打开任意表单(弹窗/抽屉) |
202
- | `V8.OpenAnyTable({...})` | 打开任意列表 |
203
- | `V8.OpenDialog({...})` | 打开自定义弹窗 |
204
- | `V8.OpenAppDialog({...})` | 按 AppKey 打开已发布在线微服务页面,支持 Dialog/Drawer 与结果回调 |
205
- | `V8.ApiEngine.Run({ApiEngineKey, ...})` | 调接口引擎(前端,参数对象格式) |
206
- | `V8.FormEngine.GetTableData(name, params, cb)` | 前端查列表(参数对象、回调或 await) |
207
- | `V8.Post(url, data, cb, errCb, headers, contentType)` | 通用 POST |
208
- | `V8.Method.ScanCode({...})` | 调用当前终端支持的扫码能力 |
209
- | `V8.Print.isConnected()` | 检查当前 BLE 写特征或 Android SPP Socket 是否仍可用 |
210
- | `V8.Print.OpenBluetoothPage()` | 在用户手势中打开蓝牙连接页,返回 Promise |
211
- | `V8.Print.reconnect()` | 使用已记住的设备授权或设备 ID 尝试重连 |
212
- | `V8.Print.getConnectionState()` | 获取连接、设备、传输、型号、指令、记忆和错误状态快照 |
213
- | `V8.Print.subscribeConnection(listener)` | 订阅应用级共享连接状态,返回取消订阅函数 |
214
- | `V8.Print.getPrinterProfile()` | 查看自动识别或手工选择后的型号配置 |
215
- | `V8.Print.setPrinterProfile(mode)` | 广播名无法识别时选 `zicox-cc4` 等型号;旧业务通常不调用 |
216
- | `V8.Print.prepareSend(bytes)` | 按型号适配后串行分包发送 TSPL、CPCL 或 ESC/POS,必须 `await` |
217
-
218
- `V8.OpenAnyForm` 只发起打开动作,不返回“用户关闭后的 Promise”。需要替换
219
- 子表单保存时,通过 `EventReplace.Submit(v8, param, callback)` 注册提交替换;
220
- 其中小写 `v8` 是子表单上下文,外层 `V8` 仍是父上下文。自定义提交结束后
221
- 必须调用 `callback(DosResult)`,否则子表单会一直等待。
222
-
223
- ### 蓝牙打印最小安全流程
224
-
225
- ```javascript
226
- if (!V8.Print) {
227
- V8.Tips('当前客户端未加载蓝牙打印能力', false);
228
- return;
229
- }
230
-
231
- if (!V8.Print.isConnected()) {
232
- var connected = await V8.Print.OpenBluetoothPage();
233
- if (!connected || !V8.Print.isConnected()) return;
234
- }
235
-
236
- var command = V8.Print.createNew(); // 同一 TSC 调用:GP-M322 原 TSPL,CC4 自动转 CPCL
237
- command.setSize(60, 40);
238
- command.setGap(2);
239
- command.setCls();
240
- command.setText(20, 20, 'TSS24.BF2', 1, 1, '测试标签');
241
- command.setPagePrint();
242
-
243
- try {
244
- await V8.Print.prepareSend(command.getData());
245
- V8.Tips('打印数据已发送', true);
246
- } catch (error) {
247
- V8.Tips('发送失败:' + (error.message || error), false);
248
- }
249
- ```
250
-
251
- PC/平板顶部导航与移动端【我的】页共用同一个应用级 `V8.Print` 实例,用户可先在全局入口连接,再进入任意模块打印。佳博 GP-M322 路径必须保持原 TSPL 字节不变;ZICOX CC4 只转换有明确 CPCL 等价语义的高层 TSC 调用,不支持的命令必须在首包写入前失败,禁止盲目透传乱码。Android 5+App 的 CC4 可在 BLE 失败时使用已配对 SPP,Web 端不能使用经典蓝牙。
252
-
253
- `prepareSend` 内部会把不同 V8 上下文排入同一发送队列;成功只证明字节已经写入 BLE 特征或 SPP 输出流,不代表打印机已走纸、无缺纸或无硬件故障。批量打印仍应逐条 `await`,不得用固定 `setTimeout` 猜测完成时间,也不要用 `Promise.all` 表达同一设备的并行打印。完整挂载范围、双型号连接、协议映射、批量恢复、安全与硬件验收见 `references/bluetooth-print.md`;源码级 TSC/ESC/CPCL 方法表见 `references/bluetooth-print-api.md`。
254
-
255
- ### 常用上下文差异
256
-
257
- | 变量 | 可用范围 |
258
- |------|----------|
259
- | `V8.OldForm` | 普通表单已加载旧数据后可用;服务端提交前/后事件也可用 |
260
- | `V8.OldValue` | 仅表格行内字段值变更可靠提供 |
261
- | `V8.Event` | 插槽按钮等显式传原生事件的场景;键盘事件使用 `V8.KeyCode` |
262
- | `V8.Row/Rows/RowIndex` | 表格行事件 |
263
- | `V8.TableRowSelected/SelectedData` | 列表批量按钮,互为兼容别名 |
264
- | `V8.SearchParam` | 列表 `{Keyword, Where}` 搜索快照 |
265
- | `V8.SysMenuModel` | 列表/菜单按钮 |
266
- | `V8.DataAppend` | 打开表单、列表、弹窗时传入的附加数据 |
267
-
268
- ### 在线微服务弹窗 V8.OpenAppDialog
269
-
270
- 复杂定制页面使用 `V8.OpenAppDialog`,不要在 V8 事件中内嵌大量 HTML/CSS:
271
-
272
- ```js
273
- V8.OpenAppDialog({
274
- AppKey: 'customer_profile_editor', // 必传:sys_microiservice.MsKey
275
- RoutePath: '/edit', // 可选,默认 /
276
- Version: '', // 可选,空值自动使用当前 BuildVersion
277
- Title: '编辑客户资料',
278
- TitleIcon: 'fas fa-user-edit',
279
- Width: 'min(920px, calc(100vw - 32px))',
280
- OpenType: 'Dialog', // Dialog / Drawer
281
- Data: { id: V8.Form.Id }, // 子应用 dialogData,只放普通数据
282
- OnSuccess: function (data) {
283
- V8.RefreshTable({ _PageIndex: -1 });
284
- },
285
- OnCancel: function (data) {},
286
- OnError: function (error) {
287
- V8.Tips(error.message || '加载失败', false);
288
- }
289
- });
290
- ```
291
-
292
- 子应用用 `window.microApp.getData()` 获取自动下发的 `apiBase`、`osClient`、`token`、`appKey`、`version`、`microRoute`、`dialog` 和 `dialogData`;用 `window.microApp.dispatch({type:'app-dialog:success', data:{...}})` 返回成功结果。完整参数表和结果协议见 `v8-menu-buttons/SKILL.md`。
293
-
294
- ### ConfirmTips 的 HTML 安全边界
295
-
296
- `V8.ConfirmTips` 当前是 callback API,且内容使用 HTML 模式渲染。只传固定文案或经过 HTML 转义的简单展示;严禁直接拼接用户输入、接口消息、数据库富文本和不可信 URL。三个以上字段、上传、表格、Tab、步骤条、代码编辑器或需要复用的页面必须使用 `V8.OpenAppDialog`。
297
-
298
- ## 前端 FormEngine 菜单上下文与兼容授权
299
-
300
- 前端 V8 不需要为每个历史项目手工补 `_SysMenuId`。新版 PC 表单引擎通过作用域 FormEngine facade 透明处理菜单上下文:
301
-
302
- - V8 调用的目标表就是当前菜单绑定表时,facade 自动注入真实 `_SysMenuId`;如果业务代码已经显式传入 `_SysMenuId` 或兼容的 `ModuleEngineKey`,平台保留显式值,由后端做严格精确校验。
303
- - V8 查询其它表时,不得把当前主表菜单 Id 带给目标表。facade 保持无菜单,由后端根据当前登录用户有效角色可访问的 `sys_menu` 缓存推断该目标表及当前操作权限。
304
- - 历史 V8 的对象参数、`表名 + 参数`、Promise、回调、批量参数等调用形式继续兼容。业务代码不得自行伪造角色、菜单或 `_TrustedServerInvocation`。
305
- - 平台敏感表仍对普通客户端硬拒绝;Import/Export 仍必须携带目标模块的真实菜单上下文及专项权限,不能依赖无菜单推断。
306
- - 菜单配置的 `SqlWhere`、`SqlJoin` / `JoinTables` 由后端追加到真实查询。前端追加 `_Where` 只能进一步缩小结果,不能扩大或覆盖服务端数据范围。
307
- - 标准 `TableChild` 自动携带内部 `_TableChildAuth` 关系提示。服务端仍会重载父/子表、菜单和字段配置,校验父记录范围并强制子表外键;业务 V8 禁止构造、缓存、跨父记录复用该对象。
308
-
309
- ```javascript
310
- // 假设当前菜单绑定 Customer:平台 facade 自动注入真实菜单,无需历史 V8 手工改造
311
- var current = await V8.FormEngine.GetFormData('Customer', { Id: V8.Form.Id });
312
-
313
- // 跨表:不要传当前表的菜单 Id;后端按用户对 Product 的菜单授权推断
314
- var products = await V8.FormEngine.GetTableData('Product', {
315
- _Where: [['Status', '=', 1]],
316
- _PageSize: 20
317
- });
318
- ```
319
-
320
- 后端接口引擎和后端表单 V8 不是浏览器调用链:平台只在服务端内部构造参数时写入 `_TrustedServerInvocation`,所以它们调用 `V8.FormEngine` 不要求 `_SysMenuId`。该标记不能从浏览器 JSON、URL 或表单参数获得,前端 V8 也不得尝试设置。
321
-
322
- ### 前端 FormEngine 方法矩阵
323
-
324
- 前端 facade 当前公开 `GetFormData`、`GetFormDataAnonymous`、`GetTableData`、`GetTableTree`、`AddFormData`、`AddFormDataBatch`、`UptFormData`、`UptFormDataBatch`、`UptFormDataByWhere`、`DelFormData`、`DelFormDataBatch`、`DelFormDataByWhere`。全部返回 Promise,并兼容可选 callback。
325
-
326
- 前端没有 `GetTableDataCount`、`GetTableDataTree`(前端名称是 `GetTableTree`)、`AddTableData`、`UptTableData`、`DelTableData`、`AddField`。Import/Export 是独立端点与专项菜单权限,也不是 facade 方法。
327
-
328
- ## 异步写法(async/await vs 回调)
329
-
330
- ```javascript
331
- // ✅ 推荐 async/await
332
- var r = await V8.FormEngine.GetTableData('Product', { _PageSize: 10 });
333
- if (r.Code === 1) { /* ... */ }
334
-
335
- // ✅ 也可回调式
336
- V8.FormEngine.GetTableData('Product', { _PageSize: 10 }, function(r) {
337
- if (r.Code === 1) { /* ... */ }
338
- });
339
- ```
340
-
341
- ## 死循环陷阱
342
-
343
- ❌ **禁止** 在 `SubmitFormV8.js` 里调用 `V8.FormSubmit()` —— 会无限递归
344
- ⚠️ **避免** 在 `FieldValueChange` 里 `V8.FormSet(同字段)` —— 前端会阻止同步直接重入,但异步回写或多字段互相赋值仍可能形成循环;需要静默赋值时使用 `V8.Form.字段名 = value`
345
- ❌ **禁止** 在 `InFormV8.js` 里写大量同步 `V8.FormEngine.Get*` —— 阻塞渲染
346
-
347
- ### 下拉框对象赋值
348
-
349
- ```javascript
350
- // 会更新下拉选项并触发 SelectUser 的值变更 V8。
351
- // 对象至少包含 SelectSaveField、SelectLabel 对应的属性;字段事件需要的其它属性也要传入。
352
- V8.FormSet('SelectUser', { Id: 'u1', Name: '张三', DeptId: 'd1' });
353
-
354
- // 响应式静默赋值:界面会更新,但不触发目标字段 V8,
355
- // 也不会执行 FormSet 的修改字段记录、模板通知等处理。
356
- V8.Form.SelectUser = { Id: 'u1', Name: '张三', DeptId: 'd1' };
357
- ```
358
-
164
+ <!-- /microi-progressive:chunk -->
165
+ <!-- microi-progressive:chunk id=v8-frontend-events-005 sha256=e7f73123dfc00720f60c49705e91854b6f18cb0506a115a6078481dc37aed41c -->
359
166
  ## 设计模式保护(CRITICAL)
360
167
 
361
168
  ```javascript
@@ -363,3 +170,10 @@ V8.Form.SelectUser = { Id: 'u1', Name: '张三', DeptId: 'd1' };
363
170
  if (V8.LoadMode === 'Design') return;
364
171
  ```
365
172
  否则在【表单设计器】中编辑字段时,事件会被误触发,可能弹提示、报错或触发副作用。
173
+ <!-- /microi-progressive:chunk -->
174
+ ## 详细参考路由(渐进披露)
175
+
176
+ 仅在当前任务涉及对应主题时读取;下列文件合计保留了原 SKILL.md 的全部详细知识。
177
+
178
+ - [references/progressive-01-列表事件.md](references/progressive-01-列表事件.md):列表事件;常用前端 API;前端 FormEngine 菜单上下文与兼容授权;异步写法(async/await vs 回调);死循环陷阱
179
+ <!-- microi-progressive:end -->
@@ -0,0 +1,219 @@
1
+ # v8-frontend-events 详细参考 1
2
+
3
+ > 按需读取;本文件由 SKILL.md 的原章节无损拆分。
4
+
5
+ <!-- microi-progressive:chunk id=v8-frontend-events-006 sha256=f9b273e42b9bf94893ecef53797876a373ad92d46f421c90c603c52259bbd2d2 -->
6
+ ## 列表事件
7
+
8
+ ### TableRowClick — 行点击
9
+
10
+ ```javascript
11
+ // V8.Form === 被点击的行
12
+ console.log('点击行:', V8.Form.Id);
13
+ // 自定义跳转
14
+ V8.OpenAnyForm({ TableName: 'OrderDetail', Id: V8.Form.Id, FormMode: 'View' });
15
+ ```
16
+
17
+ ### OpenTableBefore — 打开列表前(拦截/初始化筛选)
18
+
19
+ ```javascript
20
+ // 固定弹出表格的可选数据范围;搜索、高级筛选、分页不会移除此条件
21
+ V8.OpenTableSetWhere(V8.Field.CustomerId, [
22
+ ['OwnerId', '=', V8.CurrentUser.Id]
23
+ ]);
24
+ ```
25
+
26
+ ### OpenTableSubmit — 列表查询提交前(追加条件)
27
+
28
+ ```javascript
29
+ // V8.Param 是即将发起查询的参数
30
+ V8.Param._Where = V8.Param._Where || [];
31
+ V8.Param._Where.push(['DeptId', '=', V8.CurrentUser.DeptId]);
32
+ ```
33
+
34
+ ### PageTab — 页签切换
35
+
36
+ ```javascript
37
+ // PageTab:"待办"
38
+ V8.SearchSet({ Status: '待办' });
39
+ V8.RefreshTable({ _PageIndex: 1 });
40
+ ```
41
+
42
+ <!-- /microi-progressive:chunk -->
43
+ <!-- microi-progressive:chunk id=v8-frontend-events-007 sha256=3a8ad420eed127357a6b5e799792325bc5c152ff8607722a7dc96c252fae0da2 -->
44
+ ## 常用前端 API
45
+
46
+ | API | 说明 |
47
+ |-----|------|
48
+ | `V8.Tips(msg, ok?)` | 浮层提示。`ok=true` 绿色 |
49
+ | `V8.ConfirmTips(msg, cb)` | 回调式确认弹窗;内容按 HTML 渲染,只能传可信/已转义文本 |
50
+ | `V8.FormSet(field, value)` | 普通表单会触发目标字段 V8;列表上下文只更新当前行/模板 |
51
+ | `V8.FieldSet(field, prop, value)` | 设置字段属性;跨上下文只依赖顶层 Visible/Required/Readonly/Data |
52
+ | `V8.FormSubmit({CloseForm:true})` | 提交当前表单 |
53
+ | `V8.RefreshTable({_PageIndex:1})` | 刷新表格(-1 保持当前页) |
54
+ | `V8.SearchSet({field: value})` | 设置筛选条件 |
55
+ | `V8.OpenAnyForm({...})` | 打开任意表单(弹窗/抽屉) |
56
+ | `V8.OpenAnyTable({...})` | 打开任意列表 |
57
+ | `V8.OpenDialog({...})` | 打开自定义弹窗 |
58
+ | `V8.OpenAppDialog({...})` | 按 AppKey 打开已发布在线微服务页面,支持 Dialog/Drawer 与结果回调 |
59
+ | `V8.ApiEngine.Run({ApiEngineKey, ...})` | 调接口引擎(前端,参数对象格式) |
60
+ | `V8.FormEngine.GetTableData(name, params, cb)` | 前端查列表(参数对象、回调或 await) |
61
+ | `V8.Post(url, data, cb, errCb, headers, contentType)` | 通用 POST |
62
+ | `V8.Method.ScanCode({...})` | 调用当前终端支持的扫码能力 |
63
+ | `V8.Print.isConnected()` | 检查当前 BLE 写特征或 Android SPP Socket 是否仍可用 |
64
+ | `V8.Print.OpenBluetoothPage()` | 在用户手势中打开蓝牙连接页,返回 Promise |
65
+ | `V8.Print.reconnect()` | 使用已记住的设备授权或设备 ID 尝试重连 |
66
+ | `V8.Print.getConnectionState()` | 获取连接、设备、传输、型号、指令、记忆和错误状态快照 |
67
+ | `V8.Print.subscribeConnection(listener)` | 订阅应用级共享连接状态,返回取消订阅函数 |
68
+ | `V8.Print.getPrinterProfile()` | 查看自动识别或手工选择后的型号配置 |
69
+ | `V8.Print.setPrinterProfile(mode)` | 广播名无法识别时选 `zicox-cc4` 等型号;旧业务通常不调用 |
70
+ | `V8.Print.prepareSend(bytes)` | 按型号适配后串行分包发送 TSPL、CPCL 或 ESC/POS,必须 `await` |
71
+
72
+ `V8.OpenAnyForm` 只发起打开动作,不返回“用户关闭后的 Promise”。需要替换
73
+ 子表单保存时,通过 `EventReplace.Submit(v8, param, callback)` 注册提交替换;
74
+ 其中小写 `v8` 是子表单上下文,外层 `V8` 仍是父上下文。自定义提交结束后
75
+ 必须调用 `callback(DosResult)`,否则子表单会一直等待。
76
+
77
+ ### 蓝牙打印最小安全流程
78
+
79
+ ```javascript
80
+ if (!V8.Print) {
81
+ V8.Tips('当前客户端未加载蓝牙打印能力', false);
82
+ return;
83
+ }
84
+
85
+ if (!V8.Print.isConnected()) {
86
+ var connected = await V8.Print.OpenBluetoothPage();
87
+ if (!connected || !V8.Print.isConnected()) return;
88
+ }
89
+
90
+ var command = V8.Print.createNew(); // 同一 TSC 调用:GP-M322 原 TSPL,CC4 自动转 CPCL
91
+ command.setSize(60, 40);
92
+ command.setGap(2);
93
+ command.setCls();
94
+ command.setText(20, 20, 'TSS24.BF2', 1, 1, '测试标签');
95
+ command.setPagePrint();
96
+
97
+ try {
98
+ await V8.Print.prepareSend(command.getData());
99
+ V8.Tips('打印数据已发送', true);
100
+ } catch (error) {
101
+ V8.Tips('发送失败:' + (error.message || error), false);
102
+ }
103
+ ```
104
+
105
+ PC/平板顶部导航与移动端【我的】页共用同一个应用级 `V8.Print` 实例,用户可先在全局入口连接,再进入任意模块打印。佳博 GP-M322 路径必须保持原 TSPL 字节不变;ZICOX CC4 只转换有明确 CPCL 等价语义的高层 TSC 调用,不支持的命令必须在首包写入前失败,禁止盲目透传乱码。Android 5+App 的 CC4 可在 BLE 失败时使用已配对 SPP,Web 端不能使用经典蓝牙。
106
+
107
+ `prepareSend` 内部会把不同 V8 上下文排入同一发送队列;成功只证明字节已经写入 BLE 特征或 SPP 输出流,不代表打印机已走纸、无缺纸或无硬件故障。批量打印仍应逐条 `await`,不得用固定 `setTimeout` 猜测完成时间,也不要用 `Promise.all` 表达同一设备的并行打印。完整挂载范围、双型号连接、协议映射、批量恢复、安全与硬件验收见 `references/bluetooth-print.md`;源码级 TSC/ESC/CPCL 方法表见 `references/bluetooth-print-api.md`。
108
+
109
+ ### 常用上下文差异
110
+
111
+ | 变量 | 可用范围 |
112
+ |------|----------|
113
+ | `V8.OldForm` | 普通表单已加载旧数据后可用;服务端提交前/后事件也可用 |
114
+ | `V8.OldValue` | 仅表格行内字段值变更可靠提供 |
115
+ | `V8.Event` | 插槽按钮等显式传原生事件的场景;键盘事件使用 `V8.KeyCode` |
116
+ | `V8.Row/Rows/RowIndex` | 表格行事件 |
117
+ | `V8.TableRowSelected/SelectedData` | 列表批量按钮,互为兼容别名 |
118
+ | `V8.SearchParam` | 列表 `{Keyword, Where}` 搜索快照 |
119
+ | `V8.SysMenuModel` | 列表/菜单按钮 |
120
+ | `V8.DataAppend` | 打开表单、列表、弹窗时传入的附加数据 |
121
+
122
+ ### 在线微服务弹窗 V8.OpenAppDialog
123
+
124
+ 复杂定制页面使用 `V8.OpenAppDialog`,不要在 V8 事件中内嵌大量 HTML/CSS:
125
+
126
+ ```js
127
+ V8.OpenAppDialog({
128
+ AppKey: 'customer_profile_editor', // 必传:sys_microiservice.MsKey
129
+ RoutePath: '/edit', // 可选,默认 /
130
+ Version: '', // 可选,空值自动使用当前 BuildVersion
131
+ Title: '编辑客户资料',
132
+ TitleIcon: 'fas fa-user-edit',
133
+ Width: 'min(920px, calc(100vw - 32px))',
134
+ OpenType: 'Dialog', // Dialog / Drawer
135
+ Data: { id: V8.Form.Id }, // 子应用 dialogData,只放普通数据
136
+ OnSuccess: function (data) {
137
+ V8.RefreshTable({ _PageIndex: -1 });
138
+ },
139
+ OnCancel: function (data) {},
140
+ OnError: function (error) {
141
+ V8.Tips(error.message || '加载失败', false);
142
+ }
143
+ });
144
+ ```
145
+
146
+ 子应用用 `window.microApp.getData()` 获取自动下发的 `apiBase`、`osClient`、`token`、`appKey`、`version`、`microRoute`、`dialog` 和 `dialogData`;用 `window.microApp.dispatch({type:'app-dialog:success', data:{...}})` 返回成功结果。完整参数表和结果协议见 `v8-menu-buttons/SKILL.md`。
147
+
148
+ ### ConfirmTips 的 HTML 安全边界
149
+
150
+ `V8.ConfirmTips` 当前是 callback API,且内容使用 HTML 模式渲染。只传固定文案或经过 HTML 转义的简单展示;严禁直接拼接用户输入、接口消息、数据库富文本和不可信 URL。三个以上字段、上传、表格、Tab、步骤条、代码编辑器或需要复用的页面必须使用 `V8.OpenAppDialog`。
151
+
152
+ <!-- /microi-progressive:chunk -->
153
+ <!-- microi-progressive:chunk id=v8-frontend-events-008 sha256=eebeb0230087c0deb368baac02bd39bb4b5aa054ed19d9aa43be9447f8ef1d6d -->
154
+ ## 前端 FormEngine 菜单上下文与兼容授权
155
+
156
+ 前端 V8 不需要为每个历史项目手工补 `_SysMenuId`。新版 PC 表单引擎通过作用域 FormEngine facade 透明处理菜单上下文:
157
+
158
+ - V8 调用的目标表就是当前菜单绑定表时,facade 自动注入真实 `_SysMenuId`;如果业务代码已经显式传入 `_SysMenuId` 或兼容的 `ModuleEngineKey`,平台保留显式值,由后端做严格精确校验。
159
+ - V8 查询其它表时,不得把当前主表菜单 Id 带给目标表。facade 保持无菜单,由后端根据当前登录用户有效角色可访问的 `sys_menu` 缓存推断该目标表及当前操作权限。
160
+ - 历史 V8 的对象参数、`表名 + 参数`、Promise、回调、批量参数等调用形式继续兼容。业务代码不得自行伪造角色、菜单或 `_TrustedServerInvocation`。
161
+ - 平台敏感表仍对普通客户端硬拒绝;Import/Export 仍必须携带目标模块的真实菜单上下文及专项权限,不能依赖无菜单推断。
162
+ - 菜单配置的 `SqlWhere`、`SqlJoin` / `JoinTables` 由后端追加到真实查询。前端追加 `_Where` 只能进一步缩小结果,不能扩大或覆盖服务端数据范围。
163
+ - 标准 `TableChild` 自动携带内部 `_TableChildAuth` 关系提示。服务端仍会重载父/子表、菜单和字段配置,校验父记录范围并强制子表外键;业务 V8 禁止构造、缓存、跨父记录复用该对象。
164
+
165
+ ```javascript
166
+ // 假设当前菜单绑定 Customer:平台 facade 自动注入真实菜单,无需历史 V8 手工改造
167
+ var current = await V8.FormEngine.GetFormData('Customer', { Id: V8.Form.Id });
168
+
169
+ // 跨表:不要传当前表的菜单 Id;后端按用户对 Product 的菜单授权推断
170
+ var products = await V8.FormEngine.GetTableData('Product', {
171
+ _Where: [['Status', '=', 1]],
172
+ _PageSize: 20
173
+ });
174
+ ```
175
+
176
+ 后端接口引擎和后端表单 V8 不是浏览器调用链:平台只在服务端内部构造参数时写入 `_TrustedServerInvocation`,所以它们调用 `V8.FormEngine` 不要求 `_SysMenuId`。该标记不能从浏览器 JSON、URL 或表单参数获得,前端 V8 也不得尝试设置。
177
+
178
+ ### 前端 FormEngine 方法矩阵
179
+
180
+ 前端 facade 当前公开 `GetFormData`、`GetFormDataAnonymous`、`GetTableData`、`GetTableTree`、`AddFormData`、`AddFormDataBatch`、`UptFormData`、`UptFormDataBatch`、`UptFormDataByWhere`、`DelFormData`、`DelFormDataBatch`、`DelFormDataByWhere`。全部返回 Promise,并兼容可选 callback。
181
+
182
+ 前端没有 `GetTableDataCount`、`GetTableDataTree`(前端名称是 `GetTableTree`)、`AddTableData`、`UptTableData`、`DelTableData`、`AddField`。Import/Export 是独立端点与专项菜单权限,也不是 facade 方法。
183
+
184
+ <!-- /microi-progressive:chunk -->
185
+ <!-- microi-progressive:chunk id=v8-frontend-events-009 sha256=5e83f07a0fbcebf1eb02f3af5aa58936b3d1c3d19b0a6a0b1a0f14c66fcd6177 -->
186
+ ## 异步写法(async/await vs 回调)
187
+
188
+ ```javascript
189
+ // ✅ 推荐 async/await
190
+ var r = await V8.FormEngine.GetTableData('Product', { _PageSize: 10 });
191
+ if (r.Code === 1) { /* ... */ }
192
+
193
+ // ✅ 也可回调式
194
+ V8.FormEngine.GetTableData('Product', { _PageSize: 10 }, function(r) {
195
+ if (r.Code === 1) { /* ... */ }
196
+ });
197
+ ```
198
+
199
+ <!-- /microi-progressive:chunk -->
200
+ <!-- microi-progressive:chunk id=v8-frontend-events-010 sha256=3ca077a857ffc9f58c7290e26c7e106c0e882897b1b9b669c66b4fe7615c3821 -->
201
+ ## 死循环陷阱
202
+
203
+ ❌ **禁止** 在 `SubmitFormV8.js` 里调用 `V8.FormSubmit()` —— 会无限递归
204
+ ⚠️ **避免** 在 `FieldValueChange` 里 `V8.FormSet(同字段)` —— 前端会阻止同步直接重入,但异步回写或多字段互相赋值仍可能形成循环;需要静默赋值时使用 `V8.Form.字段名 = value`
205
+ ❌ **禁止** 在 `InFormV8.js` 里写大量同步 `V8.FormEngine.Get*` —— 阻塞渲染
206
+
207
+ ### 下拉框对象赋值
208
+
209
+ ```javascript
210
+ // 会更新下拉选项并触发 SelectUser 的值变更 V8。
211
+ // 对象至少包含 SelectSaveField、SelectLabel 对应的属性;字段事件需要的其它属性也要传入。
212
+ V8.FormSet('SelectUser', { Id: 'u1', Name: '张三', DeptId: 'd1' });
213
+
214
+ // 响应式静默赋值:界面会更新,但不触发目标字段 V8,
215
+ // 也不会执行 FormSet 的修改字段记录、模板通知等处理。
216
+ V8.Form.SelectUser = { Id: 'u1', Name: '张三', DeptId: 'd1' };
217
+ ```
218
+
219
+ <!-- /microi-progressive:chunk -->