@microi.net/cli 5.9.2 → 5.9.4

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 (171) 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/.mcp.json +1 -1
  5. package/.workbuddy-plugin/marketplace.json +2 -2
  6. package/.workbuddy-plugin/plugin.json +1 -1
  7. package/assets/build-meta.json +6 -6
  8. package/cordis.patch.yml +1 -1
  9. package/package.json +1 -1
  10. package/scripts/codex-marketplace.json +20 -20
  11. package/scripts/mcp-codex-stdio-adapter.js +189 -189
  12. package/scripts/mcp-server.js +81 -81
  13. package/scripts/mcp-trae-windows-launcher.cmd +21 -21
  14. package/scripts/microi-cli-mcp.js +7 -7
  15. package/scripts/microi-codex-broker.js +21 -5
  16. package/scripts/microi-codex-router.js +17 -1
  17. package/scripts/microi-skills.meta.json +354 -348
  18. package/skills/.microi-skills-version.json +2 -2
  19. package/skills/.progressive-disclosure-manifest.json +122 -115
  20. package/skills/README.md +287 -287
  21. package/skills/ai-engine/SKILL.md +269 -269
  22. package/skills/ai-engine/references/ai-employees.md +48 -48
  23. package/skills/ai-engine/references/self-hosted-digital-human.md +59 -59
  24. package/skills/ai-platform-governance/SKILL.md +177 -177
  25. package/skills/ai-platform-governance/references/progressive-01-/345/212/237/350/203/275/345/274/200/345/205/263.md +190 -190
  26. package/skills/app-store/SKILL.md +525 -525
  27. package/skills/business-blueprint/SKILL.md +193 -193
  28. package/skills/datasource-engine/SKILL.md +93 -93
  29. package/skills/dos-orm/SKILL.md +101 -95
  30. package/skills/dos-orm/references/api-reference.md +229 -229
  31. package/skills/email-engine/SKILL.md +81 -81
  32. package/skills/email-engine/references/v8-email.md +34 -34
  33. package/skills/job-engine/SKILL.md +176 -176
  34. package/skills/message-notification/SKILL.md +156 -156
  35. package/skills/message-notification/references/contracts.md +102 -102
  36. package/skills/microi/SKILL.md +14 -14
  37. package/skills/microi-ai-application/SKILL.md +115 -115
  38. package/skills/microi-ai-application/references/frontend-baseline.md +164 -164
  39. package/skills/microi-client-frontend/SKILL.md +242 -242
  40. 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 -144
  41. 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 +196 -196
  42. 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 +167 -167
  43. package/skills/microi-codex-installer/SKILL.md +231 -231
  44. package/skills/microi-datasource-mapping/SKILL.md +122 -122
  45. package/skills/microi-db-schema/SKILL.md +175 -175
  46. package/skills/microi-db-schema/references/core-tables.md +695 -695
  47. package/skills/microi-db-schema/references/form-component-options.md +256 -256
  48. package/skills/microi-db-schema/references/schema-overview.md +202 -202
  49. package/skills/microi-db-schema/references/schema.md +646 -646
  50. package/skills/microi-db-schema/references/table-catalog.md +1599 -1599
  51. package/skills/microi-deployment/SKILL.md +239 -220
  52. package/skills/microi-deployment/references/deployment-matrix.md +109 -109
  53. package/skills/microi-docs-coverage/SKILL.md +133 -133
  54. package/skills/microi-docs-coverage/references/capability-map.md +90 -90
  55. package/skills/microi-form-engine/SKILL.md +338 -333
  56. package/skills/microi-form-engine/references/component-catalog.md +218 -218
  57. package/skills/microi-form-engine/references/data-source-events.md +124 -124
  58. package/skills/microi-frontend-sdk/SKILL.md +194 -194
  59. 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 +176 -176
  60. package/skills/microi-left-right-layout/SKILL.md +141 -141
  61. package/skills/microi-microservice/SKILL.md +332 -328
  62. package/skills/microi-microservice/references/runtime-delivery.md +282 -278
  63. package/skills/microi-mobile-app-quality/SKILL.md +203 -203
  64. 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 +227 -227
  65. 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 +129 -129
  66. package/skills/microi-solution-quotation/SKILL.md +78 -78
  67. package/skills/microi-sso/SKILL.md +95 -91
  68. package/skills/microi-sso/references/acceptance.md +51 -49
  69. package/skills/microi-sso/references/configuration-and-security.md +53 -53
  70. package/skills/microi-sso/references/inbound.md +53 -53
  71. package/skills/microi-sso/references/outbound.md +43 -39
  72. package/skills/microi-ui/SKILL.md +192 -192
  73. 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 -183
  74. package/skills/microi-uniapp-frontend/SKILL.md +206 -204
  75. 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 +261 -261
  76. 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 -154
  77. package/skills/module-engine/SKILL.md +255 -255
  78. package/skills/module-engine/references/module-config.md +204 -204
  79. package/skills/ocr-engine/SKILL.md +113 -113
  80. package/skills/page-engine/SKILL.md +206 -206
  81. 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 -234
  82. 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 -60
  83. package/skills/performance-testing/SKILL.md +227 -221
  84. package/skills/playwright-e2e/SKILL.md +197 -196
  85. 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 -173
  86. 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 -183
  87. package/skills/playwright-e2e/references/progressive-03-microi-helper-/346/250/241/346/235/277.md +221 -221
  88. package/skills/playwright-e2e/references/progressive-04-ci-/345/273/272/350/256/256.md +115 -115
  89. package/skills/print-engine/SKILL.md +259 -259
  90. package/skills/production-readonly-audit/SKILL.md +41 -41
  91. package/skills/report-engine/SKILL.md +71 -71
  92. package/skills/search-engine/SKILL.md +75 -75
  93. package/skills/spider-engine/SKILL.md +190 -190
  94. package/skills/system-observability/SKILL.md +259 -246
  95. package/skills/system-observability/references/memory-incident-triage.md +77 -77
  96. package/skills/translate-engine/SKILL.md +140 -140
  97. package/skills/ui-design/SKILL.md +223 -223
  98. package/skills/ui-design/assets/templates/MCI-DESIGN.md +206 -206
  99. package/skills/ui-design/references/design-pattern-library.md +184 -184
  100. package/skills/ui-design/references/mci-design-contract.md +163 -163
  101. package/skills/ui-design/references/motion-and-media.md +78 -78
  102. package/skills/ui-design/references/product-flow-recipes.md +94 -94
  103. 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 -218
  104. package/skills/ui-design/references/progressive-02-/345/255/227/344/275/223.md +164 -164
  105. 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 -235
  106. 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 -152
  107. 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 -238
  108. 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 -194
  109. 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 -207
  110. 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 -142
  111. package/skills/uniapp-mall-assets/SKILL.md +176 -176
  112. package/skills/unity-integration/SKILL.md +178 -171
  113. package/skills/unity-integration/references/ai-app-delivery.md +119 -119
  114. package/skills/unity-integration/references/sdk-api.md +82 -82
  115. package/skills/unity-integration/references/toolbox-migration.md +66 -66
  116. package/skills/unity-integration/references/webgl-hosting.md +57 -57
  117. package/skills/v8-api-config/SKILL.md +388 -388
  118. package/skills/v8-cache-pattern/SKILL.md +312 -312
  119. package/skills/v8-crud-api/SKILL.md +179 -178
  120. 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 -226
  121. 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 -49
  122. package/skills/v8-debugging/SKILL.md +284 -284
  123. package/skills/v8-explorer-tree/SKILL.md +228 -228
  124. package/skills/v8-export-import/SKILL.md +219 -219
  125. 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 -211
  126. package/skills/v8-export-import/references/progressive-02-powerpoint-/345/257/274/345/207/272.md +202 -202
  127. 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 -42
  128. package/skills/v8-file-upload/SKILL.md +255 -284
  129. package/skills/v8-file-upload/references/cdn-alias-repair.md +13 -0
  130. 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 +263 -263
  131. 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 +161 -161
  132. package/skills/v8-file-upload/references/progressive-03-/347/251/272/347/233/256/345/275/225/346/240/207/350/256/260/344/270/216/350/277/234/347/250/213/344/270/213/350/275/275.md +36 -0
  133. package/skills/v8-formengine-http/SKILL.md +238 -238
  134. package/skills/v8-frontend-events/SKILL.md +180 -180
  135. package/skills/v8-frontend-events/references/bluetooth-print-api.md +135 -135
  136. package/skills/v8-frontend-events/references/bluetooth-print.md +258 -258
  137. package/skills/v8-frontend-events/references/progressive-01-/345/210/227/350/241/250/344/272/213/344/273/266.md +219 -219
  138. package/skills/v8-http-integration/SKILL.md +182 -182
  139. package/skills/v8-http-integration/references/progressive-01-get-/350/257/267/346/261/202.md +220 -220
  140. 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 -44
  141. package/skills/v8-image-processing/SKILL.md +190 -190
  142. package/skills/v8-image-processing/references/api-reference.md +623 -623
  143. package/skills/v8-menu-buttons/SKILL.md +186 -186
  144. package/skills/v8-menu-buttons/references/progressive-01-2-/346/214/211/351/222/256/345/257/271/350/261/241-schema.md +222 -222
  145. 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 +228 -228
  146. 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 -104
  147. package/skills/v8-mongodb/SKILL.md +200 -200
  148. package/skills/v8-mq-mqtt/SKILL.md +178 -176
  149. package/skills/v8-mq-mqtt/references/mqtt-production.md +352 -342
  150. package/skills/v8-mq-mqtt/references/progressive-01-v8-mqtt-iot-/347/211/251/350/201/224/347/275/221.md +181 -181
  151. package/skills/v8-saas-multi-tenant/SKILL.md +305 -305
  152. package/skills/v8-security/SKILL.md +227 -210
  153. package/skills/v8-security/references/progressive-01-2-/346/235/203/351/231/220/346/240/241/351/252/214.md +200 -200
  154. package/skills/v8-security/references/progressive-02-7-/346/227/245/345/277/227/350/256/260/345/275/225.md +160 -160
  155. package/skills/v8-sql-query/SKILL.md +302 -302
  156. package/skills/v8-table-event/SKILL.md +176 -176
  157. 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 -216
  158. 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 -46
  159. package/skills/v8-tcp-integration/SKILL.md +158 -147
  160. package/skills/v8-template-engine/SKILL.md +167 -167
  161. package/skills/v8-utilities/SKILL.md +104 -104
  162. package/skills/v8-utilities/references/client-api-index.md +143 -143
  163. package/skills/v8-utilities/references/platform-http-routes.md +83 -83
  164. package/skills/v8-utilities/references/server-api-index.md +188 -188
  165. package/skills/v8-workflow/SKILL.md +252 -252
  166. 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 -180
  167. package/skills/v8-workflow/references/workflow-configuration.md +49 -49
  168. package/skills/vision-engine/SKILL.md +160 -160
  169. package/skills/vision-engine/references/architecture-and-acceptance.md +194 -194
  170. package/skills/workspace-conventions/SKILL.md +13 -13
  171. 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 +2 -2
@@ -1,219 +1,219 @@
1
- # v8-frontend-events 详细参考 1
2
-
3
- > 按需读取;本文件由 SKILL.md 的原章节无损拆分。
4
-
5
- <!-- microi-progressive:chunk id=v8-frontend-events-006 sha256=b5dc7a887237bb719a26a0d56974d3fc99cb051b88223351742204eb7612b2ef -->
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=72ebf0b52fe19865043c3315ebaab9009e34db5abaf988c81965fce4fa8ae879 -->
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=6811b564f0992b3251578d40ad30ceda68c3c4d2938f413d76e276de4e1a65db -->
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=d5f628b4cdc5b4cc116f60af04742242f5c0411784593338ea13c89e1e90afe5 -->
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=efea9a8791d11e8d51aa2869c92583a451a5f20d93961faf763945458bca60de -->
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 -->
1
+ # v8-frontend-events 详细参考 1
2
+
3
+ > 按需读取;本文件由 SKILL.md 的原章节无损拆分。
4
+
5
+ <!-- microi-progressive:chunk id=v8-frontend-events-006 sha256=b5dc7a887237bb719a26a0d56974d3fc99cb051b88223351742204eb7612b2ef -->
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=72ebf0b52fe19865043c3315ebaab9009e34db5abaf988c81965fce4fa8ae879 -->
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=6811b564f0992b3251578d40ad30ceda68c3c4d2938f413d76e276de4e1a65db -->
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=d5f628b4cdc5b4cc116f60af04742242f5c0411784593338ea13c89e1e90afe5 -->
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=efea9a8791d11e8d51aa2869c92583a451a5f20d93961faf763945458bca60de -->
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 -->