@gct-paas/excel 0.1.40-beta.3 → 0.1.40-beta.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -4
- package/dist/{BaseComponent-B9o59n-h.js → BaseComponent-etri-HVz.js} +2 -2
- package/dist/{VueVideoPlayer-CAWYWBHi.js → VueVideoPlayer-ClxhO4jg.js} +2 -2
- package/dist/{align-editor-a4DQt4Un.js → align-editor-DWHHVeY1.js} +1 -1
- package/dist/{barcode-design-CBqUEPYu.js → barcode-design-jb-cuT80.js} +2 -2
- package/dist/base/index.es.js +742 -306
- package/dist/{diagonal-design-u23896Ky.js → diagonal-design-vAc9RdXd.js} +2 -2
- package/dist/{dynamic-table-action-BWI4Gaqi.js → dynamic-table-action-DpIXTpSN.js} +1328 -512
- 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
- package/dist/{edit.utils-CXmmCnxE-XxpC8ALV.js → edit.utils-CXmmCnxE-CXdATd1V.js} +1 -1
- package/dist/excel.css +6292 -5112
- package/dist/{exceljs.min-DfbB110X.js → exceljs.min-DKFXUxdP.js} +2 -2
- package/dist/{font-editor-BtSCLMrM.js → font-editor-CzFsHD-d.js} +3 -3
- package/dist/{image-design-CtE-Lw7N.js → image-design-4Ee8rZqa.js} +3 -8
- package/dist/{index-B0cdcIWq.js → index--JEQAw12.js} +2 -2
- package/dist/{index-DdWefZMa.js → index-B0BWjfNB.js} +2 -2
- package/dist/{index-BFg5eUdY.js → index-BCCIwSnM.js} +1 -1
- package/dist/{index-Dyomjz3y.js → index-BEi6Ietm.js} +2 -2
- package/dist/{index-BMoz_QhA.js → index-BHJxBByd.js} +1 -1
- package/dist/{index-BP-LhXXV.js → index-BHbTXjiU.js} +6 -5
- package/dist/{index-DVEe11uM.js → index-BYq7x5n6.js} +1 -1
- package/dist/{index-CAdDeEzJ.js → index-BcbH0-2H.js} +2 -2
- package/dist/{index-3WwCV4xR.js → index-BlMiHVOC.js} +1 -1
- package/dist/{index-Bnb70qEi.js → index-Bu2XMO2n.js} +3 -3
- package/dist/{index-BC8hQ4vo.js → index-BuYerha3.js} +2 -2
- package/dist/{index-BKXb3VJc.js → index-CNJu5jrK.js} +2 -2
- package/dist/{index-CdHVHaxO.js → index-C_GqkAxa.js} +2 -2
- package/dist/{index-CIa37rQm.js → index-CtatG-Ov.js} +3 -2
- package/dist/{index-CPTGioxl.js → index-D3KiKYMR.js} +1 -1
- package/dist/{index-CL9K9orM.js → index-D681oluc.js} +6 -3
- package/dist/{index-Bc61F6Hm.js → index-D7x7hItu.js} +5 -7
- package/dist/{index-I1r5pfu5.js → index-DCF-v4pK.js} +2 -2
- package/dist/{index-731OYkrc.js → index-DFhfnphF.js} +3 -3
- package/dist/{index-aNV9T6LI.js → index-DGq7IjrL.js} +2 -2
- package/dist/{index-7aS5L4ot.js → index-DIqqktrL.js} +6 -3
- package/dist/{index-BGAcYDx-.js → index-DM0OEvdI.js} +1 -1
- package/dist/{index-Ca9TLzUh.js → index-DPTR_QJn.js} +1 -1
- package/dist/{index-CeEhYXl9.js → index-DPr6NsTf.js} +2 -2
- package/dist/{index-ixQwAcB1.js → index-DoSH7mnC.js} +37708 -30078
- package/dist/{index-BRQkrFQ9.js → index-Dw-ygqE_.js} +2 -2
- package/dist/{index-9S48hpoJ.js → index-FzfTEWXH.js} +2 -2
- package/dist/{index-CpPk8P3L.js → index-KuhYPy5i.js} +1 -1
- package/dist/{index-CVsoaxTR.js → index-VyjgrRmJ.js} +2 -2
- package/dist/{index-DNj0vFvx.js → index-YlEOHde0.js} +1 -1
- package/dist/{index-IVc1dOet.js → index-aiurSMku.js} +6 -5
- package/dist/{index-CYLAVQfT.js → index-pWnZhMwm.js} +2 -2
- package/dist/{index-BfBuxgcp.js → index-s3x5GdWF.js} +2 -2
- package/dist/{index-51LtNdZ2.js → index-toqlO_-B.js} +1 -1
- package/dist/index.es.js +50 -46
- 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
- package/dist/{pagination-design-CmbsdlMe.js → pagination-design-C7Cd0vsm.js} +2 -2
- package/dist/paper-widget-design-C34lg4jR.js +4 -0
- package/dist/{print-runtime-instance-DQysbz5n.js → print-runtime-instance-CfG_y_pu.js} +1 -1
- package/dist/{print-snapshot-renderer-DWHjMsOC.js → print-snapshot-renderer-DSlZELM2.js} +3 -3
- package/dist/{qrcode-design-CX0_2mLC.js → qrcode-design-G75STwL4.js} +1 -1
- package/dist/{revo-grid.entry-DbmWFi7p.js → revo-grid.entry-Bj-4xHie.js} +1 -1
- package/dist/{revogr-attribution_7.entry-BWQDu7fq.js → revogr-attribution_7.entry-NvaozwYj.js} +3 -3
- package/dist/{revogr-clipboard_3.entry-BtTYHFZi.js → revogr-clipboard_3.entry-CkRbECsx.js} +2 -2
- package/dist/{revogr-data_4.entry-CWPXyZ7g.js → revogr-data_4.entry-Dbbd8Mpz.js} +2 -2
- package/dist/{revogr-filter-panel.entry-5gYct0XI.js → revogr-filter-panel.entry-lcMbXUNb.js} +1 -1
- package/dist/seal-design-DIQKGBL7.js +4 -0
- package/dist/{serialnumber-design-aSqL4gX6.js → serialnumber-design-B608oYcy.js} +1 -1
- package/dist/shared/index.es.js +30 -27
- package/dist/{single-field-drop-C67wLHxK.js → single-field-drop-ui-vFIsu.js} +2 -3
- package/dist/{size-editor-BHGTPLir.js → size-editor-Bl-lUcdU.js} +1 -1
- package/dist/src/adapter/adapter.d.ts +1 -1
- package/dist/src/adapter/index.d.ts +2 -0
- package/dist/src/adapter/web/inventory-scan-columns.d.ts +6 -0
- 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
- package/dist/src/{nocode-web-render/src/render/sub-table/material-balance → adapter/web}/material-consume-modal.vue.d.ts +1 -1
- package/dist/src/adapter/web/material-consume-render.d.ts +25 -0
- package/dist/src/{nocode-web-render/src/render/common → adapter/web}/open-util.d.ts +1 -1
- package/dist/src/{nocode-web-render/src/render/sub-table/stocktake/stocktake-web-render.d.ts → adapter/web/stocktake-render.d.ts} +2 -2
- package/dist/src/{nocode-web-render/src/render/sub-table/common → adapter/web}/sub-table-render.d.ts +2 -5
- package/dist/src/domain/document-business/business/product-release/profile.d.ts +2 -0
- package/dist/src/domain/document-business/business/product-release/service.d.ts +2 -0
- package/dist/src/domain/document-business/index.d.ts +2 -0
- package/dist/src/domain/document-business/registry.d.ts +2 -0
- package/dist/src/domain/document-business/runtime/field-query-runtime.d.ts +4 -0
- package/dist/src/domain/document-business/types.d.ts +24 -0
- package/dist/src/domain/field/number/product-release-qty-manifest.d.ts +2 -0
- package/dist/src/domain/field/query-filter.d.ts +15 -0
- package/dist/src/domain/table/business/material/material-balance/profile/fields.d.ts +2 -0
- package/dist/src/domain/table/business/material/material-consume/profile/fields.d.ts +2 -0
- package/dist/src/domain/table/business/material/material-substitution/profile/field-keys.d.ts +25 -10
- package/dist/src/domain/table/business/material/material-substitution/runtime/row-change-handlers.d.ts +4 -0
- package/dist/src/domain/table/business/material/material-substitution/runtime/select-loaders.d.ts +8 -0
- package/dist/src/domain/table/business/preprocess/pretreatment-list/profile/field-keys.d.ts +1 -7
- package/dist/src/domain/table/business/sterilize/entrust-steril-batch-list/profile/fields.d.ts +2 -0
- package/dist/src/domain/table/business/warehouse/shared/autofill-source-labels.d.ts +19 -0
- package/dist/src/domain/table/design/autofill-expander.d.ts +2 -0
- package/dist/src/domain/table/design/hooks/on-field-attach.d.ts +6 -0
- package/dist/src/domain/table/index.d.ts +1 -1
- package/dist/src/domain/table/types.d.ts +2 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/nocode-base/src/components/document-sub-table-action/dynamic-table-action.vue.d.ts +0 -2
- package/dist/src/nocode-base/src/components/document-sub-table-action/sub-table-action.vue.d.ts +0 -3
- package/dist/src/nocode-base/src/components/document-sub-table-action/type.d.ts +0 -4
- package/dist/src/nocode-base/src/components/material-consume/types.d.ts +1 -5
- package/dist/src/nocode-base/src/core/factory/sub-table-factory.d.ts +2 -0
- package/dist/src/nocode-base/src/core/sub-table/allocate-table-core.d.ts +2 -1
- package/dist/src/nocode-base/src/core/sub-table/profile-driven-sub-table-core.d.ts +3 -3
- package/dist/src/nocode-base/src/core/sub-table/sub-table-core.d.ts +2 -5
- package/dist/src/nocode-base/src/hooks/form-model/form-model-controller.d.ts +2 -0
- package/dist/src/nocode-base/src/hooks/inspection-module-qty.d.ts +4 -0
- package/dist/src/nocode-base/src/hooks/material-consume/bom-validator.d.ts +9 -7
- package/dist/src/nocode-base/src/hooks/material-consume/material-consume-table-controller.d.ts +18 -20
- package/dist/src/nocode-base/src/hooks/material-consume/mc-render.d.ts +1 -28
- package/dist/src/nocode-base/src/hooks/material-consume/tmpl-bom-controller.d.ts +20 -7
- package/dist/src/nocode-base/src/hooks/material-consume/types.d.ts +6 -0
- package/dist/src/nocode-base/src/hooks/material-consume-object/bom-validator.d.ts +4 -3
- package/dist/src/nocode-base/src/hooks/material-consume-object/initialize-autofill.d.ts +19 -0
- package/dist/src/nocode-base/src/hooks/material-consume-object/object-validation-controller.d.ts +24 -0
- package/dist/src/nocode-base/src/hooks/render-page/initialize-runtime.d.ts +9 -8
- package/dist/src/nocode-base/src/hooks/render-page/sterilization-date.d.ts +1 -1
- package/dist/src/nocode-base/src/hooks/render-page/types.d.ts +4 -1
- package/dist/src/nocode-base/src/hooks/useRenderPageFactory.d.ts +10 -6
- package/dist/src/nocode-base/src/hooks/validation/createValidateFactory.d.ts +1 -0
- package/dist/src/nocode-base/src/interface/ref-loader.d.ts +12 -1
- package/dist/src/nocode-base/src/interface/render.d.ts +4 -1
- package/dist/src/nocode-base/src/interface/transform.d.ts +17 -1
- package/dist/src/nocode-base/src/runtime/designer-default-values.d.ts +23 -0
- package/dist/src/nocode-base/src/runtime/formula-utils.d.ts +2 -0
- package/dist/src/nocode-base/src/runtime/multi-sheet-runtime.d.ts +3 -1
- package/dist/src/nocode-base/src/runtime/runtime-context.d.ts +4 -0
- package/dist/src/nocode-base/src/runtime/runtime-default-value-validation.d.ts +23 -0
- package/dist/src/nocode-base/src/runtime/runtime-field-initializer.d.ts +1 -0
- package/dist/src/nocode-base/src/runtime/runtime-form-state-store.d.ts +6 -2
- package/dist/src/nocode-base/src/runtime/runtime-instance-registry.d.ts +3 -0
- package/dist/src/nocode-base/src/runtime/table-row-identity.d.ts +2 -0
- package/dist/src/nocode-base/src/types/common/base.d.ts +6 -2
- package/dist/src/nocode-base/src/types/render/mc-render.d.ts +2 -15
- package/dist/src/nocode-base/src/types/render/sub-table-render.d.ts +5 -11
- package/dist/src/online-form/src/views/__cell_widgets__/cell-widget-design.vue.d.ts +2 -0
- package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/base-vxe-table.vue.d.ts +1 -1
- package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/default-value-rdo-editor.vue.d.ts +4 -4
- package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/rdo-table-dropdown.vue.d.ts +3 -3
- package/dist/src/online-form/src/views/__cell_widgets__/common/display-fields-editor/display-fields.util.d.ts +2 -2
- package/dist/src/online-form/src/views/__cell_widgets__/common/quick-search-editor/quick-search.util.d.ts +8 -0
- package/dist/src/online-form/src/views/__cell_widgets__/fake-field/fake-option-select.vue.d.ts +1 -0
- package/dist/src/online-form/src/views/designer/constants/index.d.ts +1 -0
- package/dist/src/online-form/src/views/designer/conversions/normalize-paper-grid.d.ts +3 -0
- package/dist/src/online-form/src/views/designer/hooks/useAllSpreadSheets.d.ts +35 -0
- package/dist/src/online-form/src/views/designer/hooks/useSpreadSheet.d.ts +18 -3
- package/dist/src/online-form/src/views/designer/modules/base/designer-wrapper.vue.d.ts +1 -0
- 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
- package/dist/src/online-form/src/views/designer/modules/panel/panel-data-init-config/object-init/hooks/useObjectInit.d.ts +2 -0
- 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
- package/dist/src/online-form/src/views/designer/modules/panel/sub-table/comps/use-dynamic-sub-table-panel.d.ts +12 -0
- package/dist/src/online-form/src/views/designer/modules/panel/sub-table/panel-check-table/select-check-ds-modal.vue.d.ts +3 -3
- 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
- package/dist/src/online-form/src/views/designer/types/index.d.ts +3 -1
- package/dist/src/online-form/src/views/designer/types/sheets.d.ts +2 -0
- package/dist/src/online-form/src/views/designer/utils/cell-field-placements.d.ts +12 -0
- package/dist/src/online-form/src/views/designer/utils/placed-fields.d.ts +9 -0
- package/dist/src/online-form/src/views/designer/utils/template-placed-fields.d.ts +7 -0
- package/dist/src/online-form/src/views/designer/utils/xlsx-parser.d.ts +9 -3
- package/dist/src/online-form/src/views/render/__components__/_field_/_base_/cell/cell-auto-complete.vue.d.ts +2 -2
- package/dist/src/online-form/src/views/render/__components__/_field_/_base_/cell/cell-date-picker.vue.d.ts +2 -2
- package/dist/src/online-form/src/views/render/__components__/_field_/_base_/cell/cell-text-input.vue.d.ts +2 -2
- package/dist/src/online-form/src/views/render/__components__/_field_/_base_/cell/cell-textarea.vue.d.ts +2 -2
- package/dist/src/online-form/src/views/render/__components__/_field_/seal/component/seal-floating-field.vue.d.ts +0 -1
- package/dist/src/online-form/src/views/render/__components__/_field_/seal/component/seal-runtime-layer.vue.d.ts +0 -1
- package/dist/src/online-form/src/views/render/__components__/_field_/seal/component/use-seal-stamp.d.ts +1 -4
- package/dist/src/online-form/src/views/render/__components__/_field_/trace/common/base-vxe-table.vue.d.ts +1 -1
- package/dist/src/online-form/src/views/render/__components__/_field_/trace/composables/useReferenceLabel.d.ts +4 -0
- package/dist/src/shared/components/ColorPicker/src/ColorPicker.vue.d.ts +1 -1
- package/dist/src/shared/components/Signature/logic/index.d.ts +14 -0
- package/dist/src/shared/enum/field-type.d.ts +10 -3
- package/dist/src/shared/enum/index.d.ts +2 -0
- package/dist/src/shared/enum/product-type.d.ts +9 -0
- package/dist/src/shared/enum/production-identification.d.ts +19 -0
- package/dist/src/{nocode-web-render/src → shared}/hooks/useWebUpload.d.ts +1 -1
- package/dist/src/shared/index.d.ts +1 -0
- package/dist/src/shared/types/index.d.ts +1 -0
- package/dist/src/shared/types/upload.d.ts +11 -0
- package/dist/src/shared/utils/cell-wrap.d.ts +9 -0
- package/dist/src/shared/utils/grid-size.d.ts +2 -0
- package/dist/src/shared/utils/lot2sn.d.ts +14 -1
- package/dist/src/shared/utils/query-filter.d.ts +24 -0
- package/dist/src/shared/utils/withRequestCache.d.ts +27 -0
- package/dist/{sub-table-factory-DTtDvr17.js → sub-table-factory-C8IG5P9N.js} +230 -156
- package/dist/{text-design-Dz0Qf2O3.js → text-design-ZbT4-OIQ.js} +5 -4
- package/dist/{throttle-Cpk1LoGk-CgtsG2CV.js → throttle-Cpk1LoGk-CFMeLNb-.js} +1 -1
- package/dist/{timediff-design-D9JfNqH8.js → timediff-design-DRum3zZt.js} +1 -1
- package/dist/{trace-like-wrapper-BXgr0Uv3.js → trace-like-wrapper-DX6B_qq8.js} +5 -2
- package/dist/{value-editor.vue_vue_type_style_index_0_lang-doohzADY.js → value-editor.vue_vue_type_style_index_0_lang-DiqzTQxP.js} +2 -2
- package/dist/{widget-barcode-XF3nCU9v.js → widget-barcode-FukO_v5o.js} +4 -4
- package/dist/{widget-diagonal-DSym7fks.js → widget-diagonal-BxaAV6Z0.js} +3 -4
- package/dist/{widget-image-CmjwkVs7.js → widget-image-CGmm4QwO.js} +5 -7
- package/dist/{widget-line-BX64xVfU.js → widget-line-DHV95v22.js} +2 -2
- package/dist/{widget-pagination-BV89Lvjt.js → widget-pagination-CAdmXA68.js} +5 -5
- package/dist/{widget-power-DoSfQv92.js → widget-power-sfFZYwYY.js} +3 -4
- package/dist/{widget-qrcode-UGcRLC56.js → widget-qrcode-BEISi2k7.js} +3 -3
- package/dist/{widget-rangelimit-CUHD__1H.js → widget-rangelimit-DmPylyRg.js} +3 -4
- package/dist/{widget-serialnumber-CAkZR5Xl.js → widget-serialnumber-4PW9_Sy0.js} +1 -1
- package/dist/{widget-text-DtYVTThu.js → widget-text-CFzr4fdg.js} +5 -5
- package/dist/{widget-timediff-DX_IoCMO.js → widget-timediff-BY4BQSVg.js} +2 -2
- package/package.json +2 -6
- package/dist/AntdIcon-DCIaV352.js +0 -1108
- package/dist/index-DeHX7rte.js +0 -4306
- package/dist/mb-render-Bs9S9oFn.js +0 -270
- package/dist/paper-widget-design-DIhsk1I9.js +0 -4
- package/dist/seal-design-BhzgwVju.js +0 -4
- package/dist/src/nocode-web-render/src/hooks/index.d.ts +0 -2
- package/dist/src/nocode-web-render/src/hooks/userFormPrint.d.ts +0 -15
- package/dist/src/nocode-web-render/src/index.d.ts +0 -6
- package/dist/src/nocode-web-render/src/logic/index.d.ts +0 -1
- package/dist/src/nocode-web-render/src/render/common/index.d.ts +0 -2
- package/dist/src/nocode-web-render/src/render/common/modal-manager.d.ts +0 -20
- package/dist/src/nocode-web-render/src/render/index.d.ts +0 -10
- package/dist/src/nocode-web-render/src/render/parse-rule/index.d.ts +0 -3
- package/dist/src/nocode-web-render/src/render/parse-rule/parse-rule-modal.vue.d.ts +0 -15
- package/dist/src/nocode-web-render/src/render/sub-table/allocate/allocate-web-render.d.ts +0 -4
- package/dist/src/nocode-web-render/src/render/sub-table/allocate/index.d.ts +0 -1
- package/dist/src/nocode-web-render/src/render/sub-table/common/multi-rows-modal.vue.d.ts +0 -15
- package/dist/src/nocode-web-render/src/render/sub-table/common/scan-modal.vue.d.ts +0 -19
- package/dist/src/nocode-web-render/src/render/sub-table/index.d.ts +0 -3
- package/dist/src/nocode-web-render/src/render/sub-table/material-balance/index.d.ts +0 -1
- package/dist/src/nocode-web-render/src/render/sub-table/material-consume/index.d.ts +0 -4
- package/dist/src/nocode-web-render/src/render/sub-table/material-consume/mc-web-render.d.ts +0 -42
- package/dist/src/nocode-web-render/src/render/sub-table/stocktake/index.d.ts +0 -2
- package/dist/src/nocode-web-render/src/types/hooks/index.d.ts +0 -1
- package/dist/src/nocode-web-render/src/types/index.d.ts +0 -1
- package/dist/web-render/index.d.ts +0 -1
- package/dist/web-render/index.es.js +0 -596
- /package/dist/src/{nocode-web-render/src/adapter/index.d.ts → adapter/web/setup.d.ts} +0 -0
- /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,
|
|
2
|
-
import {
|
|
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 {
|
|
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
|
|
47
|
-
const changed = changedPath
|
|
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
|
-
|
|
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
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
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
|
-
|
|
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
|
-
...
|
|
1017
|
+
...sourcePaper,
|
|
997
1018
|
props: {
|
|
998
|
-
...
|
|
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
|
|
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
|
-
/**
|
|
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
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
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
|
-
|
|
1620
|
-
|
|
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)
|
|
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 = {
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
3329
|
-
const actual = path
|
|
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();
|
|
@@ -4159,7 +4743,7 @@ class BomEntryValidator {
|
|
|
4159
4743
|
this.productCodes[i.product_id_] = i.product_code_;
|
|
4160
4744
|
});
|
|
4161
4745
|
}
|
|
4162
|
-
this.hasConsumed = this.calcQtyConsumed(this.historyData);
|
|
4746
|
+
this.hasConsumed = this.calcQtyConsumed(this.historyData, "history");
|
|
4163
4747
|
}
|
|
4164
4748
|
bomEntry;
|
|
4165
4749
|
enableSequenceLoading;
|
|
@@ -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
|
|
@@ -4199,13 +4783,15 @@ class BomEntryValidator {
|
|
|
4199
4783
|
* @param arr
|
|
4200
4784
|
* @return {*}
|
|
4201
4785
|
*/
|
|
4202
|
-
filterGroupData(arr) {
|
|
4203
|
-
return arr.filter((i) => this.isRowInGroup(i) && i.product_id_);
|
|
4786
|
+
filterGroupData(arr, source = "current") {
|
|
4787
|
+
return arr.filter((i) => this.isRowInGroup(i, source) && i.product_id_);
|
|
4204
4788
|
}
|
|
4205
|
-
/**
|
|
4206
|
-
isRowInGroup(row) {
|
|
4789
|
+
/** 按数据来源优先匹配关联标识,无关联标识时按物料判断。 */
|
|
4790
|
+
isRowInGroup(row, source = "current") {
|
|
4207
4791
|
if (row.deleted_) return false;
|
|
4208
|
-
|
|
4792
|
+
const entryId = source === "history" ? row.bom_entry_parent_id_ : row.bom_entry_id_;
|
|
4793
|
+
const targetId = source === "history" ? this.bomEntry.parent_id_ : this.bomEntry.id_;
|
|
4794
|
+
if (entryId) return entryId === targetId;
|
|
4209
4795
|
if (row.product_id_) return this.productIds.includes(row.product_id_);
|
|
4210
4796
|
return false;
|
|
4211
4797
|
}
|
|
@@ -4336,14 +4922,14 @@ class BomEntryValidator {
|
|
|
4336
4922
|
* @param arr
|
|
4337
4923
|
* @return {*}
|
|
4338
4924
|
*/
|
|
4339
|
-
calcQtyConsumed(arr = this.historyData) {
|
|
4340
|
-
const groupData = this.filterGroupData(arr);
|
|
4341
|
-
return groupData.reduce((acc, cur) => acc + (cur.qty_ ?? 0), 0);
|
|
4925
|
+
calcQtyConsumed(arr = this.historyData, source = "history") {
|
|
4926
|
+
const groupData = this.filterGroupData(arr, source);
|
|
4927
|
+
return groupData.reduce((acc, cur) => acc + Number(cur.qty_ ?? 0), 0);
|
|
4342
4928
|
}
|
|
4343
4929
|
/** 上下限校验统一按需求单位口径取转换数量,历史数据未转换时兼容原数量。 */
|
|
4344
|
-
calcQtyForBounds(arr) {
|
|
4345
|
-
const groupData = this.filterGroupData(arr);
|
|
4346
|
-
return groupData.reduce((acc, cur) => acc + (cur.qty_transfer_ ?? cur.qty_ ?? 0), 0);
|
|
4930
|
+
calcQtyForBounds(arr, source = "current") {
|
|
4931
|
+
const groupData = this.filterGroupData(arr, source);
|
|
4932
|
+
return groupData.reduce((acc, cur) => acc + Number(cur.qty_transfer_ ?? cur.qty_ ?? 0), 0);
|
|
4347
4933
|
}
|
|
4348
4934
|
/**
|
|
4349
4935
|
* 计算自定义的数量校验的最大值和最小值
|
|
@@ -4358,9 +4944,10 @@ class BomEntryValidator {
|
|
|
4358
4944
|
try {
|
|
4359
4945
|
const json = JSON.parse(str);
|
|
4360
4946
|
if (json.expr) {
|
|
4361
|
-
|
|
4362
|
-
qty_required_: data.qty_required_
|
|
4947
|
+
const value = await window.gct_expression.execute(json.expr, {
|
|
4948
|
+
qty_required_: data.qty_required_ == null ? data.qty_required_ : Number(data.qty_required_)
|
|
4363
4949
|
});
|
|
4950
|
+
return value == null ? void 0 : Number(value);
|
|
4364
4951
|
} else {
|
|
4365
4952
|
console.warn("没有配置表达式");
|
|
4366
4953
|
}
|
|
@@ -4384,11 +4971,11 @@ class BomEntryValidator {
|
|
|
4384
4971
|
return;
|
|
4385
4972
|
}
|
|
4386
4973
|
const groupData = this.filterGroupData(arr);
|
|
4387
|
-
const loaded = this.calcQtyConsumed(arr);
|
|
4974
|
+
const loaded = this.calcQtyConsumed(arr, "current");
|
|
4388
4975
|
let required4 = this.remainingNum;
|
|
4389
4976
|
if (this.isCustomRequiredQty) {
|
|
4390
|
-
const currentQty = groupData[0]?.qty_required_;
|
|
4391
|
-
if (
|
|
4977
|
+
const currentQty = Number(groupData[0]?.qty_required_);
|
|
4978
|
+
if (!Number.isFinite(currentQty) || currentQty <= 0) {
|
|
4392
4979
|
throw new Error(
|
|
4393
4980
|
groupNo != null && groupNo > 0 ? `序号${groupNo},需求数量必须大于 0` : "需求数量必须大于 0"
|
|
4394
4981
|
);
|
|
@@ -4417,7 +5004,7 @@ class BomEntryValidator {
|
|
|
4417
5004
|
break;
|
|
4418
5005
|
case "bounds": {
|
|
4419
5006
|
const groupData2 = this.filterGroupData(arr);
|
|
4420
|
-
const consumeSum = this.calcQtyForBounds(arr) + this.calcQtyForBounds(this.historyData);
|
|
5007
|
+
const consumeSum = this.calcQtyForBounds(arr) + this.calcQtyForBounds(this.historyData, "history");
|
|
4421
5008
|
const { min, max } = await this.calcCustomNumberLimit(groupData2[0]);
|
|
4422
5009
|
if (min !== void 0 && consumeSum < min || max !== void 0 && consumeSum > max) {
|
|
4423
5010
|
fail($t("sys.qtyValidationRule.bounds", { min, max }));
|
|
@@ -5202,7 +5789,7 @@ function calcGroupRowSpans(rows, validator) {
|
|
|
5202
5789
|
function calcGroupQtyConsumedTotal(entryIdx, tableData, validator) {
|
|
5203
5790
|
if (entryIdx < 0) return 0;
|
|
5204
5791
|
return tableData.reduce((sum, row) => {
|
|
5205
|
-
return validator.resolveEntryIndex(row) === entryIdx ? sum + (row.qty_ ?? 0) : sum;
|
|
5792
|
+
return validator.resolveEntryIndex(row) === entryIdx ? sum + Number(row.qty_ ?? 0) : sum;
|
|
5206
5793
|
}, 0);
|
|
5207
5794
|
}
|
|
5208
5795
|
function syncGroupQtyConsumedTotals(tableData, validator) {
|
|
@@ -5260,7 +5847,8 @@ class MaterialConsumeTableController {
|
|
|
5260
5847
|
constructor(tmplBomController, tmplBom, options = {}) {
|
|
5261
5848
|
this.tmplBomController = tmplBomController;
|
|
5262
5849
|
this.tmplBom = tmplBom;
|
|
5263
|
-
if (!options.printOnly
|
|
5850
|
+
if (!options.printOnly && this.hasFormInstance)
|
|
5851
|
+
this.initScanRule(this.tmplBom.barcode_parsing_rules_id_);
|
|
5264
5852
|
this.scanParamType = this.tmplBom.scan_param_type_;
|
|
5265
5853
|
markRaw(this);
|
|
5266
5854
|
this.bomEntriesValidator = new BomEntriesValidator(
|
|
@@ -5300,10 +5888,10 @@ class MaterialConsumeTableController {
|
|
|
5300
5888
|
mainFormState = ref({});
|
|
5301
5889
|
/** 表单数据状态(由 factory bindRuntime 注入):未填报 / STASH / SUBMIT */
|
|
5302
5890
|
dataStatus;
|
|
5303
|
-
/**
|
|
5304
|
-
|
|
5305
|
-
/**
|
|
5306
|
-
|
|
5891
|
+
/** 实例数据只在 LOADED 前准备一次,运行时绑定不再重新生成行。 */
|
|
5892
|
+
initialDataPrepared = false;
|
|
5893
|
+
/** 最近一次同步需求数量时使用的数量依赖。 */
|
|
5894
|
+
syncedMaterialNoNum;
|
|
5307
5895
|
/** 表单是否已暂存或提交(已处理过则不再跑初始化) */
|
|
5308
5896
|
get isDataProcessed() {
|
|
5309
5897
|
return ["STASH", "SUBMIT"].includes(this.dataStatus ?? "");
|
|
@@ -5323,6 +5911,9 @@ class MaterialConsumeTableController {
|
|
|
5323
5911
|
get mcPattern() {
|
|
5324
5912
|
return this.tmplBom.material_consumption_pattern_ ?? this.tmplBomController.defaultMCPattern;
|
|
5325
5913
|
}
|
|
5914
|
+
get hasFormInstance() {
|
|
5915
|
+
return this.tmplBomController.hasFormInstance;
|
|
5916
|
+
}
|
|
5326
5917
|
/**
|
|
5327
5918
|
* 解析规则数据对象
|
|
5328
5919
|
*/
|
|
@@ -5408,21 +5999,6 @@ class MaterialConsumeTableController {
|
|
|
5408
5999
|
this.scanRuleProps = toParseRuleConfig(id);
|
|
5409
6000
|
this.scanRuleInfo = await getParseRuleInfo({ id: this.scanRuleProps.parsingRuleId });
|
|
5410
6001
|
}
|
|
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
6002
|
/**
|
|
5427
6003
|
* 是否人为指定物料
|
|
5428
6004
|
* @readonly
|
|
@@ -5449,7 +6025,8 @@ class MaterialConsumeTableController {
|
|
|
5449
6025
|
return this.actualBomEntries.map((i) => {
|
|
5450
6026
|
return {
|
|
5451
6027
|
product_id_: i.product_id_,
|
|
5452
|
-
|
|
6028
|
+
qty_required_uom_id_: i.uom_id_ || void 0,
|
|
6029
|
+
...materialNoNum === void 0 ? {} : { qty_required_: Number(i.qty_required_) * Number(materialNoNum) },
|
|
5453
6030
|
bom_entry_id_: i.id_
|
|
5454
6031
|
};
|
|
5455
6032
|
});
|
|
@@ -5575,6 +6152,10 @@ class MaterialConsumeTableController {
|
|
|
5575
6152
|
}
|
|
5576
6153
|
const isRecordPattern = this.mcPattern === MaterialConsumptionPatternEnum.RECORD && !this.tmplBom.personal_bom_enabled_;
|
|
5577
6154
|
console.log("parseScanStr", data);
|
|
6155
|
+
if (!data.lot && !data.uniqueCode) {
|
|
6156
|
+
this.error($t("sys.edhr.mcTable.lotOrUniqueCodeRequired"));
|
|
6157
|
+
return;
|
|
6158
|
+
}
|
|
5578
6159
|
const arr = await materialCheck({
|
|
5579
6160
|
material_no_: data.materialCode,
|
|
5580
6161
|
production_identification_name_: data.lot,
|
|
@@ -5629,6 +6210,9 @@ class MaterialConsumeTableController {
|
|
|
5629
6210
|
this.setDefaultValue(row);
|
|
5630
6211
|
try {
|
|
5631
6212
|
const plan = await this.bomEntriesValidator.validateScanCanInsert(row, this.actualTableData);
|
|
6213
|
+
if (plan) {
|
|
6214
|
+
row.qty_required_uom_id_ = plan.target.bomEntry.uom_id_ || void 0;
|
|
6215
|
+
}
|
|
5632
6216
|
const existingRequiredQty = this.isCustomRequiredQty && plan ? this.actualTableData.find(
|
|
5633
6217
|
(item) => plan.target.isRowInGroup(item) && item.qty_required_ != null
|
|
5634
6218
|
)?.qty_required_ : void 0;
|
|
@@ -5685,40 +6269,36 @@ class MaterialConsumeTableController {
|
|
|
5685
6269
|
});
|
|
5686
6270
|
this.isScanOpen = false;
|
|
5687
6271
|
}
|
|
5688
|
-
/**
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
6272
|
+
/** Store 创建前准备物料行和数量,全部 Sheet 的 LOADED 共用这份数据。 */
|
|
6273
|
+
prepareInitialData(opts) {
|
|
6274
|
+
if (this.initialDataPrepared) return;
|
|
6275
|
+
this.tableDataRef = toRef(opts.formState, opts.field, []);
|
|
6276
|
+
this.mainFormState = toRef(() => opts.formState);
|
|
6277
|
+
this.dataStatus = opts.dataStatus;
|
|
6278
|
+
this.initTableData(opts.defaultRowData);
|
|
6279
|
+
const rows = this.actualTableData;
|
|
6280
|
+
if (rows.length === 1 && !rows[0].product_id_) {
|
|
6281
|
+
MCDataUtil.setRowEditing(rows[0], true);
|
|
5695
6282
|
}
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
}
|
|
5702
|
-
});
|
|
6283
|
+
if (this.dataStatus !== "SUBMIT") {
|
|
6284
|
+
this.syncQtyRequiredFromBom();
|
|
6285
|
+
}
|
|
6286
|
+
this.syncedMaterialNoNum = this.materialNoNum;
|
|
6287
|
+
this.initialDataPrepared = true;
|
|
5703
6288
|
}
|
|
5704
|
-
/**
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
6289
|
+
/** 数量依赖实际变化时才重算,避免首次绑定覆盖 LOADED 中的回填。 */
|
|
6290
|
+
syncQtyRequiredFromBomIfChanged() {
|
|
6291
|
+
if (this.dataStatus === "SUBMIT") return;
|
|
6292
|
+
const materialNoNum = this.materialNoNum;
|
|
6293
|
+
if (this.initialDataPrepared && Object.is(materialNoNum, this.syncedMaterialNoNum)) return;
|
|
6294
|
+
this.syncQtyRequiredFromBom();
|
|
6295
|
+
this.syncedMaterialNoNum = materialNoNum;
|
|
6296
|
+
}
|
|
6297
|
+
/** 只绑定运行时 Store,不重新生成行或修改行内容。 */
|
|
5708
6298
|
bindRuntime(opts) {
|
|
5709
6299
|
this.tableDataRef = opts.tableDataRef;
|
|
5710
|
-
this.runtimeOwnerId = opts.ownerId;
|
|
5711
6300
|
this.mainFormState = opts.mainFormState ?? ref({});
|
|
5712
6301
|
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
6302
|
}
|
|
5723
6303
|
/**
|
|
5724
6304
|
* 消耗表组件挂载时调用:只同步视图依赖,不初始化数据、不注册 watch。
|
|
@@ -5732,7 +6312,10 @@ class MaterialConsumeTableController {
|
|
|
5732
6312
|
* 按当前 materialNoNum 回写各行 qty_required_(校验侧 total 已通过 getter 实时读取)
|
|
5733
6313
|
*/
|
|
5734
6314
|
syncQtyRequiredFromBom() {
|
|
5735
|
-
if (this.tmplBom.required_qty_calc_rule_ === RequiredQtyCalcRule.Custom)
|
|
6315
|
+
if (this.tmplBom.required_qty_calc_rule_ === RequiredQtyCalcRule.Custom) {
|
|
6316
|
+
this.updateDerivedQtyFields();
|
|
6317
|
+
return;
|
|
6318
|
+
}
|
|
5736
6319
|
this.actualTableData.forEach((row) => {
|
|
5737
6320
|
if (!row.product_id_) return;
|
|
5738
6321
|
const util = this.bomEntriesValidator.findUtilByProductId(row.product_id_);
|
|
@@ -5776,7 +6359,7 @@ class MaterialConsumeTableController {
|
|
|
5776
6359
|
const formData = transformFields.reduce((acc, cur) => {
|
|
5777
6360
|
if (!cur.targetField) return acc;
|
|
5778
6361
|
if (cur.sourceField === FormulaRuleFieldKeyEnum.INPUT) {
|
|
5779
|
-
acc[cur.sourceField] = row.qty_;
|
|
6362
|
+
acc[cur.sourceField] = row.qty_ == null ? row.qty_ : Number(row.qty_);
|
|
5780
6363
|
} else if (cur.targetField.includes(".")) {
|
|
5781
6364
|
const fieldKey = cur.targetField.split(".").pop();
|
|
5782
6365
|
acc[cur.sourceField] = row[fieldKey];
|
|
@@ -5788,7 +6371,7 @@ class MaterialConsumeTableController {
|
|
|
5788
6371
|
try {
|
|
5789
6372
|
const res = await calculate(formulaContent, formData);
|
|
5790
6373
|
Object.assign(row, {
|
|
5791
|
-
qty_transfer_: res,
|
|
6374
|
+
qty_transfer_: res == null ? res : Number(res),
|
|
5792
6375
|
qty_transfer_uom_id_: targetUnitId,
|
|
5793
6376
|
transfer_formula_: formulaContent
|
|
5794
6377
|
});
|
|
@@ -5972,7 +6555,7 @@ class MaterialConsumeTableController {
|
|
|
5972
6555
|
const modifySingleRow = (index) => {
|
|
5973
6556
|
const row = this.actualTableData[index];
|
|
5974
6557
|
if (!row.product_id_) {
|
|
5975
|
-
row.qty_consumed_ =
|
|
6558
|
+
row.qty_consumed_ = Number(row.qty_ ?? 0);
|
|
5976
6559
|
return;
|
|
5977
6560
|
}
|
|
5978
6561
|
let total = 0;
|
|
@@ -5981,7 +6564,7 @@ class MaterialConsumeTableController {
|
|
|
5981
6564
|
if (util) {
|
|
5982
6565
|
total += util.hasConsumed;
|
|
5983
6566
|
util.filterGroupData(beforeArr).forEach((i) => {
|
|
5984
|
-
total += i.qty_ ?? 0;
|
|
6567
|
+
total += Number(i.qty_ ?? 0);
|
|
5985
6568
|
});
|
|
5986
6569
|
row.qty_consumed_ = total;
|
|
5987
6570
|
}
|
|
@@ -6003,11 +6586,22 @@ class MaterialConsumeTableController {
|
|
|
6003
6586
|
this.updateRowConsumed();
|
|
6004
6587
|
this.updateGroupQtyConsumedTotal();
|
|
6005
6588
|
}
|
|
6589
|
+
/** 同步 BOM 主物料的需求数量单位,未关联 BOM 的行保留原单位。 */
|
|
6590
|
+
syncRequiredUomFromBom(row) {
|
|
6591
|
+
const validator = this.bomEntriesValidator;
|
|
6592
|
+
const productId = row.product_id_;
|
|
6593
|
+
const bound = row.bom_entry_id_ ? validator.bomEntryValidators.find((item) => item.bomEntry.id_ === row.bom_entry_id_) : void 0;
|
|
6594
|
+
const matched = productId ? bound?.productIds.includes(productId) ? bound : validator.findUtilByProductId(productId) : void 0;
|
|
6595
|
+
if (matched || bound) {
|
|
6596
|
+
row.qty_required_uom_id_ = matched?.bomEntry.uom_id_ || void 0;
|
|
6597
|
+
}
|
|
6598
|
+
}
|
|
6006
6599
|
/**
|
|
6007
|
-
*
|
|
6600
|
+
* 设置默认值,如工序,需求数量/需求数量单位/已消耗数量
|
|
6008
6601
|
* @param row
|
|
6009
6602
|
*/
|
|
6010
6603
|
setDefaultValue(row) {
|
|
6604
|
+
this.syncRequiredUomFromBom(row);
|
|
6011
6605
|
if (!row.routing_operation_id_) {
|
|
6012
6606
|
row.routing_operation_id_ = this.tmplBomController.operationId;
|
|
6013
6607
|
}
|
|
@@ -6069,7 +6663,16 @@ class MaterialConsumeTableController {
|
|
|
6069
6663
|
this.error(msg);
|
|
6070
6664
|
return;
|
|
6071
6665
|
}
|
|
6072
|
-
if (!value)
|
|
6666
|
+
if (!value) {
|
|
6667
|
+
if (row.product_id_ && !this.isCustomRequiredQty) {
|
|
6668
|
+
const util = this.bomEntriesValidator.findUtilByProductId(row.product_id_);
|
|
6669
|
+
if (util) {
|
|
6670
|
+
row.qty_required_ = util.total;
|
|
6671
|
+
}
|
|
6672
|
+
}
|
|
6673
|
+
this.updateDerivedQtyFields();
|
|
6674
|
+
return;
|
|
6675
|
+
}
|
|
6073
6676
|
try {
|
|
6074
6677
|
await validateReinspectionDate({
|
|
6075
6678
|
product_id_: option.product_id_ ?? row.product_id_,
|
|
@@ -6093,12 +6696,38 @@ class MaterialConsumeTableController {
|
|
|
6093
6696
|
const qty = oldGroupId && row.bom_entry_id_ === oldGroupId ? oldRequiredQty : this.getCustomGroupRequiredQty(row);
|
|
6094
6697
|
this.setCustomGroupRequiredQty(row, qty);
|
|
6095
6698
|
}
|
|
6699
|
+
this.updateDerivedQtyFields();
|
|
6096
6700
|
} else if (field === "qty_") {
|
|
6097
6701
|
this.updateDerivedQtyFields();
|
|
6098
6702
|
}
|
|
6099
6703
|
await this.applyUnitConversionRules(row);
|
|
6100
6704
|
}
|
|
6101
6705
|
}
|
|
6706
|
+
class MCRender {
|
|
6707
|
+
/**
|
|
6708
|
+
* 提示信息
|
|
6709
|
+
* @param opts
|
|
6710
|
+
*/
|
|
6711
|
+
message(opts) {
|
|
6712
|
+
throw new Error("Function message not implemented.");
|
|
6713
|
+
}
|
|
6714
|
+
async openScanModal(opts) {
|
|
6715
|
+
throw new Error("Function openScanModal not implemented.");
|
|
6716
|
+
}
|
|
6717
|
+
/**
|
|
6718
|
+
* 扫码返回多条候选时,弹窗选择其中一条
|
|
6719
|
+
* 取消返回 undefined
|
|
6720
|
+
*/
|
|
6721
|
+
async openMultiRowsModal(opts) {
|
|
6722
|
+
throw new Error("Function openMultiRowsModal not implemented.");
|
|
6723
|
+
}
|
|
6724
|
+
/**
|
|
6725
|
+
* 关闭当前页面的 form-base 弹层
|
|
6726
|
+
*/
|
|
6727
|
+
destroyAllModals(_ownerId) {
|
|
6728
|
+
throw new Error("Function destroyAllModals not implemented.");
|
|
6729
|
+
}
|
|
6730
|
+
}
|
|
6102
6731
|
var SubTableActionEnum = /* @__PURE__ */ ((SubTableActionEnum2) => {
|
|
6103
6732
|
SubTableActionEnum2["QuickFillRowCurrent"] = "quickFillRowCurrent";
|
|
6104
6733
|
SubTableActionEnum2["InsertRowBefore"] = "insertRowBefore";
|
|
@@ -6110,8 +6739,6 @@ var SubTableActionEnum = /* @__PURE__ */ ((SubTableActionEnum2) => {
|
|
|
6110
6739
|
SubTableActionEnum2["ClearRowCurrent"] = "clearRowCurrent";
|
|
6111
6740
|
SubTableActionEnum2["CONFIRM"] = "CONFIRM";
|
|
6112
6741
|
SubTableActionEnum2["SCAN"] = "SCAN";
|
|
6113
|
-
SubTableActionEnum2["VIEW_BOM"] = "VIEW_BOM";
|
|
6114
|
-
SubTableActionEnum2["CHANGE_PARSE_RULE"] = "CHANGE_PARSE_RULE";
|
|
6115
6742
|
SubTableActionEnum2["RowEdit"] = "rowEdit";
|
|
6116
6743
|
SubTableActionEnum2["Insert1GroupAfter"] = "insert1GroupAfter";
|
|
6117
6744
|
return SubTableActionEnum2;
|
|
@@ -6131,18 +6758,6 @@ function getMenuByAction(type4) {
|
|
|
6131
6758
|
label: "条码扫描",
|
|
6132
6759
|
icon: "size24 icon-saoma1"
|
|
6133
6760
|
},
|
|
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
6761
|
[SubTableActionEnum.QuickFillRowCurrent]: {
|
|
6147
6762
|
type: SubTableActionMenuTypeEnum.ACTION,
|
|
6148
6763
|
key: SubTableActionEnum.QuickFillRowCurrent,
|
|
@@ -6326,27 +6941,225 @@ class TdHandler {
|
|
|
6326
6941
|
this.mergeTd({ cellWidget: { props: { newSpecificConfig: { customLoader } } } });
|
|
6327
6942
|
}
|
|
6328
6943
|
}
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6944
|
+
class BaseFormModelFetcher {
|
|
6945
|
+
/** 默认接口 */
|
|
6946
|
+
apis = {
|
|
6947
|
+
getFieldMetaList: api.apaas.fieldMeta.getList,
|
|
6948
|
+
getModelMetaSubModelList: api.apaas.modelComprehensive.getSubModelList,
|
|
6949
|
+
getModelDetail2FieldList: api.apaas.modelMeta.getDetail
|
|
6950
|
+
};
|
|
6951
|
+
/**
|
|
6952
|
+
* 模型映射缓存
|
|
6953
|
+
*/
|
|
6954
|
+
modelMetaMap = {};
|
|
6955
|
+
async load(opts) {
|
|
6956
|
+
const { model } = opts;
|
|
6957
|
+
this.modelMetaMap = {};
|
|
6958
|
+
await this.loadModelFields(model);
|
|
6959
|
+
await this.loadSubModelsFields(model);
|
|
6960
|
+
return Object.values(this.modelMetaMap);
|
|
6338
6961
|
}
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
}
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6962
|
+
/**
|
|
6963
|
+
* 补全字段信息
|
|
6964
|
+
* @param modelKey 字段所属的模型
|
|
6965
|
+
* @param [fields=[]]
|
|
6966
|
+
* @return {*}
|
|
6967
|
+
*/
|
|
6968
|
+
completeFields(modelKey, fields = []) {
|
|
6969
|
+
return fields.map((field) => {
|
|
6970
|
+
if (!field.modelKey) {
|
|
6971
|
+
field.modelKey = modelKey;
|
|
6972
|
+
}
|
|
6973
|
+
return field;
|
|
6974
|
+
});
|
|
6975
|
+
}
|
|
6976
|
+
/**
|
|
6977
|
+
* 根据模型key加载模型字段
|
|
6978
|
+
*
|
|
6979
|
+
* @param [modelKey=this.model]
|
|
6980
|
+
* @return {*}
|
|
6981
|
+
*/
|
|
6982
|
+
async loadModelFields(modelKey) {
|
|
6983
|
+
if (typeof this.apis.getFieldMetaList !== "function") {
|
|
6984
|
+
return;
|
|
6985
|
+
}
|
|
6986
|
+
const res = await this.apis.getFieldMetaList({
|
|
6987
|
+
modelKey
|
|
6988
|
+
});
|
|
6989
|
+
this.modelMetaMap[modelKey] = {
|
|
6990
|
+
key: modelKey,
|
|
6991
|
+
name: "",
|
|
6992
|
+
fields: this.completeFields(modelKey, res)
|
|
6993
|
+
};
|
|
6994
|
+
return res;
|
|
6995
|
+
}
|
|
6996
|
+
/**
|
|
6997
|
+
* 加载表单所有子表字段对应模型的字段信息集合
|
|
6998
|
+
*/
|
|
6999
|
+
async loadSubModelsFields(modelKey) {
|
|
7000
|
+
const res = await this.apis.getModelMetaSubModelList({
|
|
7001
|
+
modelKey
|
|
7002
|
+
});
|
|
7003
|
+
(res ?? []).forEach((m) => {
|
|
7004
|
+
if (!this.modelMetaMap[m.key]) {
|
|
7005
|
+
this.modelMetaMap[m.key] = {
|
|
7006
|
+
key: m.key,
|
|
7007
|
+
name: m.name,
|
|
7008
|
+
subModel: m.subModel,
|
|
7009
|
+
fields: this.completeFields(m.key, m.fieldMetaList)
|
|
7010
|
+
};
|
|
7011
|
+
}
|
|
7012
|
+
});
|
|
7013
|
+
}
|
|
7014
|
+
}
|
|
7015
|
+
class FormModelController {
|
|
7016
|
+
/** 主模型的key */
|
|
7017
|
+
masterModelKey;
|
|
7018
|
+
/** 主模型的名称 */
|
|
7019
|
+
masterModelName;
|
|
7020
|
+
/** 模型请求器 */
|
|
7021
|
+
fetcher = new BaseFormModelFetcher();
|
|
7022
|
+
/** 模型映射缓存 */
|
|
7023
|
+
modelMetaMap = reactive({});
|
|
7024
|
+
/** 主模型信息 */
|
|
7025
|
+
get masterModel() {
|
|
7026
|
+
return this.modelMetaMap[this.masterModelKey];
|
|
7027
|
+
}
|
|
7028
|
+
/** 获取主模型字段集合 */
|
|
7029
|
+
get masterFields() {
|
|
7030
|
+
return this.masterModel?.fields;
|
|
7031
|
+
}
|
|
7032
|
+
/** 获取子模型 */
|
|
7033
|
+
getSubModel(subModelKey) {
|
|
7034
|
+
return this.modelMetaMap[subModelKey];
|
|
7035
|
+
}
|
|
7036
|
+
/** 获取子模型字段集合 */
|
|
7037
|
+
getSubModelFields(subModelKey) {
|
|
7038
|
+
return this.getSubModel(subModelKey)?.fields;
|
|
7039
|
+
}
|
|
7040
|
+
/**
|
|
7041
|
+
* 表单字段下拉选项(排除系统字段和子表字段)
|
|
7042
|
+
* value 格式为 modelKey.fieldKey,与字段映射存储格式一致
|
|
7043
|
+
*/
|
|
7044
|
+
getFormFieldOptions(subModelKey) {
|
|
7045
|
+
const fields = subModelKey ? this.getSubModelFields(subModelKey) : this.masterModel?.fields;
|
|
7046
|
+
return (fields ?? []).filter(
|
|
7047
|
+
(field) => !this.isSystemField(field) && !this.isSubField(field) && !this.isObjectField(field)
|
|
7048
|
+
).map((field) => ({
|
|
7049
|
+
...field,
|
|
7050
|
+
label: `${field.name}`,
|
|
7051
|
+
value: `${field.modelKey}.${field.key}`
|
|
7052
|
+
}));
|
|
7053
|
+
}
|
|
7054
|
+
/**
|
|
7055
|
+
* 初始化
|
|
7056
|
+
*
|
|
7057
|
+
* @param opts
|
|
7058
|
+
* - model 主模型key
|
|
7059
|
+
* - name 主模型名称
|
|
7060
|
+
*/
|
|
7061
|
+
async init(opts) {
|
|
7062
|
+
this.masterModelKey = opts.model;
|
|
7063
|
+
this.masterModelName = opts.name;
|
|
7064
|
+
await this.load();
|
|
7065
|
+
}
|
|
7066
|
+
/** 刷新数据 */
|
|
7067
|
+
async refresh() {
|
|
7068
|
+
await this.load();
|
|
7069
|
+
}
|
|
7070
|
+
/**
|
|
7071
|
+
* 加载数据并填充到modelMetaMap中
|
|
7072
|
+
* @protected
|
|
7073
|
+
* @return {*}
|
|
7074
|
+
*/
|
|
7075
|
+
async load() {
|
|
7076
|
+
if (!this.masterModelKey) {
|
|
7077
|
+
console.error("缺少主模型的key");
|
|
7078
|
+
return;
|
|
7079
|
+
}
|
|
7080
|
+
const models = await this.fetcher.load({ model: this.masterModelKey });
|
|
7081
|
+
this.modelMetaMap = models.reduce((acc, cur) => {
|
|
7082
|
+
acc[cur.key] = cur;
|
|
7083
|
+
if (cur.key === this.masterModelKey) {
|
|
7084
|
+
cur.name = this.masterModelName;
|
|
7085
|
+
}
|
|
7086
|
+
return acc;
|
|
7087
|
+
}, {});
|
|
7088
|
+
}
|
|
7089
|
+
/** 是否是子模型字段 */
|
|
7090
|
+
isSubField(field) {
|
|
7091
|
+
return field.type === FIELD_TYPE.MASTERSLAVE && field.bindInfo;
|
|
7092
|
+
}
|
|
7093
|
+
/** 是否是预置字段,包括系统字段和业务内置字段 */
|
|
7094
|
+
isPresetField(field) {
|
|
7095
|
+
return [CreateType.BUILTIN, CreateType.SYSTEM].includes(field.createType);
|
|
7096
|
+
}
|
|
7097
|
+
/** 是否是系统字段 */
|
|
7098
|
+
isSystemField(field) {
|
|
7099
|
+
return field.createType === CreateType.SYSTEM;
|
|
7100
|
+
}
|
|
7101
|
+
/** 是否是对象字段类型 */
|
|
7102
|
+
isObjectField(field) {
|
|
7103
|
+
return field.type === FIELD_TYPE.OBJECT_TYPE;
|
|
7104
|
+
}
|
|
7105
|
+
/**
|
|
7106
|
+
* 获取主模型里子表字段对应的子模型key
|
|
7107
|
+
*
|
|
7108
|
+
* @param fieldKey 子表字段在主表里的字段key
|
|
7109
|
+
* @return {*}
|
|
7110
|
+
*/
|
|
7111
|
+
getSubFieldModelKey(fieldKey) {
|
|
7112
|
+
return this.masterFields.find((field) => field.key === fieldKey)?.bindInfo;
|
|
7113
|
+
}
|
|
7114
|
+
/**
|
|
7115
|
+
* 获取字段信息
|
|
7116
|
+
* @param [modelKey=this.masterModelKey] 模型key
|
|
7117
|
+
* @param fieldKey 字段key
|
|
7118
|
+
* @return {*}
|
|
7119
|
+
*/
|
|
7120
|
+
findField(modelKey = this.masterModelKey, fieldKey) {
|
|
7121
|
+
const model = this.modelMetaMap[modelKey];
|
|
7122
|
+
if (!model) {
|
|
7123
|
+
return;
|
|
7124
|
+
}
|
|
7125
|
+
return model.fields.find((field) => field.key === fieldKey);
|
|
7126
|
+
}
|
|
7127
|
+
}
|
|
7128
|
+
const FormModelControllerKey = "GctFormModelController";
|
|
7129
|
+
function useFormModel() {
|
|
7130
|
+
function provideController(c = new FormModelController()) {
|
|
7131
|
+
provide(FormModelControllerKey, c);
|
|
7132
|
+
return c;
|
|
7133
|
+
}
|
|
7134
|
+
function injectController() {
|
|
7135
|
+
return inject(FormModelControllerKey);
|
|
7136
|
+
}
|
|
7137
|
+
return {
|
|
7138
|
+
provideController,
|
|
7139
|
+
injectController
|
|
7140
|
+
};
|
|
7141
|
+
}
|
|
7142
|
+
const SCAN_ROW_META_KEYS = /* @__PURE__ */ new Set([FRONT_ROW_KEY, "id_", "id", "group_", "deleted_", "delete_"]);
|
|
7143
|
+
function hasRowId(row) {
|
|
7144
|
+
const id = row.id_ ?? row.id;
|
|
7145
|
+
return id !== void 0 && id !== null && String(id).trim() !== "";
|
|
7146
|
+
}
|
|
7147
|
+
function isEmptyScanValue(value) {
|
|
7148
|
+
if (value == null || value === "") return true;
|
|
7149
|
+
if (typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) {
|
|
7150
|
+
return true;
|
|
7151
|
+
}
|
|
7152
|
+
return false;
|
|
7153
|
+
}
|
|
7154
|
+
function isProductBatchEmptyRow(row) {
|
|
7155
|
+
return isEmptyScanValue(row.product_id_) && isEmptyScanValue(row.material_no_) && isEmptyScanValue(row.material_no__id_);
|
|
7156
|
+
}
|
|
7157
|
+
function hasSubtableBusinessData(row, ignoreValues = {}) {
|
|
7158
|
+
if (!row || typeof row !== "object") return false;
|
|
7159
|
+
if (hasRowId(row)) return true;
|
|
7160
|
+
return Object.keys(row).some((key) => {
|
|
7161
|
+
if (SCAN_ROW_META_KEYS.has(key) || key.startsWith("_")) return false;
|
|
7162
|
+
const value = row[key];
|
|
6350
7163
|
if (isEmptyScanValue(value)) return false;
|
|
6351
7164
|
if (key in ignoreValues && value === ignoreValues[key]) return false;
|
|
6352
7165
|
return true;
|
|
@@ -6559,8 +7372,6 @@ class SubTableCore {
|
|
|
6559
7372
|
const { actionKey } = params;
|
|
6560
7373
|
if (actionKey === SubTableActionEnum.SCAN) {
|
|
6561
7374
|
this.openScanModal();
|
|
6562
|
-
} else if (actionKey === SubTableActionEnum.CHANGE_PARSE_RULE) {
|
|
6563
|
-
this.changeScanRule();
|
|
6564
7375
|
}
|
|
6565
7376
|
}
|
|
6566
7377
|
/**
|
|
@@ -6662,20 +7473,6 @@ class SubTableCore {
|
|
|
6662
7473
|
scanRuleInfo;
|
|
6663
7474
|
/** 解析规则配置对象 */
|
|
6664
7475
|
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
7476
|
/**
|
|
6680
7477
|
* 打开扫描弹窗
|
|
6681
7478
|
* @param opts
|
|
@@ -6727,11 +7524,12 @@ class SubTableCore {
|
|
|
6727
7524
|
/**
|
|
6728
7525
|
* 扫码多条候选时选择一行(1 条自动选中)
|
|
6729
7526
|
*/
|
|
6730
|
-
async pickScanRecord(records) {
|
|
7527
|
+
async pickScanRecord(records, options = {}) {
|
|
6731
7528
|
if (!records.length) return void 0;
|
|
6732
7529
|
if (records.length === 1) return records[0];
|
|
6733
7530
|
return this.render.openMultiRowsModal({
|
|
6734
|
-
rows: mapScanRecordsForPicker(records)
|
|
7531
|
+
rows: mapScanRecordsForPicker(records),
|
|
7532
|
+
...options
|
|
6735
7533
|
});
|
|
6736
7534
|
}
|
|
6737
7535
|
/**
|
|
@@ -6991,7 +7789,7 @@ async function validateObjectBomQtyOnSubmit(opts) {
|
|
|
6991
7789
|
for (const obj of objectFieldList) {
|
|
6992
7790
|
if (!obj?.objectField) continue;
|
|
6993
7791
|
const objectBom = findObjectBom(formInstBom, obj.objectField);
|
|
6994
|
-
if (objectBom?.material_consumption_pattern_ === MaterialConsumptionPatternEnum.RECORD) {
|
|
7792
|
+
if (objectBom?.material_consumption_pattern_ === MaterialConsumptionPatternEnum.RECORD && !objectBom.personal_bom_enabled_) {
|
|
6995
7793
|
continue;
|
|
6996
7794
|
}
|
|
6997
7795
|
const { productKey, productFieldName, qtyKey, qtyRequiredKey, qtyFieldName } = pickObjectFieldKeys(obj.subFields, obj.objectField);
|
|
@@ -7052,150 +7850,6 @@ async function validateObjectBomQtyOnSubmit(opts) {
|
|
|
7052
7850
|
}
|
|
7053
7851
|
return errors;
|
|
7054
7852
|
}
|
|
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
7853
|
function useRuntimeRowState(rowSource) {
|
|
7200
7854
|
const { formStateStore } = useRuntimeInstanceServices();
|
|
7201
7855
|
function requireStore() {
|
|
@@ -7524,7 +8178,11 @@ function useDependency(widget, props) {
|
|
|
7524
8178
|
);
|
|
7525
8179
|
if (!controlledFormData.value._OPCT) {
|
|
7526
8180
|
const store = formStateStore.value;
|
|
7527
|
-
store.
|
|
8181
|
+
store.transaction(
|
|
8182
|
+
"restore",
|
|
8183
|
+
() => store.setObjectField(controlledFormData.value, "_OPCT", { _DICT: {} }, "restore"),
|
|
8184
|
+
{ restoreScope: "fields" }
|
|
8185
|
+
);
|
|
7528
8186
|
}
|
|
7529
8187
|
const formRowData = toRef(() => {
|
|
7530
8188
|
if (isFieldModel) {
|
|
@@ -7550,6 +8208,7 @@ function useDependency(widget, props) {
|
|
|
7550
8208
|
if (!store) throw new Error("字段组件缺少实例级 FormStateStore");
|
|
7551
8209
|
const row = store.createScopedView(formRowData.value, formRowPath.value);
|
|
7552
8210
|
const path = store.getFieldPath(row, targetFieldId);
|
|
8211
|
+
if (assignment_expression) store.markUserModified(path);
|
|
7553
8212
|
store.setObjectField(row, targetFieldId, val, "user", path);
|
|
7554
8213
|
if (assignment_expression && strategy === ASSIGNMENTSTRATEGY_ENUM.notCovered && commonUtils.isEmptyValue(val)) {
|
|
7555
8214
|
store.clearUserModified(path);
|
|
@@ -7948,6 +8607,159 @@ function useFormTmplConfig() {
|
|
|
7948
8607
|
injectController
|
|
7949
8608
|
};
|
|
7950
8609
|
}
|
|
8610
|
+
function isBlank(value) {
|
|
8611
|
+
return value == null || value === "";
|
|
8612
|
+
}
|
|
8613
|
+
function pickPresent(preferred, fallback) {
|
|
8614
|
+
return isBlank(preferred) ? fallback : preferred;
|
|
8615
|
+
}
|
|
8616
|
+
function resolveObjectFieldKeys(opts) {
|
|
8617
|
+
const obj = opts.objectFieldList?.find((item) => item.objectField === opts.belongingObject);
|
|
8618
|
+
const fromList = obj?.subFields ? pickObjectFieldKeys(obj.subFields, opts.belongingObject) : {};
|
|
8619
|
+
const fromFallback = pickObjectFieldKeys(opts.fallbackFields, opts.belongingObject, {
|
|
8620
|
+
requireUsed: false
|
|
8621
|
+
});
|
|
8622
|
+
return {
|
|
8623
|
+
productKey: pickPresent(fromList.productKey, fromFallback.productKey),
|
|
8624
|
+
productFieldName: fromList.productFieldName ?? fromFallback.productFieldName,
|
|
8625
|
+
materialNoKey: pickPresent(fromList.materialNoKey, fromFallback.materialNoKey),
|
|
8626
|
+
materialNoFieldName: fromList.materialNoFieldName ?? fromFallback.materialNoFieldName,
|
|
8627
|
+
qtyKey: pickPresent(fromList.qtyKey, fromFallback.qtyKey),
|
|
8628
|
+
qtyRequiredKey: pickPresent(fromList.qtyRequiredKey, fromFallback.qtyRequiredKey),
|
|
8629
|
+
qtyFieldName: fromList.qtyFieldName ?? fromFallback.qtyFieldName,
|
|
8630
|
+
bomEntryIdKey: pickPresent(fromList.bomEntryIdKey, fromFallback.bomEntryIdKey)
|
|
8631
|
+
};
|
|
8632
|
+
}
|
|
8633
|
+
function buildObjectLotExtraQuery(productId) {
|
|
8634
|
+
if (isBlank(productId)) return {};
|
|
8635
|
+
const versionId = String(productId).split(":").pop();
|
|
8636
|
+
if (!versionId) return {};
|
|
8637
|
+
return { "product_id_.versionEq": versionId };
|
|
8638
|
+
}
|
|
8639
|
+
function clearedLotFields(materialNoKey) {
|
|
8640
|
+
if (!materialNoKey) return {};
|
|
8641
|
+
return {
|
|
8642
|
+
[materialNoKey]: void 0,
|
|
8643
|
+
[`${materialNoKey}_id_`]: void 0,
|
|
8644
|
+
[`${materialNoKey}_lb_`]: void 0
|
|
8645
|
+
};
|
|
8646
|
+
}
|
|
8647
|
+
function shouldClearLotOnProductChange(opts) {
|
|
8648
|
+
const { prevProduct, nextProduct, lotValue } = opts;
|
|
8649
|
+
if (isBlank(prevProduct) && isBlank(nextProduct)) return false;
|
|
8650
|
+
if (prevProduct === nextProduct) return false;
|
|
8651
|
+
if (isBlank(prevProduct) && !isBlank(nextProduct) && !isBlank(lotValue)) {
|
|
8652
|
+
return false;
|
|
8653
|
+
}
|
|
8654
|
+
return true;
|
|
8655
|
+
}
|
|
8656
|
+
let fillingProduct = false;
|
|
8657
|
+
function runWithFillProduct(fn) {
|
|
8658
|
+
fillingProduct = true;
|
|
8659
|
+
try {
|
|
8660
|
+
fn();
|
|
8661
|
+
} finally {
|
|
8662
|
+
nextTick(() => {
|
|
8663
|
+
fillingProduct = false;
|
|
8664
|
+
});
|
|
8665
|
+
}
|
|
8666
|
+
}
|
|
8667
|
+
function resolveLotValidateParams(keys, formData, option) {
|
|
8668
|
+
return {
|
|
8669
|
+
product_id_: option?.product_id_ ?? option?._item?.product_id_ ?? (keys.productKey ? formData[keys.productKey] : void 0),
|
|
8670
|
+
material_no_: option?.name_ ?? option?.__VALUE__ ?? (keys.materialNoKey ? formData[keys.materialNoKey] : void 0),
|
|
8671
|
+
material_no_id_: option?.id_ ?? (keys.materialNoKey ? formData[`${keys.materialNoKey}_id_`] : void 0)
|
|
8672
|
+
};
|
|
8673
|
+
}
|
|
8674
|
+
async function applyConsumeObjectTraceChange(opts) {
|
|
8675
|
+
const { belongingObject, role, formData } = opts;
|
|
8676
|
+
if (!belongingObject || !formData) return {};
|
|
8677
|
+
const keys = resolveObjectFieldKeys({
|
|
8678
|
+
belongingObject,
|
|
8679
|
+
objectFieldList: opts.objectFieldList,
|
|
8680
|
+
fallbackFields: opts.fallbackFields
|
|
8681
|
+
});
|
|
8682
|
+
if (role === FIELD_TYPE.PRODUCT) {
|
|
8683
|
+
if (!("prevProduct" in opts) || fillingProduct) return {};
|
|
8684
|
+
const values = {};
|
|
8685
|
+
if (shouldClearLotOnProductChange({
|
|
8686
|
+
prevProduct: opts.prevProduct,
|
|
8687
|
+
nextProduct: opts.nextValue,
|
|
8688
|
+
lotValue: keys.materialNoKey ? formData[keys.materialNoKey] : void 0
|
|
8689
|
+
})) {
|
|
8690
|
+
Object.assign(values, clearedLotFields(keys.materialNoKey));
|
|
8691
|
+
}
|
|
8692
|
+
if (keys.bomEntryIdKey) {
|
|
8693
|
+
values[keys.bomEntryIdKey] = null;
|
|
8694
|
+
if (!isBlank(opts.nextValue) && opts.formInstBom) {
|
|
8695
|
+
const entry = resolveObjectBomEntry({
|
|
8696
|
+
formInstBom: opts.formInstBom,
|
|
8697
|
+
belongingObject,
|
|
8698
|
+
productId: String(opts.nextValue)
|
|
8699
|
+
});
|
|
8700
|
+
if (entry) values[keys.bomEntryIdKey] = entry.id_;
|
|
8701
|
+
}
|
|
8702
|
+
}
|
|
8703
|
+
opts.rowWriter.patchRow(values, "autofill");
|
|
8704
|
+
const lotValue = keys.materialNoKey ? formData[keys.materialNoKey] : void 0;
|
|
8705
|
+
if (!isBlank(opts.nextValue) && !isBlank(lotValue)) {
|
|
8706
|
+
try {
|
|
8707
|
+
await validateReinspectionDate({
|
|
8708
|
+
product_id_: String(opts.nextValue),
|
|
8709
|
+
material_no_: lotValue,
|
|
8710
|
+
material_no_id_: keys.materialNoKey ? formData[`${keys.materialNoKey}_id_`] : void 0
|
|
8711
|
+
});
|
|
8712
|
+
} catch (e) {
|
|
8713
|
+
return { abortReinspection: e?.message || String(e) };
|
|
8714
|
+
}
|
|
8715
|
+
}
|
|
8716
|
+
return {};
|
|
8717
|
+
}
|
|
8718
|
+
if (role === FIELD_TYPE.MATERIAL_NO) {
|
|
8719
|
+
if (opts.option?.is_locked_) {
|
|
8720
|
+
opts.rowWriter.patchRow(clearedLotFields(keys.materialNoKey), "autofill");
|
|
8721
|
+
return { abortLocked: opts.option.id_ };
|
|
8722
|
+
}
|
|
8723
|
+
const params = resolveLotValidateParams(keys, formData, opts.option);
|
|
8724
|
+
if (isBlank(params.material_no_) && isBlank(params.material_no_id_)) return {};
|
|
8725
|
+
try {
|
|
8726
|
+
await validateReinspectionDate(params);
|
|
8727
|
+
} catch (e) {
|
|
8728
|
+
opts.rowWriter.patchRow(clearedLotFields(keys.materialNoKey), "async");
|
|
8729
|
+
return { abortReinspection: e?.message || String(e) };
|
|
8730
|
+
}
|
|
8731
|
+
const values = {};
|
|
8732
|
+
const productId = opts.option?.product_id_ ?? opts.option?._item?.product_id_;
|
|
8733
|
+
if (keys.productKey && !isBlank(productId)) values[keys.productKey] = productId;
|
|
8734
|
+
if (keys.bomEntryIdKey && opts.formInstBom) {
|
|
8735
|
+
if (!isBlank(productId)) {
|
|
8736
|
+
const entry = resolveObjectBomEntry({
|
|
8737
|
+
formInstBom: opts.formInstBom,
|
|
8738
|
+
belongingObject,
|
|
8739
|
+
productId: String(productId)
|
|
8740
|
+
});
|
|
8741
|
+
if (entry) values[keys.bomEntryIdKey] = entry.id_;
|
|
8742
|
+
}
|
|
8743
|
+
}
|
|
8744
|
+
const patchRelatedFields = () => opts.rowWriter.patchRow(values, "autofill");
|
|
8745
|
+
if (keys.productKey && !isBlank(productId)) {
|
|
8746
|
+
runWithFillProduct(patchRelatedFields);
|
|
8747
|
+
} else {
|
|
8748
|
+
patchRelatedFields();
|
|
8749
|
+
}
|
|
8750
|
+
return {};
|
|
8751
|
+
}
|
|
8752
|
+
return {};
|
|
8753
|
+
}
|
|
8754
|
+
class MBRender {
|
|
8755
|
+
// 多 Sheet / 同屏场景用 ownerId 隔离实例;基类仅声明宿主需要实现的能力。
|
|
8756
|
+
async openConsumeModal(_ownerId, _data) {
|
|
8757
|
+
throw new Error("Function openConsumeModal not implemented.");
|
|
8758
|
+
}
|
|
8759
|
+
destoryConsumeModal(_ownerId) {
|
|
8760
|
+
throw new Error("Function destoryConsumeModal not implemented.");
|
|
8761
|
+
}
|
|
8762
|
+
}
|
|
7951
8763
|
const _hoisted_1$5 = ["data-merge", "data-fill-direction"];
|
|
7952
8764
|
const _hoisted_2$1 = {
|
|
7953
8765
|
key: 0,
|
|
@@ -8268,6 +9080,7 @@ const DocumentSubTable = /* @__PURE__ */ defineComponent({
|
|
|
8268
9080
|
showDisplayStatus,
|
|
8269
9081
|
dataRelationShip
|
|
8270
9082
|
} = useWidgetStaticAttrs(props.widget);
|
|
9083
|
+
const isMockMaterialConsume = computed(() => !!dataRelationShip?.isMockReport && !!props.widget.props.isMaterialConsumeTable);
|
|
8271
9084
|
const sheetId = () => fields.value?.findWidgetById(props.widget.id)?.sheetId;
|
|
8272
9085
|
const subTableCore = props.subTableCore;
|
|
8273
9086
|
provide(NCB_PROVIDE.SUB_TABLE_CORE, subTableCore);
|
|
@@ -8363,6 +9176,7 @@ const DocumentSubTable = /* @__PURE__ */ defineComponent({
|
|
|
8363
9176
|
const newRowsData = actionType === "copyRow" ? [cloneDeep(rowData)] : Array.from({
|
|
8364
9177
|
length: rowNum
|
|
8365
9178
|
}, (_, index2) => transformUtils.addSubTableRowItem({
|
|
9179
|
+
defaultValueOrigins: instance.value?.defaultValueValidation?.defaults,
|
|
8366
9180
|
defaultData: currentFieldDefaultData.value,
|
|
8367
9181
|
quickFillData: quickFillDatas?.[index2],
|
|
8368
9182
|
subFieldId: field,
|
|
@@ -8408,6 +9222,9 @@ const DocumentSubTable = /* @__PURE__ */ defineComponent({
|
|
|
8408
9222
|
key,
|
|
8409
9223
|
actionValue
|
|
8410
9224
|
}) => {
|
|
9225
|
+
if (isMockMaterialConsume.value && (key === SubTableActionEnum.SCAN || key === SubTableActionEnum.Insert1GroupAfter)) {
|
|
9226
|
+
return;
|
|
9227
|
+
}
|
|
8411
9228
|
switch (key) {
|
|
8412
9229
|
case "insertRowBefore":
|
|
8413
9230
|
handleAddRow({
|
|
@@ -8501,10 +9318,11 @@ const DocumentSubTable = /* @__PURE__ */ defineComponent({
|
|
|
8501
9318
|
showRowWatermark,
|
|
8502
9319
|
rowGroupKey
|
|
8503
9320
|
}) => {
|
|
8504
|
-
const
|
|
9321
|
+
const baseMenus = subTableCore?.calcSubTableActionMenu({
|
|
8505
9322
|
rowData,
|
|
8506
9323
|
showDelBtn
|
|
8507
9324
|
});
|
|
9325
|
+
const menus = isMockMaterialConsume.value ? [getMenuByAction(SubTableActionEnum.SCAN), getMenuByAction(SubTableActionEnum.Insert1GroupAfter), ...baseMenus ?? []] : baseMenus;
|
|
8508
9326
|
const annRowDetails = dataRelationShip?.annRowDetails;
|
|
8509
9327
|
const rowMark = dataIdx !== -1 && annRowDetails?.length ? resolveRowFormChangeMark(field, rowData, annRowDetails) : null;
|
|
8510
9328
|
const rowUi = resolveFormChangeRowUi(rowData, rowMark);
|
|
@@ -8764,8 +9582,6 @@ function waitDomStable(el, idle = 100, timeout = 2e3) {
|
|
|
8764
9582
|
var MaterialConsumeActionType = /* @__PURE__ */ ((MaterialConsumeActionType2) => {
|
|
8765
9583
|
MaterialConsumeActionType2["CONFIRM"] = "CONFIRM";
|
|
8766
9584
|
MaterialConsumeActionType2["SCAN"] = "SCAN";
|
|
8767
|
-
MaterialConsumeActionType2["VIEW_BOM"] = "VIEW_BOM";
|
|
8768
|
-
MaterialConsumeActionType2["CHANGE_PARSE_RULE"] = "CHANGE_PARSE_RULE";
|
|
8769
9585
|
return MaterialConsumeActionType2;
|
|
8770
9586
|
})(MaterialConsumeActionType || {});
|
|
8771
9587
|
const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
|
|
@@ -8916,6 +9732,7 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
|
|
|
8916
9732
|
length: rowNum
|
|
8917
9733
|
}, (_, i) => {
|
|
8918
9734
|
const row = transformUtils.addSubTableRowItem({
|
|
9735
|
+
defaultValueOrigins: instance.value?.defaultValueValidation?.defaults,
|
|
8919
9736
|
defaultData: currentFieldDefaultData.value,
|
|
8920
9737
|
quickFillData: quickFillDatas?.[i],
|
|
8921
9738
|
subFieldId: field,
|
|
@@ -9006,6 +9823,7 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
|
|
|
9006
9823
|
}));
|
|
9007
9824
|
};
|
|
9008
9825
|
const handleAction = (action, rowData) => {
|
|
9826
|
+
if (!tableController.hasFormInstance) return;
|
|
9009
9827
|
switch (action) {
|
|
9010
9828
|
case MaterialConsumeActionType.CONFIRM:
|
|
9011
9829
|
tableController.confirm(rowData);
|
|
@@ -9015,12 +9833,6 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
|
|
|
9015
9833
|
title: props.widget.props.tableTitle
|
|
9016
9834
|
});
|
|
9017
9835
|
break;
|
|
9018
|
-
case MaterialConsumeActionType.VIEW_BOM:
|
|
9019
|
-
tableController.openBomModal();
|
|
9020
|
-
break;
|
|
9021
|
-
case MaterialConsumeActionType.CHANGE_PARSE_RULE:
|
|
9022
|
-
tableController.changeScanRule();
|
|
9023
|
-
break;
|
|
9024
9836
|
}
|
|
9025
9837
|
};
|
|
9026
9838
|
const getNewTdInfo = (tdInfo, rowData, rowIndex) => {
|
|
@@ -9078,6 +9890,7 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
|
|
|
9078
9890
|
key,
|
|
9079
9891
|
actionValue
|
|
9080
9892
|
}) => {
|
|
9893
|
+
if (!tableController.hasFormInstance) return;
|
|
9081
9894
|
switch (key) {
|
|
9082
9895
|
case "rowEdit":
|
|
9083
9896
|
await tableController.editRow(rowData);
|
|
@@ -9197,10 +10010,6 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
|
|
|
9197
10010
|
label: "业务操作"
|
|
9198
10011
|
},
|
|
9199
10012
|
showScanBtn ? getMenuByAction(SubTableActionEnum.SCAN) : void 0,
|
|
9200
|
-
// tableController.actualBomEntries?.length
|
|
9201
|
-
// ? getMenuByAction(SubTableActionEnum.VIEW_BOM)
|
|
9202
|
-
// : undefined,
|
|
9203
|
-
// getMenuByAction(SubTableActionEnum.CHANGE_PARSE_RULE),
|
|
9204
10013
|
{
|
|
9205
10014
|
type: SubTableActionMenuTypeEnum.DIVIDER
|
|
9206
10015
|
},
|
|
@@ -9448,7 +10257,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9448
10257
|
createElementVNode("i", { class: "iconfont icon-zhuyi" }),
|
|
9449
10258
|
createElementVNode("ul", { class: "tips-list" }, [
|
|
9450
10259
|
createElementVNode("li", null, "可将Excel内容粘贴到表格中,支持使用复制、粘贴、删除快捷键"),
|
|
9451
|
-
createElementVNode("li", null, "
|
|
10260
|
+
createElementVNode("li", null, " 表单中支持快速填报的字段类型:文本、长文本、整数、长整数、小数、精度小数、日期、时间、日期时间、批次/SN、报废物料批次、枚举单选、枚举多选(选项间以“,”分割) ")
|
|
9452
10261
|
])
|
|
9453
10262
|
], -1)),
|
|
9454
10263
|
createElementVNode("div", {
|
|
@@ -9473,7 +10282,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9473
10282
|
};
|
|
9474
10283
|
}
|
|
9475
10284
|
});
|
|
9476
|
-
const FixedQuickFillModal = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
10285
|
+
const FixedQuickFillModal = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-58540cb3"]]);
|
|
9477
10286
|
const _hoisted_1$1 = {
|
|
9478
10287
|
key: 1,
|
|
9479
10288
|
class: "sub-table-action__subtitle"
|
|
@@ -9486,7 +10295,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
9486
10295
|
showInsertMultiple: { type: Boolean, default: false },
|
|
9487
10296
|
showEditBtn: { type: Boolean, default: false },
|
|
9488
10297
|
isMaterialConsume: { type: Boolean, default: false },
|
|
9489
|
-
showBom: { type: Boolean, default: false },
|
|
9490
10298
|
showScanBtn: { type: Boolean, default: false },
|
|
9491
10299
|
showConfirmBtn: { type: Boolean, default: false },
|
|
9492
10300
|
noPopover: { type: Boolean, default: false },
|
|
@@ -9510,19 +10318,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
9510
10318
|
label: "条码扫描",
|
|
9511
10319
|
icon: "size24 icon-saoma1"
|
|
9512
10320
|
},
|
|
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
10321
|
{
|
|
9527
10322
|
type: "divider"
|
|
9528
10323
|
},
|
|
@@ -9749,7 +10544,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
9749
10544
|
};
|
|
9750
10545
|
}
|
|
9751
10546
|
});
|
|
9752
|
-
const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
10547
|
+
const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-7047f1a3"]]);
|
|
9753
10548
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
9754
10549
|
__name: "fixed-table-action",
|
|
9755
10550
|
props: {
|
|
@@ -10175,7 +10970,7 @@ const DocumentPaper = /* @__PURE__ */ defineComponent({
|
|
|
10175
10970
|
}) : null,
|
|
10176
10971
|
// 在[固定表]顶部的可见单元格上加装操作按钮
|
|
10177
10972
|
tableAction: (() => {
|
|
10178
|
-
const fixedTableActionVisible = fixedTableInfo?.quickFillVisible && !filledFixedTableKeys.value.includes(fixedTableInfo.subFieldKey);
|
|
10973
|
+
const fixedTableActionVisible = props.basicInfo.renderModeType !== RenderModeEnum.ViewMode && fixedTableInfo?.quickFillVisible && !filledFixedTableKeys.value.includes(fixedTableInfo.subFieldKey);
|
|
10179
10974
|
return () => fixedTableActionVisible ? createVNode(_sfc_main$2, {
|
|
10180
10975
|
"tdId": tdId,
|
|
10181
10976
|
"formState": formState.value,
|
|
@@ -10246,7 +11041,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
10246
11041
|
createElementVNode("i", { class: "iconfont icon-zhuyi" }),
|
|
10247
11042
|
createElementVNode("ul", { class: "tips-list" }, [
|
|
10248
11043
|
createElementVNode("li", null, "可将Excel内容粘贴到表格中,支持使用复制、粘贴、删除快捷键"),
|
|
10249
|
-
createElementVNode("li", null, "
|
|
11044
|
+
createElementVNode("li", null, "表单中支持快速填报的字段类型:文本、长文本、整数、长整数、小数、精度小数、日期、时间、日期时间、批次/SN、报废物料批次、枚举单选、枚举多选(选项间以“,”分割)"),
|
|
10250
11045
|
createElementVNode("li", null, "当前快速填报最多支持200行")
|
|
10251
11046
|
])
|
|
10252
11047
|
], -1)),
|
|
@@ -10266,7 +11061,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
10266
11061
|
};
|
|
10267
11062
|
}
|
|
10268
11063
|
});
|
|
10269
|
-
const DynamicQuickFillModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
11064
|
+
const DynamicQuickFillModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-840aca0a"]]);
|
|
10270
11065
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10271
11066
|
__name: "dynamic-table-action",
|
|
10272
11067
|
props: {
|
|
@@ -10279,7 +11074,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10279
11074
|
showInsertMultiple: { type: Boolean, default: true },
|
|
10280
11075
|
showEditBtn: { type: Boolean },
|
|
10281
11076
|
isMaterialConsume: { type: Boolean },
|
|
10282
|
-
showBom: { type: Boolean },
|
|
10283
11077
|
showScanBtn: { type: Boolean },
|
|
10284
11078
|
showConfirmBtn: { type: Boolean },
|
|
10285
11079
|
noPopover: { type: Boolean },
|
|
@@ -10336,7 +11130,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10336
11130
|
showDelBtn: __props.showDelBtn,
|
|
10337
11131
|
showQuickFillBtn: __props.showQuickFillBtn,
|
|
10338
11132
|
noPopover: __props.noPopover,
|
|
10339
|
-
showBom: __props.showBom,
|
|
10340
11133
|
showConfirmBtn: __props.showConfirmBtn,
|
|
10341
11134
|
showEditBtn: __props.showEditBtn,
|
|
10342
11135
|
showInsertMultiple: __props.showInsertMultiple,
|
|
@@ -10344,118 +11137,141 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10344
11137
|
isMaterialConsume: __props.isMaterialConsume,
|
|
10345
11138
|
menus: __props.menus,
|
|
10346
11139
|
onMenuClick
|
|
10347
|
-
}, null, 8, ["showDelBtn", "showQuickFillBtn", "noPopover", "
|
|
11140
|
+
}, null, 8, ["showDelBtn", "showQuickFillBtn", "noPopover", "showConfirmBtn", "showEditBtn", "showInsertMultiple", "showScanBtn", "isMaterialConsume", "menus"]);
|
|
10348
11141
|
};
|
|
10349
11142
|
}
|
|
10350
11143
|
});
|
|
10351
|
-
const DynamicTableAction = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
11144
|
+
const DynamicTableAction = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8710052f"]]);
|
|
10352
11145
|
export {
|
|
10353
|
-
|
|
10354
|
-
|
|
11146
|
+
RequiredQtyCalcRule as $,
|
|
11147
|
+
validateObjectBomForScan as A,
|
|
10355
11148
|
BorderTD as B,
|
|
10356
|
-
|
|
11149
|
+
resolveObjectBomEntry as C,
|
|
10357
11150
|
DEFAULT_BOOLEAN_FIELD_WIDTH as D,
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
11151
|
+
runWithFillProduct as E,
|
|
11152
|
+
FormModelController as F,
|
|
11153
|
+
useNocodeFormWidget as G,
|
|
11154
|
+
applyConsumeObjectTraceChange as H,
|
|
11155
|
+
getObjectBomProductQuery as I,
|
|
11156
|
+
EMPTY_PRODUCT_VERSION_ID as J,
|
|
11157
|
+
normalizeHistoricalAutofillRow as K,
|
|
11158
|
+
readSealValue as L,
|
|
10366
11159
|
MAX_RUNTIME_SHEETS as M,
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
|
|
11160
|
+
isSealStamped as N,
|
|
11161
|
+
stampSealValue as O,
|
|
11162
|
+
isValidSealValue as P,
|
|
11163
|
+
clearSealValue as Q,
|
|
11164
|
+
NCB_PROVIDE as R,
|
|
11165
|
+
calculateFormula as S,
|
|
11166
|
+
useStyles as T,
|
|
11167
|
+
useDependency as U,
|
|
11168
|
+
useFieldPresentation as V,
|
|
11169
|
+
useRuntimeEditorFlusher as W,
|
|
11170
|
+
RuntimeFormStateStore as X,
|
|
11171
|
+
createRuntimeInstanceContext as Y,
|
|
11172
|
+
RuntimeInstanceRegistry as Z,
|
|
11173
|
+
ScanParamType as _,
|
|
10381
11174
|
MAX_RUNTIME_SHEET_TITLE_LENGTH as a,
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
11175
|
+
getMenuByAction as a$,
|
|
11176
|
+
MBRender as a0,
|
|
11177
|
+
MCRender as a1,
|
|
11178
|
+
moveSealValue as a2,
|
|
11179
|
+
DocumentPaper as a3,
|
|
11180
|
+
DynamicTableAction as a4,
|
|
11181
|
+
_sfc_main$5 as a5,
|
|
11182
|
+
resolveRuntimeFieldProps as a6,
|
|
11183
|
+
resolveRuntimeFieldState as a7,
|
|
11184
|
+
assembleRules as a8,
|
|
11185
|
+
getRuntimeDependencyOutputKey as a9,
|
|
11186
|
+
RuntimeDependencyService as aA,
|
|
11187
|
+
RuntimeFieldRegistry as aB,
|
|
11188
|
+
RuntimeInstanceEventBus as aC,
|
|
11189
|
+
RuntimePersistenceCoordinator as aD,
|
|
11190
|
+
RuntimeValidationService as aE,
|
|
11191
|
+
SubTableCore as aF,
|
|
11192
|
+
buildFormChangeDisplayRows as aG,
|
|
11193
|
+
convertV1Runtime as aH,
|
|
11194
|
+
detailsHaveFormChangeRowOps as aI,
|
|
11195
|
+
extractFormChangeRowDetails as aJ,
|
|
11196
|
+
getFormChangeRowKey as aK,
|
|
11197
|
+
getFormChangeRowOp as aL,
|
|
11198
|
+
getSubTableQuickFillInfo as aM,
|
|
11199
|
+
isAnnLocationSelected as aN,
|
|
11200
|
+
isBlank as aO,
|
|
11201
|
+
isFormChangeGhostRow as aP,
|
|
11202
|
+
normalizeHistoricalFieldConfig as aQ,
|
|
11203
|
+
pickObjectFieldKeys as aR,
|
|
11204
|
+
recordSubtableRowAdd as aS,
|
|
11205
|
+
recordSubtableRowDelete as aT,
|
|
11206
|
+
relocateDeletedRowsToEnd as aU,
|
|
11207
|
+
resolveAnnotationFieldLocation as aV,
|
|
11208
|
+
resolveFormChangeRowUi as aW,
|
|
11209
|
+
resolveRowFormChangeMark as aX,
|
|
11210
|
+
setSelectMobileTdId as aY,
|
|
11211
|
+
stripLegacyFormConfigFromPaper as aZ,
|
|
11212
|
+
SubTableActionMenuTypeEnum as a_,
|
|
11213
|
+
isRowAddedInCurrentFormChange as aa,
|
|
11214
|
+
resolveFormulaData as ab,
|
|
11215
|
+
MaterialConsumeTableController as ac,
|
|
11216
|
+
setFormulaParamsConfig as ad,
|
|
11217
|
+
normalizeRuntime as ae,
|
|
11218
|
+
initializeSealFields as af,
|
|
11219
|
+
RuntimeSheetService as ag,
|
|
11220
|
+
validateObjectBomQtyOnSubmit as ah,
|
|
11221
|
+
areValidationCommentsEqual as ai,
|
|
11222
|
+
closeValidatorPopovers as aj,
|
|
11223
|
+
enrichFormChangeRowDetails as ak,
|
|
11224
|
+
useMaterialBalance as al,
|
|
11225
|
+
collectFormChangeFieldLocations as am,
|
|
11226
|
+
nextFormChangeRowViewHistoryId as an,
|
|
11227
|
+
BaseFormModelFetcher as ao,
|
|
11228
|
+
DeviceConnector as ap,
|
|
11229
|
+
DocumentLoading as aq,
|
|
11230
|
+
DynamicQuickFillModal as ar,
|
|
11231
|
+
FixedQuickFillModal as as,
|
|
11232
|
+
FormTmplConfigController as at,
|
|
11233
|
+
LEGACY_RUNTIME_FORM_CONFIG_KEYS as au,
|
|
11234
|
+
LEGACY_RUNTIME_SHEET_ID as av,
|
|
11235
|
+
LEGACY_RUNTIME_SHEET_TITLE as aw,
|
|
11236
|
+
MCDataUtil as ax,
|
|
11237
|
+
OCR_MODEL_PRECISION_ENUM_KEY as ay,
|
|
11238
|
+
RuntimeAsyncTaskCoordinator as az,
|
|
10436
11239
|
bindFormulaCacheInvalidation as b,
|
|
11240
|
+
SubTableActionEnum as b0,
|
|
11241
|
+
resolveScanFillData as b1,
|
|
11242
|
+
buildDefaultMapFromProfile as b2,
|
|
11243
|
+
buildFieldStatusFromProfile as b3,
|
|
11244
|
+
getRowHandlersForFieldChange as b4,
|
|
11245
|
+
getInsertSubMenu as b5,
|
|
11246
|
+
resolveScanAdjustType as b6,
|
|
11247
|
+
resolveScanQty as b7,
|
|
11248
|
+
toDateOnly as b8,
|
|
11249
|
+
hasSubtableBusinessData as b9,
|
|
11250
|
+
getCopySubMenu as ba,
|
|
11251
|
+
resolveScanParsedValue as bb,
|
|
11252
|
+
isProductBatchEmptyRow as bc,
|
|
10437
11253
|
currentParamsConfig as c,
|
|
10438
11254
|
MULTI_SHEET_SCHEMA_VERSION as d,
|
|
10439
11255
|
createRuntimeDocumentV2 as e,
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
11256
|
+
clampSealPosition as f,
|
|
11257
|
+
getParseFormulaVarInfos as g,
|
|
11258
|
+
normalizeSealDiameter as h,
|
|
11259
|
+
normalizeFieldWidth as i,
|
|
11260
|
+
isCellAutoLineBreak as j,
|
|
11261
|
+
useFormTmplConfig as k,
|
|
11262
|
+
findFieldProfile as l,
|
|
11263
|
+
normalizeHistoricalBusinessRow as m,
|
|
11264
|
+
normalizeGridColumnWidth as n,
|
|
11265
|
+
DeviceLinkTmplUtil as o,
|
|
11266
|
+
normalizeAIOcrTmpl as p,
|
|
11267
|
+
useWidgetStaticAttrs as q,
|
|
11268
|
+
useRuntimeInstanceServices as r,
|
|
10453
11269
|
setSelectValidatorId as s,
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
11270
|
+
setSelectAnnotationId as t,
|
|
11271
|
+
useFormModel as u,
|
|
11272
|
+
useRuntimeRowState as v,
|
|
11273
|
+
getObjectBomMaterialLotQuery as w,
|
|
11274
|
+
buildObjectLotExtraQuery as x,
|
|
11275
|
+
resolveObjectFieldKeys as y,
|
|
11276
|
+
MaterialConsumptionPatternEnum as z
|
|
10461
11277
|
};
|