@gct-paas/excel 0.1.40-beta.3 → 0.1.40-beta.30

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 (228) hide show
  1. package/README.md +3 -4
  2. package/dist/{BaseComponent-B9o59n-h.js → BaseComponent-EzX32ZdY.js} +2 -2
  3. package/dist/{VueVideoPlayer-CAWYWBHi.js → VueVideoPlayer-BuuQaqyI.js} +2 -2
  4. package/dist/{align-editor-a4DQt4Un.js → align-editor-DWHHVeY1.js} +1 -1
  5. package/dist/{barcode-design-CBqUEPYu.js → barcode-design-B0WcJSEI.js} +2 -2
  6. package/dist/base/index.es.js +742 -306
  7. package/dist/{diagonal-design-u23896Ky.js → diagonal-design-D6uOJZmP.js} +2 -2
  8. package/dist/{dynamic-table-action-BWI4Gaqi.js → dynamic-table-action-D-ub6KoK.js} +1316 -502
  9. package/dist/{dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-BvrrN6te.js → dynamic-table-action.vue_vue_type_style_index_0_scoped_8710052f_lang-BCLE4joQ.js} +3076 -1680
  10. package/dist/{edit.utils-CXmmCnxE-XxpC8ALV.js → edit.utils-CXmmCnxE-CXdATd1V.js} +1 -1
  11. package/dist/excel.css +6292 -5112
  12. package/dist/{exceljs.min-DfbB110X.js → exceljs.min-BXhhaToT.js} +2 -2
  13. package/dist/{font-editor-BtSCLMrM.js → font-editor-_HTdKFX6.js} +3 -3
  14. package/dist/{image-design-CtE-Lw7N.js → image-design-4Ee8rZqa.js} +3 -8
  15. package/dist/{index-I1r5pfu5.js → index-7AmrbQlC.js} +2 -2
  16. package/dist/{index-IVc1dOet.js → index-8ZnBcx1k.js} +6 -5
  17. package/dist/{index-CYLAVQfT.js → index-B4LuUmbW.js} +2 -2
  18. package/dist/{index-BFg5eUdY.js → index-BCCIwSnM.js} +1 -1
  19. package/dist/{index-BMoz_QhA.js → index-BHJxBByd.js} +1 -1
  20. package/dist/{index-Bc61F6Hm.js → index-BLf1U1A9.js} +5 -7
  21. package/dist/{index-DVEe11uM.js → index-BYq7x5n6.js} +1 -1
  22. package/dist/{index-BfBuxgcp.js → index-B_DPnVrC.js} +2 -2
  23. package/dist/{index-CL9K9orM.js → index-Bbyb-owd.js} +6 -3
  24. package/dist/{index-3WwCV4xR.js → index-BlMiHVOC.js} +1 -1
  25. package/dist/{index-BKXb3VJc.js → index-BnOOLcX1.js} +2 -2
  26. package/dist/{index-B0cdcIWq.js → index-Bnt54Sc6.js} +2 -2
  27. package/dist/{index-Dyomjz3y.js → index-CH_C9ijO.js} +2 -2
  28. package/dist/{index-aNV9T6LI.js → index-CMdXdyvs.js} +2 -2
  29. package/dist/{index-CdHVHaxO.js → index-CQ0_Kx1_.js} +2 -2
  30. package/dist/{index-DdWefZMa.js → index-Cb7Fh_E2.js} +2 -2
  31. package/dist/{index-Bnb70qEi.js → index-CtVFTmHZ.js} +3 -3
  32. package/dist/{index-CPTGioxl.js → index-D3KiKYMR.js} +1 -1
  33. package/dist/{index-BRQkrFQ9.js → index-D87CVHA-.js} +2 -2
  34. package/dist/{index-BGAcYDx-.js → index-DM0OEvdI.js} +1 -1
  35. package/dist/{index-Ca9TLzUh.js → index-DPTR_QJn.js} +1 -1
  36. package/dist/{index-CAdDeEzJ.js → index-DVzaxa5k.js} +2 -2
  37. package/dist/{index-BP-LhXXV.js → index-DcXbL-0o.js} +6 -5
  38. package/dist/{index-CIa37rQm.js → index-Dn0qfALy.js} +3 -2
  39. package/dist/{index-CVsoaxTR.js → index-Dnz3YPDV.js} +2 -2
  40. package/dist/{index-BC8hQ4vo.js → index-DoWp9uDw.js} +2 -2
  41. package/dist/{index-CeEhYXl9.js → index-Dstr-PNj.js} +2 -2
  42. package/dist/{index-9S48hpoJ.js → index-DzqaKW6e.js} +2 -2
  43. package/dist/{index-ixQwAcB1.js → index-GoAXo3fT.js} +37707 -30077
  44. package/dist/{index-731OYkrc.js → index-Jy2tofdo.js} +3 -3
  45. package/dist/{index-7aS5L4ot.js → index-KRo2-iQv.js} +6 -3
  46. package/dist/{index-CpPk8P3L.js → index-KuhYPy5i.js} +1 -1
  47. package/dist/{index-DNj0vFvx.js → index-YlEOHde0.js} +1 -1
  48. package/dist/{index-51LtNdZ2.js → index-toqlO_-B.js} +1 -1
  49. package/dist/index.es.js +50 -46
  50. package/dist/{online-form-model-select.vue_vue_type_script_setup_true_name_online-form-model-select_lang-CRyGHP7k.js → online-form-model-select.vue_vue_type_script_setup_true_name_online-form-model-select_lang-DAAF0eOB.js} +33 -3
  51. package/dist/{pagination-design-CmbsdlMe.js → pagination-design-DANnqQdI.js} +2 -2
  52. package/dist/paper-widget-design-BrE7Bb4V.js +4 -0
  53. package/dist/{print-runtime-instance-DQysbz5n.js → print-runtime-instance-PabaORE2.js} +1 -1
  54. package/dist/{print-snapshot-renderer-DWHjMsOC.js → print-snapshot-renderer-DQr2G7Hv.js} +3 -3
  55. package/dist/{qrcode-design-CX0_2mLC.js → qrcode-design-BEA1JchI.js} +1 -1
  56. package/dist/{revo-grid.entry-DbmWFi7p.js → revo-grid.entry-Bj-4xHie.js} +1 -1
  57. package/dist/{revogr-attribution_7.entry-BWQDu7fq.js → revogr-attribution_7.entry-NvaozwYj.js} +3 -3
  58. package/dist/{revogr-clipboard_3.entry-BtTYHFZi.js → revogr-clipboard_3.entry-CkRbECsx.js} +2 -2
  59. package/dist/{revogr-data_4.entry-CWPXyZ7g.js → revogr-data_4.entry-Dbbd8Mpz.js} +2 -2
  60. package/dist/{revogr-filter-panel.entry-5gYct0XI.js → revogr-filter-panel.entry-lcMbXUNb.js} +1 -1
  61. package/dist/seal-design-CX-ZxOn3.js +4 -0
  62. package/dist/{serialnumber-design-aSqL4gX6.js → serialnumber-design-B608oYcy.js} +1 -1
  63. package/dist/shared/index.es.js +30 -27
  64. package/dist/{single-field-drop-C67wLHxK.js → single-field-drop-CkUP3H7u.js} +2 -3
  65. package/dist/{size-editor-BHGTPLir.js → size-editor-Bl-lUcdU.js} +1 -1
  66. package/dist/src/adapter/adapter.d.ts +1 -1
  67. package/dist/src/adapter/index.d.ts +2 -0
  68. package/dist/src/adapter/web/inventory-scan-columns.d.ts +6 -0
  69. package/dist/src/{nocode-web-render/src/render/sub-table/material-balance/mb-web-render.d.ts → adapter/web/material-balance-render.d.ts} +1 -1
  70. package/dist/src/{nocode-web-render/src/render/sub-table/material-balance → adapter/web}/material-consume-modal.vue.d.ts +1 -1
  71. package/dist/src/adapter/web/material-consume-render.d.ts +25 -0
  72. package/dist/src/{nocode-web-render/src/render/common → adapter/web}/open-util.d.ts +1 -1
  73. package/dist/src/{nocode-web-render/src/render/sub-table/stocktake/stocktake-web-render.d.ts → adapter/web/stocktake-render.d.ts} +2 -2
  74. package/dist/src/{nocode-web-render/src/render/sub-table/common → adapter/web}/sub-table-render.d.ts +2 -5
  75. package/dist/src/domain/document-business/business/product-release/profile.d.ts +2 -0
  76. package/dist/src/domain/document-business/business/product-release/service.d.ts +2 -0
  77. package/dist/src/domain/document-business/index.d.ts +2 -0
  78. package/dist/src/domain/document-business/registry.d.ts +2 -0
  79. package/dist/src/domain/document-business/runtime/field-query-runtime.d.ts +4 -0
  80. package/dist/src/domain/document-business/types.d.ts +24 -0
  81. package/dist/src/domain/field/number/product-release-qty-manifest.d.ts +2 -0
  82. package/dist/src/domain/field/query-filter.d.ts +15 -0
  83. package/dist/src/domain/table/business/material/material-balance/profile/fields.d.ts +2 -0
  84. package/dist/src/domain/table/business/material/material-consume/profile/fields.d.ts +2 -0
  85. package/dist/src/domain/table/business/material/material-substitution/profile/field-keys.d.ts +25 -10
  86. package/dist/src/domain/table/business/material/material-substitution/runtime/row-change-handlers.d.ts +4 -0
  87. package/dist/src/domain/table/business/material/material-substitution/runtime/select-loaders.d.ts +8 -0
  88. package/dist/src/domain/table/business/preprocess/pretreatment-list/profile/field-keys.d.ts +1 -7
  89. package/dist/src/domain/table/business/sterilize/entrust-steril-batch-list/profile/fields.d.ts +2 -0
  90. package/dist/src/domain/table/business/warehouse/shared/autofill-source-labels.d.ts +19 -0
  91. package/dist/src/domain/table/design/autofill-expander.d.ts +2 -0
  92. package/dist/src/domain/table/design/hooks/on-field-attach.d.ts +6 -0
  93. package/dist/src/domain/table/index.d.ts +1 -1
  94. package/dist/src/domain/table/types.d.ts +2 -0
  95. package/dist/src/index.d.ts +2 -0
  96. package/dist/src/nocode-base/src/components/document-sub-table-action/dynamic-table-action.vue.d.ts +0 -2
  97. package/dist/src/nocode-base/src/components/document-sub-table-action/sub-table-action.vue.d.ts +0 -3
  98. package/dist/src/nocode-base/src/components/document-sub-table-action/type.d.ts +0 -4
  99. package/dist/src/nocode-base/src/components/material-consume/types.d.ts +1 -5
  100. package/dist/src/nocode-base/src/core/factory/sub-table-factory.d.ts +2 -0
  101. package/dist/src/nocode-base/src/core/sub-table/allocate-table-core.d.ts +2 -1
  102. package/dist/src/nocode-base/src/core/sub-table/profile-driven-sub-table-core.d.ts +3 -3
  103. package/dist/src/nocode-base/src/core/sub-table/sub-table-core.d.ts +2 -5
  104. package/dist/src/nocode-base/src/hooks/form-model/form-model-controller.d.ts +2 -0
  105. package/dist/src/nocode-base/src/hooks/inspection-module-qty.d.ts +4 -0
  106. package/dist/src/nocode-base/src/hooks/material-consume/bom-validator.d.ts +2 -2
  107. package/dist/src/nocode-base/src/hooks/material-consume/material-consume-table-controller.d.ts +18 -20
  108. package/dist/src/nocode-base/src/hooks/material-consume/mc-render.d.ts +1 -28
  109. package/dist/src/nocode-base/src/hooks/material-consume/tmpl-bom-controller.d.ts +20 -7
  110. package/dist/src/nocode-base/src/hooks/material-consume/types.d.ts +2 -0
  111. package/dist/src/nocode-base/src/hooks/material-consume-object/bom-validator.d.ts +4 -3
  112. package/dist/src/nocode-base/src/hooks/material-consume-object/initialize-autofill.d.ts +19 -0
  113. package/dist/src/nocode-base/src/hooks/material-consume-object/object-validation-controller.d.ts +24 -0
  114. package/dist/src/nocode-base/src/hooks/render-page/initialize-runtime.d.ts +9 -8
  115. package/dist/src/nocode-base/src/hooks/render-page/sterilization-date.d.ts +1 -1
  116. package/dist/src/nocode-base/src/hooks/render-page/types.d.ts +4 -1
  117. package/dist/src/nocode-base/src/hooks/useRenderPageFactory.d.ts +10 -6
  118. package/dist/src/nocode-base/src/hooks/validation/createValidateFactory.d.ts +1 -0
  119. package/dist/src/nocode-base/src/interface/ref-loader.d.ts +12 -1
  120. package/dist/src/nocode-base/src/interface/render.d.ts +4 -1
  121. package/dist/src/nocode-base/src/interface/transform.d.ts +17 -1
  122. package/dist/src/nocode-base/src/runtime/designer-default-values.d.ts +23 -0
  123. package/dist/src/nocode-base/src/runtime/formula-utils.d.ts +2 -0
  124. package/dist/src/nocode-base/src/runtime/multi-sheet-runtime.d.ts +3 -1
  125. package/dist/src/nocode-base/src/runtime/runtime-context.d.ts +4 -0
  126. package/dist/src/nocode-base/src/runtime/runtime-default-value-validation.d.ts +23 -0
  127. package/dist/src/nocode-base/src/runtime/runtime-field-initializer.d.ts +1 -0
  128. package/dist/src/nocode-base/src/runtime/runtime-form-state-store.d.ts +6 -2
  129. package/dist/src/nocode-base/src/runtime/runtime-instance-registry.d.ts +3 -0
  130. package/dist/src/nocode-base/src/runtime/table-row-identity.d.ts +2 -0
  131. package/dist/src/nocode-base/src/types/common/base.d.ts +6 -2
  132. package/dist/src/nocode-base/src/types/render/mc-render.d.ts +2 -15
  133. package/dist/src/nocode-base/src/types/render/sub-table-render.d.ts +5 -11
  134. package/dist/src/online-form/src/views/__cell_widgets__/cell-widget-design.vue.d.ts +2 -0
  135. package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/base-vxe-table.vue.d.ts +1 -1
  136. package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/default-value-rdo-editor.vue.d.ts +4 -4
  137. package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/rdo-table-dropdown.vue.d.ts +3 -3
  138. package/dist/src/online-form/src/views/__cell_widgets__/common/display-fields-editor/display-fields.util.d.ts +2 -2
  139. package/dist/src/online-form/src/views/__cell_widgets__/common/quick-search-editor/quick-search.util.d.ts +8 -0
  140. package/dist/src/online-form/src/views/__cell_widgets__/fake-field/fake-option-select.vue.d.ts +1 -0
  141. package/dist/src/online-form/src/views/designer/constants/index.d.ts +1 -0
  142. package/dist/src/online-form/src/views/designer/conversions/normalize-paper-grid.d.ts +3 -0
  143. package/dist/src/online-form/src/views/designer/hooks/useAllSpreadSheets.d.ts +23 -0
  144. package/dist/src/online-form/src/views/designer/hooks/useSpreadSheet.d.ts +11 -3
  145. package/dist/src/online-form/src/views/designer/modules/base/designer-wrapper.vue.d.ts +1 -0
  146. package/dist/src/{nocode-web-render/src/components/print-fill-background-selector.vue.d.ts → online-form/src/views/designer/modules/duplicate-field-notice.vue.d.ts} +1 -1
  147. package/dist/src/online-form/src/views/designer/modules/panel/panel-data-init-config/object-init/hooks/useObjectInit.d.ts +1 -0
  148. package/dist/src/{nocode-web-render/src/render/parse-rule → online-form/src/views/designer/modules/panel/sub-table/comps}/add-rule-btn.vue.d.ts +1 -1
  149. package/dist/src/online-form/src/views/designer/modules/panel/sub-table/comps/use-dynamic-sub-table-panel.d.ts +6 -0
  150. package/dist/src/online-form/src/views/designer/modules/panel/sub-table/panel-check-table/select-check-ds-modal.vue.d.ts +3 -3
  151. package/dist/src/{nocode-web-render/src/render/sub-table/material-consume/bom-modal.vue.d.ts → online-form/src/views/designer/modules/xlsx-import-summary.vue.d.ts} +7 -7
  152. package/dist/src/online-form/src/views/designer/types/index.d.ts +3 -1
  153. package/dist/src/online-form/src/views/designer/types/sheets.d.ts +2 -0
  154. package/dist/src/online-form/src/views/designer/utils/cell-field-placements.d.ts +12 -0
  155. package/dist/src/online-form/src/views/designer/utils/placed-fields.d.ts +9 -0
  156. package/dist/src/online-form/src/views/designer/utils/template-placed-fields.d.ts +7 -0
  157. package/dist/src/online-form/src/views/designer/utils/xlsx-parser.d.ts +9 -3
  158. package/dist/src/online-form/src/views/render/__components__/_field_/_base_/cell/cell-auto-complete.vue.d.ts +2 -2
  159. package/dist/src/online-form/src/views/render/__components__/_field_/_base_/cell/cell-date-picker.vue.d.ts +2 -2
  160. package/dist/src/online-form/src/views/render/__components__/_field_/_base_/cell/cell-text-input.vue.d.ts +2 -2
  161. package/dist/src/online-form/src/views/render/__components__/_field_/_base_/cell/cell-textarea.vue.d.ts +2 -2
  162. package/dist/src/online-form/src/views/render/__components__/_field_/seal/component/seal-floating-field.vue.d.ts +0 -1
  163. package/dist/src/online-form/src/views/render/__components__/_field_/seal/component/seal-runtime-layer.vue.d.ts +0 -1
  164. package/dist/src/online-form/src/views/render/__components__/_field_/seal/component/use-seal-stamp.d.ts +1 -4
  165. package/dist/src/online-form/src/views/render/__components__/_field_/trace/common/base-vxe-table.vue.d.ts +1 -1
  166. package/dist/src/online-form/src/views/render/__components__/_field_/trace/composables/useReferenceLabel.d.ts +4 -0
  167. package/dist/src/shared/components/ColorPicker/src/ColorPicker.vue.d.ts +1 -1
  168. package/dist/src/shared/components/Signature/logic/index.d.ts +14 -0
  169. package/dist/src/shared/enum/field-type.d.ts +10 -3
  170. package/dist/src/shared/enum/index.d.ts +2 -0
  171. package/dist/src/shared/enum/product-type.d.ts +9 -0
  172. package/dist/src/shared/enum/production-identification.d.ts +19 -0
  173. package/dist/src/{nocode-web-render/src → shared}/hooks/useWebUpload.d.ts +1 -1
  174. package/dist/src/shared/index.d.ts +1 -0
  175. package/dist/src/shared/types/index.d.ts +1 -0
  176. package/dist/src/shared/types/upload.d.ts +11 -0
  177. package/dist/src/shared/utils/cell-wrap.d.ts +9 -0
  178. package/dist/src/shared/utils/grid-size.d.ts +2 -0
  179. package/dist/src/shared/utils/lot2sn.d.ts +14 -1
  180. package/dist/src/shared/utils/query-filter.d.ts +24 -0
  181. package/dist/src/shared/utils/withRequestCache.d.ts +27 -0
  182. package/dist/{sub-table-factory-DTtDvr17.js → sub-table-factory-GzYKYE9t.js} +230 -156
  183. package/dist/{text-design-Dz0Qf2O3.js → text-design-V3TQuLps.js} +5 -4
  184. package/dist/{throttle-Cpk1LoGk-CgtsG2CV.js → throttle-Cpk1LoGk-CFMeLNb-.js} +1 -1
  185. package/dist/{timediff-design-D9JfNqH8.js → timediff-design-DRum3zZt.js} +1 -1
  186. package/dist/{trace-like-wrapper-BXgr0Uv3.js → trace-like-wrapper-D1Gzs1mF.js} +5 -2
  187. package/dist/{value-editor.vue_vue_type_style_index_0_lang-doohzADY.js → value-editor.vue_vue_type_style_index_0_lang-DoOuCca5.js} +2 -2
  188. package/dist/{widget-barcode-XF3nCU9v.js → widget-barcode-CNrl2NxY.js} +4 -4
  189. package/dist/{widget-diagonal-DSym7fks.js → widget-diagonal-CqjD1SwW.js} +3 -4
  190. package/dist/{widget-image-CmjwkVs7.js → widget-image-Xjl5W2Fp.js} +5 -7
  191. package/dist/{widget-line-BX64xVfU.js → widget-line-BUVVnwrU.js} +2 -2
  192. package/dist/{widget-pagination-BV89Lvjt.js → widget-pagination-DjMXWioI.js} +5 -5
  193. package/dist/{widget-power-DoSfQv92.js → widget-power-Dck9H8a9.js} +3 -4
  194. package/dist/{widget-qrcode-UGcRLC56.js → widget-qrcode-Cu8BwE24.js} +3 -3
  195. package/dist/{widget-rangelimit-CUHD__1H.js → widget-rangelimit-DLxebCKf.js} +3 -4
  196. package/dist/{widget-serialnumber-CAkZR5Xl.js → widget-serialnumber-DecFCGS0.js} +1 -1
  197. package/dist/{widget-text-DtYVTThu.js → widget-text-DV3yKKsx.js} +5 -5
  198. package/dist/{widget-timediff-DX_IoCMO.js → widget-timediff-BIwewJ39.js} +2 -2
  199. package/package.json +2 -6
  200. package/dist/AntdIcon-DCIaV352.js +0 -1108
  201. package/dist/index-DeHX7rte.js +0 -4306
  202. package/dist/mb-render-Bs9S9oFn.js +0 -270
  203. package/dist/paper-widget-design-DIhsk1I9.js +0 -4
  204. package/dist/seal-design-BhzgwVju.js +0 -4
  205. package/dist/src/nocode-web-render/src/hooks/index.d.ts +0 -2
  206. package/dist/src/nocode-web-render/src/hooks/userFormPrint.d.ts +0 -15
  207. package/dist/src/nocode-web-render/src/index.d.ts +0 -6
  208. package/dist/src/nocode-web-render/src/logic/index.d.ts +0 -1
  209. package/dist/src/nocode-web-render/src/render/common/index.d.ts +0 -2
  210. package/dist/src/nocode-web-render/src/render/common/modal-manager.d.ts +0 -20
  211. package/dist/src/nocode-web-render/src/render/index.d.ts +0 -10
  212. package/dist/src/nocode-web-render/src/render/parse-rule/index.d.ts +0 -3
  213. package/dist/src/nocode-web-render/src/render/parse-rule/parse-rule-modal.vue.d.ts +0 -15
  214. package/dist/src/nocode-web-render/src/render/sub-table/allocate/allocate-web-render.d.ts +0 -4
  215. package/dist/src/nocode-web-render/src/render/sub-table/allocate/index.d.ts +0 -1
  216. package/dist/src/nocode-web-render/src/render/sub-table/common/multi-rows-modal.vue.d.ts +0 -15
  217. package/dist/src/nocode-web-render/src/render/sub-table/common/scan-modal.vue.d.ts +0 -19
  218. package/dist/src/nocode-web-render/src/render/sub-table/index.d.ts +0 -3
  219. package/dist/src/nocode-web-render/src/render/sub-table/material-balance/index.d.ts +0 -1
  220. package/dist/src/nocode-web-render/src/render/sub-table/material-consume/index.d.ts +0 -4
  221. package/dist/src/nocode-web-render/src/render/sub-table/material-consume/mc-web-render.d.ts +0 -42
  222. package/dist/src/nocode-web-render/src/render/sub-table/stocktake/index.d.ts +0 -2
  223. package/dist/src/nocode-web-render/src/types/hooks/index.d.ts +0 -1
  224. package/dist/src/nocode-web-render/src/types/index.d.ts +0 -1
  225. package/dist/web-render/index.d.ts +0 -1
  226. package/dist/web-render/index.es.js +0 -596
  227. /package/dist/src/{nocode-web-render/src/adapter/index.d.ts → adapter/web/setup.d.ts} +0 -0
  228. /package/dist/src/{nocode-web-render/src/logic/utils.d.ts → adapter/web/upload.d.ts} +0 -0
@@ -1,11 +1,9 @@
1
- import { reactive, toRaw, computed, watch, onScopeDispose, inject, h, shallowReactive, markRaw, ref, nextTick, toRef, provide, defineComponent, openBlock, createElementBlock, mergeProps, unref, createElementVNode, normalizeClass, renderSlot, createCommentVNode, createVNode, toDisplayString, Fragment, renderList, onUnmounted, isVNode, onMounted, onBeforeMount, resolveComponent, createBlock, withCtx, createTextVNode } from "vue";
2
- import { ai as CellWidgetViewState, F as FIELD_TYPE, b6 as RenderModeEnum, Y as FormTypeEnum, bC as BpmnNodeTypeEnum, cv as getFieldPlaceholder, bU as MobileFillTypeEnum, C as ComponentTypeEnum, $ as PlatformEnum, cw as isReferenceOptionActive, o as api, bs as uuid2, c2 as calcUtils, bh as findRuntimeTableRow, c6 as ensureTableRowKeys, b$ as bindRuntimeTableColumns, bg as getRowId, cx as FRONT_ROW_KEY, cl as isTableRowKeyMatch, bu as isAttachFieldActive, cy as filterRulesByTrigger, cz as isEmptyValue$1, c3 as decodeTableCellRowKey, c5 as ensureFrontRowKey, a_ as getParseRuleInfo, aF as transformUtils, aW as materialCheck, aX as getLotLockedReason, aY as validateReinspectionDate, bl as FormulaRuleFieldKeyEnum, f as SubTableType, a$ as getParseRuleValue, cA as buildError, H as CreateType, bj as findRuntimeParentRow, aI as Dependency_ENUM, aH as ASSIGNMENTSTRATEGY_ENUM, bH as commonUtils, aM as DeviceLink, a8 as _export_sfc, cf as getRenderedRuntimeTableCell, z as CellType, cp as relocateDeletedRowsToEnd, cB as resetTableRowIdentity, J as useModal, cC as q, cD as QUICK_FILL_ALLOWED_FIELDS, cE as groupFixedTableRows, cF as processQuickFillRows, cG as getIsGroupEmpty } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-BvrrN6te.js";
3
- import { cloneDeep, isEmpty, has, pickBy, isNil, mergeWith, omit, last, pick, merge } from "lodash-es";
1
+ import { reactive, toRaw, computed, watch, onScopeDispose, inject, h, shallowReactive, markRaw, ref, toRef, provide, nextTick, defineComponent, openBlock, createElementBlock, mergeProps, unref, createElementVNode, normalizeClass, renderSlot, createCommentVNode, createVNode, toDisplayString, Fragment, renderList, onUnmounted, isVNode, onMounted, onBeforeMount, resolveComponent, createBlock, withCtx, createTextVNode } from "vue";
2
+ import { cx as splitRuntimeDataPath, am as CellWidgetViewState, F as FIELD_TYPE, bo as RenderModeEnum, a1 as FormTypeEnum, bJ as BpmnNodeTypeEnum, by as getRuntimeDataFieldId, cA as getFieldPlaceholder, b_ as MobileFillTypeEnum, C as ComponentTypeEnum, a4 as PlatformEnum, cB as isReferenceOptionActive, p as api, bx as uuid2, c8 as calcUtils, M as getBusinessFieldKey, bn as findRuntimeTableRow, cc as ensureTableRowKeys, c5 as bindRuntimeTableColumns, bm as getRowId, cC as FRONT_ROW_KEY, cr as isTableRowKeyMatch, aB as RangeCompareOp, aA as RangeValidateMode, cD as getCurrentFormData, bB as isAttachFieldActive, bl as parseRuntimeFieldPath, c9 as decodeTableCellRowKey, cb as ensureFrontRowKey, bb as getParseRuleInfo, aN as transformUtils, b5 as materialCheck, b6 as getLotLockedReason, b7 as validateReinspectionDate, br as FormulaRuleFieldKeyEnum, bA as buildRuntimeFieldPath, Q as CreateType, h as SubTableType, bc as getParseRuleValue, bp as findRuntimeParentRow, aQ as Dependency_ENUM, aP as ASSIGNMENTSTRATEGY_ENUM, bO as commonUtils, aU as DeviceLink, ad as useNamespace, ae as _export_sfc, I as Icon, cl as getRenderedRuntimeTableCell, H as CellType, cE as resetTableRowIdentity, U as useModal, cF as q, cG as QUICK_FILL_ALLOWED_FIELDS, cH as groupFixedTableRows, cI as processQuickFillRows, cJ as getIsGroupEmpty } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_8710052f_lang-BCLE4joQ.js";
4
3
  import dayjs from "dayjs";
5
- import { a as useNamespace, I as Icon } from "./AntdIcon-DCIaV352.js";
4
+ import { cloneDeep, isEmpty, isNil, pickBy, mergeWith, omit, last, pick, merge } from "lodash-es";
6
5
  import "@gct-paas/form-base";
7
6
  import { Modal, message } from "ant-design-vue";
8
- import { u as useFormModel } from "./mb-render-Bs9S9oFn.js";
9
7
  var MaterialConsumptionPatternEnum = /* @__PURE__ */ ((MaterialConsumptionPatternEnum2) => {
10
8
  MaterialConsumptionPatternEnum2["RECORD"] = "record";
11
9
  MaterialConsumptionPatternEnum2["BOM"] = "bom";
@@ -18,6 +16,61 @@ function normalizeFieldWidth(value, fallback = DEFAULT_FIELD_WIDTH) {
18
16
  const width = Number(value);
19
17
  return Number.isFinite(width) && width >= 0 ? width : fallback;
20
18
  }
19
+ function isBlank$1(value) {
20
+ return value === void 0 || value === null || value === "";
21
+ }
22
+ function matchFieldKey(match, fieldKey) {
23
+ if (!match.fieldKey) return false;
24
+ const keys = Array.isArray(match.fieldKey) ? match.fieldKey : [match.fieldKey];
25
+ return keys.includes(fieldKey);
26
+ }
27
+ function findFieldProfile(profile, fieldKey) {
28
+ return profile?.fields?.find((item) => matchFieldKey(item.match, fieldKey));
29
+ }
30
+ function buildDefaultMapFromProfile(profile, paramsConfig) {
31
+ const result = {};
32
+ if (!profile?.contextAssignments?.length) return result;
33
+ const assignments = profile.contextAssignments.filter(
34
+ (item) => item.when === "onRowInit"
35
+ );
36
+ for (const assignment of assignments) {
37
+ const value = paramsConfig?.[assignment.paramKey];
38
+ if (isBlank$1(value)) continue;
39
+ result[assignment.fieldKey] = value;
40
+ }
41
+ return result;
42
+ }
43
+ function buildFieldStatusFromProfile(params) {
44
+ const { profile, field } = params;
45
+ const result = {};
46
+ if (!profile) return result;
47
+ const fieldProfile = findFieldProfile(profile, field);
48
+ if (fieldProfile?.defaultProps) {
49
+ if (fieldProfile.defaultProps.disabled === true || fieldProfile.defaultProps.fieldDisabled === true) {
50
+ result.disabled = true;
51
+ }
52
+ if (fieldProfile.defaultProps.readonly === true || fieldProfile.defaultProps.fieldReadonly === true) {
53
+ result.readonly = true;
54
+ }
55
+ if (fieldProfile.defaultProps.required === false) {
56
+ result.required = false;
57
+ }
58
+ }
59
+ const rules2 = (profile.runtimeRules ?? []).filter(
60
+ (rule) => !rule.when || rule.when === "always" || rule.when === "onRowInit"
61
+ );
62
+ for (const rule of rules2) {
63
+ if (!rule.fields.includes(field)) continue;
64
+ if (rule.effect.readonly) result.readonly = true;
65
+ if (rule.effect.disabled) result.disabled = true;
66
+ if (rule.effect.required !== void 0) result.required = rule.effect.required;
67
+ }
68
+ return result;
69
+ }
70
+ function getRowHandlersForFieldChange(profile, changedField) {
71
+ if (!profile?.rowHandlers?.length) return [];
72
+ return profile.rowHandlers.filter((item) => item.when === "onFieldChange").filter((item) => !item.watch?.length || item.watch.includes(changedField)).map((item) => item.handler);
73
+ }
21
74
  function hasSignatureValue(value) {
22
75
  if (value === void 0 || value === null) return false;
23
76
  if (typeof value !== "string") {
@@ -43,8 +96,8 @@ function getRuntimeDependencyOutputKey(widgetId, type4, rowPath) {
43
96
  return JSON.stringify([widgetId, type4, rowPath]);
44
97
  }
45
98
  function pathMatches(source, changedPath, structureOnly = false) {
46
- const expected = source.split(".");
47
- const changed = changedPath.split(".");
99
+ const expected = splitRuntimeDataPath(source);
100
+ const changed = splitRuntimeDataPath(changedPath);
48
101
  if (structureOnly && changed.length > expected.length) return false;
49
102
  return expected.slice(0, Math.min(expected.length, changed.length)).every((part, index) => part === "*" || part === changed[index]);
50
103
  }
@@ -147,7 +200,9 @@ class RuntimeDependencyService {
147
200
  }
148
201
  schedule(change) {
149
202
  if (this.disposed) return;
150
- if (change.source === "restore") change = { ...change, paths: ["*"] };
203
+ const labelsOnly = change.paths.length > 0 && change.paths.every((path) => path.endsWith("_lb_"));
204
+ if (change.source === "restore" && change.restoreScope !== "fields" && !labelsOnly)
205
+ change = { ...change, paths: ["*"] };
151
206
  this.effects.forEach((effect) => {
152
207
  if (this.matches(effect, change.paths)) this.cancelExecution(effect.id);
153
208
  });
@@ -297,50 +352,10 @@ function resolveRuntimeFieldState(props, info) {
297
352
  keepExceptionHighlight: typeof props.keepExceptionHighlight === "boolean" ? props.keepExceptionHighlight : void 0
298
353
  };
299
354
  }
300
- function getRuntimeDataFieldId(props = {}) {
301
- return props.field ? props.isFieldModel ? props.fieldLink ?? "" : props.field : "";
302
- }
303
- function getBusinessFieldKey(field) {
304
- return [field.subModelKey ?? field.modelKey ?? "", field.fieldId ?? ""].join(":");
305
- }
306
- const FIELD_POSITION_PREFIX = "runtime_field_";
307
- function buildRuntimeFieldPath(position) {
308
- if (!position.fieldId) throw new Error("运行时字段位置缺少 fieldId");
309
- if (position.subFieldKey && !position.rowKey) throw new Error("子表字段位置缺少 front_row_key_");
310
- const serialized = JSON.stringify([
311
- position.modelKey ?? "",
312
- position.subModelKey ?? "",
313
- position.subFieldKey ?? "",
314
- position.rowKey ?? "",
315
- position.fieldId
316
- ]);
317
- return FIELD_POSITION_PREFIX + btoa(
318
- Array.from(new TextEncoder().encode(serialized), (byte) => String.fromCharCode(byte)).join(
319
- ""
320
- )
321
- ).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
322
- }
323
- function parseRuntimeFieldPath(path) {
324
- if (!path.startsWith(FIELD_POSITION_PREFIX)) return void 0;
325
- try {
326
- const encoded = path.slice(FIELD_POSITION_PREFIX.length).replace(/-/g, "+").replace(/_/g, "/");
327
- const parts = JSON.parse(
328
- new TextDecoder().decode(Uint8Array.from(atob(encoded), (char) => char.charCodeAt(0)))
329
- );
330
- if (!Array.isArray(parts) || parts.length !== 5 || parts.some((part) => typeof part !== "string"))
331
- return void 0;
332
- const [modelKey, subModelKey, subFieldKey, rowKey, fieldId] = parts;
333
- if (!fieldId || subFieldKey && !rowKey) return void 0;
334
- return {
335
- modelKey: modelKey || void 0,
336
- subModelKey: subModelKey || void 0,
337
- subFieldKey: subFieldKey || void 0,
338
- rowKey: rowKey || void 0,
339
- fieldId
340
- };
341
- } catch {
342
- return void 0;
343
- }
355
+ function isCellAutoLineBreak(style) {
356
+ const whiteSpace = style?.whiteSpace ?? style?.["white-space"];
357
+ const wordBreak = style?.wordBreak ?? style?.["word-break"];
358
+ return whiteSpace === "pre-wrap" && wordBreak === "break-all" || whiteSpace === "pre-line";
344
359
  }
345
360
  var NCB_PROVIDE = /* @__PURE__ */ ((NCB_PROVIDE2) => {
346
361
  NCB_PROVIDE2["IS_PDF"] = "NCB_IsPdf";
@@ -468,12 +483,7 @@ function useWidgetStaticAttrs(widget) {
468
483
  dataRelationShip
469
484
  )
470
485
  );
471
- const isAutoLineBreak = computed(() => {
472
- if (!isEmpty(widget.style) && has(widget.style, "whiteSpace") && has(widget.style, "wordBreak") && widget.style.whiteSpace === "pre-wrap" && widget.style.wordBreak === "break-all") {
473
- return true;
474
- }
475
- return false;
476
- });
486
+ const isAutoLineBreak = computed(() => isCellAutoLineBreak(widget.style));
477
487
  return {
478
488
  field,
479
489
  fieldType,
@@ -868,6 +878,9 @@ function useMaterialBalance() {
868
878
  destoryConsumeModal
869
879
  };
870
880
  }
881
+ function normalizeGridColumnWidth(value) {
882
+ return typeof value === "number" && Number.isFinite(value) ? Math.max(0, value) : 75;
883
+ }
871
884
  function normalizeHistoricalFieldConfig(value) {
872
885
  if (!value || typeof value !== "object") return value;
873
886
  if (Array.isArray(value)) {
@@ -885,10 +898,17 @@ function normalizeHistoricalFieldConfig(value) {
885
898
  const props = result.props;
886
899
  const attachment = props.fieldType === FIELD_TYPE.ATTACHMENT && props.viewState === CellWidgetViewState.Auto;
887
900
  const autofill = Array.isArray(props.autofillRules) && props.enableAutofill === void 0;
888
- if (attachment || autofill) {
901
+ const wrap = result.component === "td" && props.autoLineBreak !== true && isCellAutoLineBreak(result.cellWidget?.style);
902
+ const colsWidth = Array.isArray(props.colsWidth) ? props.colsWidth.map(
903
+ (width) => typeof width === "number" && Number.isFinite(width) ? normalizeGridColumnWidth(width) : width
904
+ ) : void 0;
905
+ const columnWidths = colsWidth?.some((width, index) => width !== props.colsWidth[index]);
906
+ if (attachment || autofill || wrap || columnWidths) {
889
907
  result = { ...result, props: { ...props } };
890
908
  if (attachment) result.props.viewState = CellWidgetViewState.Readonly;
891
909
  if (autofill) result.props.enableAutofill = true;
910
+ if (wrap) result.props.autoLineBreak = true;
911
+ if (columnWidths) result.props.colsWidth = colsWidth;
892
912
  }
893
913
  }
894
914
  return result;
@@ -992,16 +1012,17 @@ function validateSheetGraph(sheet) {
992
1012
  }
993
1013
  function normalizeSheetMetadata(sheet) {
994
1014
  const nodes = normalizeHistoricalFieldConfig(sheet.nodes);
1015
+ const sourcePaper = normalizeHistoricalFieldConfig(sheet.paper);
995
1016
  const paper = {
996
- ...sheet.paper,
1017
+ ...sourcePaper,
997
1018
  props: {
998
- ...sheet.paper.props,
1019
+ ...sourcePaper.props,
999
1020
  subTableWidgetIds: Object.entries(nodes).filter(([, node]) => node.component === ComponentTypeEnum.SUB_TABLE).map(([id]) => id)
1000
1021
  }
1001
1022
  };
1002
1023
  return { ...sheet, paper, nodes, dataCenter: { [ComponentTypeEnum.PAPER]: paper, ...nodes } };
1003
1024
  }
1004
- function normalizeRuntime(runtime) {
1025
+ function normalizeRuntime(runtime, formType) {
1005
1026
  if (typeof runtime === "string") {
1006
1027
  if (!runtime.trim()) throw new Error("运行时数据不能为空");
1007
1028
  try {
@@ -1012,7 +1033,16 @@ function normalizeRuntime(runtime) {
1012
1033
  }
1013
1034
  assertObject(runtime, "运行时数据格式无效");
1014
1035
  if (runtime.schemaVersion == null || runtime.schemaVersion === 1) {
1015
- const normalized = convertV1Runtime(runtime);
1036
+ const legacyRuntime = formType === FormTypeEnum.FILE && runtime[ComponentTypeEnum.PAPER] == null ? {
1037
+ ...runtime,
1038
+ [ComponentTypeEnum.PAPER]: {
1039
+ id: ComponentTypeEnum.PAPER,
1040
+ component: ComponentTypeEnum.PAPER,
1041
+ props: {},
1042
+ nextIds: []
1043
+ }
1044
+ } : runtime;
1045
+ const normalized = convertV1Runtime(legacyRuntime);
1016
1046
  normalized.sheets.forEach(validateSheetGraph);
1017
1047
  return { ...normalized, sheets: normalized.sheets.map(normalizeSheetMetadata) };
1018
1048
  }
@@ -1149,6 +1179,7 @@ function createRuntimeInstanceContext(options) {
1149
1179
  uniqueId: options.uniqueId,
1150
1180
  instanceId: options.instanceId,
1151
1181
  templateId: options.templateId,
1182
+ formType: options.formType,
1152
1183
  schemaVersion: options.runtime.schemaVersion,
1153
1184
  formConfig: options.runtime.formConfig,
1154
1185
  defaultData: options.defaultData,
@@ -1238,7 +1269,7 @@ class RuntimeSheetService {
1238
1269
  this.calculatingDepth += 1;
1239
1270
  let succeeded = false;
1240
1271
  try {
1241
- const pageData = RuntimeSheetService.calculatePages(sheet.dataCenter, this.formState.state);
1272
+ const pageData = this.context.formType === FormTypeEnum.FILE ? [] : RuntimeSheetService.calculatePages(sheet.dataCenter, this.formState.state);
1242
1273
  this.assertAlive();
1243
1274
  sheet.pageData = pageData;
1244
1275
  sheet.paginationError = void 0;
@@ -1439,6 +1470,7 @@ class RuntimeFormStateStore {
1439
1470
  constructor(initialState, subtableFields = [], tableRelations = []) {
1440
1471
  this.tableRelations = tableRelations;
1441
1472
  this.subtableFields = new Set(subtableFields);
1473
+ normalizeEmptyReferenceLabels(initialState);
1442
1474
  this.subtableFields.forEach((field) => ensureTableRowKeys(initialState[field]));
1443
1475
  bindRuntimeTableColumns(initialState, this.tableRelations);
1444
1476
  this.reactiveState = reactive(initialState);
@@ -1461,7 +1493,7 @@ class RuntimeFormStateStore {
1461
1493
  reactiveState;
1462
1494
  /** 每次成功提交一批变更递增一次,保存和提交用它判断快照是否过期。 */
1463
1495
  revision = 0;
1464
- /** 是否存在尚未保存的变更;restore 来源不会把实例标记为脏。 */
1496
+ /** 是否存在尚未保存的变更;数据恢复及保存回填不会把实例标记为脏。 */
1465
1497
  dirty = false;
1466
1498
  /** 当前嵌套事务深度;只有最外层事务结束时才递增 revision 并通知订阅方。 */
1467
1499
  mutationDepth = 0;
@@ -1469,6 +1501,7 @@ class RuntimeFormStateStore {
1469
1501
  pendingPaths = /* @__PURE__ */ new Set();
1470
1502
  /** 最外层事务的变更来源,嵌套写入沿用该来源。 */
1471
1503
  pendingSource = "system";
1504
+ pendingRestoreScope;
1472
1505
  /** 联动、分页失效、自动保存等实例服务登记的变更监听器。 */
1473
1506
  subscribers = /* @__PURE__ */ new Set();
1474
1507
  /** 用户主动修改过的业务路径,供公式和自动填充执行“不覆盖用户输入”策略。 */
@@ -1593,9 +1626,15 @@ class RuntimeFormStateStore {
1593
1626
  target = this.unwrap(target);
1594
1627
  value = this.unwrap(value);
1595
1628
  this.ensureIncomingRowKeys(target, fieldKey, value);
1596
- if (Object.is(toRaw(this.unwrap(target[fieldKey])), toRaw(value))) return;
1597
- this.mutate([path], source, () => {
1598
- target[fieldKey] = value;
1629
+ const valueChanged = !Object.is(toRaw(this.unwrap(target[fieldKey])), toRaw(value));
1630
+ const labelKey = `${fieldKey}_lb_`;
1631
+ const clearLabel = isEmptyReferenceValue(value) && target[labelKey] != null;
1632
+ if (!valueChanged && !clearLabel) return;
1633
+ const paths = valueChanged ? [path] : [];
1634
+ if (clearLabel) paths.push(`${path}_lb_`);
1635
+ this.mutate(paths, source, () => {
1636
+ if (valueChanged) target[fieldKey] = value;
1637
+ if (clearLabel) target[labelKey] = null;
1599
1638
  });
1600
1639
  }
1601
1640
  /** 合并当前行的一组关联字段,累计稳定业务路径,只提交一次变更。 */
@@ -1614,10 +1653,12 @@ class RuntimeFormStateStore {
1614
1653
  /**
1615
1654
  * 保存后只回填后端身份元数据,不能用仅含 id_/front_row_key_ 的数组覆盖当前业务行。
1616
1655
  * 二维内置复合键可通过原始子行键匹配保存前的本地行。
1656
+ * 保存回填只通知实际变化的字段,不作为整份数据恢复触发全部赋值规则。
1617
1657
  */
1618
1658
  patchSavedMetadata(values) {
1619
- const paths = Object.keys(values);
1620
- this.mutate(paths, "restore", () => this.mergeSavedMetadata(this.reactiveState, values));
1659
+ this.transaction("restore", () => this.mergeSavedMetadata(this.state, values), {
1660
+ restoreScope: "fields"
1661
+ });
1621
1662
  }
1622
1663
  /**
1623
1664
  * 用新对象整体替换实例数据,删除旧对象中多余的顶层字段。
@@ -1626,19 +1667,23 @@ class RuntimeFormStateStore {
1626
1667
  replace(values, source = "restore") {
1627
1668
  const paths = /* @__PURE__ */ new Set([...Object.keys(this.reactiveState), ...Object.keys(values)]);
1628
1669
  this.mutate(Array.from(paths), source, () => {
1670
+ this.userModifiedPaths.clear();
1629
1671
  Object.keys(this.reactiveState).forEach((key) => delete this.reactiveState[key]);
1630
1672
  this.assignValues(this.reactiveState, values);
1673
+ normalizeEmptyReferenceLabels(this.reactiveState);
1631
1674
  });
1632
- this.userModifiedPaths.clear();
1633
1675
  if (source === "restore") this.dirty = false;
1634
1676
  }
1635
1677
  /**
1636
1678
  * 将多次深层写入合并成一次变更提交。
1637
1679
  * 嵌套事务只累计路径,最外层 finally 统一递增 revision 并通知订阅方。
1638
1680
  */
1639
- transaction(source, callback) {
1681
+ transaction(source, callback, options) {
1640
1682
  const outermost = this.mutationDepth === 0;
1641
- if (outermost) this.pendingSource = source;
1683
+ if (outermost) {
1684
+ this.pendingSource = source;
1685
+ this.pendingRestoreScope = source === "restore" ? options?.restoreScope : void 0;
1686
+ }
1642
1687
  this.mutationDepth += 1;
1643
1688
  try {
1644
1689
  return callback(this.state);
@@ -1648,7 +1693,9 @@ class RuntimeFormStateStore {
1648
1693
  const paths = Array.from(this.pendingPaths);
1649
1694
  this.pendingPaths.clear();
1650
1695
  const pendingSource = this.pendingSource;
1696
+ const restoreScope = this.pendingRestoreScope;
1651
1697
  this.pendingSource = "system";
1698
+ this.pendingRestoreScope = void 0;
1652
1699
  try {
1653
1700
  if (paths.some(
1654
1701
  (path) => this.tableRelations.some(
@@ -1661,7 +1708,7 @@ class RuntimeFormStateStore {
1661
1708
  });
1662
1709
  }
1663
1710
  } finally {
1664
- if (paths.length) this.commit(paths, pendingSource);
1711
+ if (paths.length) this.commit(paths, pendingSource, restoreScope);
1665
1712
  }
1666
1713
  }
1667
1714
  }
@@ -1711,10 +1758,15 @@ class RuntimeFormStateStore {
1711
1758
  this.userModifiedPaths.clear();
1712
1759
  }
1713
1760
  /** 提交当前事务积累的路径,更新版本和脏状态,然后同步通知实例服务。 */
1714
- commit(paths, source) {
1761
+ commit(paths, source, restoreScope) {
1715
1762
  this.revision += 1;
1716
1763
  if (source !== "restore") this.dirty = true;
1717
- const change = { revision: this.revision, paths, source };
1764
+ const change = {
1765
+ revision: this.revision,
1766
+ paths,
1767
+ source,
1768
+ ...restoreScope ? { restoreScope } : {}
1769
+ };
1718
1770
  this.subscribers.forEach((subscriber) => subscriber(change));
1719
1771
  }
1720
1772
  /** 如果值是 Store 创建的 scoped view,返回它实际包装的 Vue 响应式目标。 */
@@ -1766,7 +1818,8 @@ class RuntimeFormStateStore {
1766
1818
  if (!target || typeof target !== "object" || Array.isArray(target)) return incoming;
1767
1819
  Object.entries(incoming).forEach(([key, value]) => {
1768
1820
  const childPath = path ? `${path}.${key}` : key;
1769
- target[key] = this.mergeSavedMetadata(target[key], value, childPath);
1821
+ const merged = this.mergeSavedMetadata(target[key], value, childPath);
1822
+ this.setObjectField(target, key, merged, "restore");
1770
1823
  });
1771
1824
  return target;
1772
1825
  }
@@ -1808,6 +1861,23 @@ const ARRAY_MUTATIONS = /* @__PURE__ */ new Set([
1808
1861
  "unshift"
1809
1862
  ]);
1810
1863
  const ARRAY_SEARCHES = /* @__PURE__ */ new Set(["includes", "indexOf", "lastIndexOf"]);
1864
+ function isEmptyReferenceValue(value) {
1865
+ return value == null || value === "" || Array.isArray(value) && value.length === 0;
1866
+ }
1867
+ function normalizeEmptyReferenceLabels(value, visited = /* @__PURE__ */ new WeakSet()) {
1868
+ if (!isMutableRecord(value) || visited.has(toRaw(value))) return;
1869
+ visited.add(toRaw(value));
1870
+ Object.entries(value).forEach(([key, child]) => {
1871
+ if (key.endsWith("_lb_")) {
1872
+ const fieldKey = key.slice(0, -4);
1873
+ if (child != null && Object.prototype.hasOwnProperty.call(value, fieldKey) && isEmptyReferenceValue(value[fieldKey])) {
1874
+ value[key] = null;
1875
+ }
1876
+ } else if (key !== "_DICT") {
1877
+ normalizeEmptyReferenceLabels(child, visited);
1878
+ }
1879
+ });
1880
+ }
1811
1881
  function joinPath(basePath, key) {
1812
1882
  return basePath ? `${basePath}.${key}` : key;
1813
1883
  }
@@ -2086,7 +2156,7 @@ function format(template) {
2086
2156
  function isNativeStringType(type4) {
2087
2157
  return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
2088
2158
  }
2089
- function isEmptyValue(value, type4) {
2159
+ function isEmptyValue$1(value, type4) {
2090
2160
  if (value === void 0 || value === null) {
2091
2161
  return true;
2092
2162
  }
@@ -2245,7 +2315,7 @@ function deepMerge(target, source) {
2245
2315
  return target;
2246
2316
  }
2247
2317
  var required$1 = function required(rule, value, source, errors, options, type4) {
2248
- if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
2318
+ if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue$1(value, type4 || rule.type))) {
2249
2319
  errors.push(format(options.messages.required, rule.fullField));
2250
2320
  }
2251
2321
  };
@@ -2432,11 +2502,11 @@ var string = function string2(rule, value, callback, source, options) {
2432
2502
  var errors = [];
2433
2503
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2434
2504
  if (validate) {
2435
- if (isEmptyValue(value, "string") && !rule.required) {
2505
+ if (isEmptyValue$1(value, "string") && !rule.required) {
2436
2506
  return callback();
2437
2507
  }
2438
2508
  rules.required(rule, value, source, errors, options, "string");
2439
- if (!isEmptyValue(value, "string")) {
2509
+ if (!isEmptyValue$1(value, "string")) {
2440
2510
  rules.type(rule, value, source, errors, options);
2441
2511
  rules.range(rule, value, source, errors, options);
2442
2512
  rules.pattern(rule, value, source, errors, options);
@@ -2451,7 +2521,7 @@ var method2 = function method3(rule, value, callback, source, options) {
2451
2521
  var errors = [];
2452
2522
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2453
2523
  if (validate) {
2454
- if (isEmptyValue(value) && !rule.required) {
2524
+ if (isEmptyValue$1(value) && !rule.required) {
2455
2525
  return callback();
2456
2526
  }
2457
2527
  rules.required(rule, value, source, errors, options);
@@ -2468,7 +2538,7 @@ var number2 = function number3(rule, value, callback, source, options) {
2468
2538
  if (value === "") {
2469
2539
  value = void 0;
2470
2540
  }
2471
- if (isEmptyValue(value) && !rule.required) {
2541
+ if (isEmptyValue$1(value) && !rule.required) {
2472
2542
  return callback();
2473
2543
  }
2474
2544
  rules.required(rule, value, source, errors, options);
@@ -2483,7 +2553,7 @@ var _boolean = function _boolean2(rule, value, callback, source, options) {
2483
2553
  var errors = [];
2484
2554
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2485
2555
  if (validate) {
2486
- if (isEmptyValue(value) && !rule.required) {
2556
+ if (isEmptyValue$1(value) && !rule.required) {
2487
2557
  return callback();
2488
2558
  }
2489
2559
  rules.required(rule, value, source, errors, options);
@@ -2497,11 +2567,11 @@ var regexp2 = function regexp3(rule, value, callback, source, options) {
2497
2567
  var errors = [];
2498
2568
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2499
2569
  if (validate) {
2500
- if (isEmptyValue(value) && !rule.required) {
2570
+ if (isEmptyValue$1(value) && !rule.required) {
2501
2571
  return callback();
2502
2572
  }
2503
2573
  rules.required(rule, value, source, errors, options);
2504
- if (!isEmptyValue(value)) {
2574
+ if (!isEmptyValue$1(value)) {
2505
2575
  rules.type(rule, value, source, errors, options);
2506
2576
  }
2507
2577
  }
@@ -2511,7 +2581,7 @@ var integer2 = function integer3(rule, value, callback, source, options) {
2511
2581
  var errors = [];
2512
2582
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2513
2583
  if (validate) {
2514
- if (isEmptyValue(value) && !rule.required) {
2584
+ if (isEmptyValue$1(value) && !rule.required) {
2515
2585
  return callback();
2516
2586
  }
2517
2587
  rules.required(rule, value, source, errors, options);
@@ -2526,7 +2596,7 @@ var floatFn = function floatFn2(rule, value, callback, source, options) {
2526
2596
  var errors = [];
2527
2597
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2528
2598
  if (validate) {
2529
- if (isEmptyValue(value) && !rule.required) {
2599
+ if (isEmptyValue$1(value) && !rule.required) {
2530
2600
  return callback();
2531
2601
  }
2532
2602
  rules.required(rule, value, source, errors, options);
@@ -2556,7 +2626,7 @@ var object2 = function object3(rule, value, callback, source, options) {
2556
2626
  var errors = [];
2557
2627
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2558
2628
  if (validate) {
2559
- if (isEmptyValue(value) && !rule.required) {
2629
+ if (isEmptyValue$1(value) && !rule.required) {
2560
2630
  return callback();
2561
2631
  }
2562
2632
  rules.required(rule, value, source, errors, options);
@@ -2571,7 +2641,7 @@ var enumerable2 = function enumerable3(rule, value, callback, source, options) {
2571
2641
  var errors = [];
2572
2642
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2573
2643
  if (validate) {
2574
- if (isEmptyValue(value) && !rule.required) {
2644
+ if (isEmptyValue$1(value) && !rule.required) {
2575
2645
  return callback();
2576
2646
  }
2577
2647
  rules.required(rule, value, source, errors, options);
@@ -2585,11 +2655,11 @@ var pattern2 = function pattern3(rule, value, callback, source, options) {
2585
2655
  var errors = [];
2586
2656
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2587
2657
  if (validate) {
2588
- if (isEmptyValue(value, "string") && !rule.required) {
2658
+ if (isEmptyValue$1(value, "string") && !rule.required) {
2589
2659
  return callback();
2590
2660
  }
2591
2661
  rules.required(rule, value, source, errors, options);
2592
- if (!isEmptyValue(value, "string")) {
2662
+ if (!isEmptyValue$1(value, "string")) {
2593
2663
  rules.pattern(rule, value, source, errors, options);
2594
2664
  }
2595
2665
  }
@@ -2599,11 +2669,11 @@ var date2 = function date3(rule, value, callback, source, options) {
2599
2669
  var errors = [];
2600
2670
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2601
2671
  if (validate) {
2602
- if (isEmptyValue(value, "date") && !rule.required) {
2672
+ if (isEmptyValue$1(value, "date") && !rule.required) {
2603
2673
  return callback();
2604
2674
  }
2605
2675
  rules.required(rule, value, source, errors, options);
2606
- if (!isEmptyValue(value, "date")) {
2676
+ if (!isEmptyValue$1(value, "date")) {
2607
2677
  var dateObject;
2608
2678
  if (value instanceof Date) {
2609
2679
  dateObject = value;
@@ -2629,11 +2699,11 @@ var type2 = function type3(rule, value, callback, source, options) {
2629
2699
  var errors = [];
2630
2700
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2631
2701
  if (validate) {
2632
- if (isEmptyValue(value, ruleType) && !rule.required) {
2702
+ if (isEmptyValue$1(value, ruleType) && !rule.required) {
2633
2703
  return callback();
2634
2704
  }
2635
2705
  rules.required(rule, value, source, errors, options, ruleType);
2636
- if (!isEmptyValue(value, ruleType)) {
2706
+ if (!isEmptyValue$1(value, ruleType)) {
2637
2707
  rules.type(rule, value, source, errors, options);
2638
2708
  }
2639
2709
  }
@@ -2643,7 +2713,7 @@ var any = function any2(rule, value, callback, source, options) {
2643
2713
  var errors = [];
2644
2714
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2645
2715
  if (validate) {
2646
- if (isEmptyValue(value) && !rule.required) {
2716
+ if (isEmptyValue$1(value) && !rule.required) {
2647
2717
  return callback();
2648
2718
  }
2649
2719
  rules.required(rule, value, source, errors, options);
@@ -2980,6 +3050,519 @@ Schema.register = function register(type4, validator) {
2980
3050
  Schema.warning = warning;
2981
3051
  Schema.messages = messages;
2982
3052
  Schema.validators = validators;
3053
+ const stampKeys = [
3054
+ "sealId",
3055
+ "sealName",
3056
+ "sealType",
3057
+ "sealImage",
3058
+ "sealUserId",
3059
+ "sealUserName",
3060
+ "sealUserTime"
3061
+ ];
3062
+ function isSealPosition(value) {
3063
+ if (!value || typeof value !== "object") return false;
3064
+ const p = value;
3065
+ return typeof p.sheetId === "string" && !!p.sheetId && Number.isInteger(p.pageIndex) && p.pageIndex >= 0 && Number.isFinite(p.leftMm) && p.leftMm >= 0 && Number.isFinite(p.topMm) && p.topMm >= 0;
3066
+ }
3067
+ function readSealValue(raw, fallback) {
3068
+ let parsed = {};
3069
+ try {
3070
+ const value = typeof raw === "string" ? JSON.parse(raw || "{}") : raw;
3071
+ if (value && typeof value === "object" && !Array.isArray(value)) parsed = value;
3072
+ } catch {
3073
+ }
3074
+ const stamp = Object.fromEntries(
3075
+ stampKeys.map((key) => [key, typeof parsed[key] === "string" ? parsed[key] : ""])
3076
+ );
3077
+ return {
3078
+ ...stamp,
3079
+ sealPosition: { ...isSealPosition(parsed.sealPosition) ? parsed.sealPosition : fallback }
3080
+ };
3081
+ }
3082
+ function isSealStamped(raw) {
3083
+ try {
3084
+ const value = typeof raw === "string" ? JSON.parse(raw || "{}") : raw;
3085
+ return !!value && typeof value.sealId === "string" && !!value.sealId && typeof value.sealImage === "string" && !!value.sealImage;
3086
+ } catch {
3087
+ return false;
3088
+ }
3089
+ }
3090
+ function isValidSealValue(raw) {
3091
+ try {
3092
+ const value = typeof raw === "string" ? JSON.parse(raw || "{}") : raw;
3093
+ return !!value && stampKeys.every((key) => typeof value[key] === "string") && isSealPosition(value.sealPosition) && (stampKeys.every((key) => !value[key]) || stampKeys.every((key) => !!value[key]));
3094
+ } catch {
3095
+ return false;
3096
+ }
3097
+ }
3098
+ function moveSealValue(raw, fallback, position) {
3099
+ return JSON.stringify({ ...readSealValue(raw, fallback), sealPosition: { ...position } });
3100
+ }
3101
+ function stampSealValue(raw, fallback, stamp) {
3102
+ const current = readSealValue(raw, fallback);
3103
+ const next = readSealValue({ ...stamp, sealPosition: current.sealPosition }, fallback);
3104
+ return JSON.stringify(next);
3105
+ }
3106
+ function clearSealValue(raw, fallback) {
3107
+ return JSON.stringify(
3108
+ readSealValue({ sealPosition: readSealValue(raw, fallback).sealPosition }, fallback)
3109
+ );
3110
+ }
3111
+ function normalizeSealDiameter(value) {
3112
+ const diameter = Number(value);
3113
+ return Number.isFinite(diameter) && diameter > 0 ? Math.min(diameter, 200) : 42;
3114
+ }
3115
+ function clampSealPosition(position, widthMm, heightMm, diameterMm) {
3116
+ return {
3117
+ ...position,
3118
+ leftMm: Math.max(0, Math.min(position.leftMm, Math.max(0, widthMm - diameterMm))),
3119
+ topMm: Math.max(0, Math.min(position.topMm, Math.max(0, heightMm - diameterMm)))
3120
+ };
3121
+ }
3122
+ function initializeSealFields(fields, formData) {
3123
+ for (const { props } of fields) {
3124
+ if (!props.field || props.isFieldModel || props.subFieldKey) continue;
3125
+ const raw = formData[props.field];
3126
+ if (raw == null || raw === "") {
3127
+ formData[props.field] = JSON.stringify(readSealValue("", props.sealPosition));
3128
+ continue;
3129
+ }
3130
+ try {
3131
+ const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
3132
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) continue;
3133
+ if (!isSealPosition(parsed.sealPosition)) {
3134
+ formData[props.field] = JSON.stringify({
3135
+ ...parsed,
3136
+ sealPosition: { ...props.sealPosition }
3137
+ });
3138
+ } else if (typeof raw !== "string") {
3139
+ formData[props.field] = JSON.stringify(parsed);
3140
+ }
3141
+ } catch {
3142
+ }
3143
+ }
3144
+ }
3145
+ const { identify, calculate: calculate$1 } = {
3146
+ identify: (expression) => window.NocodeAdapter.utils?.formulaIdentify?.(expression) ?? [],
3147
+ calculate: (expression, data) => window.NocodeAdapter.utils?.formulaCalculate?.(expression, data)
3148
+ };
3149
+ const getFieldDataValue = (parseInfo, formData) => {
3150
+ const getTextValue = (processedKey, value) => {
3151
+ const textValue = value ?? formData?.[processedKey] ?? "";
3152
+ return Array.isArray(textValue) ? textValue.join() : textValue;
3153
+ };
3154
+ const { type: type4, processed, hashValue } = parseInfo;
3155
+ if (type4 === "hash") {
3156
+ const tableData = toRaw(formData?.[hashValue] || []);
3157
+ return tableData.filter((d) => !d.deleted_).map((row) => getTextValue(processed, row?.[processed])).filter((i) => !isNil(i));
3158
+ }
3159
+ return getTextValue(processed, formData?.[processed]);
3160
+ };
3161
+ const parseFormulaVar = (formulaVar) => {
3162
+ const result = {
3163
+ original: formulaVar,
3164
+ type: "",
3165
+ processed: "",
3166
+ hashValue: "",
3167
+ dataType: ""
3168
+ };
3169
+ if (/^\$([^$]+)\$\.(.+)$/.test(formulaVar)) {
3170
+ const match = formulaVar.match(/^\$([^$]+)\$\.(.+)$/);
3171
+ result.type = "hash";
3172
+ result.processed = match[2];
3173
+ result.hashValue = match[1];
3174
+ result.dataType = "globType";
3175
+ } else if (/^_\.(.+)$/.test(formulaVar)) {
3176
+ const match = formulaVar.match(/^_\.(.+)$/);
3177
+ result.type = "underscore";
3178
+ result.processed = match[1];
3179
+ result.dataType = "currentRowType";
3180
+ } else {
3181
+ result.type = "plain";
3182
+ result.processed = formulaVar;
3183
+ result.dataType = "globType";
3184
+ }
3185
+ return result;
3186
+ };
3187
+ const getParseFormulaVarInfos = (expr) => {
3188
+ const rowArgs = expr ? identify(expr) : [];
3189
+ return {
3190
+ rowArgs,
3191
+ parseInfos: rowArgs.map((curr) => parseFormulaVar(curr))
3192
+ };
3193
+ };
3194
+ const resolveFormulaData = (expr, formData, instanceFormState) => {
3195
+ const rowArgs = identify(expr);
3196
+ const formulaData = isEmpty(rowArgs) ? {} : rowArgs.reduce((total, curr) => {
3197
+ const parseInfo = parseFormulaVar(curr);
3198
+ total[curr] = getFieldDataValue(
3199
+ parseInfo,
3200
+ parseInfo.dataType === "currentRowType" ? formData : instanceFormState
3201
+ );
3202
+ return total;
3203
+ }, {});
3204
+ return formulaData;
3205
+ };
3206
+ const calculateFormula = async (expr, formData, instanceFormState) => calculate$1(expr, resolveFormulaData(expr, formData, instanceFormState));
3207
+ const isEmptyValue = (value) => {
3208
+ return value === void 0 || value === null || typeof value === "string" && value.trim() === "" || Array.isArray(value) && value.length === 0;
3209
+ };
3210
+ const compareByOp = (left, right, op) => {
3211
+ switch (op) {
3212
+ case RangeCompareOp.LT:
3213
+ return left < right;
3214
+ case RangeCompareOp.LE:
3215
+ return left <= right;
3216
+ case RangeCompareOp.GT:
3217
+ return left > right;
3218
+ case RangeCompareOp.GE:
3219
+ default:
3220
+ return left >= right;
3221
+ }
3222
+ };
3223
+ const rangeCompareMessage = (op, val) => {
3224
+ switch (op) {
3225
+ case RangeCompareOp.LT:
3226
+ return $t("sys.fieldValueNotGreaterOrEqual", { val });
3227
+ case RangeCompareOp.LE:
3228
+ return $t("sys.fieldValueNoMoreThan", { val });
3229
+ case RangeCompareOp.GT:
3230
+ return $t("sys.fieldValueNotLessOrEqual", { val });
3231
+ case RangeCompareOp.GE:
3232
+ default:
3233
+ return $t("sys.fieldValueNotLessThan", { val });
3234
+ }
3235
+ };
3236
+ const toUnixTimestamp = (input) => {
3237
+ if (isNil(input) || input === "") return null;
3238
+ const asNumber = typeof input === "number" || typeof input === "string" && /^-?\d+(\.\d+)?$/.test(input.trim());
3239
+ if (asNumber) {
3240
+ const n = Number(input);
3241
+ if (Number.isNaN(n)) return null;
3242
+ const parsed2 = n > 1e12 ? dayjs(n) : dayjs.unix(n);
3243
+ return parsed2.isValid() ? parsed2.unix() : null;
3244
+ }
3245
+ const parsed = dayjs(input);
3246
+ return parsed.isValid() ? parsed.unix() : null;
3247
+ };
3248
+ const buildError = (validatorInfo, message2) => JSON.stringify({ ...validatorInfo, message: message2 });
3249
+ function areValidationCommentsEqual(left, right) {
3250
+ const serialize = (comments) => JSON.stringify(
3251
+ comments,
3252
+ (_key, value) => value && typeof value === "object" && "message" in value ? { ...value, message: value.message } : value
3253
+ );
3254
+ return serialize(left) === serialize(right);
3255
+ }
3256
+ const createRule = (validator, message2, trigger = "change") => ({
3257
+ required: true,
3258
+ validator,
3259
+ message: message2,
3260
+ trigger
3261
+ });
3262
+ function relocateDeletedRowsToEnd(rows = []) {
3263
+ const active = [];
3264
+ const deleted = [];
3265
+ for (const row of rows) {
3266
+ if (row?.deleted_) deleted.push(row);
3267
+ else active.push(row);
3268
+ }
3269
+ return [...active, ...deleted];
3270
+ }
3271
+ function filterRulesByTrigger(rules2, trigger) {
3272
+ return rules2.filter((rule) => {
3273
+ const ruleTrigger = rule.trigger;
3274
+ if (!ruleTrigger) return trigger === "change";
3275
+ if (trigger === "blur") {
3276
+ return ruleTrigger === "blur" || ruleTrigger === "change";
3277
+ }
3278
+ return ruleTrigger === trigger;
3279
+ });
3280
+ }
3281
+ function assembleRules(input) {
3282
+ const { showRequired, fieldType, validatorInfo, props } = input;
3283
+ const {
3284
+ minlength,
3285
+ maxlength,
3286
+ regex,
3287
+ regexHint,
3288
+ validateTrue,
3289
+ validateFalse,
3290
+ enableRangeValidate,
3291
+ maxValidateMode,
3292
+ minValidateMode,
3293
+ maxCompareOp,
3294
+ minCompareOp,
3295
+ minValue,
3296
+ maxValue,
3297
+ minFormulaExpr,
3298
+ maxFormulaExpr,
3299
+ minDate,
3300
+ maxDate,
3301
+ minDateFormulaExpr,
3302
+ maxDateFormulaExpr,
3303
+ maxDateValidateMode,
3304
+ minDateValidateMode
3305
+ } = props;
3306
+ const resolvedMaxCompareOp = maxCompareOp ?? RangeCompareOp.LE;
3307
+ const resolvedMinCompareOp = minCompareOp ?? RangeCompareOp.GE;
3308
+ const RuleProps = [];
3309
+ if (props.bizType === FIELD_TYPE.SEAL) {
3310
+ if (showRequired) {
3311
+ RuleProps.push(
3312
+ createRule(
3313
+ (_rule, value) => isSealStamped(value),
3314
+ buildError(
3315
+ { ...validatorInfo, validationCode: "seal-required" },
3316
+ $t("sys.fieldRequired")
3317
+ ),
3318
+ "manual"
3319
+ )
3320
+ );
3321
+ }
3322
+ RuleProps.push(
3323
+ createRule(
3324
+ (_rule, value) => isEmptyValue(value) || isValidSealValue(value),
3325
+ buildError(validatorInfo, $t("sys.seal.invalid"))
3326
+ )
3327
+ );
3328
+ return RuleProps;
3329
+ }
3330
+ if (showRequired) {
3331
+ RuleProps.push(
3332
+ createRule(
3333
+ (_rule, value) => !isEmptyValue(value),
3334
+ buildError(validatorInfo, $t("sys.fieldRequired")),
3335
+ "manual"
3336
+ )
3337
+ );
3338
+ }
3339
+ if (!isNil(minlength)) {
3340
+ RuleProps.push(
3341
+ createRule((_rule, value) => {
3342
+ if (isEmptyValue(value)) return true;
3343
+ return String(value).length >= minlength;
3344
+ }, buildError(validatorInfo, $t("sys.fieldLengthNotLessThan", { len: minlength })))
3345
+ );
3346
+ }
3347
+ const effectiveMaxlength = isNil(maxlength) && fieldType === FIELD_TYPE.TEXT ? 1024 : maxlength;
3348
+ if (!isNil(effectiveMaxlength)) {
3349
+ RuleProps.push(
3350
+ createRule((_rule, value) => {
3351
+ if (isEmptyValue(value)) return true;
3352
+ return String(value).length <= effectiveMaxlength;
3353
+ }, buildError(validatorInfo, $t("sys.fieldLengthNoMoreThan", { len: effectiveMaxlength })))
3354
+ );
3355
+ }
3356
+ if (regex) {
3357
+ RuleProps.push(
3358
+ createRule((_rule, value) => {
3359
+ if (isEmptyValue(value)) return true;
3360
+ return new RegExp(regex).test(value);
3361
+ }, buildError(validatorInfo, regexHint ?? $t("sys.fieldFormatError")))
3362
+ );
3363
+ }
3364
+ if (validateTrue) {
3365
+ RuleProps.push({
3366
+ required: true,
3367
+ trigger: "manual",
3368
+ validator: (_rule, value) => value === true,
3369
+ message: buildError(validatorInfo, $t("sys.fieldValueNeedTrue"))
3370
+ });
3371
+ }
3372
+ if (validateFalse) {
3373
+ RuleProps.push({
3374
+ required: true,
3375
+ trigger: "manual",
3376
+ validator: (_rule, value) => value === false,
3377
+ message: buildError(validatorInfo, $t("sys.fieldValueNeedFalse"))
3378
+ });
3379
+ }
3380
+ const configuredMinCoversZero = enableRangeValidate && minValidateMode === RangeValidateMode.Fixed_Number && !isEmptyValue(minValue) && Number(minValue) >= 0 && (resolvedMinCompareOp === RangeCompareOp.GE || resolvedMinCompareOp === RangeCompareOp.GT);
3381
+ if (input.defaultMinValue === 0 && !configuredMinCoversZero) {
3382
+ RuleProps.push(
3383
+ createRule(
3384
+ (_rule, value) => isEmptyValue(value) || Number(value) >= 0,
3385
+ buildError(validatorInfo, rangeCompareMessage(RangeCompareOp.GE, 0))
3386
+ )
3387
+ );
3388
+ }
3389
+ if (!enableRangeValidate) {
3390
+ return RuleProps;
3391
+ }
3392
+ if (minValidateMode === RangeValidateMode.Fixed_Number && !isEmptyValue(minValue)) {
3393
+ RuleProps.push(
3394
+ createRule((_rule, value) => {
3395
+ if (isEmptyValue(value)) return true;
3396
+ return compareByOp(Number(value), Number(minValue), resolvedMinCompareOp);
3397
+ }, buildError(validatorInfo, rangeCompareMessage(resolvedMinCompareOp, minValue)))
3398
+ );
3399
+ }
3400
+ if (minValidateMode === RangeValidateMode.Variable_Validate && minFormulaExpr) {
3401
+ RuleProps.push({
3402
+ required: true,
3403
+ trigger: "change",
3404
+ validator: async (_rule, value, _callback, _source, options) => {
3405
+ const currentFormData = getCurrentFormData(_rule, options);
3406
+ const formulaValue = await calculateFormula(
3407
+ minFormulaExpr,
3408
+ currentFormData,
3409
+ options?.formData
3410
+ );
3411
+ if (isEmptyValue(formulaValue)) {
3412
+ return Promise.resolve();
3413
+ }
3414
+ const parsedMin = parseFloat(formulaValue);
3415
+ if (!isNaN(parsedMin)) {
3416
+ if (isEmptyValue(value)) {
3417
+ return Promise.resolve();
3418
+ }
3419
+ if (!compareByOp(Number(value), parsedMin, resolvedMinCompareOp)) {
3420
+ return Promise.reject(
3421
+ new Error(
3422
+ buildError(validatorInfo, rangeCompareMessage(resolvedMinCompareOp, parsedMin))
3423
+ )
3424
+ );
3425
+ }
3426
+ }
3427
+ return Promise.resolve();
3428
+ }
3429
+ });
3430
+ }
3431
+ if (maxValidateMode === RangeValidateMode.Fixed_Number && !isEmptyValue(maxValue)) {
3432
+ RuleProps.push(
3433
+ createRule((_rule, value) => {
3434
+ if (isEmptyValue(value)) return true;
3435
+ return compareByOp(Number(value), Number(maxValue), resolvedMaxCompareOp);
3436
+ }, buildError(validatorInfo, rangeCompareMessage(resolvedMaxCompareOp, maxValue)))
3437
+ );
3438
+ }
3439
+ if (maxValidateMode === RangeValidateMode.Variable_Validate && maxFormulaExpr) {
3440
+ RuleProps.push({
3441
+ required: true,
3442
+ trigger: "change",
3443
+ validator: async (_rule, value, _callback, _source, options) => {
3444
+ const currentFormData = getCurrentFormData(_rule, options);
3445
+ const formulaValue = await calculateFormula(
3446
+ maxFormulaExpr,
3447
+ currentFormData,
3448
+ options?.formData
3449
+ );
3450
+ if (isEmptyValue(formulaValue)) {
3451
+ return Promise.resolve();
3452
+ }
3453
+ const parsedMax = parseFloat(formulaValue);
3454
+ if (!isNaN(parsedMax)) {
3455
+ if (isEmptyValue(value)) {
3456
+ return Promise.resolve();
3457
+ }
3458
+ if (!compareByOp(Number(value), parsedMax, resolvedMaxCompareOp)) {
3459
+ return Promise.reject(
3460
+ new Error(
3461
+ buildError(validatorInfo, rangeCompareMessage(resolvedMaxCompareOp, parsedMax))
3462
+ )
3463
+ );
3464
+ }
3465
+ }
3466
+ return Promise.resolve();
3467
+ }
3468
+ });
3469
+ }
3470
+ if (minDateValidateMode === RangeValidateMode.Fixed_Number && minDate) {
3471
+ RuleProps.push(
3472
+ createRule((_rule, value) => {
3473
+ if (isEmptyValue(value)) return true;
3474
+ const inputTime = dayjs(value).unix();
3475
+ const minTimestamp = dayjs(minDate).unix();
3476
+ if (!dayjs(value).isValid() || !dayjs(minDate).isValid()) return true;
3477
+ return compareByOp(inputTime, minTimestamp, resolvedMinCompareOp);
3478
+ }, buildError(validatorInfo, rangeCompareMessage(resolvedMinCompareOp, minDate)))
3479
+ );
3480
+ }
3481
+ if (maxDateValidateMode === RangeValidateMode.Fixed_Number && maxDate) {
3482
+ RuleProps.push(
3483
+ createRule((_rule, value) => {
3484
+ if (isEmptyValue(value)) return true;
3485
+ const inputTime = dayjs(value).unix();
3486
+ const maxTimestamp = dayjs(maxDate).unix();
3487
+ if (!dayjs(value).isValid() || !dayjs(maxDate).isValid()) return true;
3488
+ return compareByOp(inputTime, maxTimestamp, resolvedMaxCompareOp);
3489
+ }, buildError(validatorInfo, rangeCompareMessage(resolvedMaxCompareOp, maxDate)))
3490
+ );
3491
+ }
3492
+ if (minDateValidateMode === RangeValidateMode.Variable_Validate && minDateFormulaExpr) {
3493
+ RuleProps.push({
3494
+ required: true,
3495
+ trigger: "change",
3496
+ validator: async (_rule, value, _callback, _source, options) => {
3497
+ const currentFormData = getCurrentFormData(_rule, options);
3498
+ const formulaValue = await calculateFormula(
3499
+ minDateFormulaExpr,
3500
+ currentFormData,
3501
+ options?.formData
3502
+ );
3503
+ const limitTime = toUnixTimestamp(formulaValue);
3504
+ if (limitTime !== null) {
3505
+ if (isEmptyValue(value)) {
3506
+ return Promise.resolve();
3507
+ }
3508
+ if (!dayjs(value).isValid()) {
3509
+ return Promise.resolve();
3510
+ }
3511
+ const inputTime = dayjs(value).unix();
3512
+ const fmt = fieldType === FIELD_TYPE.DATE_TIME ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
3513
+ if (!compareByOp(inputTime, limitTime, resolvedMinCompareOp)) {
3514
+ return Promise.reject(
3515
+ new Error(
3516
+ buildError(
3517
+ validatorInfo,
3518
+ rangeCompareMessage(resolvedMinCompareOp, dayjs.unix(limitTime).format(fmt))
3519
+ )
3520
+ )
3521
+ );
3522
+ }
3523
+ }
3524
+ return Promise.resolve();
3525
+ }
3526
+ });
3527
+ }
3528
+ if (maxDateValidateMode === RangeValidateMode.Variable_Validate && maxDateFormulaExpr) {
3529
+ RuleProps.push({
3530
+ required: true,
3531
+ trigger: "change",
3532
+ validator: async (_rule, value, _callback, _source, options) => {
3533
+ const currentFormData = getCurrentFormData(_rule, options);
3534
+ const formulaValue = await calculateFormula(
3535
+ maxDateFormulaExpr,
3536
+ currentFormData,
3537
+ options?.formData
3538
+ );
3539
+ const limitTime = toUnixTimestamp(formulaValue);
3540
+ if (limitTime !== null) {
3541
+ if (isEmptyValue(value)) {
3542
+ return Promise.resolve();
3543
+ }
3544
+ if (!dayjs(value).isValid()) {
3545
+ return Promise.resolve();
3546
+ }
3547
+ const inputTime = dayjs(value).unix();
3548
+ const fmt = fieldType === FIELD_TYPE.DATE_TIME ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
3549
+ if (!compareByOp(inputTime, limitTime, resolvedMaxCompareOp)) {
3550
+ return Promise.reject(
3551
+ new Error(
3552
+ buildError(
3553
+ validatorInfo,
3554
+ rangeCompareMessage(resolvedMaxCompareOp, dayjs.unix(limitTime).format(fmt))
3555
+ )
3556
+ )
3557
+ );
3558
+ }
3559
+ }
3560
+ return Promise.resolve();
3561
+ }
3562
+ });
3563
+ }
3564
+ return RuleProps;
3565
+ }
2983
3566
  function resolveKeepExceptionHighlight(formValue, fieldValue) {
2984
3567
  if (typeof fieldValue === "boolean") {
2985
3568
  return fieldValue;
@@ -3105,7 +3688,7 @@ function clearResolvedManualErrors(map, resolvePayload) {
3105
3688
  if (!payload) continue;
3106
3689
  const hasManual = filterRulesByTrigger(payload.rules, "manual").length > 0;
3107
3690
  const hasLive = filterRulesByTrigger(payload.rules, "change").length > 0;
3108
- if (hasManual && !hasLive && !isEmptyValue$1(payload.value)) {
3691
+ if (hasManual && !hasLive && !isEmptyValue(payload.value)) {
3109
3692
  delete next[path];
3110
3693
  }
3111
3694
  }
@@ -3119,7 +3702,7 @@ function mergeLiveValidation(current, liveResult, livePaths, resolvePayload) {
3119
3702
  continue;
3120
3703
  }
3121
3704
  const payload = resolvePayload(path);
3122
- const keepManualComment = !!payload && filterRulesByTrigger(payload.rules, "manual").length > 0 && isEmptyValue$1(payload.value) && !!base[path]?.length;
3705
+ const keepManualComment = !!payload && filterRulesByTrigger(payload.rules, "manual").length > 0 && isEmptyValue(payload.value) && !!base[path]?.length;
3123
3706
  if (!keepManualComment) {
3124
3707
  delete base[path];
3125
3708
  }
@@ -3162,7 +3745,7 @@ function mergeDisplayValidation(current, displayResult, ruleKeys, validatedPaths
3162
3745
  next[path] = displayResult[path];
3163
3746
  } else {
3164
3747
  const payload = resolvePayload(path);
3165
- const keepManualComment = !!payload && filterRulesByTrigger(payload.rules, "manual").length > 0 && isEmptyValue$1(payload.value) && !!next[path]?.length;
3748
+ const keepManualComment = !!payload && filterRulesByTrigger(payload.rules, "manual").length > 0 && isEmptyValue(payload.value) && !!next[path]?.length;
3166
3749
  if (!keepManualComment) delete next[path];
3167
3750
  }
3168
3751
  }
@@ -3325,8 +3908,8 @@ class RuntimeValidationService {
3325
3908
  }
3326
3909
  function matchesPattern(pattern4, path) {
3327
3910
  if (!pattern4.includes("*")) return pattern4 === path;
3328
- const expected = pattern4.split(".");
3329
- const actual = path.split(".");
3911
+ const expected = splitRuntimeDataPath(pattern4);
3912
+ const actual = splitRuntimeDataPath(path);
3330
3913
  return expected.length === actual.length && expected.every((part, index) => part === "*" || part === actual[index]);
3331
3914
  }
3332
3915
  class RuntimeFieldRegistry {
@@ -3845,6 +4428,7 @@ class RuntimeInstanceRegistry {
3845
4428
  this.disposables.get(uniqueId)?.forEach((dispose) => dispose());
3846
4429
  this.disposables.delete(uniqueId);
3847
4430
  record.fieldInitializer?.dispose();
4431
+ record.defaultValueValidation?.dispose();
3848
4432
  record.ruleCompiler?.dispose();
3849
4433
  record.validation.dispose();
3850
4434
  record.scriptRunner?.dispose();
@@ -4184,7 +4768,7 @@ class BomEntryValidator {
4184
4768
  }
4185
4769
  /** 需求总量 = 数量倍数 × BOM 单位用量 */
4186
4770
  get total() {
4187
- return this.materialNoNum * this.bomEntry.qty_required_;
4771
+ return this.materialNoNum * Number(this.bomEntry.qty_required_);
4188
4772
  }
4189
4773
  /**
4190
4774
  * 翻译物料的code
@@ -4338,12 +4922,12 @@ class BomEntryValidator {
4338
4922
  */
4339
4923
  calcQtyConsumed(arr = this.historyData) {
4340
4924
  const groupData = this.filterGroupData(arr);
4341
- return groupData.reduce((acc, cur) => acc + (cur.qty_ ?? 0), 0);
4925
+ return groupData.reduce((acc, cur) => acc + Number(cur.qty_ ?? 0), 0);
4342
4926
  }
4343
4927
  /** 上下限校验统一按需求单位口径取转换数量,历史数据未转换时兼容原数量。 */
4344
4928
  calcQtyForBounds(arr) {
4345
4929
  const groupData = this.filterGroupData(arr);
4346
- return groupData.reduce((acc, cur) => acc + (cur.qty_transfer_ ?? cur.qty_ ?? 0), 0);
4930
+ return groupData.reduce((acc, cur) => acc + Number(cur.qty_transfer_ ?? cur.qty_ ?? 0), 0);
4347
4931
  }
4348
4932
  /**
4349
4933
  * 计算自定义的数量校验的最大值和最小值
@@ -4358,9 +4942,10 @@ class BomEntryValidator {
4358
4942
  try {
4359
4943
  const json = JSON.parse(str);
4360
4944
  if (json.expr) {
4361
- return await window.gct_expression.execute(json.expr, {
4362
- qty_required_: data.qty_required_
4945
+ const value = await window.gct_expression.execute(json.expr, {
4946
+ qty_required_: data.qty_required_ == null ? data.qty_required_ : Number(data.qty_required_)
4363
4947
  });
4948
+ return value == null ? void 0 : Number(value);
4364
4949
  } else {
4365
4950
  console.warn("没有配置表达式");
4366
4951
  }
@@ -4387,8 +4972,8 @@ class BomEntryValidator {
4387
4972
  const loaded = this.calcQtyConsumed(arr);
4388
4973
  let required4 = this.remainingNum;
4389
4974
  if (this.isCustomRequiredQty) {
4390
- const currentQty = groupData[0]?.qty_required_;
4391
- if (typeof currentQty !== "number" || !Number.isFinite(currentQty) || currentQty <= 0) {
4975
+ const currentQty = Number(groupData[0]?.qty_required_);
4976
+ if (!Number.isFinite(currentQty) || currentQty <= 0) {
4392
4977
  throw new Error(
4393
4978
  groupNo != null && groupNo > 0 ? `序号${groupNo},需求数量必须大于 0` : "需求数量必须大于 0"
4394
4979
  );
@@ -5202,7 +5787,7 @@ function calcGroupRowSpans(rows, validator) {
5202
5787
  function calcGroupQtyConsumedTotal(entryIdx, tableData, validator) {
5203
5788
  if (entryIdx < 0) return 0;
5204
5789
  return tableData.reduce((sum, row) => {
5205
- return validator.resolveEntryIndex(row) === entryIdx ? sum + (row.qty_ ?? 0) : sum;
5790
+ return validator.resolveEntryIndex(row) === entryIdx ? sum + Number(row.qty_ ?? 0) : sum;
5206
5791
  }, 0);
5207
5792
  }
5208
5793
  function syncGroupQtyConsumedTotals(tableData, validator) {
@@ -5260,7 +5845,8 @@ class MaterialConsumeTableController {
5260
5845
  constructor(tmplBomController, tmplBom, options = {}) {
5261
5846
  this.tmplBomController = tmplBomController;
5262
5847
  this.tmplBom = tmplBom;
5263
- if (!options.printOnly) this.initScanRule(this.tmplBom.barcode_parsing_rules_id_);
5848
+ if (!options.printOnly && this.hasFormInstance)
5849
+ this.initScanRule(this.tmplBom.barcode_parsing_rules_id_);
5264
5850
  this.scanParamType = this.tmplBom.scan_param_type_;
5265
5851
  markRaw(this);
5266
5852
  this.bomEntriesValidator = new BomEntriesValidator(
@@ -5300,10 +5886,10 @@ class MaterialConsumeTableController {
5300
5886
  mainFormState = ref({});
5301
5887
  /** 表单数据状态(由 factory bindRuntime 注入):未填报 / STASH / SUBMIT */
5302
5888
  dataStatus;
5303
- /** factory 是否已绑定过运行时(避免重复 initTableData) */
5304
- runtimeBound = false;
5305
- /** 多 Sheet / 同屏多实例下,弹层和异步交互使用该键隔离。 */
5306
- runtimeOwnerId = "";
5889
+ /** 实例数据只在 LOADED 前准备一次,运行时绑定不再重新生成行。 */
5890
+ initialDataPrepared = false;
5891
+ /** 最近一次同步需求数量时使用的数量依赖。 */
5892
+ syncedMaterialNoNum;
5307
5893
  /** 表单是否已暂存或提交(已处理过则不再跑初始化) */
5308
5894
  get isDataProcessed() {
5309
5895
  return ["STASH", "SUBMIT"].includes(this.dataStatus ?? "");
@@ -5323,6 +5909,9 @@ class MaterialConsumeTableController {
5323
5909
  get mcPattern() {
5324
5910
  return this.tmplBom.material_consumption_pattern_ ?? this.tmplBomController.defaultMCPattern;
5325
5911
  }
5912
+ get hasFormInstance() {
5913
+ return this.tmplBomController.hasFormInstance;
5914
+ }
5326
5915
  /**
5327
5916
  * 解析规则数据对象
5328
5917
  */
@@ -5408,21 +5997,6 @@ class MaterialConsumeTableController {
5408
5997
  this.scanRuleProps = toParseRuleConfig(id);
5409
5998
  this.scanRuleInfo = await getParseRuleInfo({ id: this.scanRuleProps.parsingRuleId });
5410
5999
  }
5411
- /**
5412
- * 变更条码规则
5413
- */
5414
- async changeScanRule() {
5415
- const { id_, base_id_ } = this.scanRuleInfo ?? {};
5416
- const newConfig = await MaterialConsumeTableController.render.openChangeRuleModal({
5417
- config: this.scanRuleProps,
5418
- subModelKey: this.widget.props.modelKey,
5419
- formModelController: this.formModelController
5420
- });
5421
- if (newConfig) {
5422
- this.scanRuleProps = newConfig;
5423
- this.scanRuleInfo = await getParseRuleInfo({ id: this.scanRuleProps.parsingRuleId });
5424
- }
5425
- }
5426
6000
  /**
5427
6001
  * 是否人为指定物料
5428
6002
  * @readonly
@@ -5449,7 +6023,8 @@ class MaterialConsumeTableController {
5449
6023
  return this.actualBomEntries.map((i) => {
5450
6024
  return {
5451
6025
  product_id_: i.product_id_,
5452
- ...materialNoNum === void 0 ? {} : { qty_required_: i.qty_required_ * materialNoNum },
6026
+ qty_required_uom_id_: i.uom_id_ || void 0,
6027
+ ...materialNoNum === void 0 ? {} : { qty_required_: Number(i.qty_required_) * Number(materialNoNum) },
5453
6028
  bom_entry_id_: i.id_
5454
6029
  };
5455
6030
  });
@@ -5575,6 +6150,10 @@ class MaterialConsumeTableController {
5575
6150
  }
5576
6151
  const isRecordPattern = this.mcPattern === MaterialConsumptionPatternEnum.RECORD && !this.tmplBom.personal_bom_enabled_;
5577
6152
  console.log("parseScanStr", data);
6153
+ if (!data.lot && !data.uniqueCode) {
6154
+ this.error($t("sys.edhr.mcTable.lotOrUniqueCodeRequired"));
6155
+ return;
6156
+ }
5578
6157
  const arr = await materialCheck({
5579
6158
  material_no_: data.materialCode,
5580
6159
  production_identification_name_: data.lot,
@@ -5629,6 +6208,9 @@ class MaterialConsumeTableController {
5629
6208
  this.setDefaultValue(row);
5630
6209
  try {
5631
6210
  const plan = await this.bomEntriesValidator.validateScanCanInsert(row, this.actualTableData);
6211
+ if (plan) {
6212
+ row.qty_required_uom_id_ = plan.target.bomEntry.uom_id_ || void 0;
6213
+ }
5632
6214
  const existingRequiredQty = this.isCustomRequiredQty && plan ? this.actualTableData.find(
5633
6215
  (item) => plan.target.isRowInGroup(item) && item.qty_required_ != null
5634
6216
  )?.qty_required_ : void 0;
@@ -5685,40 +6267,36 @@ class MaterialConsumeTableController {
5685
6267
  });
5686
6268
  this.isScanOpen = false;
5687
6269
  }
5688
- /**
5689
- * 打开扫描弹窗
5690
- * @param opts
5691
- */
5692
- async openBomModal() {
5693
- if (!this.actualBomEntries) {
5694
- return;
6270
+ /** Store 创建前准备物料行和数量,全部 Sheet 的 LOADED 共用这份数据。 */
6271
+ prepareInitialData(opts) {
6272
+ if (this.initialDataPrepared) return;
6273
+ this.tableDataRef = toRef(opts.formState, opts.field, []);
6274
+ this.mainFormState = toRef(() => opts.formState);
6275
+ this.dataStatus = opts.dataStatus;
6276
+ this.initTableData(opts.defaultRowData);
6277
+ const rows = this.actualTableData;
6278
+ if (rows.length === 1 && !rows[0].product_id_) {
6279
+ MCDataUtil.setRowEditing(rows[0], true);
5695
6280
  }
5696
- await MaterialConsumeTableController.render?.openBomModal({
5697
- ownerId: this.runtimeOwnerId,
5698
- bomList: this.actualBomEntries,
5699
- onSubstitute: async () => {
5700
- console.log("一键导入数据逻辑");
5701
- }
5702
- });
6281
+ if (this.dataStatus !== "SUBMIT") {
6282
+ this.syncQtyRequiredFromBom();
6283
+ }
6284
+ this.syncedMaterialNoNum = this.materialNoNum;
6285
+ this.initialDataPrepared = true;
5703
6286
  }
5704
- /**
5705
- * 表单加载时由 factory 调用:绑定稳定数据源并初始化行数据。
5706
- * 不在分页组件 setup 中调用,避免跨页挂载重复 init。
5707
- */
6287
+ /** 数量依赖实际变化时才重算,避免首次绑定覆盖 LOADED 中的回填。 */
6288
+ syncQtyRequiredFromBomIfChanged() {
6289
+ if (this.dataStatus === "SUBMIT") return;
6290
+ const materialNoNum = this.materialNoNum;
6291
+ if (this.initialDataPrepared && Object.is(materialNoNum, this.syncedMaterialNoNum)) return;
6292
+ this.syncQtyRequiredFromBom();
6293
+ this.syncedMaterialNoNum = materialNoNum;
6294
+ }
6295
+ /** 只绑定运行时 Store,不重新生成行或修改行内容。 */
5708
6296
  bindRuntime(opts) {
5709
6297
  this.tableDataRef = opts.tableDataRef;
5710
- this.runtimeOwnerId = opts.ownerId;
5711
6298
  this.mainFormState = opts.mainFormState ?? ref({});
5712
6299
  this.dataStatus = opts.dataStatus;
5713
- if (this.runtimeBound) return;
5714
- this.runtimeBound = true;
5715
- this.initTableData(opts.defaultRowData);
5716
- if (this.actualTableData.length === 1) {
5717
- const firstRow = this.actualTableData[0];
5718
- if (!firstRow.product_id_) {
5719
- MCDataUtil.setRowEditing(firstRow, true);
5720
- }
5721
- }
5722
6300
  }
5723
6301
  /**
5724
6302
  * 消耗表组件挂载时调用:只同步视图依赖,不初始化数据、不注册 watch。
@@ -5732,7 +6310,10 @@ class MaterialConsumeTableController {
5732
6310
  * 按当前 materialNoNum 回写各行 qty_required_(校验侧 total 已通过 getter 实时读取)
5733
6311
  */
5734
6312
  syncQtyRequiredFromBom() {
5735
- if (this.tmplBom.required_qty_calc_rule_ === RequiredQtyCalcRule.Custom) return;
6313
+ if (this.tmplBom.required_qty_calc_rule_ === RequiredQtyCalcRule.Custom) {
6314
+ this.updateDerivedQtyFields();
6315
+ return;
6316
+ }
5736
6317
  this.actualTableData.forEach((row) => {
5737
6318
  if (!row.product_id_) return;
5738
6319
  const util = this.bomEntriesValidator.findUtilByProductId(row.product_id_);
@@ -5776,7 +6357,7 @@ class MaterialConsumeTableController {
5776
6357
  const formData = transformFields.reduce((acc, cur) => {
5777
6358
  if (!cur.targetField) return acc;
5778
6359
  if (cur.sourceField === FormulaRuleFieldKeyEnum.INPUT) {
5779
- acc[cur.sourceField] = row.qty_;
6360
+ acc[cur.sourceField] = row.qty_ == null ? row.qty_ : Number(row.qty_);
5780
6361
  } else if (cur.targetField.includes(".")) {
5781
6362
  const fieldKey = cur.targetField.split(".").pop();
5782
6363
  acc[cur.sourceField] = row[fieldKey];
@@ -5788,7 +6369,7 @@ class MaterialConsumeTableController {
5788
6369
  try {
5789
6370
  const res = await calculate(formulaContent, formData);
5790
6371
  Object.assign(row, {
5791
- qty_transfer_: res,
6372
+ qty_transfer_: res == null ? res : Number(res),
5792
6373
  qty_transfer_uom_id_: targetUnitId,
5793
6374
  transfer_formula_: formulaContent
5794
6375
  });
@@ -5972,7 +6553,7 @@ class MaterialConsumeTableController {
5972
6553
  const modifySingleRow = (index) => {
5973
6554
  const row = this.actualTableData[index];
5974
6555
  if (!row.product_id_) {
5975
- row.qty_consumed_ = 0 + (row.qty_ ?? 0);
6556
+ row.qty_consumed_ = Number(row.qty_ ?? 0);
5976
6557
  return;
5977
6558
  }
5978
6559
  let total = 0;
@@ -5981,7 +6562,7 @@ class MaterialConsumeTableController {
5981
6562
  if (util) {
5982
6563
  total += util.hasConsumed;
5983
6564
  util.filterGroupData(beforeArr).forEach((i) => {
5984
- total += i.qty_ ?? 0;
6565
+ total += Number(i.qty_ ?? 0);
5985
6566
  });
5986
6567
  row.qty_consumed_ = total;
5987
6568
  }
@@ -6003,11 +6584,22 @@ class MaterialConsumeTableController {
6003
6584
  this.updateRowConsumed();
6004
6585
  this.updateGroupQtyConsumedTotal();
6005
6586
  }
6587
+ /** 同步 BOM 主物料的需求数量单位,未关联 BOM 的行保留原单位。 */
6588
+ syncRequiredUomFromBom(row) {
6589
+ const validator = this.bomEntriesValidator;
6590
+ const productId = row.product_id_;
6591
+ const bound = row.bom_entry_id_ ? validator.bomEntryValidators.find((item) => item.bomEntry.id_ === row.bom_entry_id_) : void 0;
6592
+ const matched = productId ? bound?.productIds.includes(productId) ? bound : validator.findUtilByProductId(productId) : void 0;
6593
+ if (matched || bound) {
6594
+ row.qty_required_uom_id_ = matched?.bomEntry.uom_id_ || void 0;
6595
+ }
6596
+ }
6006
6597
  /**
6007
- * 设置默认值,如工序,需求数量/已消耗数量
6598
+ * 设置默认值,如工序,需求数量/需求数量单位/已消耗数量
6008
6599
  * @param row
6009
6600
  */
6010
6601
  setDefaultValue(row) {
6602
+ this.syncRequiredUomFromBom(row);
6011
6603
  if (!row.routing_operation_id_) {
6012
6604
  row.routing_operation_id_ = this.tmplBomController.operationId;
6013
6605
  }
@@ -6069,7 +6661,16 @@ class MaterialConsumeTableController {
6069
6661
  this.error(msg);
6070
6662
  return;
6071
6663
  }
6072
- if (!value) return;
6664
+ if (!value) {
6665
+ if (row.product_id_ && !this.isCustomRequiredQty) {
6666
+ const util = this.bomEntriesValidator.findUtilByProductId(row.product_id_);
6667
+ if (util) {
6668
+ row.qty_required_ = util.total;
6669
+ }
6670
+ }
6671
+ this.updateDerivedQtyFields();
6672
+ return;
6673
+ }
6073
6674
  try {
6074
6675
  await validateReinspectionDate({
6075
6676
  product_id_: option.product_id_ ?? row.product_id_,
@@ -6093,12 +6694,38 @@ class MaterialConsumeTableController {
6093
6694
  const qty = oldGroupId && row.bom_entry_id_ === oldGroupId ? oldRequiredQty : this.getCustomGroupRequiredQty(row);
6094
6695
  this.setCustomGroupRequiredQty(row, qty);
6095
6696
  }
6697
+ this.updateDerivedQtyFields();
6096
6698
  } else if (field === "qty_") {
6097
6699
  this.updateDerivedQtyFields();
6098
6700
  }
6099
6701
  await this.applyUnitConversionRules(row);
6100
6702
  }
6101
6703
  }
6704
+ class MCRender {
6705
+ /**
6706
+ * 提示信息
6707
+ * @param opts
6708
+ */
6709
+ message(opts) {
6710
+ throw new Error("Function message not implemented.");
6711
+ }
6712
+ async openScanModal(opts) {
6713
+ throw new Error("Function openScanModal not implemented.");
6714
+ }
6715
+ /**
6716
+ * 扫码返回多条候选时,弹窗选择其中一条
6717
+ * 取消返回 undefined
6718
+ */
6719
+ async openMultiRowsModal(opts) {
6720
+ throw new Error("Function openMultiRowsModal not implemented.");
6721
+ }
6722
+ /**
6723
+ * 关闭当前页面的 form-base 弹层
6724
+ */
6725
+ destroyAllModals(_ownerId) {
6726
+ throw new Error("Function destroyAllModals not implemented.");
6727
+ }
6728
+ }
6102
6729
  var SubTableActionEnum = /* @__PURE__ */ ((SubTableActionEnum2) => {
6103
6730
  SubTableActionEnum2["QuickFillRowCurrent"] = "quickFillRowCurrent";
6104
6731
  SubTableActionEnum2["InsertRowBefore"] = "insertRowBefore";
@@ -6110,8 +6737,6 @@ var SubTableActionEnum = /* @__PURE__ */ ((SubTableActionEnum2) => {
6110
6737
  SubTableActionEnum2["ClearRowCurrent"] = "clearRowCurrent";
6111
6738
  SubTableActionEnum2["CONFIRM"] = "CONFIRM";
6112
6739
  SubTableActionEnum2["SCAN"] = "SCAN";
6113
- SubTableActionEnum2["VIEW_BOM"] = "VIEW_BOM";
6114
- SubTableActionEnum2["CHANGE_PARSE_RULE"] = "CHANGE_PARSE_RULE";
6115
6740
  SubTableActionEnum2["RowEdit"] = "rowEdit";
6116
6741
  SubTableActionEnum2["Insert1GroupAfter"] = "insert1GroupAfter";
6117
6742
  return SubTableActionEnum2;
@@ -6131,18 +6756,6 @@ function getMenuByAction(type4) {
6131
6756
  label: "条码扫描",
6132
6757
  icon: "size24 icon-saoma1"
6133
6758
  },
6134
- [SubTableActionEnum.VIEW_BOM]: {
6135
- type: SubTableActionMenuTypeEnum.ACTION,
6136
- key: SubTableActionEnum.VIEW_BOM,
6137
- label: "BOM查看",
6138
- icon: "size24 icon-a-bom11"
6139
- },
6140
- [SubTableActionEnum.CHANGE_PARSE_RULE]: {
6141
- type: SubTableActionMenuTypeEnum.ACTION,
6142
- key: SubTableActionEnum.CHANGE_PARSE_RULE,
6143
- label: "条码解析规则变更",
6144
- icon: "icon-tiaomajiexi"
6145
- },
6146
6759
  [SubTableActionEnum.QuickFillRowCurrent]: {
6147
6760
  type: SubTableActionMenuTypeEnum.ACTION,
6148
6761
  key: SubTableActionEnum.QuickFillRowCurrent,
@@ -6326,29 +6939,227 @@ class TdHandler {
6326
6939
  this.mergeTd({ cellWidget: { props: { newSpecificConfig: { customLoader } } } });
6327
6940
  }
6328
6941
  }
6329
- const SCAN_ROW_META_KEYS = /* @__PURE__ */ new Set([FRONT_ROW_KEY, "id_", "id", "group_", "deleted_", "delete_"]);
6330
- function hasRowId(row) {
6331
- const id = row.id_ ?? row.id;
6332
- return id !== void 0 && id !== null && String(id).trim() !== "";
6333
- }
6334
- function isEmptyScanValue(value) {
6335
- if (value == null || value === "") return true;
6336
- if (typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) {
6337
- return true;
6942
+ class BaseFormModelFetcher {
6943
+ /** 默认接口 */
6944
+ apis = {
6945
+ getFieldMetaList: api.apaas.fieldMeta.getList,
6946
+ getModelMetaSubModelList: api.apaas.modelComprehensive.getSubModelList,
6947
+ getModelDetail2FieldList: api.apaas.modelMeta.getDetail
6948
+ };
6949
+ /**
6950
+ * 模型映射缓存
6951
+ */
6952
+ modelMetaMap = {};
6953
+ async load(opts) {
6954
+ const { model } = opts;
6955
+ this.modelMetaMap = {};
6956
+ await this.loadModelFields(model);
6957
+ await this.loadSubModelsFields(model);
6958
+ return Object.values(this.modelMetaMap);
6338
6959
  }
6339
- return false;
6340
- }
6341
- function isProductBatchEmptyRow(row) {
6342
- return isEmptyScanValue(row.product_id_) && isEmptyScanValue(row.material_no_) && isEmptyScanValue(row.material_no__id_);
6343
- }
6344
- function hasSubtableBusinessData(row, ignoreValues = {}) {
6345
- if (!row || typeof row !== "object") return false;
6346
- if (hasRowId(row)) return true;
6347
- return Object.keys(row).some((key) => {
6348
- if (SCAN_ROW_META_KEYS.has(key) || key.startsWith("_")) return false;
6349
- const value = row[key];
6350
- if (isEmptyScanValue(value)) return false;
6351
- if (key in ignoreValues && value === ignoreValues[key]) return false;
6960
+ /**
6961
+ * 补全字段信息
6962
+ * @param modelKey 字段所属的模型
6963
+ * @param [fields=[]]
6964
+ * @return {*}
6965
+ */
6966
+ completeFields(modelKey, fields = []) {
6967
+ return fields.map((field) => {
6968
+ if (!field.modelKey) {
6969
+ field.modelKey = modelKey;
6970
+ }
6971
+ return field;
6972
+ });
6973
+ }
6974
+ /**
6975
+ * 根据模型key加载模型字段
6976
+ *
6977
+ * @param [modelKey=this.model]
6978
+ * @return {*}
6979
+ */
6980
+ async loadModelFields(modelKey) {
6981
+ if (typeof this.apis.getFieldMetaList !== "function") {
6982
+ return;
6983
+ }
6984
+ const res = await this.apis.getFieldMetaList({
6985
+ modelKey
6986
+ });
6987
+ this.modelMetaMap[modelKey] = {
6988
+ key: modelKey,
6989
+ name: "",
6990
+ fields: this.completeFields(modelKey, res)
6991
+ };
6992
+ return res;
6993
+ }
6994
+ /**
6995
+ * 加载表单所有子表字段对应模型的字段信息集合
6996
+ */
6997
+ async loadSubModelsFields(modelKey) {
6998
+ const res = await this.apis.getModelMetaSubModelList({
6999
+ modelKey
7000
+ });
7001
+ (res ?? []).forEach((m) => {
7002
+ if (!this.modelMetaMap[m.key]) {
7003
+ this.modelMetaMap[m.key] = {
7004
+ key: m.key,
7005
+ name: m.name,
7006
+ subModel: m.subModel,
7007
+ fields: this.completeFields(m.key, m.fieldMetaList)
7008
+ };
7009
+ }
7010
+ });
7011
+ }
7012
+ }
7013
+ class FormModelController {
7014
+ /** 主模型的key */
7015
+ masterModelKey;
7016
+ /** 主模型的名称 */
7017
+ masterModelName;
7018
+ /** 模型请求器 */
7019
+ fetcher = new BaseFormModelFetcher();
7020
+ /** 模型映射缓存 */
7021
+ modelMetaMap = reactive({});
7022
+ /** 主模型信息 */
7023
+ get masterModel() {
7024
+ return this.modelMetaMap[this.masterModelKey];
7025
+ }
7026
+ /** 获取主模型字段集合 */
7027
+ get masterFields() {
7028
+ return this.masterModel?.fields;
7029
+ }
7030
+ /** 获取子模型 */
7031
+ getSubModel(subModelKey) {
7032
+ return this.modelMetaMap[subModelKey];
7033
+ }
7034
+ /** 获取子模型字段集合 */
7035
+ getSubModelFields(subModelKey) {
7036
+ return this.getSubModel(subModelKey)?.fields;
7037
+ }
7038
+ /**
7039
+ * 表单字段下拉选项(排除系统字段和子表字段)
7040
+ * value 格式为 modelKey.fieldKey,与字段映射存储格式一致
7041
+ */
7042
+ getFormFieldOptions(subModelKey) {
7043
+ const fields = subModelKey ? this.getSubModelFields(subModelKey) : this.masterModel?.fields;
7044
+ return (fields ?? []).filter(
7045
+ (field) => !this.isSystemField(field) && !this.isSubField(field) && !this.isObjectField(field)
7046
+ ).map((field) => ({
7047
+ ...field,
7048
+ label: `${field.name}`,
7049
+ value: `${field.modelKey}.${field.key}`
7050
+ }));
7051
+ }
7052
+ /**
7053
+ * 初始化
7054
+ *
7055
+ * @param opts
7056
+ * - model 主模型key
7057
+ * - name 主模型名称
7058
+ */
7059
+ async init(opts) {
7060
+ this.masterModelKey = opts.model;
7061
+ this.masterModelName = opts.name;
7062
+ await this.load();
7063
+ }
7064
+ /** 刷新数据 */
7065
+ async refresh() {
7066
+ await this.load();
7067
+ }
7068
+ /**
7069
+ * 加载数据并填充到modelMetaMap中
7070
+ * @protected
7071
+ * @return {*}
7072
+ */
7073
+ async load() {
7074
+ if (!this.masterModelKey) {
7075
+ console.error("缺少主模型的key");
7076
+ return;
7077
+ }
7078
+ const models = await this.fetcher.load({ model: this.masterModelKey });
7079
+ this.modelMetaMap = models.reduce((acc, cur) => {
7080
+ acc[cur.key] = cur;
7081
+ if (cur.key === this.masterModelKey) {
7082
+ cur.name = this.masterModelName;
7083
+ }
7084
+ return acc;
7085
+ }, {});
7086
+ }
7087
+ /** 是否是子模型字段 */
7088
+ isSubField(field) {
7089
+ return field.type === FIELD_TYPE.MASTERSLAVE && field.bindInfo;
7090
+ }
7091
+ /** 是否是预置字段,包括系统字段和业务内置字段 */
7092
+ isPresetField(field) {
7093
+ return [CreateType.BUILTIN, CreateType.SYSTEM].includes(field.createType);
7094
+ }
7095
+ /** 是否是系统字段 */
7096
+ isSystemField(field) {
7097
+ return field.createType === CreateType.SYSTEM;
7098
+ }
7099
+ /** 是否是对象字段类型 */
7100
+ isObjectField(field) {
7101
+ return field.type === FIELD_TYPE.OBJECT_TYPE;
7102
+ }
7103
+ /**
7104
+ * 获取主模型里子表字段对应的子模型key
7105
+ *
7106
+ * @param fieldKey 子表字段在主表里的字段key
7107
+ * @return {*}
7108
+ */
7109
+ getSubFieldModelKey(fieldKey) {
7110
+ return this.masterFields.find((field) => field.key === fieldKey)?.bindInfo;
7111
+ }
7112
+ /**
7113
+ * 获取字段信息
7114
+ * @param [modelKey=this.masterModelKey] 模型key
7115
+ * @param fieldKey 字段key
7116
+ * @return {*}
7117
+ */
7118
+ findField(modelKey = this.masterModelKey, fieldKey) {
7119
+ const model = this.modelMetaMap[modelKey];
7120
+ if (!model) {
7121
+ return;
7122
+ }
7123
+ return model.fields.find((field) => field.key === fieldKey);
7124
+ }
7125
+ }
7126
+ const FormModelControllerKey = "GctFormModelController";
7127
+ function useFormModel() {
7128
+ function provideController(c = new FormModelController()) {
7129
+ provide(FormModelControllerKey, c);
7130
+ return c;
7131
+ }
7132
+ function injectController() {
7133
+ return inject(FormModelControllerKey);
7134
+ }
7135
+ return {
7136
+ provideController,
7137
+ injectController
7138
+ };
7139
+ }
7140
+ const SCAN_ROW_META_KEYS = /* @__PURE__ */ new Set([FRONT_ROW_KEY, "id_", "id", "group_", "deleted_", "delete_"]);
7141
+ function hasRowId(row) {
7142
+ const id = row.id_ ?? row.id;
7143
+ return id !== void 0 && id !== null && String(id).trim() !== "";
7144
+ }
7145
+ function isEmptyScanValue(value) {
7146
+ if (value == null || value === "") return true;
7147
+ if (typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) {
7148
+ return true;
7149
+ }
7150
+ return false;
7151
+ }
7152
+ function isProductBatchEmptyRow(row) {
7153
+ return isEmptyScanValue(row.product_id_) && isEmptyScanValue(row.material_no_) && isEmptyScanValue(row.material_no__id_);
7154
+ }
7155
+ function hasSubtableBusinessData(row, ignoreValues = {}) {
7156
+ if (!row || typeof row !== "object") return false;
7157
+ if (hasRowId(row)) return true;
7158
+ return Object.keys(row).some((key) => {
7159
+ if (SCAN_ROW_META_KEYS.has(key) || key.startsWith("_")) return false;
7160
+ const value = row[key];
7161
+ if (isEmptyScanValue(value)) return false;
7162
+ if (key in ignoreValues && value === ignoreValues[key]) return false;
6352
7163
  return true;
6353
7164
  });
6354
7165
  }
@@ -6559,8 +7370,6 @@ class SubTableCore {
6559
7370
  const { actionKey } = params;
6560
7371
  if (actionKey === SubTableActionEnum.SCAN) {
6561
7372
  this.openScanModal();
6562
- } else if (actionKey === SubTableActionEnum.CHANGE_PARSE_RULE) {
6563
- this.changeScanRule();
6564
7373
  }
6565
7374
  }
6566
7375
  /**
@@ -6662,20 +7471,6 @@ class SubTableCore {
6662
7471
  scanRuleInfo;
6663
7472
  /** 解析规则配置对象 */
6664
7473
  scanRuleProps;
6665
- /**
6666
- * 变更条码规则
6667
- */
6668
- async changeScanRule() {
6669
- const newConfig = await this.render.openChangeRuleModal({
6670
- config: this.scanRuleProps,
6671
- subModelKey: this.subModelKey,
6672
- formModelController: this.formModelController
6673
- });
6674
- if (newConfig) {
6675
- this.scanRuleProps = newConfig;
6676
- this.scanRuleInfo = await getParseRuleInfo({ id: newConfig.parsingRuleId });
6677
- }
6678
- }
6679
7474
  /**
6680
7475
  * 打开扫描弹窗
6681
7476
  * @param opts
@@ -6727,11 +7522,12 @@ class SubTableCore {
6727
7522
  /**
6728
7523
  * 扫码多条候选时选择一行(1 条自动选中)
6729
7524
  */
6730
- async pickScanRecord(records) {
7525
+ async pickScanRecord(records, options = {}) {
6731
7526
  if (!records.length) return void 0;
6732
7527
  if (records.length === 1) return records[0];
6733
7528
  return this.render.openMultiRowsModal({
6734
- rows: mapScanRecordsForPicker(records)
7529
+ rows: mapScanRecordsForPicker(records),
7530
+ ...options
6735
7531
  });
6736
7532
  }
6737
7533
  /**
@@ -6991,7 +7787,7 @@ async function validateObjectBomQtyOnSubmit(opts) {
6991
7787
  for (const obj of objectFieldList) {
6992
7788
  if (!obj?.objectField) continue;
6993
7789
  const objectBom = findObjectBom(formInstBom, obj.objectField);
6994
- if (objectBom?.material_consumption_pattern_ === MaterialConsumptionPatternEnum.RECORD) {
7790
+ if (objectBom?.material_consumption_pattern_ === MaterialConsumptionPatternEnum.RECORD && !objectBom.personal_bom_enabled_) {
6995
7791
  continue;
6996
7792
  }
6997
7793
  const { productKey, productFieldName, qtyKey, qtyRequiredKey, qtyFieldName } = pickObjectFieldKeys(obj.subFields, obj.objectField);
@@ -7052,150 +7848,6 @@ async function validateObjectBomQtyOnSubmit(opts) {
7052
7848
  }
7053
7849
  return errors;
7054
7850
  }
7055
- function isBlank(value) {
7056
- return value == null || value === "";
7057
- }
7058
- function pickPresent(preferred, fallback) {
7059
- return isBlank(preferred) ? fallback : preferred;
7060
- }
7061
- function resolveObjectFieldKeys(opts) {
7062
- const obj = opts.objectFieldList?.find((item) => item.objectField === opts.belongingObject);
7063
- const fromList = obj?.subFields ? pickObjectFieldKeys(obj.subFields, opts.belongingObject) : {};
7064
- const fromFallback = pickObjectFieldKeys(opts.fallbackFields, opts.belongingObject, {
7065
- requireUsed: false
7066
- });
7067
- return {
7068
- productKey: pickPresent(fromList.productKey, fromFallback.productKey),
7069
- productFieldName: fromList.productFieldName ?? fromFallback.productFieldName,
7070
- materialNoKey: pickPresent(fromList.materialNoKey, fromFallback.materialNoKey),
7071
- materialNoFieldName: fromList.materialNoFieldName ?? fromFallback.materialNoFieldName,
7072
- qtyKey: pickPresent(fromList.qtyKey, fromFallback.qtyKey),
7073
- qtyRequiredKey: pickPresent(fromList.qtyRequiredKey, fromFallback.qtyRequiredKey),
7074
- qtyFieldName: fromList.qtyFieldName ?? fromFallback.qtyFieldName,
7075
- bomEntryIdKey: pickPresent(fromList.bomEntryIdKey, fromFallback.bomEntryIdKey)
7076
- };
7077
- }
7078
- function buildObjectLotExtraQuery(productId) {
7079
- if (isBlank(productId)) return {};
7080
- const versionId = String(productId).split(":").pop();
7081
- if (!versionId) return {};
7082
- return { "product_id_.versionEq": versionId };
7083
- }
7084
- function clearedLotFields(materialNoKey) {
7085
- if (!materialNoKey) return {};
7086
- return {
7087
- [materialNoKey]: void 0,
7088
- [`${materialNoKey}_id_`]: void 0,
7089
- [`${materialNoKey}_lb_`]: void 0
7090
- };
7091
- }
7092
- function shouldClearLotOnProductChange(opts) {
7093
- const { prevProduct, nextProduct, lotValue } = opts;
7094
- if (isBlank(prevProduct) && isBlank(nextProduct)) return false;
7095
- if (prevProduct === nextProduct) return false;
7096
- if (isBlank(prevProduct) && !isBlank(nextProduct) && !isBlank(lotValue)) {
7097
- return false;
7098
- }
7099
- return true;
7100
- }
7101
- let fillingProduct = false;
7102
- function runWithFillProduct(fn) {
7103
- fillingProduct = true;
7104
- try {
7105
- fn();
7106
- } finally {
7107
- nextTick(() => {
7108
- fillingProduct = false;
7109
- });
7110
- }
7111
- }
7112
- function resolveLotValidateParams(keys, formData, option) {
7113
- return {
7114
- product_id_: option?.product_id_ ?? option?._item?.product_id_ ?? (keys.productKey ? formData[keys.productKey] : void 0),
7115
- material_no_: option?.name_ ?? option?.__VALUE__ ?? (keys.materialNoKey ? formData[keys.materialNoKey] : void 0),
7116
- material_no_id_: option?.id_ ?? (keys.materialNoKey ? formData[`${keys.materialNoKey}_id_`] : void 0)
7117
- };
7118
- }
7119
- async function applyConsumeObjectTraceChange(opts) {
7120
- const { belongingObject, role, formData } = opts;
7121
- if (!belongingObject || !formData) return {};
7122
- const keys = resolveObjectFieldKeys({
7123
- belongingObject,
7124
- objectFieldList: opts.objectFieldList,
7125
- fallbackFields: opts.fallbackFields
7126
- });
7127
- if (role === FIELD_TYPE.PRODUCT) {
7128
- if (!("prevProduct" in opts) || fillingProduct) return {};
7129
- const values = {};
7130
- if (shouldClearLotOnProductChange({
7131
- prevProduct: opts.prevProduct,
7132
- nextProduct: opts.nextValue,
7133
- lotValue: keys.materialNoKey ? formData[keys.materialNoKey] : void 0
7134
- })) {
7135
- Object.assign(values, clearedLotFields(keys.materialNoKey));
7136
- }
7137
- if (keys.bomEntryIdKey) {
7138
- values[keys.bomEntryIdKey] = null;
7139
- if (!isBlank(opts.nextValue) && opts.formInstBom) {
7140
- const entry = resolveObjectBomEntry({
7141
- formInstBom: opts.formInstBom,
7142
- belongingObject,
7143
- productId: String(opts.nextValue)
7144
- });
7145
- if (entry) values[keys.bomEntryIdKey] = entry.id_;
7146
- }
7147
- }
7148
- opts.rowWriter.patchRow(values, "autofill");
7149
- const lotValue = keys.materialNoKey ? formData[keys.materialNoKey] : void 0;
7150
- if (!isBlank(opts.nextValue) && !isBlank(lotValue)) {
7151
- try {
7152
- await validateReinspectionDate({
7153
- product_id_: String(opts.nextValue),
7154
- material_no_: lotValue,
7155
- material_no_id_: keys.materialNoKey ? formData[`${keys.materialNoKey}_id_`] : void 0
7156
- });
7157
- } catch (e) {
7158
- return { abortReinspection: e?.message || String(e) };
7159
- }
7160
- }
7161
- return {};
7162
- }
7163
- if (role === FIELD_TYPE.MATERIAL_NO) {
7164
- if (opts.option?.is_locked_) {
7165
- opts.rowWriter.patchRow(clearedLotFields(keys.materialNoKey), "autofill");
7166
- return { abortLocked: opts.option.id_ };
7167
- }
7168
- const params = resolveLotValidateParams(keys, formData, opts.option);
7169
- if (isBlank(params.material_no_) && isBlank(params.material_no_id_)) return {};
7170
- try {
7171
- await validateReinspectionDate(params);
7172
- } catch (e) {
7173
- opts.rowWriter.patchRow(clearedLotFields(keys.materialNoKey), "async");
7174
- return { abortReinspection: e?.message || String(e) };
7175
- }
7176
- const values = {};
7177
- const productId = opts.option?.product_id_ ?? opts.option?._item?.product_id_;
7178
- if (keys.productKey && !isBlank(productId)) values[keys.productKey] = productId;
7179
- if (keys.bomEntryIdKey && opts.formInstBom) {
7180
- if (!isBlank(productId)) {
7181
- const entry = resolveObjectBomEntry({
7182
- formInstBom: opts.formInstBom,
7183
- belongingObject,
7184
- productId: String(productId)
7185
- });
7186
- if (entry) values[keys.bomEntryIdKey] = entry.id_;
7187
- }
7188
- }
7189
- const patchRelatedFields = () => opts.rowWriter.patchRow(values, "autofill");
7190
- if (keys.productKey && !isBlank(productId)) {
7191
- runWithFillProduct(patchRelatedFields);
7192
- } else {
7193
- patchRelatedFields();
7194
- }
7195
- return {};
7196
- }
7197
- return {};
7198
- }
7199
7851
  function useRuntimeRowState(rowSource) {
7200
7852
  const { formStateStore } = useRuntimeInstanceServices();
7201
7853
  function requireStore() {
@@ -7524,7 +8176,11 @@ function useDependency(widget, props) {
7524
8176
  );
7525
8177
  if (!controlledFormData.value._OPCT) {
7526
8178
  const store = formStateStore.value;
7527
- store.setObjectField(controlledFormData.value, "_OPCT", { _DICT: {} }, "restore");
8179
+ store.transaction(
8180
+ "restore",
8181
+ () => store.setObjectField(controlledFormData.value, "_OPCT", { _DICT: {} }, "restore"),
8182
+ { restoreScope: "fields" }
8183
+ );
7528
8184
  }
7529
8185
  const formRowData = toRef(() => {
7530
8186
  if (isFieldModel) {
@@ -7550,6 +8206,7 @@ function useDependency(widget, props) {
7550
8206
  if (!store) throw new Error("字段组件缺少实例级 FormStateStore");
7551
8207
  const row = store.createScopedView(formRowData.value, formRowPath.value);
7552
8208
  const path = store.getFieldPath(row, targetFieldId);
8209
+ if (assignment_expression) store.markUserModified(path);
7553
8210
  store.setObjectField(row, targetFieldId, val, "user", path);
7554
8211
  if (assignment_expression && strategy === ASSIGNMENTSTRATEGY_ENUM.notCovered && commonUtils.isEmptyValue(val)) {
7555
8212
  store.clearUserModified(path);
@@ -7948,6 +8605,159 @@ function useFormTmplConfig() {
7948
8605
  injectController
7949
8606
  };
7950
8607
  }
8608
+ function isBlank(value) {
8609
+ return value == null || value === "";
8610
+ }
8611
+ function pickPresent(preferred, fallback) {
8612
+ return isBlank(preferred) ? fallback : preferred;
8613
+ }
8614
+ function resolveObjectFieldKeys(opts) {
8615
+ const obj = opts.objectFieldList?.find((item) => item.objectField === opts.belongingObject);
8616
+ const fromList = obj?.subFields ? pickObjectFieldKeys(obj.subFields, opts.belongingObject) : {};
8617
+ const fromFallback = pickObjectFieldKeys(opts.fallbackFields, opts.belongingObject, {
8618
+ requireUsed: false
8619
+ });
8620
+ return {
8621
+ productKey: pickPresent(fromList.productKey, fromFallback.productKey),
8622
+ productFieldName: fromList.productFieldName ?? fromFallback.productFieldName,
8623
+ materialNoKey: pickPresent(fromList.materialNoKey, fromFallback.materialNoKey),
8624
+ materialNoFieldName: fromList.materialNoFieldName ?? fromFallback.materialNoFieldName,
8625
+ qtyKey: pickPresent(fromList.qtyKey, fromFallback.qtyKey),
8626
+ qtyRequiredKey: pickPresent(fromList.qtyRequiredKey, fromFallback.qtyRequiredKey),
8627
+ qtyFieldName: fromList.qtyFieldName ?? fromFallback.qtyFieldName,
8628
+ bomEntryIdKey: pickPresent(fromList.bomEntryIdKey, fromFallback.bomEntryIdKey)
8629
+ };
8630
+ }
8631
+ function buildObjectLotExtraQuery(productId) {
8632
+ if (isBlank(productId)) return {};
8633
+ const versionId = String(productId).split(":").pop();
8634
+ if (!versionId) return {};
8635
+ return { "product_id_.versionEq": versionId };
8636
+ }
8637
+ function clearedLotFields(materialNoKey) {
8638
+ if (!materialNoKey) return {};
8639
+ return {
8640
+ [materialNoKey]: void 0,
8641
+ [`${materialNoKey}_id_`]: void 0,
8642
+ [`${materialNoKey}_lb_`]: void 0
8643
+ };
8644
+ }
8645
+ function shouldClearLotOnProductChange(opts) {
8646
+ const { prevProduct, nextProduct, lotValue } = opts;
8647
+ if (isBlank(prevProduct) && isBlank(nextProduct)) return false;
8648
+ if (prevProduct === nextProduct) return false;
8649
+ if (isBlank(prevProduct) && !isBlank(nextProduct) && !isBlank(lotValue)) {
8650
+ return false;
8651
+ }
8652
+ return true;
8653
+ }
8654
+ let fillingProduct = false;
8655
+ function runWithFillProduct(fn) {
8656
+ fillingProduct = true;
8657
+ try {
8658
+ fn();
8659
+ } finally {
8660
+ nextTick(() => {
8661
+ fillingProduct = false;
8662
+ });
8663
+ }
8664
+ }
8665
+ function resolveLotValidateParams(keys, formData, option) {
8666
+ return {
8667
+ product_id_: option?.product_id_ ?? option?._item?.product_id_ ?? (keys.productKey ? formData[keys.productKey] : void 0),
8668
+ material_no_: option?.name_ ?? option?.__VALUE__ ?? (keys.materialNoKey ? formData[keys.materialNoKey] : void 0),
8669
+ material_no_id_: option?.id_ ?? (keys.materialNoKey ? formData[`${keys.materialNoKey}_id_`] : void 0)
8670
+ };
8671
+ }
8672
+ async function applyConsumeObjectTraceChange(opts) {
8673
+ const { belongingObject, role, formData } = opts;
8674
+ if (!belongingObject || !formData) return {};
8675
+ const keys = resolveObjectFieldKeys({
8676
+ belongingObject,
8677
+ objectFieldList: opts.objectFieldList,
8678
+ fallbackFields: opts.fallbackFields
8679
+ });
8680
+ if (role === FIELD_TYPE.PRODUCT) {
8681
+ if (!("prevProduct" in opts) || fillingProduct) return {};
8682
+ const values = {};
8683
+ if (shouldClearLotOnProductChange({
8684
+ prevProduct: opts.prevProduct,
8685
+ nextProduct: opts.nextValue,
8686
+ lotValue: keys.materialNoKey ? formData[keys.materialNoKey] : void 0
8687
+ })) {
8688
+ Object.assign(values, clearedLotFields(keys.materialNoKey));
8689
+ }
8690
+ if (keys.bomEntryIdKey) {
8691
+ values[keys.bomEntryIdKey] = null;
8692
+ if (!isBlank(opts.nextValue) && opts.formInstBom) {
8693
+ const entry = resolveObjectBomEntry({
8694
+ formInstBom: opts.formInstBom,
8695
+ belongingObject,
8696
+ productId: String(opts.nextValue)
8697
+ });
8698
+ if (entry) values[keys.bomEntryIdKey] = entry.id_;
8699
+ }
8700
+ }
8701
+ opts.rowWriter.patchRow(values, "autofill");
8702
+ const lotValue = keys.materialNoKey ? formData[keys.materialNoKey] : void 0;
8703
+ if (!isBlank(opts.nextValue) && !isBlank(lotValue)) {
8704
+ try {
8705
+ await validateReinspectionDate({
8706
+ product_id_: String(opts.nextValue),
8707
+ material_no_: lotValue,
8708
+ material_no_id_: keys.materialNoKey ? formData[`${keys.materialNoKey}_id_`] : void 0
8709
+ });
8710
+ } catch (e) {
8711
+ return { abortReinspection: e?.message || String(e) };
8712
+ }
8713
+ }
8714
+ return {};
8715
+ }
8716
+ if (role === FIELD_TYPE.MATERIAL_NO) {
8717
+ if (opts.option?.is_locked_) {
8718
+ opts.rowWriter.patchRow(clearedLotFields(keys.materialNoKey), "autofill");
8719
+ return { abortLocked: opts.option.id_ };
8720
+ }
8721
+ const params = resolveLotValidateParams(keys, formData, opts.option);
8722
+ if (isBlank(params.material_no_) && isBlank(params.material_no_id_)) return {};
8723
+ try {
8724
+ await validateReinspectionDate(params);
8725
+ } catch (e) {
8726
+ opts.rowWriter.patchRow(clearedLotFields(keys.materialNoKey), "async");
8727
+ return { abortReinspection: e?.message || String(e) };
8728
+ }
8729
+ const values = {};
8730
+ const productId = opts.option?.product_id_ ?? opts.option?._item?.product_id_;
8731
+ if (keys.productKey && !isBlank(productId)) values[keys.productKey] = productId;
8732
+ if (keys.bomEntryIdKey && opts.formInstBom) {
8733
+ if (!isBlank(productId)) {
8734
+ const entry = resolveObjectBomEntry({
8735
+ formInstBom: opts.formInstBom,
8736
+ belongingObject,
8737
+ productId: String(productId)
8738
+ });
8739
+ if (entry) values[keys.bomEntryIdKey] = entry.id_;
8740
+ }
8741
+ }
8742
+ const patchRelatedFields = () => opts.rowWriter.patchRow(values, "autofill");
8743
+ if (keys.productKey && !isBlank(productId)) {
8744
+ runWithFillProduct(patchRelatedFields);
8745
+ } else {
8746
+ patchRelatedFields();
8747
+ }
8748
+ return {};
8749
+ }
8750
+ return {};
8751
+ }
8752
+ class MBRender {
8753
+ // 多 Sheet / 同屏场景用 ownerId 隔离实例;基类仅声明宿主需要实现的能力。
8754
+ async openConsumeModal(_ownerId, _data) {
8755
+ throw new Error("Function openConsumeModal not implemented.");
8756
+ }
8757
+ destoryConsumeModal(_ownerId) {
8758
+ throw new Error("Function destoryConsumeModal not implemented.");
8759
+ }
8760
+ }
7951
8761
  const _hoisted_1$5 = ["data-merge", "data-fill-direction"];
7952
8762
  const _hoisted_2$1 = {
7953
8763
  key: 0,
@@ -8268,6 +9078,7 @@ const DocumentSubTable = /* @__PURE__ */ defineComponent({
8268
9078
  showDisplayStatus,
8269
9079
  dataRelationShip
8270
9080
  } = useWidgetStaticAttrs(props.widget);
9081
+ const isMockMaterialConsume = computed(() => !!dataRelationShip?.isMockReport && !!props.widget.props.isMaterialConsumeTable);
8271
9082
  const sheetId = () => fields.value?.findWidgetById(props.widget.id)?.sheetId;
8272
9083
  const subTableCore = props.subTableCore;
8273
9084
  provide(NCB_PROVIDE.SUB_TABLE_CORE, subTableCore);
@@ -8363,6 +9174,7 @@ const DocumentSubTable = /* @__PURE__ */ defineComponent({
8363
9174
  const newRowsData = actionType === "copyRow" ? [cloneDeep(rowData)] : Array.from({
8364
9175
  length: rowNum
8365
9176
  }, (_, index2) => transformUtils.addSubTableRowItem({
9177
+ defaultValueOrigins: instance.value?.defaultValueValidation?.defaults,
8366
9178
  defaultData: currentFieldDefaultData.value,
8367
9179
  quickFillData: quickFillDatas?.[index2],
8368
9180
  subFieldId: field,
@@ -8408,6 +9220,9 @@ const DocumentSubTable = /* @__PURE__ */ defineComponent({
8408
9220
  key,
8409
9221
  actionValue
8410
9222
  }) => {
9223
+ if (isMockMaterialConsume.value && (key === SubTableActionEnum.SCAN || key === SubTableActionEnum.Insert1GroupAfter)) {
9224
+ return;
9225
+ }
8411
9226
  switch (key) {
8412
9227
  case "insertRowBefore":
8413
9228
  handleAddRow({
@@ -8501,10 +9316,11 @@ const DocumentSubTable = /* @__PURE__ */ defineComponent({
8501
9316
  showRowWatermark,
8502
9317
  rowGroupKey
8503
9318
  }) => {
8504
- const menus = subTableCore?.calcSubTableActionMenu({
9319
+ const baseMenus = subTableCore?.calcSubTableActionMenu({
8505
9320
  rowData,
8506
9321
  showDelBtn
8507
9322
  });
9323
+ const menus = isMockMaterialConsume.value ? [getMenuByAction(SubTableActionEnum.SCAN), getMenuByAction(SubTableActionEnum.Insert1GroupAfter), ...baseMenus ?? []] : baseMenus;
8508
9324
  const annRowDetails = dataRelationShip?.annRowDetails;
8509
9325
  const rowMark = dataIdx !== -1 && annRowDetails?.length ? resolveRowFormChangeMark(field, rowData, annRowDetails) : null;
8510
9326
  const rowUi = resolveFormChangeRowUi(rowData, rowMark);
@@ -8764,8 +9580,6 @@ function waitDomStable(el, idle = 100, timeout = 2e3) {
8764
9580
  var MaterialConsumeActionType = /* @__PURE__ */ ((MaterialConsumeActionType2) => {
8765
9581
  MaterialConsumeActionType2["CONFIRM"] = "CONFIRM";
8766
9582
  MaterialConsumeActionType2["SCAN"] = "SCAN";
8767
- MaterialConsumeActionType2["VIEW_BOM"] = "VIEW_BOM";
8768
- MaterialConsumeActionType2["CHANGE_PARSE_RULE"] = "CHANGE_PARSE_RULE";
8769
9583
  return MaterialConsumeActionType2;
8770
9584
  })(MaterialConsumeActionType || {});
8771
9585
  const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
@@ -8916,6 +9730,7 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
8916
9730
  length: rowNum
8917
9731
  }, (_, i) => {
8918
9732
  const row = transformUtils.addSubTableRowItem({
9733
+ defaultValueOrigins: instance.value?.defaultValueValidation?.defaults,
8919
9734
  defaultData: currentFieldDefaultData.value,
8920
9735
  quickFillData: quickFillDatas?.[i],
8921
9736
  subFieldId: field,
@@ -9006,6 +9821,7 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
9006
9821
  }));
9007
9822
  };
9008
9823
  const handleAction = (action, rowData) => {
9824
+ if (!tableController.hasFormInstance) return;
9009
9825
  switch (action) {
9010
9826
  case MaterialConsumeActionType.CONFIRM:
9011
9827
  tableController.confirm(rowData);
@@ -9015,12 +9831,6 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
9015
9831
  title: props.widget.props.tableTitle
9016
9832
  });
9017
9833
  break;
9018
- case MaterialConsumeActionType.VIEW_BOM:
9019
- tableController.openBomModal();
9020
- break;
9021
- case MaterialConsumeActionType.CHANGE_PARSE_RULE:
9022
- tableController.changeScanRule();
9023
- break;
9024
9834
  }
9025
9835
  };
9026
9836
  const getNewTdInfo = (tdInfo, rowData, rowIndex) => {
@@ -9078,6 +9888,7 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
9078
9888
  key,
9079
9889
  actionValue
9080
9890
  }) => {
9891
+ if (!tableController.hasFormInstance) return;
9081
9892
  switch (key) {
9082
9893
  case "rowEdit":
9083
9894
  await tableController.editRow(rowData);
@@ -9197,10 +10008,6 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
9197
10008
  label: "业务操作"
9198
10009
  },
9199
10010
  showScanBtn ? getMenuByAction(SubTableActionEnum.SCAN) : void 0,
9200
- // tableController.actualBomEntries?.length
9201
- // ? getMenuByAction(SubTableActionEnum.VIEW_BOM)
9202
- // : undefined,
9203
- // getMenuByAction(SubTableActionEnum.CHANGE_PARSE_RULE),
9204
10011
  {
9205
10012
  type: SubTableActionMenuTypeEnum.DIVIDER
9206
10013
  },
@@ -9448,7 +10255,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9448
10255
  createElementVNode("i", { class: "iconfont icon-zhuyi" }),
9449
10256
  createElementVNode("ul", { class: "tips-list" }, [
9450
10257
  createElementVNode("li", null, "可将Excel内容粘贴到表格中,支持使用复制、粘贴、删除快捷键"),
9451
- createElementVNode("li", null, " 表单中支持快速填报的字段类型:文本、长文本、整数、长整数、小数、精度小数、日期、时间、日期时间、LOT/SN、报废物料批次、枚举单选、枚举多选(选项间以“,”分割) ")
10258
+ createElementVNode("li", null, " 表单中支持快速填报的字段类型:文本、长文本、整数、长整数、小数、精度小数、日期、时间、日期时间、批次/SN、报废物料批次、枚举单选、枚举多选(选项间以“,”分割) ")
9452
10259
  ])
9453
10260
  ], -1)),
9454
10261
  createElementVNode("div", {
@@ -9473,7 +10280,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9473
10280
  };
9474
10281
  }
9475
10282
  });
9476
- const FixedQuickFillModal = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-b589958f"]]);
10283
+ const FixedQuickFillModal = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-58540cb3"]]);
9477
10284
  const _hoisted_1$1 = {
9478
10285
  key: 1,
9479
10286
  class: "sub-table-action__subtitle"
@@ -9486,7 +10293,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
9486
10293
  showInsertMultiple: { type: Boolean, default: false },
9487
10294
  showEditBtn: { type: Boolean, default: false },
9488
10295
  isMaterialConsume: { type: Boolean, default: false },
9489
- showBom: { type: Boolean, default: false },
9490
10296
  showScanBtn: { type: Boolean, default: false },
9491
10297
  showConfirmBtn: { type: Boolean, default: false },
9492
10298
  noPopover: { type: Boolean, default: false },
@@ -9510,19 +10316,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
9510
10316
  label: "条码扫描",
9511
10317
  icon: "size24 icon-saoma1"
9512
10318
  },
9513
- {
9514
- show: props.showBom,
9515
- type: "action",
9516
- key: SubTableActionEnum.VIEW_BOM,
9517
- label: "BOM查看",
9518
- icon: "size24 icon-a-bom11"
9519
- },
9520
- {
9521
- type: "action",
9522
- key: SubTableActionEnum.CHANGE_PARSE_RULE,
9523
- label: "条码解析规则变更",
9524
- icon: "icon-tiaomajiexi"
9525
- },
9526
10319
  {
9527
10320
  type: "divider"
9528
10321
  },
@@ -9749,7 +10542,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
9749
10542
  };
9750
10543
  }
9751
10544
  });
9752
- const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-acff8196"]]);
10545
+ const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-7047f1a3"]]);
9753
10546
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
9754
10547
  __name: "fixed-table-action",
9755
10548
  props: {
@@ -10175,7 +10968,7 @@ const DocumentPaper = /* @__PURE__ */ defineComponent({
10175
10968
  }) : null,
10176
10969
  // 在[固定表]顶部的可见单元格上加装操作按钮
10177
10970
  tableAction: (() => {
10178
- const fixedTableActionVisible = fixedTableInfo?.quickFillVisible && !filledFixedTableKeys.value.includes(fixedTableInfo.subFieldKey);
10971
+ const fixedTableActionVisible = props.basicInfo.renderModeType !== RenderModeEnum.ViewMode && fixedTableInfo?.quickFillVisible && !filledFixedTableKeys.value.includes(fixedTableInfo.subFieldKey);
10179
10972
  return () => fixedTableActionVisible ? createVNode(_sfc_main$2, {
10180
10973
  "tdId": tdId,
10181
10974
  "formState": formState.value,
@@ -10246,7 +11039,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10246
11039
  createElementVNode("i", { class: "iconfont icon-zhuyi" }),
10247
11040
  createElementVNode("ul", { class: "tips-list" }, [
10248
11041
  createElementVNode("li", null, "可将Excel内容粘贴到表格中,支持使用复制、粘贴、删除快捷键"),
10249
- createElementVNode("li", null, "表单中支持快速填报的字段类型:文本、长文本、整数、长整数、小数、精度小数、日期、时间、日期时间、LOT/SN、报废物料批次、枚举单选、枚举多选(选项间以“,”分割)"),
11042
+ createElementVNode("li", null, "表单中支持快速填报的字段类型:文本、长文本、整数、长整数、小数、精度小数、日期、时间、日期时间、批次/SN、报废物料批次、枚举单选、枚举多选(选项间以“,”分割)"),
10250
11043
  createElementVNode("li", null, "当前快速填报最多支持200行")
10251
11044
  ])
10252
11045
  ], -1)),
@@ -10266,7 +11059,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10266
11059
  };
10267
11060
  }
10268
11061
  });
10269
- const DynamicQuickFillModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-ae9acd3f"]]);
11062
+ const DynamicQuickFillModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-840aca0a"]]);
10270
11063
  const _sfc_main = /* @__PURE__ */ defineComponent({
10271
11064
  __name: "dynamic-table-action",
10272
11065
  props: {
@@ -10279,7 +11072,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10279
11072
  showInsertMultiple: { type: Boolean, default: true },
10280
11073
  showEditBtn: { type: Boolean },
10281
11074
  isMaterialConsume: { type: Boolean },
10282
- showBom: { type: Boolean },
10283
11075
  showScanBtn: { type: Boolean },
10284
11076
  showConfirmBtn: { type: Boolean },
10285
11077
  noPopover: { type: Boolean },
@@ -10336,7 +11128,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10336
11128
  showDelBtn: __props.showDelBtn,
10337
11129
  showQuickFillBtn: __props.showQuickFillBtn,
10338
11130
  noPopover: __props.noPopover,
10339
- showBom: __props.showBom,
10340
11131
  showConfirmBtn: __props.showConfirmBtn,
10341
11132
  showEditBtn: __props.showEditBtn,
10342
11133
  showInsertMultiple: __props.showInsertMultiple,
@@ -10344,118 +11135,141 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10344
11135
  isMaterialConsume: __props.isMaterialConsume,
10345
11136
  menus: __props.menus,
10346
11137
  onMenuClick
10347
- }, null, 8, ["showDelBtn", "showQuickFillBtn", "noPopover", "showBom", "showConfirmBtn", "showEditBtn", "showInsertMultiple", "showScanBtn", "isMaterialConsume", "menus"]);
11138
+ }, null, 8, ["showDelBtn", "showQuickFillBtn", "noPopover", "showConfirmBtn", "showEditBtn", "showInsertMultiple", "showScanBtn", "isMaterialConsume", "menus"]);
10348
11139
  };
10349
11140
  }
10350
11141
  });
10351
- const DynamicTableAction = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-53d7e66c"]]);
11142
+ const DynamicTableAction = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8710052f"]]);
10352
11143
  export {
10353
- normalizeRuntime as $,
10354
- normalizeHistoricalAutofillRow as A,
11144
+ RequiredQtyCalcRule as $,
11145
+ validateObjectBomForScan as A,
10355
11146
  BorderTD as B,
10356
- parseRuntimeFieldPath as C,
11147
+ resolveObjectBomEntry as C,
10357
11148
  DEFAULT_BOOLEAN_FIELD_WIDTH as D,
10358
- EMPTY_PRODUCT_VERSION_ID as E,
10359
- useStyles as F,
10360
- useDependency as G,
10361
- useFieldPresentation as H,
10362
- useRuntimeEditorFlusher as I,
10363
- createRuntimeInstanceContext as J,
10364
- RuntimeInstanceRegistry as K,
10365
- RequiredQtyCalcRule as L,
11149
+ runWithFillProduct as E,
11150
+ FormModelController as F,
11151
+ useNocodeFormWidget as G,
11152
+ applyConsumeObjectTraceChange as H,
11153
+ getObjectBomProductQuery as I,
11154
+ EMPTY_PRODUCT_VERSION_ID as J,
11155
+ normalizeHistoricalAutofillRow as K,
11156
+ readSealValue as L,
10366
11157
  MAX_RUNTIME_SHEETS as M,
10367
- NCB_PROVIDE as N,
10368
- DocumentPaper as O,
10369
- DynamicTableAction as P,
10370
- getRuntimeDataFieldId as Q,
10371
- RuntimeFormStateStore as R,
10372
- ScanParamType as S,
10373
- buildRuntimeFieldPath as T,
10374
- resolveRuntimeFieldProps as U,
10375
- resolveRuntimeFieldState as V,
10376
- getRuntimeDependencyOutputKey as W,
10377
- isRowAddedInCurrentFormChange as X,
10378
- MaterialConsumeTableController as Y,
10379
- setFormulaParamsConfig as Z,
10380
- _sfc_main$5 as _,
11158
+ isSealStamped as N,
11159
+ stampSealValue as O,
11160
+ isValidSealValue as P,
11161
+ clearSealValue as Q,
11162
+ NCB_PROVIDE as R,
11163
+ calculateFormula as S,
11164
+ useStyles as T,
11165
+ useDependency as U,
11166
+ useFieldPresentation as V,
11167
+ useRuntimeEditorFlusher as W,
11168
+ RuntimeFormStateStore as X,
11169
+ createRuntimeInstanceContext as Y,
11170
+ RuntimeInstanceRegistry as Z,
11171
+ ScanParamType as _,
10381
11172
  MAX_RUNTIME_SHEET_TITLE_LENGTH as a,
10382
- RuntimeSheetService as a0,
10383
- validateObjectBomQtyOnSubmit as a1,
10384
- closeValidatorPopovers as a2,
10385
- enrichFormChangeRowDetails as a3,
10386
- useMaterialBalance as a4,
10387
- collectFormChangeFieldLocations as a5,
10388
- nextFormChangeRowViewHistoryId as a6,
10389
- DeviceConnector as a7,
10390
- DocumentLoading as a8,
10391
- DynamicQuickFillModal as a9,
10392
- recordSubtableRowAdd as aA,
10393
- recordSubtableRowDelete as aB,
10394
- resolveAnnotationFieldLocation as aC,
10395
- resolveFormChangeRowUi as aD,
10396
- resolveRowFormChangeMark as aE,
10397
- setSelectMobileTdId as aF,
10398
- stripLegacyFormConfigFromPaper as aG,
10399
- SubTableActionMenuTypeEnum as aH,
10400
- getMenuByAction as aI,
10401
- SubTableActionEnum as aJ,
10402
- resolveScanFillData as aK,
10403
- getInsertSubMenu as aL,
10404
- resolveScanAdjustType as aM,
10405
- resolveScanQty as aN,
10406
- toDateOnly as aO,
10407
- getCopySubMenu as aP,
10408
- resolveScanParsedValue as aQ,
10409
- isProductBatchEmptyRow as aR,
10410
- FixedQuickFillModal as aa,
10411
- FormTmplConfigController as ab,
10412
- LEGACY_RUNTIME_FORM_CONFIG_KEYS as ac,
10413
- LEGACY_RUNTIME_SHEET_ID as ad,
10414
- LEGACY_RUNTIME_SHEET_TITLE as ae,
10415
- MCDataUtil as af,
10416
- OCR_MODEL_PRECISION_ENUM_KEY as ag,
10417
- RuntimeAsyncTaskCoordinator as ah,
10418
- RuntimeDependencyService as ai,
10419
- RuntimeFieldRegistry as aj,
10420
- RuntimeInstanceEventBus as ak,
10421
- RuntimePersistenceCoordinator as al,
10422
- RuntimeValidationService as am,
10423
- SubTableCore as an,
10424
- buildFormChangeDisplayRows as ao,
10425
- convertV1Runtime as ap,
10426
- detailsHaveFormChangeRowOps as aq,
10427
- extractFormChangeRowDetails as ar,
10428
- getFormChangeRowKey as as,
10429
- getFormChangeRowOp as at,
10430
- getSubTableQuickFillInfo as au,
10431
- isAnnLocationSelected as av,
10432
- isBlank as aw,
10433
- isFormChangeGhostRow as ax,
10434
- normalizeHistoricalFieldConfig as ay,
10435
- pickObjectFieldKeys as az,
11173
+ getMenuByAction as a$,
11174
+ MBRender as a0,
11175
+ MCRender as a1,
11176
+ moveSealValue as a2,
11177
+ DocumentPaper as a3,
11178
+ DynamicTableAction as a4,
11179
+ _sfc_main$5 as a5,
11180
+ resolveRuntimeFieldProps as a6,
11181
+ resolveRuntimeFieldState as a7,
11182
+ assembleRules as a8,
11183
+ getRuntimeDependencyOutputKey as a9,
11184
+ RuntimeDependencyService as aA,
11185
+ RuntimeFieldRegistry as aB,
11186
+ RuntimeInstanceEventBus as aC,
11187
+ RuntimePersistenceCoordinator as aD,
11188
+ RuntimeValidationService as aE,
11189
+ SubTableCore as aF,
11190
+ buildFormChangeDisplayRows as aG,
11191
+ convertV1Runtime as aH,
11192
+ detailsHaveFormChangeRowOps as aI,
11193
+ extractFormChangeRowDetails as aJ,
11194
+ getFormChangeRowKey as aK,
11195
+ getFormChangeRowOp as aL,
11196
+ getSubTableQuickFillInfo as aM,
11197
+ isAnnLocationSelected as aN,
11198
+ isBlank as aO,
11199
+ isFormChangeGhostRow as aP,
11200
+ normalizeHistoricalFieldConfig as aQ,
11201
+ pickObjectFieldKeys as aR,
11202
+ recordSubtableRowAdd as aS,
11203
+ recordSubtableRowDelete as aT,
11204
+ relocateDeletedRowsToEnd as aU,
11205
+ resolveAnnotationFieldLocation as aV,
11206
+ resolveFormChangeRowUi as aW,
11207
+ resolveRowFormChangeMark as aX,
11208
+ setSelectMobileTdId as aY,
11209
+ stripLegacyFormConfigFromPaper as aZ,
11210
+ SubTableActionMenuTypeEnum as a_,
11211
+ isRowAddedInCurrentFormChange as aa,
11212
+ resolveFormulaData as ab,
11213
+ MaterialConsumeTableController as ac,
11214
+ setFormulaParamsConfig as ad,
11215
+ normalizeRuntime as ae,
11216
+ initializeSealFields as af,
11217
+ RuntimeSheetService as ag,
11218
+ validateObjectBomQtyOnSubmit as ah,
11219
+ areValidationCommentsEqual as ai,
11220
+ closeValidatorPopovers as aj,
11221
+ enrichFormChangeRowDetails as ak,
11222
+ useMaterialBalance as al,
11223
+ collectFormChangeFieldLocations as am,
11224
+ nextFormChangeRowViewHistoryId as an,
11225
+ BaseFormModelFetcher as ao,
11226
+ DeviceConnector as ap,
11227
+ DocumentLoading as aq,
11228
+ DynamicQuickFillModal as ar,
11229
+ FixedQuickFillModal as as,
11230
+ FormTmplConfigController as at,
11231
+ LEGACY_RUNTIME_FORM_CONFIG_KEYS as au,
11232
+ LEGACY_RUNTIME_SHEET_ID as av,
11233
+ LEGACY_RUNTIME_SHEET_TITLE as aw,
11234
+ MCDataUtil as ax,
11235
+ OCR_MODEL_PRECISION_ENUM_KEY as ay,
11236
+ RuntimeAsyncTaskCoordinator as az,
10436
11237
  bindFormulaCacheInvalidation as b,
11238
+ SubTableActionEnum as b0,
11239
+ resolveScanFillData as b1,
11240
+ buildDefaultMapFromProfile as b2,
11241
+ buildFieldStatusFromProfile as b3,
11242
+ getRowHandlersForFieldChange as b4,
11243
+ getInsertSubMenu as b5,
11244
+ resolveScanAdjustType as b6,
11245
+ resolveScanQty as b7,
11246
+ toDateOnly as b8,
11247
+ hasSubtableBusinessData as b9,
11248
+ getCopySubMenu as ba,
11249
+ resolveScanParsedValue as bb,
11250
+ isProductBatchEmptyRow as bc,
10437
11251
  currentParamsConfig as c,
10438
11252
  MULTI_SHEET_SCHEMA_VERSION as d,
10439
11253
  createRuntimeDocumentV2 as e,
10440
- normalizeHistoricalBusinessRow as f,
10441
- getBusinessFieldKey as g,
10442
- DeviceLinkTmplUtil as h,
10443
- normalizeAIOcrTmpl as i,
10444
- useWidgetStaticAttrs as j,
10445
- useRuntimeInstanceServices as k,
10446
- setSelectAnnotationId as l,
10447
- useRuntimeRowState as m,
10448
- normalizeFieldWidth as n,
10449
- getObjectBomMaterialLotQuery as o,
10450
- buildObjectLotExtraQuery as p,
10451
- MaterialConsumptionPatternEnum as q,
10452
- resolveObjectFieldKeys as r,
11254
+ clampSealPosition as f,
11255
+ getParseFormulaVarInfos as g,
11256
+ normalizeSealDiameter as h,
11257
+ normalizeFieldWidth as i,
11258
+ isCellAutoLineBreak as j,
11259
+ useFormTmplConfig as k,
11260
+ findFieldProfile as l,
11261
+ normalizeHistoricalBusinessRow as m,
11262
+ normalizeGridColumnWidth as n,
11263
+ DeviceLinkTmplUtil as o,
11264
+ normalizeAIOcrTmpl as p,
11265
+ useWidgetStaticAttrs as q,
11266
+ useRuntimeInstanceServices as r,
10453
11267
  setSelectValidatorId as s,
10454
- resolveObjectBomEntry as t,
10455
- useFormTmplConfig as u,
10456
- validateObjectBomForScan as v,
10457
- runWithFillProduct as w,
10458
- useNocodeFormWidget as x,
10459
- applyConsumeObjectTraceChange as y,
10460
- getObjectBomProductQuery as z
11268
+ setSelectAnnotationId as t,
11269
+ useFormModel as u,
11270
+ useRuntimeRowState as v,
11271
+ getObjectBomMaterialLotQuery as w,
11272
+ buildObjectLotExtraQuery as x,
11273
+ resolveObjectFieldKeys as y,
11274
+ MaterialConsumptionPatternEnum as z
10461
11275
  };