@gct-paas/excel 0.1.37-beta.2 → 0.1.38
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/dist/{BaseComponent-DN5v-Q_h.js → BaseComponent-5QpH6Rui.js} +2 -20
- package/dist/{VueVideoPlayer-C49th9G_.js → VueVideoPlayer-DZh8_F3v.js} +2 -2
- package/dist/{align-editor-CpscpDxA.js → align-editor-BTvIuOVN.js} +1 -1
- package/dist/{barcode-design-B7AoHzux.js → barcode-design-Blhh1Fsh.js} +2 -3
- package/dist/base/index.es.js +2799 -2279
- package/dist/{diagonal-design-CeYHDi2e.js → diagonal-design-DZ6ePuEf.js} +2 -3
- package/dist/{dynamic-table-action-zR6VwiFi.js → dynamic-table-action-Ckc4yetB.js} +3015 -7111
- package/dist/{dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-BDkKB_4N.js → dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-CGpmtwPb.js} +24570 -23749
- package/dist/{edit.utils-CXmmCnxE-evcsspEJ.js → edit.utils-CXmmCnxE-DDvf_1B1.js} +1 -1
- package/dist/excel.css +1204 -2454
- package/dist/{exceljs.min-DYYU4xe-.js → exceljs.min-Co96ZEAw.js} +2 -2
- package/dist/{font-editor-hpUeXFv_.js → font-editor-CVRIStrS.js} +3 -3
- package/dist/{image-design-BnDK5Jwf.js → image-design-kQ2vbtwc.js} +2 -2
- package/dist/{index-BcfmxYW-.js → index-B5HIN-qO.js} +2 -3
- package/dist/{index-DPiPri6e.js → index-B9sZfT3j.js} +2 -3
- package/dist/{index-CRj08TWu.js → index-BJyfzYBO.js} +2 -3
- package/dist/{index-D3t6B-9k.js → index-BNiGRPzJ.js} +1 -2
- package/dist/{index-BWvyGnI_.js → index-BPKmoc5N.js} +2 -3
- package/dist/{index-sQI9wXhV.js → index-BWEQIjQE.js} +1 -2
- package/dist/{index-Dfs0gE3N.js → index-BaCxUMCF.js} +2 -3
- package/dist/{index-3n5gOxbD.js → index-Bk8MpwGt.js} +2 -3
- package/dist/{index-B8tTsX2y.js → index-BqI7r_XC.js} +2 -3
- package/dist/{index-D1C_tY7a.js → index-C1DOk9t-.js} +1 -2
- package/dist/{index-BEyidTCC.js → index-C3HGy13G.js} +1 -2
- package/dist/{index-CLyowrpG.js → index-C4tkNDTa.js} +2 -3
- package/dist/{index-DP1WApp-.js → index-C5ESFU7b.js} +1 -2
- package/dist/{index-BY7_uLSS.js → index-C91SfhAb.js} +1 -2
- package/dist/{index-CZv8lo_f.js → index-CPlxRgll.js} +2 -3
- package/dist/{index-DX1Nqubf.js → index-CjA2dLPh.js} +2 -3
- package/dist/{index-YuHHwSzv.js → index-ClnlX2jZ.js} +1 -2
- package/dist/{index-BezxcVwZ.js → index-CnTC_LFJ.js} +2 -3
- package/dist/{index-CUhlQ0aK.js → index-CxpwR4N2.js} +3 -4
- package/dist/{index-BaC0Py3z.js → index-D3Wgt5Z0.js} +6849 -12289
- package/dist/{index-CXBwY7ba.js → index-DCMnBDPA.js} +237 -432
- package/dist/{index-HNE-yLqK.js → index-DF5irDE9.js} +2 -3
- package/dist/{index-CUhR3L97.js → index-DJEG4gZW.js} +3 -4
- package/dist/{index-B9q2iVJw.js → index-DPql9xNw.js} +3 -4
- package/dist/{index-BboAW45l.js → index-DbDB5bsa.js} +3 -4
- package/dist/{index-D6T0GkNc.js → index-Def-kZ_X.js} +3 -4
- package/dist/{index-557u9lSs.js → index-Dg6nmj-a.js} +74 -9
- package/dist/{index-Crs2UUiJ.js → index-DqDGmouR.js} +2 -3
- package/dist/{index-D9pfqRAP.js → index-DvlAMJkQ.js} +3 -6
- package/dist/{index-DULgJ5M_.js → index-Dxh55nQw.js} +1 -2
- package/dist/{index-CA25B2UR.js → index-Dzydpwhf.js} +2 -3
- package/dist/{index-DKAk8Fzf.js → index-SV0mQReN.js} +2 -14
- package/dist/{index-Bxgg0txy.js → index-YlVy61FH.js} +1 -2
- package/dist/{index-tRVTXeIS.js → index-avQcYIlZ.js} +2 -3
- package/dist/index.es.js +49 -51
- package/dist/{mb-render-jAsNtPqY.js → mb-render-BtXKf12F.js} +15 -21
- package/dist/{online-form-model-select.vue_vue_type_script_setup_true_name_online-form-model-select_lang-Cxs9ZecX.js → online-form-model-select.vue_vue_type_script_setup_true_name_online-form-model-select_lang-C-9AZcTz.js} +8 -2
- package/dist/{pagination-design-lgUGQHWo.js → pagination-design-DyxVdL8V.js} +2 -3
- package/dist/paper-widget-design-Czt7pMDo.js +4 -0
- package/dist/{qrcode-design-DCgtf75a.js → qrcode-design-eMDgLDg2.js} +1 -1
- package/dist/{revo-grid.entry-Bygattd8.js → revo-grid.entry-h26i-X1O.js} +1 -1
- package/dist/{revogr-attribution_7.entry-BqzhD1hP.js → revogr-attribution_7.entry-DnWhGt3I.js} +3 -3
- package/dist/{revogr-clipboard_3.entry-Wr7KhnJ_.js → revogr-clipboard_3.entry-DHP6m3aV.js} +2 -2
- package/dist/{revogr-data_4.entry-CrFW39f1.js → revogr-data_4.entry-CBEPKC2v.js} +2 -2
- package/dist/{revogr-filter-panel.entry-9khS41SL.js → revogr-filter-panel.entry-DpaMxMlv.js} +1 -1
- package/dist/{serialnumber-design-eXgfrjw9.js → serialnumber-design-KRWMAGLy.js} +1 -1
- package/dist/shared/index.es.js +26 -32
- package/dist/{single-field-drop-rKr_LXW8.js → single-field-drop-DarhKwZE.js} +2 -2
- package/dist/{size-editor-OEPrJU0W.js → size-editor-BqOSTI8R.js} +1 -1
- package/dist/src/adapter/adapter.d.ts +1 -6
- package/dist/src/assets/svgs/table/index.d.ts +0 -1
- package/dist/src/domain/field/types.d.ts +2 -2
- package/dist/src/domain/table/business/material/material-requisition/profile/field-keys.d.ts +1 -1
- package/dist/src/domain/table/design/create-subtable.d.ts +1 -1
- package/dist/src/domain/table/design/hooks/on-field-attach.d.ts +1 -1
- package/dist/src/domain/table/design/index.d.ts +1 -1
- package/dist/src/domain/table/design/ribbon-options.d.ts +0 -1
- package/dist/src/domain/table/design/sub-model-matcher.d.ts +0 -1
- package/dist/src/domain/table/index.d.ts +2 -3
- package/dist/src/domain/table/registry.d.ts +0 -1
- package/dist/src/domain/table/types.d.ts +3 -8
- package/dist/src/index.d.ts +0 -6
- package/dist/src/nocode-base/src/_utils_/uuid.d.ts +0 -8
- package/dist/src/nocode-base/src/components/document-layout.vue.d.ts +0 -3
- package/dist/src/nocode-base/src/components/document-sub-table-action/sub-table-action.vue.d.ts +3 -3
- package/dist/src/nocode-base/src/components/material-consume/material-consume-action.vue.d.ts +17 -0
- package/dist/src/nocode-base/src/constant/index.d.ts +2 -8
- package/dist/src/nocode-base/src/core/factory/sub-table-factory.d.ts +3 -11
- package/dist/src/nocode-base/src/core/sub-table/allocate-table-core.d.ts +1 -0
- package/dist/src/nocode-base/src/core/sub-table/pretreatment-list-table-core.d.ts +1 -0
- package/dist/src/nocode-base/src/core/sub-table/profile-driven-sub-table-core.d.ts +1 -23
- package/dist/src/nocode-base/src/core/sub-table/sterilize-batch-table-core.d.ts +1 -0
- package/dist/src/nocode-base/src/core/sub-table/stocktake-table-core.d.ts +1 -0
- package/dist/src/nocode-base/src/core/sub-table/sub-table-core.d.ts +5 -0
- package/dist/src/nocode-base/src/core/types/index.d.ts +0 -4
- package/dist/src/nocode-base/src/emit/enum.d.ts +12 -2
- package/dist/src/nocode-base/src/hooks/annotation/form-change-row.d.ts +5 -7
- package/dist/src/nocode-base/src/hooks/device-link/controller.d.ts +6 -0
- package/dist/src/nocode-base/src/hooks/form-tmpl-config/device-connector.d.ts +1 -1
- package/dist/src/nocode-base/src/hooks/index.d.ts +3 -5
- package/dist/src/nocode-base/src/hooks/material-balance/mb-render.d.ts +2 -2
- package/dist/src/nocode-base/src/hooks/material-balance/useMaterialBalance.d.ts +4 -4
- package/dist/src/nocode-base/src/hooks/material-consume/bom-validator.d.ts +2 -10
- package/dist/src/nocode-base/src/hooks/material-consume/material-consume-table-controller.d.ts +25 -13
- package/dist/src/nocode-base/src/hooks/material-consume/mc-render.d.ts +6 -5
- package/dist/src/nocode-base/src/hooks/material-consume/tmpl-bom-controller.d.ts +4 -8
- package/dist/src/nocode-base/src/hooks/material-consume-object/index.d.ts +1 -0
- package/dist/src/nocode-base/src/hooks/material-consume-object/product-lot-link.d.ts +0 -3
- package/dist/src/nocode-base/src/hooks/material-consume-object/use-tmpl-bom.d.ts +13 -0
- package/dist/src/nocode-base/src/hooks/useDependency.d.ts +1 -2
- package/dist/src/nocode-base/src/hooks/useFormHook.d.ts +4 -7
- package/dist/src/nocode-base/src/hooks/useFormulaExpWatcher.d.ts +15 -0
- package/dist/src/nocode-base/src/hooks/useMergeSameCells.d.ts +2 -3
- package/dist/src/nocode-base/src/hooks/useNocodeEmitter.d.ts +9 -1
- package/dist/src/nocode-base/src/hooks/useRenderData.d.ts +24 -8
- package/dist/src/nocode-base/src/hooks/useRenderPageFactory.d.ts +99 -102
- package/dist/src/nocode-base/src/hooks/useValidator.d.ts +18 -0
- package/dist/src/nocode-base/src/hooks/validation/attach.d.ts +10 -4
- package/dist/src/nocode-base/src/hooks/validation/createValidateFactory.d.ts +0 -1
- package/dist/src/nocode-base/src/hooks/validation/formRulesStore.d.ts +15 -0
- package/dist/src/nocode-base/src/hooks/validation/merge.d.ts +2 -3
- package/dist/src/nocode-base/src/hooks/validation/runValidation.d.ts +8 -5
- package/dist/src/nocode-base/src/hooks/validation/scheduler.d.ts +12 -0
- package/dist/src/nocode-base/src/hooks/validation/types.d.ts +8 -15
- package/dist/src/nocode-base/src/hooks/validation/useFormValidator.d.ts +41 -0
- package/dist/src/nocode-base/src/hooks/validation/utils.d.ts +0 -6
- package/dist/src/nocode-base/src/hooks/validation/waitForSettle.d.ts +17 -0
- package/dist/src/nocode-base/src/index.d.ts +0 -2
- package/dist/src/nocode-base/src/interface/calc.d.ts +1 -1
- package/dist/src/nocode-base/src/interface/check-ds-data.d.ts +3 -4
- package/dist/src/nocode-base/src/interface/code-runner.d.ts +0 -4
- package/dist/src/nocode-base/src/interface/render.d.ts +2 -5
- package/dist/src/nocode-base/src/interface/transform.d.ts +22 -26
- package/dist/src/nocode-base/src/types/business/index.d.ts +1 -8
- package/dist/src/nocode-base/src/types/calc/i-calc.d.ts +0 -3
- package/dist/src/nocode-base/src/types/common/base.d.ts +6 -62
- package/dist/src/nocode-base/src/types/fields/i-sign.d.ts +1 -1
- package/dist/src/nocode-base/src/types/fields/index.d.ts +0 -1
- package/dist/src/nocode-base/src/types/index.d.ts +1 -1
- package/dist/src/nocode-base/src/types/render/mb-render.d.ts +2 -4
- package/dist/src/nocode-base/src/types/render/mc-render.d.ts +2 -2
- package/dist/src/nocode-base/src/types/render/sub-table-render.d.ts +5 -3
- package/dist/src/nocode-base/src/types/widgets/i-paper.d.ts +35 -4
- package/dist/src/nocode-web-render/src/render/sub-table/common/sub-table-render.d.ts +1 -0
- package/dist/src/nocode-web-render/src/render/sub-table/material-balance/mb-web-render.d.ts +7 -4
- package/dist/src/nocode-web-render/src/render/sub-table/material-consume/mc-web-render.d.ts +6 -8
- package/dist/src/online-form/src/components/device/device-select.vue.d.ts +1 -1
- package/dist/src/online-form/src/components/version-diff/iframe/preview-iframe.vue.d.ts +0 -2
- package/dist/src/online-form/src/components/version-diff/index/types.d.ts +0 -3
- package/dist/src/online-form/src/components/version-diff/index/version-diff-index.vue.d.ts +0 -4
- package/dist/src/online-form/src/views/designer/constants/index.d.ts +1 -7
- package/dist/src/online-form/src/views/designer/enums/index.d.ts +1 -5
- package/dist/src/online-form/src/views/designer/hooks/reverse-modeling/scan-field.d.ts +0 -4
- package/dist/src/online-form/src/views/designer/hooks/reverse-modeling/utils.d.ts +0 -1
- package/dist/src/online-form/src/views/designer/hooks/useAllSpreadSheets.d.ts +678 -1208
- package/dist/src/online-form/src/views/designer/hooks/useModelFields.d.ts +1 -5
- package/dist/src/online-form/src/views/designer/hooks/useSpreadSheet.d.ts +2480 -503
- package/dist/src/online-form/src/views/designer/modules/panel/panel-data-init-config/common/add-ipaas/parameter-struct/json-expression-editor.vue.d.ts +1 -1
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/panel-rule-config.vue.d.ts +1 -18
- package/dist/src/online-form/src/views/designer/modules/panel/sub-table/comps/use-dynamic-sub-table-panel.d.ts +327 -209
- package/dist/src/online-form/src/views/designer/modules/sheets/sheets-swapper.vue.d.ts +2 -0
- package/dist/src/online-form/src/views/designer/types/index.d.ts +26 -48
- package/dist/src/online-form/src/views/designer/utils/dom-parser.d.ts +3 -8
- package/dist/src/online-form/src/views/designer/utils/xlsx-parser.d.ts +108 -11
- package/dist/src/online-form/src/views/render/__components__/_common_/useAutofill.d.ts +4 -2
- package/dist/src/online-form/src/views/render/__components__/_field_/_base_/cell/cell-media.vue.d.ts +1 -1
- package/dist/src/online-form/src/views/render/__components__/_field_/trace/composables/useSelectTable.d.ts +2 -2
- package/dist/src/online-form/src/views/render/__components__/_field_/trace/utils/use-rule-props.d.ts +1 -2
- package/dist/src/online-form/src/views/render/__components__/_widget_/combine-fields/index.d.ts +0 -1
- package/dist/src/online-form/src/views/render/__components__/paper/index.d.ts +1 -2
- package/dist/src/online-form/src/views/render/__logic__/dataCenter.logic.d.ts +1 -1
- package/dist/src/online-form/src/views/render/preview-container.vue.d.ts +19 -21
- package/dist/src/shared/components/Scrollbar/src/Scrollbar.vue.d.ts +8 -8
- package/dist/src/shared/components/Signature/index.d.ts +2 -1
- package/dist/src/shared/components/Signature/logic/index.d.ts +15 -2
- package/dist/src/shared/components/Signature/ui/sign-editor.vue.d.ts +29 -0
- package/dist/src/shared/components/Signature/ui/sign-popover-content.vue.d.ts +2 -4
- package/dist/src/shared/components/Signature/ui/sign-preview.vue.d.ts +18 -0
- package/dist/src/shared/components/Signature/ui/sign-switcher-modal.vue.d.ts +118 -0
- package/dist/src/shared/components/Signature/ui/sign-switcher.vue.d.ts +1 -1
- package/dist/src/shared/components/category-select/category-select.vue.d.ts +1 -1
- package/dist/src/shared/enum/field-type.d.ts +0 -23
- package/dist/src/shared/enum/online-form.d.ts +2 -8
- package/dist/src/shared/index.d.ts +0 -1
- package/dist/src/shared/types/field-meta.d.ts +0 -1
- package/dist/src/shared/utils/field-size.d.ts +2 -4
- package/dist/src/shared/utils/lot2sn.d.ts +0 -5
- package/dist/{text-design-Dd5uT-hc.js → text-design-C-EZZVRY.js} +2 -3
- package/dist/{throttle-Cpk1LoGk-DxTostCa.js → throttle-Cpk1LoGk-DadArQT5.js} +1 -1
- package/dist/{timediff-design-DhxYymPd.js → timediff-design-q-J7ObPi.js} +1 -2
- package/dist/{trace-like-wrapper-CczUTJwp.js → trace-like-wrapper-Bt6sH9nJ.js} +2 -3
- package/dist/{value-editor.vue_vue_type_style_index_0_lang-BzAhq5rc.js → value-editor.vue_vue_type_style_index_0_lang-JFeO09Sn.js} +2 -3
- package/dist/web-render/index.es.js +5 -6
- package/dist/{widget-barcode-BrLmLnCd.js → widget-barcode-BJWcsF99.js} +4 -5
- package/dist/{widget-diagonal-CIg1Yn3D.js → widget-diagonal-DV6kaLwd.js} +3 -4
- package/dist/{widget-image-bPGudw8R.js → widget-image-ewHjWqqr.js} +5 -5
- package/dist/{widget-line-Dw1mkN0H.js → widget-line-BDvA6h3g.js} +2 -3
- package/dist/{widget-pagination-C2ylpEkR.js → widget-pagination-DY16bTxN.js} +5 -6
- package/dist/{widget-power-Ceni1m5s.js → widget-power-CviN2kwQ.js} +3 -4
- package/dist/{widget-qrcode-dHuN8ZTP.js → widget-qrcode-61PSq7lC.js} +3 -4
- package/dist/{widget-rangelimit-DkZwe6ix.js → widget-rangelimit-BTvirJ4W.js} +3 -3
- package/dist/{widget-serialnumber-Dz2_gK_C.js → widget-serialnumber-K9k_R7rl.js} +1 -1
- package/dist/{widget-text-BIMT_dmX.js → widget-text-vMW5bWn3.js} +5 -5
- package/dist/{widget-timediff-LoUQBpX7.js → widget-timediff-t_w2rNsB.js} +2 -3
- package/package.json +4 -4
- package/dist/index-Bfrtgjub.js +0 -27
- package/dist/paper-widget-design-B6GKQFw2.js +0 -4
- package/dist/print-runtime-instance-MxA8-bHV.js +0 -36
- package/dist/print-snapshot-renderer-D6sRzdVe.js +0 -76
- package/dist/seal-design-CJO9Kmm0.js +0 -4
- package/dist/src/domain/field/date/sterilization-date-manifest.d.ts +0 -2
- package/dist/src/domain/field/number/inspection-module-qty-manifest.d.ts +0 -2
- package/dist/src/domain/field/seal/seal-manifest.d.ts +0 -2
- package/dist/src/domain/field/select/inspection-container-manifest.d.ts +0 -2
- package/dist/src/domain/field/text/udi-manifest.d.ts +0 -2
- package/dist/src/domain/table/business/device/maintenance/index.d.ts +0 -1
- package/dist/src/domain/table/business/device/maintenance/profile/field-keys.d.ts +0 -9
- package/dist/src/domain/table/business/device/maintenance/profile/fields.d.ts +0 -2
- package/dist/src/domain/table/business/device/maintenance/profile/index.d.ts +0 -3
- package/dist/src/domain/table/business/device/point-inspection/index.d.ts +0 -1
- package/dist/src/domain/table/business/device/point-inspection/profile/field-keys.d.ts +0 -9
- package/dist/src/domain/table/business/device/point-inspection/profile/fields.d.ts +0 -2
- package/dist/src/domain/table/business/device/point-inspection/profile/index.d.ts +0 -3
- package/dist/src/domain/table/business/device/signature-lock.d.ts +0 -9
- package/dist/src/domain/table/business/material/material-substitution/index.d.ts +0 -2
- package/dist/src/domain/table/business/material/material-substitution/profile/field-keys.d.ts +0 -75
- package/dist/src/domain/table/business/material/material-substitution/profile/fields.d.ts +0 -2
- package/dist/src/domain/table/business/material/material-substitution/profile/index.d.ts +0 -4
- package/dist/src/domain/table/business/material/material-substitution/runtime/register-handlers.d.ts +0 -1
- package/dist/src/domain/table/business/material/material-substitution/runtime/row-change-handlers.d.ts +0 -6
- package/dist/src/nocode-base/src/components/inspection-decision-prompt-modal.vue.d.ts +0 -7
- package/dist/src/nocode-base/src/hooks/annotation/runtime-annotation-binding.d.ts +0 -17
- package/dist/src/nocode-base/src/hooks/inspection-decision-rule/evaluator.d.ts +0 -11
- package/dist/src/nocode-base/src/hooks/render-page/initialize-runtime.d.ts +0 -56
- package/dist/src/nocode-base/src/hooks/render-page/runtime-data-sources.d.ts +0 -45
- package/dist/src/nocode-base/src/hooks/render-page/runtime-request.d.ts +0 -24
- package/dist/src/nocode-base/src/hooks/render-page/runtime-validation.d.ts +0 -17
- package/dist/src/nocode-base/src/hooks/render-page/types.d.ts +0 -67
- package/dist/src/nocode-base/src/hooks/udi.d.ts +0 -6
- package/dist/src/nocode-base/src/hooks/useCalcFunction.d.ts +0 -3
- package/dist/src/nocode-base/src/hooks/useFieldPresentation.d.ts +0 -4
- package/dist/src/nocode-base/src/hooks/useRuntimeInstanceServices.d.ts +0 -65
- package/dist/src/nocode-base/src/hooks/useRuntimeRowState.d.ts +0 -16
- package/dist/src/nocode-base/src/runtime/async-task-coordinator.d.ts +0 -66
- package/dist/src/nocode-base/src/runtime/conversions/business-row.d.ts +0 -2
- package/dist/src/nocode-base/src/runtime/conversions/field-config.d.ts +0 -4
- package/dist/src/nocode-base/src/runtime/conversions/historical-annotation.d.ts +0 -15
- package/dist/src/nocode-base/src/runtime/conversions/index.d.ts +0 -11
- package/dist/src/nocode-base/src/runtime/conversions/ocr-template.d.ts +0 -7
- package/dist/src/nocode-base/src/runtime/conversions/v1-runtime.d.ts +0 -21
- package/dist/src/nocode-base/src/runtime/date-compliance.d.ts +0 -8
- package/dist/src/nocode-base/src/runtime/field-identity.d.ts +0 -21
- package/dist/src/nocode-base/src/runtime/formula-utils.d.ts +0 -7
- package/dist/src/nocode-base/src/runtime/index.d.ts +0 -18
- package/dist/src/nocode-base/src/runtime/multi-sheet-runtime.d.ts +0 -43
- package/dist/src/nocode-base/src/runtime/runtime-console-debug.d.ts +0 -36
- package/dist/src/nocode-base/src/runtime/runtime-context.d.ts +0 -122
- package/dist/src/nocode-base/src/runtime/runtime-dependency-service.d.ts +0 -82
- package/dist/src/nocode-base/src/runtime/runtime-field-initializer.d.ts +0 -26
- package/dist/src/nocode-base/src/runtime/runtime-field-registry.d.ts +0 -90
- package/dist/src/nocode-base/src/runtime/runtime-field-rows.d.ts +0 -7
- package/dist/src/nocode-base/src/runtime/runtime-field-state.d.ts +0 -15
- package/dist/src/nocode-base/src/runtime/runtime-form-state-store.d.ts +0 -132
- package/dist/src/nocode-base/src/runtime/runtime-instance-controller.d.ts +0 -80
- package/dist/src/nocode-base/src/runtime/runtime-instance-event-bus.d.ts +0 -17
- package/dist/src/nocode-base/src/runtime/runtime-instance-registry.d.ts +0 -296
- package/dist/src/nocode-base/src/runtime/runtime-persistence-coordinator.d.ts +0 -93
- package/dist/src/nocode-base/src/runtime/runtime-rule-compiler.d.ts +0 -37
- package/dist/src/nocode-base/src/runtime/runtime-sheet-service.d.ts +0 -99
- package/dist/src/nocode-base/src/runtime/runtime-validation-service.d.ts +0 -44
- package/dist/src/nocode-base/src/runtime/table-row-identity.d.ts +0 -23
- package/dist/src/nocode-base/src/types/fields/i-seal.d.ts +0 -10
- package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/base-vxe-table.vue.d.ts +0 -78
- package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/columns.d.ts +0 -43
- package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/default-value-rdo-editor.vue.d.ts +0 -194
- package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/hooks.d.ts +0 -28
- package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/index.d.ts +0 -6
- package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/rdo-table-dropdown.vue.d.ts +0 -145
- package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/rdo-version-name-tag.vue.d.ts +0 -11
- package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/useSelectTable.d.ts +0 -31
- package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-select-editor/use-default-value-options.d.ts +0 -40
- package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-select-editor/use-default-value-visibility.d.ts +0 -2
- package/dist/src/online-form/src/views/__cell_widgets__/seal/seal-design.vue.d.ts +0 -6
- package/dist/src/online-form/src/views/__cell_widgets__/seal/seal-type-labels.d.ts +0 -4
- package/dist/src/online-form/src/views/__cell_widgets__/seal/seal.config.d.ts +0 -2
- package/dist/src/online-form/src/views/__widgets__/spacer/spacer-width.d.ts +0 -2
- package/dist/src/online-form/src/views/__widgets__/spacer/spacer.config.d.ts +0 -2
- package/dist/src/online-form/src/views/designer/conversions/v1-designer.d.ts +0 -9
- package/dist/src/online-form/src/views/designer/hooks/useDhrEdition.d.ts +0 -7
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/decision-rule-condition.vue.d.ts +0 -19
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/decision-rule-group.vue.d.ts +0 -16
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/decision-rule.d.ts +0 -54
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/field-tree-node.vue.d.ts +0 -24
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/field-tree-select.vue.d.ts +0 -30
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/field-tree-utils.d.ts +0 -12
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/inspection-decision-modal.vue.d.ts +0 -9
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/word-ui/gct-button.vue.d.ts +0 -33
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/word-ui/gct-icon.vue.d.ts +0 -12
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/word-ui/gct-input.vue.d.ts +0 -23
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/word-ui/gct-modal.vue.d.ts +0 -36
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/word-ui/gct-scrollbar.vue.d.ts +0 -21
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/word-ui/gct-select.vue.d.ts +0 -30
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/word-ui/gct-switch.vue.d.ts +0 -17
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/word-ui/gct-text-area.vue.d.ts +0 -20
- package/dist/src/online-form/src/views/designer/modules/panel/panel-rule-config/word-ui/index.d.ts +0 -8
- package/dist/src/online-form/src/views/designer/modules/panel/panel-seal.vue.d.ts +0 -2
- package/dist/src/online-form/src/views/designer/modules/sheet/seal-layer.vue.d.ts +0 -2
- package/dist/src/online-form/src/views/designer/types/sheets.d.ts +0 -16
- package/dist/src/online-form/src/views/render/__components__/_field_/seal/component/seal-api.d.ts +0 -17
- package/dist/src/online-form/src/views/render/__components__/_field_/seal/component/seal-floating-field.vue.d.ts +0 -9
- package/dist/src/online-form/src/views/render/__components__/_field_/seal/component/seal-runtime-layer.vue.d.ts +0 -9
- package/dist/src/online-form/src/views/render/__components__/_field_/seal/component/use-seal-stamp.d.ts +0 -29
- package/dist/src/online-form/src/views/render/__components__/_field_/seal/index.d.ts +0 -58
- package/dist/src/online-form/src/views/render/__components__/_field_/sign/component/sign-validation.d.ts +0 -14
- package/dist/src/online-form/src/views/render/__components__/_field_/trace/composables/useSearchEnter.d.ts +0 -10
- package/dist/src/online-form/src/views/render/active-sheet-renderer.vue.d.ts +0 -15
- package/dist/src/online-form/src/views/render/all-sheets-renderer.vue.d.ts +0 -9
- package/dist/src/online-form/src/views/render/printing/iframe-print.d.ts +0 -11
- package/dist/src/online-form/src/views/render/printing/print-runtime-instance.d.ts +0 -11
- package/dist/src/online-form/src/views/render/printing/print-snapshot-renderer.vue.d.ts +0 -27
- package/dist/src/online-form/src/views/render/printing/runtime-print-snapshot.d.ts +0 -24
- package/dist/src/online-form/src/views/render/sheet-tab-bar.vue.d.ts +0 -14
- package/dist/src/shared/components/Seal/seal-placeholder.vue.d.ts +0 -6
- package/dist/src/shared/components/Seal/seal-positioned.vue.d.ts +0 -38
- package/dist/src/shared/seal/index.d.ts +0 -44
- package/dist/sub-table-factory-DLXJkTHY.js +0 -2118
|
@@ -1,2118 +0,0 @@
|
|
|
1
|
-
import { shallowReactive } from "vue";
|
|
2
|
-
import { aE as SubTableActionMenuTypeEnum, aF as getMenuByAction, aG as SubTableActionEnum, aH as resolveScanFillData, ak as SubTableCore, aI as getInsertSubMenu, aJ as resolveScanAdjustType, aK as resolveScanQty, aL as toDateOnly, aM as getCopySubMenu, aN as resolveScanParsedValue, aO as isProductBatchEmptyRow } from "./dynamic-table-action-zR6VwiFi.js";
|
|
3
|
-
import { E as api, cI as F$1, cJ as SCAN_ROW_CONTENT_FIELDS, cK as F$2, cL as F$3, cM as runRowHandler, c as getProfileByTableType, b as isBusinessSubTableProfile, cN as F$4, cO as F$5, cP as FILL_FROM_SOURCE_PRODUCT_OPTION, cQ as FILL_FROM_TARGET_MATERIAL_NO_OPTION, cR as FILL_FROM_INVENTORY_OPTION, cS as FILL_FROM_PART_OPTION, cT as FILL_FROM_INVENTORY_OPTION$1, cU as TABLE_TYPE, cV as FILL_FROM_INVENTORY_OPTION$2, b4 as F$6, cW as INVENTORY_BASE_FIELDS, cX as resolveGroupByWarehouse, cY as AUTO_LOAD_READONLY_SELECT_FIELDS, b3 as STOCKTAKE_DIMENSION, b0 as getParseRuleInfo, cZ as buildFillFromInventoryOption, c1 as calcFillData, c_ as resolveStocktakeInventoryApi, b1 as getParseRuleValue, c$ as F$7, d0 as FILL_FROM_INVENTORY_OPTION$3, c5 as extractKeywordFromQueryData, d1 as composeProductionLotListQuery, aK as resolveLotDisplayLabel, d2 as F$8, d3 as isProductManuallyEditable, d4 as applyFillFromMfgOrderOption, d5 as applyFillFromOption$1, d6 as applyFillFromProductOption, aU as LOT_CONTAINER_ROLE, d7 as MATERIAL_CONTAINER_ID, d8 as F$9, d9 as PRODUCT_QUICK_SEARCH_FIELDS, da as PRODUCT_QUICK_SEARCH_EXP, db as isProductManuallyEditable$1, dc as applyFillFromMaterialNoOption, dd as applyFillFromProductOption$1, de as F$a, df as FILL_FROM_INVENTORY_OPTION$4, Y as FormTypeEnum, aF as transformUtils, f as SubTableType } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-BDkKB_4N.js";
|
|
4
|
-
import { has, merge } from "lodash-es";
|
|
5
|
-
function isBlank$4(value) {
|
|
6
|
-
return value === void 0 || value === null || value === "";
|
|
7
|
-
}
|
|
8
|
-
function matchFieldKey(match, fieldKey) {
|
|
9
|
-
if (!match.fieldKey) return false;
|
|
10
|
-
const keys = Array.isArray(match.fieldKey) ? match.fieldKey : [match.fieldKey];
|
|
11
|
-
return keys.includes(fieldKey);
|
|
12
|
-
}
|
|
13
|
-
function findFieldProfile(profile, fieldKey) {
|
|
14
|
-
return profile?.fields?.find((item) => matchFieldKey(item.match, fieldKey));
|
|
15
|
-
}
|
|
16
|
-
function buildDefaultMapFromProfile(profile, paramsConfig) {
|
|
17
|
-
const result = {};
|
|
18
|
-
if (!profile?.contextAssignments?.length) return result;
|
|
19
|
-
const assignments = profile.contextAssignments.filter(
|
|
20
|
-
(item) => item.when === "onRowInit"
|
|
21
|
-
);
|
|
22
|
-
for (const assignment of assignments) {
|
|
23
|
-
const value = paramsConfig?.[assignment.paramKey];
|
|
24
|
-
if (isBlank$4(value)) continue;
|
|
25
|
-
result[assignment.fieldKey] = value;
|
|
26
|
-
}
|
|
27
|
-
return result;
|
|
28
|
-
}
|
|
29
|
-
function buildFieldStatusFromProfile(params) {
|
|
30
|
-
const { profile, field } = params;
|
|
31
|
-
const result = {};
|
|
32
|
-
if (!profile) return result;
|
|
33
|
-
const fieldProfile = findFieldProfile(profile, field);
|
|
34
|
-
if (fieldProfile?.defaultProps) {
|
|
35
|
-
if (fieldProfile.defaultProps.disabled === true || fieldProfile.defaultProps.fieldDisabled === true) {
|
|
36
|
-
result.disabled = true;
|
|
37
|
-
}
|
|
38
|
-
if (fieldProfile.defaultProps.readonly === true || fieldProfile.defaultProps.fieldReadonly === true) {
|
|
39
|
-
result.readonly = true;
|
|
40
|
-
}
|
|
41
|
-
if (fieldProfile.defaultProps.required === false) {
|
|
42
|
-
result.required = false;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const rules = (profile.runtimeRules ?? []).filter(
|
|
46
|
-
(rule) => !rule.when || rule.when === "always" || rule.when === "onRowInit"
|
|
47
|
-
);
|
|
48
|
-
for (const rule of rules) {
|
|
49
|
-
if (!rule.fields.includes(field)) continue;
|
|
50
|
-
if (rule.effect.readonly) result.readonly = true;
|
|
51
|
-
if (rule.effect.disabled) result.disabled = true;
|
|
52
|
-
if (rule.effect.required !== void 0) result.required = rule.effect.required;
|
|
53
|
-
}
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
function getRowHandlersForFieldChange(profile, changedField) {
|
|
57
|
-
if (!profile?.rowHandlers?.length) return [];
|
|
58
|
-
return profile.rowHandlers.filter((item) => item.when === "onFieldChange").filter((item) => !item.watch?.length || item.watch.includes(changedField)).map((item) => item.handler);
|
|
59
|
-
}
|
|
60
|
-
class RuntimeInstanceController {
|
|
61
|
-
context;
|
|
62
|
-
persistenceCoordinator;
|
|
63
|
-
sheets;
|
|
64
|
-
// Controller 在 Registry 中保持原始引用;单独让 UI 状态响应式,标签可直接订阅。
|
|
65
|
-
viewState = shallowReactive({
|
|
66
|
-
switching: false,
|
|
67
|
-
preparationError: void 0
|
|
68
|
-
});
|
|
69
|
-
/** 初始化和模式切换的真实准备任务;不再用固定时间窗口推断准备是否结束。 */
|
|
70
|
-
viewPreparations = shallowReactive(/* @__PURE__ */ new Set());
|
|
71
|
-
viewPreparationSequence = 0;
|
|
72
|
-
disposed = false;
|
|
73
|
-
switchSequence = 0;
|
|
74
|
-
editorFlushers = /* @__PURE__ */ new Set();
|
|
75
|
-
onValidate;
|
|
76
|
-
onGetSubmitData;
|
|
77
|
-
onValidationFailed;
|
|
78
|
-
/** 合并整个 UI 提交流程,避免并发点击重复执行错误导航。 */
|
|
79
|
-
preparingSubmission;
|
|
80
|
-
constructor(options) {
|
|
81
|
-
this.context = options.context;
|
|
82
|
-
this.sheets = options.sheetService;
|
|
83
|
-
this.persistenceCoordinator = options.persistenceCoordinator;
|
|
84
|
-
this.onValidate = options.onValidate;
|
|
85
|
-
this.onGetSubmitData = options.onGetSubmitData;
|
|
86
|
-
this.onValidationFailed = options.onValidationFailed;
|
|
87
|
-
}
|
|
88
|
-
get switching() {
|
|
89
|
-
return this.viewState.switching;
|
|
90
|
-
}
|
|
91
|
-
get preparing() {
|
|
92
|
-
return this.viewPreparations.size > 0;
|
|
93
|
-
}
|
|
94
|
-
get preparationError() {
|
|
95
|
-
return this.viewState.preparationError;
|
|
96
|
-
}
|
|
97
|
-
/** 库内准备入口;异步回调按当前轮次判断是否还能更新展示,不让旧模式覆盖新模式。 */
|
|
98
|
-
prepareView(prepare) {
|
|
99
|
-
this.assertAlive();
|
|
100
|
-
const sequence = ++this.viewPreparationSequence;
|
|
101
|
-
this.viewState.preparationError = void 0;
|
|
102
|
-
const isCurrent = () => !this.disposed && sequence === this.viewPreparationSequence;
|
|
103
|
-
const operation = Promise.resolve().then(() => prepare(isCurrent)).then((result) => {
|
|
104
|
-
this.assertAlive();
|
|
105
|
-
return result;
|
|
106
|
-
}).catch((error) => {
|
|
107
|
-
if (isCurrent()) {
|
|
108
|
-
this.viewState.preparationError = error instanceof Error ? error : new Error(String(error));
|
|
109
|
-
}
|
|
110
|
-
throw error;
|
|
111
|
-
}).finally(() => this.viewPreparations.delete(operation));
|
|
112
|
-
this.viewPreparations.add(operation);
|
|
113
|
-
return operation;
|
|
114
|
-
}
|
|
115
|
-
/** 提交、草稿、打印及初始化完成通知,都等待实际准备任务结束。 */
|
|
116
|
-
async waitUntilPrepared() {
|
|
117
|
-
this.assertAlive();
|
|
118
|
-
while (this.viewPreparations.size) {
|
|
119
|
-
await Promise.all(Array.from(this.viewPreparations));
|
|
120
|
-
this.assertAlive();
|
|
121
|
-
}
|
|
122
|
-
if (this.viewState.preparationError) throw this.viewState.preparationError;
|
|
123
|
-
}
|
|
124
|
-
/** 严格获取活动 Sheet,核心操作缺少活动 Sheet 时立即报错。 */
|
|
125
|
-
getActiveSheet() {
|
|
126
|
-
const sheet = this.getSheet();
|
|
127
|
-
if (!sheet) throw new Error("运行时实例缺少活动工作表");
|
|
128
|
-
return sheet;
|
|
129
|
-
}
|
|
130
|
-
/** 查询指定 Sheet;省略 sheetId 时返回活动 Sheet,打印可明确指定其他 Sheet。 */
|
|
131
|
-
getSheet(sheetId = this.context.activeSheetId) {
|
|
132
|
-
return this.context.sheets.find((sheet) => sheet.sheetId === sheetId);
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* 字段通过 useRuntimeEditorFlusher 注册尚未写入 Store 的编辑状态提交函数,
|
|
136
|
-
* 卸载时调用返回的注销函数;已即时写入 Store 的控件无需额外注册。
|
|
137
|
-
*/
|
|
138
|
-
registerEditorFlusher(flusher) {
|
|
139
|
-
this.assertAlive();
|
|
140
|
-
this.editorFlushers.add(flusher);
|
|
141
|
-
return () => this.editorFlushers.delete(flusher);
|
|
142
|
-
}
|
|
143
|
-
async flushActiveEditor() {
|
|
144
|
-
this.assertAlive();
|
|
145
|
-
await this.waitUntilPrepared();
|
|
146
|
-
await Promise.all(Array.from(this.editorFlushers, (flusher) => flusher()));
|
|
147
|
-
}
|
|
148
|
-
async activateSheet(sheetId, options = {}) {
|
|
149
|
-
this.assertAlive();
|
|
150
|
-
const targetSheet = this.getSheet(sheetId);
|
|
151
|
-
if (!targetSheet) throw new Error(`运行时实例不存在工作表:${sheetId}`);
|
|
152
|
-
if (targetSheet.status !== "ready") {
|
|
153
|
-
throw new Error(targetSheet.errorMessage || `工作表「${targetSheet.title}」尚未完成初始化`);
|
|
154
|
-
}
|
|
155
|
-
const previousSheet = this.getActiveSheet();
|
|
156
|
-
const sequence = ++this.switchSequence;
|
|
157
|
-
if (previousSheet.sheetId === sheetId && !this.sheets.isDirty(sheetId)) {
|
|
158
|
-
this.viewState.switching = false;
|
|
159
|
-
if (options.scrollTop != null) {
|
|
160
|
-
this.updateScrollTop(previousSheet.sheetId, options.scrollTop);
|
|
161
|
-
}
|
|
162
|
-
return previousSheet;
|
|
163
|
-
}
|
|
164
|
-
this.viewState.switching = true;
|
|
165
|
-
try {
|
|
166
|
-
await this.flushActiveEditor();
|
|
167
|
-
if (sequence !== this.switchSequence) return void 0;
|
|
168
|
-
for (let round = 0; this.sheets.isDirty(sheetId); round += 1) {
|
|
169
|
-
if (round >= 10) throw new Error("工作表数据持续变化,暂时无法切换,请稍后重试");
|
|
170
|
-
this.sheets.recalculateSheet(sheetId);
|
|
171
|
-
await Promise.resolve();
|
|
172
|
-
if (sequence !== this.switchSequence) return void 0;
|
|
173
|
-
}
|
|
174
|
-
if (sequence !== this.switchSequence) return void 0;
|
|
175
|
-
if (options.scrollTop != null) {
|
|
176
|
-
this.updateScrollTop(previousSheet.sheetId, options.scrollTop);
|
|
177
|
-
}
|
|
178
|
-
this.context.activeSheetId = targetSheet.sheetId;
|
|
179
|
-
return targetSheet;
|
|
180
|
-
} finally {
|
|
181
|
-
if (sequence === this.switchSequence) this.viewState.switching = false;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
/** 统一记录 Sheet 滚动位置;无效数值归零,负值截断为零。 */
|
|
185
|
-
updateScrollTop(sheetId, scrollTop) {
|
|
186
|
-
this.assertAlive();
|
|
187
|
-
const sheet = this.getSheet(sheetId);
|
|
188
|
-
if (!sheet) throw new Error(`运行时实例不存在工作表:${sheetId}`);
|
|
189
|
-
sheet.scrollTop = Number.isFinite(scrollTop) ? Math.max(0, scrollTop) : 0;
|
|
190
|
-
}
|
|
191
|
-
/** 暂存/变更业务取得稳定数据,不校验、不导航;不能把此结果当作已通过提交校验。 */
|
|
192
|
-
async prepareDraft() {
|
|
193
|
-
this.assertAlive();
|
|
194
|
-
const result = await this.persistenceCoordinator.prepareDataSnapshot({
|
|
195
|
-
flushEditors: () => this.flushActiveEditor(),
|
|
196
|
-
transform: (formState) => {
|
|
197
|
-
this.assertAlive();
|
|
198
|
-
return this.onGetSubmitData(formState);
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
this.assertAlive();
|
|
202
|
-
return result;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* 打印渲染器同步捕获同一 revision 的数据、节点和分页;不执行业务转换或校验。
|
|
206
|
-
* capture 只复制展示状态,不能请求数据或修改原实例;宿主通过 PreviewContainer 打印。
|
|
207
|
-
*/
|
|
208
|
-
async preparePrintSnapshot(capture) {
|
|
209
|
-
this.assertAlive();
|
|
210
|
-
const snapshot = await this.persistenceCoordinator.prepareReadSnapshot(
|
|
211
|
-
() => this.flushActiveEditor(),
|
|
212
|
-
capture
|
|
213
|
-
);
|
|
214
|
-
this.assertAlive();
|
|
215
|
-
return snapshot;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* 【宿主接入·已接通】业务按钮消费本次 result.validation/result.payload,不读取提交缓存。
|
|
219
|
-
* 网络异常由宿主处理;本方法仅生成稳定快照,不发送保存或提交请求。
|
|
220
|
-
*/
|
|
221
|
-
prepareSubmission() {
|
|
222
|
-
this.assertAlive();
|
|
223
|
-
if (!this.preparingSubmission) {
|
|
224
|
-
this.preparingSubmission = this.runSubmission().finally(() => {
|
|
225
|
-
this.preparingSubmission = void 0;
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
return this.preparingSubmission;
|
|
229
|
-
}
|
|
230
|
-
async runSubmission() {
|
|
231
|
-
for (let round = 0; round < 10; round += 1) {
|
|
232
|
-
const result = await this.persistenceCoordinator.prepareSubmission({
|
|
233
|
-
flushEditors: () => this.flushActiveEditor(),
|
|
234
|
-
validate: () => {
|
|
235
|
-
this.assertAlive();
|
|
236
|
-
return this.onValidate();
|
|
237
|
-
},
|
|
238
|
-
transform: (formState) => {
|
|
239
|
-
this.assertAlive();
|
|
240
|
-
return this.onGetSubmitData(formState);
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
this.assertAlive();
|
|
244
|
-
if (!result.isValid) await this.onValidationFailed?.(result.validation);
|
|
245
|
-
this.assertAlive();
|
|
246
|
-
if (this.persistenceCoordinator.isCurrentRevision(result.revision)) return result;
|
|
247
|
-
}
|
|
248
|
-
throw new Error("表单数据持续变化,暂时无法生成稳定的提交数据,请稍后重试");
|
|
249
|
-
}
|
|
250
|
-
dispose() {
|
|
251
|
-
this.disposed = true;
|
|
252
|
-
this.viewPreparationSequence++;
|
|
253
|
-
this.viewPreparations.clear();
|
|
254
|
-
this.viewState.preparationError = void 0;
|
|
255
|
-
this.switchSequence++;
|
|
256
|
-
this.viewState.switching = false;
|
|
257
|
-
this.editorFlushers.clear();
|
|
258
|
-
}
|
|
259
|
-
assertAlive() {
|
|
260
|
-
if (this.disposed) throw new Error("运行时实例已销毁,无法执行控制器操作");
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
const SCAN_NOT_FOUND_MSG$2 = "扫描的物料不存在";
|
|
264
|
-
const SCAN_LOT_OR_UNIQUE_REQUIRED_MSG = "条码中未解析到物料批号或唯一码";
|
|
265
|
-
function hasLotOrUniqueCode(parsed) {
|
|
266
|
-
return Boolean(String(parsed.lot ?? "").trim() || String(parsed.uniqueCode ?? "").trim());
|
|
267
|
-
}
|
|
268
|
-
function buildInventoryScanRequestBody(parsed, warehouseId) {
|
|
269
|
-
const body = {};
|
|
270
|
-
if (parsed.materialCode) body.product_code_ = parsed.materialCode;
|
|
271
|
-
if (parsed.lot) body.material_no_ = parsed.lot;
|
|
272
|
-
if (parsed.uniqueCode) body.unique_code_ = parsed.uniqueCode;
|
|
273
|
-
if (parsed.mfgOrderCode) body.mfg_order_code_ = parsed.mfgOrderCode;
|
|
274
|
-
if (warehouseId) body.warehouse_id_ = warehouseId;
|
|
275
|
-
return body;
|
|
276
|
-
}
|
|
277
|
-
function unwrapBizServiceList$1(result) {
|
|
278
|
-
if (!result) return [];
|
|
279
|
-
if (Array.isArray(result)) return result;
|
|
280
|
-
const data = result.data;
|
|
281
|
-
if (Array.isArray(data)) return data;
|
|
282
|
-
if (data && typeof data === "object") return [data];
|
|
283
|
-
return [];
|
|
284
|
-
}
|
|
285
|
-
async function matchInventoryScanRecords(parsed, warehouseId) {
|
|
286
|
-
const body = buildInventoryScanRequestBody(parsed, warehouseId);
|
|
287
|
-
if (!body.material_no_ && !body.unique_code_) return [];
|
|
288
|
-
const result = await api.apaas.modelComprehensive.postBizServiceGeneralModelCategoryModelKeyBsKey(
|
|
289
|
-
{
|
|
290
|
-
modelCategory: "entity",
|
|
291
|
-
modelKey: "em_inventory",
|
|
292
|
-
bsKey: "biz_inventory_production_identification_scan"
|
|
293
|
-
},
|
|
294
|
-
{},
|
|
295
|
-
body
|
|
296
|
-
);
|
|
297
|
-
return unwrapBizServiceList$1(result);
|
|
298
|
-
}
|
|
299
|
-
const PRODUCTION_IDENTIFICATION_SCAN_NOT_FOUND_MSG = "扫描的物料不存在";
|
|
300
|
-
const PRODUCTION_IDENTIFICATION_SCAN_LOT_OR_UNIQUE_REQUIRED_MSG = "条码中未解析到物料批号或唯一码";
|
|
301
|
-
function hasProductionIdentificationScanKey(parsed) {
|
|
302
|
-
return Boolean(String(parsed.lot ?? "").trim() || String(parsed.uniqueCode ?? "").trim());
|
|
303
|
-
}
|
|
304
|
-
function buildProductionIdentificationScanBody(parsed) {
|
|
305
|
-
const body = {};
|
|
306
|
-
if (parsed.materialCode) body.product_code_ = parsed.materialCode;
|
|
307
|
-
if (parsed.lot) body.material_no_ = parsed.lot;
|
|
308
|
-
if (parsed.qty != null) body.qty_ = parsed.qty;
|
|
309
|
-
if (parsed.expiration) body.vaildate_ = parsed.expiration;
|
|
310
|
-
if (parsed.deviceCode) body.device_code_ = parsed.deviceCode;
|
|
311
|
-
if (parsed.uniqueCode) body.unique_code = parsed.uniqueCode;
|
|
312
|
-
if (parsed.mfgOrderCode) body.mfg_order_code_ = parsed.mfgOrderCode;
|
|
313
|
-
if (parsed.sterilizationLot) body.sterilization_code_ = parsed.sterilizationLot;
|
|
314
|
-
const productionContainerName = parsed.productionContainerName ?? parsed.production_container_name_ ?? parsed.productionLot;
|
|
315
|
-
if (productionContainerName) {
|
|
316
|
-
body.production_container_name_ = productionContainerName;
|
|
317
|
-
}
|
|
318
|
-
return body;
|
|
319
|
-
}
|
|
320
|
-
function unwrapBizServiceList(result) {
|
|
321
|
-
if (!result) return [];
|
|
322
|
-
if (Array.isArray(result)) return result;
|
|
323
|
-
const data = result.data;
|
|
324
|
-
if (Array.isArray(data)) return data;
|
|
325
|
-
if (data && typeof data === "object") return [data];
|
|
326
|
-
return [];
|
|
327
|
-
}
|
|
328
|
-
async function matchProductionIdentificationScanRecords(parsed) {
|
|
329
|
-
const body = buildProductionIdentificationScanBody(parsed);
|
|
330
|
-
if (!body.material_no_ && !body.unique_code) return [];
|
|
331
|
-
const result = await api.apaas.modelComprehensive.postBizServiceGeneralModelCategoryModelKeyBsKey(
|
|
332
|
-
{
|
|
333
|
-
modelCategory: "entity",
|
|
334
|
-
modelKey: "em_production_identification",
|
|
335
|
-
bsKey: "biz_production_identification_scan"
|
|
336
|
-
},
|
|
337
|
-
{},
|
|
338
|
-
body
|
|
339
|
-
);
|
|
340
|
-
return unwrapBizServiceList(result);
|
|
341
|
-
}
|
|
342
|
-
class ProfileDrivenSubTableCore extends SubTableCore {
|
|
343
|
-
get profile() {
|
|
344
|
-
const profile = getProfileByTableType(this.ctx.widget.props.tableType);
|
|
345
|
-
return profile && isBusinessSubTableProfile(profile) ? profile : void 0;
|
|
346
|
-
}
|
|
347
|
-
calcDefaultMap() {
|
|
348
|
-
return {
|
|
349
|
-
...super.calcDefaultMap(),
|
|
350
|
-
...buildDefaultMapFromProfile(this.profile, this.pageCtx?.paramsConfig)
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
calcFieldStatus(params) {
|
|
354
|
-
const result = super.calcFieldStatus(params);
|
|
355
|
-
const fromProfile = buildFieldStatusFromProfile({
|
|
356
|
-
profile: this.profile,
|
|
357
|
-
field: params.field
|
|
358
|
-
});
|
|
359
|
-
return {
|
|
360
|
-
...result,
|
|
361
|
-
...fromProfile
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
handleChange(params) {
|
|
365
|
-
const profileType = this.profile?.type;
|
|
366
|
-
if (profileType) {
|
|
367
|
-
for (const handlerName of getRowHandlersForFieldChange(this.profile, params.field)) {
|
|
368
|
-
runRowHandler(profileType, handlerName, {
|
|
369
|
-
rowData: params.rowData,
|
|
370
|
-
changedField: params.field
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
super.handleChange(params);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
function isBlank$3(value) {
|
|
378
|
-
return value === void 0 || value === null || value === "";
|
|
379
|
-
}
|
|
380
|
-
function resolveOptionRecord$1(option) {
|
|
381
|
-
if (!option) return void 0;
|
|
382
|
-
const nested = option._item;
|
|
383
|
-
if (nested && typeof nested === "object") {
|
|
384
|
-
return nested;
|
|
385
|
-
}
|
|
386
|
-
return option;
|
|
387
|
-
}
|
|
388
|
-
function applyOptionFill(rowData, option, mappings) {
|
|
389
|
-
const record = resolveOptionRecord$1(option) ?? option;
|
|
390
|
-
for (const { optionField, toField } of mappings) {
|
|
391
|
-
if (record[optionField] !== void 0) {
|
|
392
|
-
rowData[toField] = record[optionField];
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
const MATERIAL_CONSUME_HISTORY_DISPLAY_FIELDS = [
|
|
397
|
-
{ key: "product_id_.name_", name: "物料名称" },
|
|
398
|
-
{ key: "product_id_.code_", name: "物料编码" },
|
|
399
|
-
{ key: "product_id_.spec_", name: "物料规格" },
|
|
400
|
-
{ key: "material_name_", name: "物料批号" },
|
|
401
|
-
{ key: "qty_consumed_", name: "已消耗数量" }
|
|
402
|
-
];
|
|
403
|
-
function getForeignProductValue(item, field) {
|
|
404
|
-
return item[field] ?? item._OPCT?.[field] ?? item.__FOREIGN__?.[field];
|
|
405
|
-
}
|
|
406
|
-
function flattenMaterialConsumeRecord(item) {
|
|
407
|
-
return {
|
|
408
|
-
...item,
|
|
409
|
-
"product_id_.name_": getForeignProductValue(item, "product_id_.name_"),
|
|
410
|
-
"product_id_.code_": getForeignProductValue(item, "product_id_.code_"),
|
|
411
|
-
"product_id_.spec_": getForeignProductValue(item, "product_id_.spec_")
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
function hasQueryValue(value) {
|
|
415
|
-
if (Array.isArray(value)) return value.length > 0;
|
|
416
|
-
return !isBlank$3(value);
|
|
417
|
-
}
|
|
418
|
-
function createMaterialConsumeHistoryLoader() {
|
|
419
|
-
return async ({ mode, queryData = {}, pageNo = 1, pageSize = 20, ids = [] }) => {
|
|
420
|
-
const query = Object.fromEntries(
|
|
421
|
-
Object.entries(queryData).filter(([, value]) => hasQueryValue(value))
|
|
422
|
-
);
|
|
423
|
-
if (mode === "byIds" && ids.length) {
|
|
424
|
-
query["product_id_.in"] = ids;
|
|
425
|
-
}
|
|
426
|
-
const queryKeys = Object.keys(query);
|
|
427
|
-
const exp = queryKeys.length > 1 ? `AND(${queryKeys.join(",")})` : queryKeys.length === 1 ? queryKeys[0] : "";
|
|
428
|
-
const res = await api.apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey(
|
|
429
|
-
{
|
|
430
|
-
modelCategory: "entity",
|
|
431
|
-
modelKey: "em_material_consume",
|
|
432
|
-
bsKey: "listByPage"
|
|
433
|
-
},
|
|
434
|
-
{},
|
|
435
|
-
{
|
|
436
|
-
foreignFields: ["product_id_.spec_", "product_id_.code_", "product_id_.name_"],
|
|
437
|
-
query,
|
|
438
|
-
exp,
|
|
439
|
-
pageNo,
|
|
440
|
-
pageSize
|
|
441
|
-
}
|
|
442
|
-
);
|
|
443
|
-
const rows = (Array.isArray(res) ? res : res?.data ?? []).map(flattenMaterialConsumeRecord);
|
|
444
|
-
const totalCount = Number(res?.totalCount ?? rows.length);
|
|
445
|
-
const totalPage = Number(res?.totalPage ?? Math.max(1, Math.ceil(totalCount / pageSize)));
|
|
446
|
-
const options = rows.map((item) => ({
|
|
447
|
-
label: getForeignProductValue(item, "product_id_.name_") ?? item.material_name_ ?? String(item.product_id_ ?? ""),
|
|
448
|
-
value: item.product_id_,
|
|
449
|
-
disabled: !!item.deleted_,
|
|
450
|
-
_item: item
|
|
451
|
-
}));
|
|
452
|
-
return {
|
|
453
|
-
data: rows,
|
|
454
|
-
options,
|
|
455
|
-
finished: mode === "byIds" || pageNo >= totalPage,
|
|
456
|
-
totalCount,
|
|
457
|
-
totalPage
|
|
458
|
-
};
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
function applyAllocatePartTd(params, partField, mode, inventoryBinding) {
|
|
462
|
-
const { field, tdHandler } = params;
|
|
463
|
-
if (field !== partField) return;
|
|
464
|
-
tdHandler.mergeTd({
|
|
465
|
-
cellWidget: {
|
|
466
|
-
props: {
|
|
467
|
-
customRenderTag: "allocatePart",
|
|
468
|
-
partSelectMode: mode,
|
|
469
|
-
inventoryBinding,
|
|
470
|
-
newSpecificConfig: {
|
|
471
|
-
newOptions: []
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
class WarehouseInboundTableCore extends ProfileDrivenSubTableCore {
|
|
478
|
-
handleFieldTd = (params) => {
|
|
479
|
-
applyAllocatePartTd(params, F$4.part, "master");
|
|
480
|
-
super.handleFieldTd(params);
|
|
481
|
-
};
|
|
482
|
-
handleChange(params) {
|
|
483
|
-
super.handleChange(params);
|
|
484
|
-
const { field, value, option, rowData } = params;
|
|
485
|
-
if (field !== F$4.part || isBlank$3(value) || !option) return;
|
|
486
|
-
applyOptionFill(rowData, option, FILL_FROM_PART_OPTION);
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
class WarehouseOutboundTableCore extends ProfileDrivenSubTableCore {
|
|
490
|
-
get warehouseId() {
|
|
491
|
-
return this.factory.ctx.paramsConfig?.warehouseId;
|
|
492
|
-
}
|
|
493
|
-
handleFieldTd = (params) => {
|
|
494
|
-
applyAllocatePartTd(params, F$5.part, "inventory", {
|
|
495
|
-
formField: F$5.inventory,
|
|
496
|
-
optionField: "id_"
|
|
497
|
-
});
|
|
498
|
-
super.handleFieldTd(params);
|
|
499
|
-
};
|
|
500
|
-
calcFieldQuery = (params) => {
|
|
501
|
-
if (params.field === F$5.part) {
|
|
502
|
-
return { warehouse_id_: this.warehouseId };
|
|
503
|
-
}
|
|
504
|
-
};
|
|
505
|
-
handleChange(params) {
|
|
506
|
-
super.handleChange(params);
|
|
507
|
-
const { field, value, option, rowData } = params;
|
|
508
|
-
if (field !== F$5.part || isBlank$3(value) || !option) return;
|
|
509
|
-
applyOptionFill(rowData, option, FILL_FROM_INVENTORY_OPTION$1);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
class PartStocktakeTableCore extends ProfileDrivenSubTableCore {
|
|
513
|
-
get warehouseId() {
|
|
514
|
-
return this.factory.ctx.paramsConfig?.warehouseId;
|
|
515
|
-
}
|
|
516
|
-
handleFieldTd = (params) => {
|
|
517
|
-
applyAllocatePartTd(params, F$3.part, "inventory", {
|
|
518
|
-
formField: F$3.inventory,
|
|
519
|
-
optionField: "id_"
|
|
520
|
-
});
|
|
521
|
-
super.handleFieldTd(params);
|
|
522
|
-
};
|
|
523
|
-
calcFieldQuery = (params) => {
|
|
524
|
-
if (params.field === F$3.part) {
|
|
525
|
-
return { warehouse_id_: this.warehouseId };
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
handleChange(params) {
|
|
529
|
-
super.handleChange(params);
|
|
530
|
-
const { field, value, option, rowData } = params;
|
|
531
|
-
if (field !== F$3.part || isBlank$3(value) || !option) return;
|
|
532
|
-
applyOptionFill(rowData, option, FILL_FROM_INVENTORY_OPTION);
|
|
533
|
-
runRowHandler(TABLE_TYPE, "stocktake-derived", {
|
|
534
|
-
rowData,
|
|
535
|
-
changedField: field
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
class DevicePartConsumeTableCore extends ProfileDrivenSubTableCore {
|
|
540
|
-
get warehouseId() {
|
|
541
|
-
return this.factory.ctx.paramsConfig?.warehouseId;
|
|
542
|
-
}
|
|
543
|
-
handleFieldTd = (params) => {
|
|
544
|
-
applyAllocatePartTd(params, F$1.part, "inventory", {
|
|
545
|
-
formField: F$1.inventory,
|
|
546
|
-
optionField: "id_"
|
|
547
|
-
});
|
|
548
|
-
super.handleFieldTd(params);
|
|
549
|
-
};
|
|
550
|
-
calcFieldQuery = (params) => {
|
|
551
|
-
if (params.field === F$1.part) {
|
|
552
|
-
return { warehouse_id_: this.warehouseId };
|
|
553
|
-
}
|
|
554
|
-
};
|
|
555
|
-
handleChange(params) {
|
|
556
|
-
super.handleChange(params);
|
|
557
|
-
const { field, value, option, rowData } = params;
|
|
558
|
-
if (field !== F$1.part || isBlank$3(value) || !option) return;
|
|
559
|
-
applyOptionFill(rowData, option, FILL_FROM_INVENTORY_OPTION$2);
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
class MaterialRequisitionTableCore extends ProfileDrivenSubTableCore {
|
|
563
|
-
}
|
|
564
|
-
class MaterialSubstitutionTableCore extends ProfileDrivenSubTableCore {
|
|
565
|
-
isEmptyScanRow(row) {
|
|
566
|
-
return SCAN_ROW_CONTENT_FIELDS.every((field) => isBlank$3(row[field]));
|
|
567
|
-
}
|
|
568
|
-
handleFieldTd = (params) => {
|
|
569
|
-
const { field, tdHandler } = params;
|
|
570
|
-
if (field === F$2.sourceProduct) {
|
|
571
|
-
tdHandler.mergeTd({
|
|
572
|
-
cellWidget: {
|
|
573
|
-
props: {
|
|
574
|
-
displayFields: MATERIAL_CONSUME_HISTORY_DISPLAY_FIELDS,
|
|
575
|
-
quickSearchable: true,
|
|
576
|
-
quickSearchField: ["material_name_.like"],
|
|
577
|
-
quickSearchExp: "OR(material_name_.like)",
|
|
578
|
-
customRefTableMode: "flat",
|
|
579
|
-
newSpecificConfig: { newOptions: [] }
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
});
|
|
583
|
-
}
|
|
584
|
-
super.handleFieldTd(params);
|
|
585
|
-
};
|
|
586
|
-
calcFieldQuery = ({ field, rowData }) => {
|
|
587
|
-
if (field !== F$2.sourceProduct) return;
|
|
588
|
-
const query = {};
|
|
589
|
-
if (!isBlank$3(rowData[F$2.productionContainer])) {
|
|
590
|
-
query["production_identification_id_.eq"] = rowData[F$2.productionContainer];
|
|
591
|
-
}
|
|
592
|
-
if (!isBlank$3(rowData[F$2.routingOperation])) {
|
|
593
|
-
query["routing_operation_id_.eq"] = rowData[F$2.routingOperation];
|
|
594
|
-
}
|
|
595
|
-
return query;
|
|
596
|
-
};
|
|
597
|
-
calcFieldDataSource = ({ field }) => {
|
|
598
|
-
if (field === F$2.sourceProduct) {
|
|
599
|
-
return createMaterialConsumeHistoryLoader();
|
|
600
|
-
}
|
|
601
|
-
};
|
|
602
|
-
handleChange(params) {
|
|
603
|
-
super.handleChange(params);
|
|
604
|
-
const { field, value, option, rowData } = params;
|
|
605
|
-
if (isBlank$3(value) || !option) return;
|
|
606
|
-
const source = resolveOptionRecord$1(option);
|
|
607
|
-
if (!source) return;
|
|
608
|
-
if (field === F$2.sourceProduct) {
|
|
609
|
-
applyOptionFill(
|
|
610
|
-
rowData,
|
|
611
|
-
flattenMaterialConsumeRecord(source),
|
|
612
|
-
FILL_FROM_SOURCE_PRODUCT_OPTION
|
|
613
|
-
);
|
|
614
|
-
return;
|
|
615
|
-
}
|
|
616
|
-
if (field === F$2.targetMaterialNo) {
|
|
617
|
-
applyOptionFill(rowData, source, FILL_FROM_TARGET_MATERIAL_NO_OPTION);
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
calcSubTableActionMenu = ({ showDelBtn }) => [
|
|
621
|
-
{
|
|
622
|
-
type: SubTableActionMenuTypeEnum.SUBTITLE,
|
|
623
|
-
label: $t("sys.edhr.bizOperation")
|
|
624
|
-
},
|
|
625
|
-
getMenuByAction(SubTableActionEnum.SCAN),
|
|
626
|
-
{
|
|
627
|
-
type: SubTableActionMenuTypeEnum.DIVIDER
|
|
628
|
-
},
|
|
629
|
-
{
|
|
630
|
-
type: SubTableActionMenuTypeEnum.SUBTITLE,
|
|
631
|
-
label: $t("sys.edhr.editRow")
|
|
632
|
-
},
|
|
633
|
-
getMenuByAction(SubTableActionEnum.Insert1RowAfter),
|
|
634
|
-
...showDelBtn ? [
|
|
635
|
-
{
|
|
636
|
-
type: SubTableActionMenuTypeEnum.DIVIDER
|
|
637
|
-
},
|
|
638
|
-
getMenuByAction(SubTableActionEnum.DeleteRowCurrent)
|
|
639
|
-
] : []
|
|
640
|
-
];
|
|
641
|
-
async onScan(input) {
|
|
642
|
-
const fillData = resolveScanFillData(input);
|
|
643
|
-
if (!Object.keys(fillData).length) {
|
|
644
|
-
this.warning({ content: "未配置条码字段映射" });
|
|
645
|
-
return;
|
|
646
|
-
}
|
|
647
|
-
this.appendOrFillScanRow(fillData);
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
var WarehouseInventoryRowSource = /* @__PURE__ */ ((WarehouseInventoryRowSource2) => {
|
|
651
|
-
WarehouseInventoryRowSource2["MANUAL"] = "manual";
|
|
652
|
-
WarehouseInventoryRowSource2["AUTO"] = "auto";
|
|
653
|
-
WarehouseInventoryRowSource2["SCAN"] = "scan";
|
|
654
|
-
return WarehouseInventoryRowSource2;
|
|
655
|
-
})(WarehouseInventoryRowSource || {});
|
|
656
|
-
const STOCKTAKE_STATUS = {
|
|
657
|
-
waiting: "sys.edhr.stocktakeStatusEnum.waiting",
|
|
658
|
-
surplus: "sys.edhr.stocktakeStatusEnum.surplus",
|
|
659
|
-
loss: "sys.edhr.stocktakeStatusEnum.loss",
|
|
660
|
-
equals: "sys.edhr.stocktakeStatusEnum.equals"
|
|
661
|
-
};
|
|
662
|
-
function toNumber(value, fallback = 0) {
|
|
663
|
-
const num = Number(value);
|
|
664
|
-
return Number.isNaN(num) ? fallback : num;
|
|
665
|
-
}
|
|
666
|
-
function isBlank$2(value) {
|
|
667
|
-
return value == null || value === "";
|
|
668
|
-
}
|
|
669
|
-
function pickInventoryBase(record) {
|
|
670
|
-
return Object.fromEntries(
|
|
671
|
-
INVENTORY_BASE_FIELDS.map((key) => [key, record[key]])
|
|
672
|
-
);
|
|
673
|
-
}
|
|
674
|
-
function mapInventoryIdentity(record, warehouseSummary) {
|
|
675
|
-
if (!warehouseSummary) {
|
|
676
|
-
return { [F$6.inventory]: record.id_ };
|
|
677
|
-
}
|
|
678
|
-
return {
|
|
679
|
-
[F$6.inventory]: record[F$6.inventory],
|
|
680
|
-
[F$6.frontId]: record.id_
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
function mapInventoryRecordToRow(record, warehouseSummary) {
|
|
684
|
-
return {
|
|
685
|
-
...pickInventoryBase(record),
|
|
686
|
-
...mapInventoryIdentity(record, warehouseSummary),
|
|
687
|
-
[F$6.location]: record[F$6.location],
|
|
688
|
-
[F$6.stock]: toNumber(record[F$6.stock])
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
function getStocktakeDiff(stocktakeNum, stockNum) {
|
|
692
|
-
if (isBlank$2(stocktakeNum)) {
|
|
693
|
-
return void 0;
|
|
694
|
-
}
|
|
695
|
-
const stocktake = toNumber(stocktakeNum);
|
|
696
|
-
if (Number.isNaN(stocktake)) {
|
|
697
|
-
return void 0;
|
|
698
|
-
}
|
|
699
|
-
return stocktake - toNumber(stockNum);
|
|
700
|
-
}
|
|
701
|
-
function buildStocktakeDerived(stocktakeNum, stockNum) {
|
|
702
|
-
const diff = getStocktakeDiff(stocktakeNum, stockNum);
|
|
703
|
-
let status;
|
|
704
|
-
if (diff == null) {
|
|
705
|
-
status = "waiting";
|
|
706
|
-
} else if (diff > 0) {
|
|
707
|
-
status = "surplus";
|
|
708
|
-
} else if (diff < 0) {
|
|
709
|
-
status = "loss";
|
|
710
|
-
} else {
|
|
711
|
-
status = "equals";
|
|
712
|
-
}
|
|
713
|
-
return {
|
|
714
|
-
diff,
|
|
715
|
-
status,
|
|
716
|
-
statusLabel: STOCKTAKE_STATUS[status]
|
|
717
|
-
};
|
|
718
|
-
}
|
|
719
|
-
function applyScanQtyToStocktake(current, scanQty, type = "add") {
|
|
720
|
-
if (isBlank$2(scanQty)) {
|
|
721
|
-
return current;
|
|
722
|
-
}
|
|
723
|
-
const qtyNum = toNumber(scanQty);
|
|
724
|
-
if (Number.isNaN(qtyNum)) {
|
|
725
|
-
return current;
|
|
726
|
-
}
|
|
727
|
-
const base = isBlank$2(current) ? 0 : toNumber(current);
|
|
728
|
-
return base + (type === "minus" ? -qtyNum : qtyNum);
|
|
729
|
-
}
|
|
730
|
-
const MIN_STOCKTAKE_NUM = 0;
|
|
731
|
-
function getScanQtyDeductionBlockReason(current, scanQty, type = "add") {
|
|
732
|
-
if (type !== "minus" || isBlank$2(scanQty)) {
|
|
733
|
-
return void 0;
|
|
734
|
-
}
|
|
735
|
-
const qtyNum = Number(scanQty);
|
|
736
|
-
if (Number.isNaN(qtyNum) || qtyNum <= 0) {
|
|
737
|
-
return void 0;
|
|
738
|
-
}
|
|
739
|
-
const base = isBlank$2(current) ? 0 : toNumber(current);
|
|
740
|
-
if (base - qtyNum >= MIN_STOCKTAKE_NUM) {
|
|
741
|
-
return void 0;
|
|
742
|
-
}
|
|
743
|
-
return "当前实盘数量小于本次条码扫码数量,无法扣减";
|
|
744
|
-
}
|
|
745
|
-
function groupInventoryToStocktakeRows(records, warehouseSummary) {
|
|
746
|
-
return records.map((r) => mapInventoryRecordToRow(r, warehouseSummary));
|
|
747
|
-
}
|
|
748
|
-
async function getStockData({
|
|
749
|
-
warehouse_id_,
|
|
750
|
-
material_no_,
|
|
751
|
-
location_id_,
|
|
752
|
-
product_code_,
|
|
753
|
-
production_identification_id_,
|
|
754
|
-
stocktakeDimension
|
|
755
|
-
}) {
|
|
756
|
-
const inventoryApi = resolveStocktakeInventoryApi({ stocktakeDimension });
|
|
757
|
-
const body = {
|
|
758
|
-
warehouse_id_,
|
|
759
|
-
material_no_,
|
|
760
|
-
location_id_,
|
|
761
|
-
product_code_,
|
|
762
|
-
production_identification_id_
|
|
763
|
-
};
|
|
764
|
-
if (inventoryApi.paginated) {
|
|
765
|
-
body.pageNo = 1;
|
|
766
|
-
body.pageSize = 9999;
|
|
767
|
-
}
|
|
768
|
-
const res = await api.apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey(
|
|
769
|
-
{
|
|
770
|
-
modelCategory: inventoryApi.modelCategory,
|
|
771
|
-
bsKey: inventoryApi.bsKey,
|
|
772
|
-
modelKey: inventoryApi.modelKey
|
|
773
|
-
},
|
|
774
|
-
{},
|
|
775
|
-
body
|
|
776
|
-
);
|
|
777
|
-
if (Array.isArray(res)) return res;
|
|
778
|
-
if (Array.isArray(res?.data)) return res.data;
|
|
779
|
-
return [];
|
|
780
|
-
}
|
|
781
|
-
function isSameStocktakeIdentity(row, record, groupByWarehouse) {
|
|
782
|
-
if (row[F$6.product] !== record.product_id_) return false;
|
|
783
|
-
const rowBatch = row[F$6.batch];
|
|
784
|
-
const recordBatch = record.production_identification_id_;
|
|
785
|
-
if (rowBatch && recordBatch && rowBatch !== recordBatch) return false;
|
|
786
|
-
if (!rowBatch || !recordBatch) {
|
|
787
|
-
const rowNo = row[F$6.matno];
|
|
788
|
-
const recordNo = record.material_no_ ?? record.name_;
|
|
789
|
-
if (!(rowNo && recordNo && rowNo === recordNo)) return false;
|
|
790
|
-
}
|
|
791
|
-
if ((row[F$6.warehouse] ?? "") !== (record.warehouse_id_ ?? "")) return false;
|
|
792
|
-
if (!groupByWarehouse) {
|
|
793
|
-
if ((row[F$6.location] ?? "") !== (record.location_id_ ?? "")) return false;
|
|
794
|
-
}
|
|
795
|
-
return true;
|
|
796
|
-
}
|
|
797
|
-
function buildInventoryScanRow(record, parsed, fillData, stocktakeQty, warehouseSummary = false) {
|
|
798
|
-
const row = {
|
|
799
|
-
// 按仓库汇总时:inventory_id_ 来自接口字段,id_ 另存为 front_id_
|
|
800
|
-
[F$6.inventory]: warehouseSummary ? record[F$6.inventory] ?? record.id_ : record.id_,
|
|
801
|
-
...warehouseSummary ? { [F$6.frontId]: record.id_ } : {},
|
|
802
|
-
[F$6.batch]: record.production_identification_id_,
|
|
803
|
-
[F$6.product]: record.product_id_,
|
|
804
|
-
[F$6.productName]: record.product_id_name_,
|
|
805
|
-
[F$6.productCode]: record.product_id_code_ ?? record.product_code_,
|
|
806
|
-
[F$6.productSpec]: record.product_id_spec_,
|
|
807
|
-
[F$6.warehouse]: record.warehouse_id_,
|
|
808
|
-
[F$6.location]: record.location_id_,
|
|
809
|
-
[F$6.stock]: record.stock_num_,
|
|
810
|
-
[F$6.matno]: record.material_no_ ?? record.name_,
|
|
811
|
-
[F$6.reInspectionDate]: record.re_inspection_date_,
|
|
812
|
-
[F$6.stocktake]: stocktakeQty,
|
|
813
|
-
[F$6.rowSource]: "scan",
|
|
814
|
-
...fillData
|
|
815
|
-
};
|
|
816
|
-
const validityFromRecord = record.validate_ ?? record.validity_;
|
|
817
|
-
if (parsed.expiration) {
|
|
818
|
-
row[F$6.validity] = toDateOnly(parsed.expiration);
|
|
819
|
-
} else if (validityFromRecord != null) {
|
|
820
|
-
row[F$6.validity] = toDateOnly(validityFromRecord);
|
|
821
|
-
}
|
|
822
|
-
return row;
|
|
823
|
-
}
|
|
824
|
-
function calcRowData(rowData, stocktakeNum) {
|
|
825
|
-
const { stock_num_, stocktake_num_ } = rowData;
|
|
826
|
-
const { diff, status, statusLabel } = buildStocktakeDerived(
|
|
827
|
-
stocktake_num_,
|
|
828
|
-
stock_num_
|
|
829
|
-
);
|
|
830
|
-
rowData.diff_num_ = diff;
|
|
831
|
-
rowData.stocktake_status_ = status;
|
|
832
|
-
rowData.stocktake_status__lb_ = $t(statusLabel);
|
|
833
|
-
}
|
|
834
|
-
class StocktakeTableCore extends ProfileDrivenSubTableCore {
|
|
835
|
-
initData = [];
|
|
836
|
-
get isGroupByWarehouse() {
|
|
837
|
-
return resolveGroupByWarehouse(
|
|
838
|
-
this.bizTableConfig,
|
|
839
|
-
!!this.ctx.widget?.props?.isGroupByWarehouse
|
|
840
|
-
);
|
|
841
|
-
}
|
|
842
|
-
get paramsWarehouseId() {
|
|
843
|
-
return (this.pageCtx?.paramsConfig || {}).warehouseId;
|
|
844
|
-
}
|
|
845
|
-
get render() {
|
|
846
|
-
return window.NocodeAdapter.stocktakeRender;
|
|
847
|
-
}
|
|
848
|
-
/**
|
|
849
|
-
* 运行态禁用优先按 row_source_(manual / auto / scan),
|
|
850
|
-
* Profile READONLY_INFO_FIELDS 作为基线由 super 合并。
|
|
851
|
-
*/
|
|
852
|
-
calcFieldStatus(params) {
|
|
853
|
-
const result = super.calcFieldStatus(params);
|
|
854
|
-
const { field, rowData } = params;
|
|
855
|
-
const { row_source_: source } = rowData;
|
|
856
|
-
if (field === F$6.stocktake) return result;
|
|
857
|
-
if (!Object.values(F$6).includes(field)) return result;
|
|
858
|
-
if (source === WarehouseInventoryRowSource.SCAN) {
|
|
859
|
-
result.disabled = F$6.location !== field;
|
|
860
|
-
} else if (source === WarehouseInventoryRowSource.AUTO) {
|
|
861
|
-
result.disabled = true;
|
|
862
|
-
} else if (!source || source === WarehouseInventoryRowSource.MANUAL) {
|
|
863
|
-
result.disabled = !AUTO_LOAD_READONLY_SELECT_FIELDS.includes(field);
|
|
864
|
-
} else {
|
|
865
|
-
result.disabled = true;
|
|
866
|
-
}
|
|
867
|
-
return result;
|
|
868
|
-
}
|
|
869
|
-
calcFieldQuery = (params) => {
|
|
870
|
-
const { field, rowData } = params;
|
|
871
|
-
if (field === F$6.location && rowData[F$6.inventoryLocationIds]) {
|
|
872
|
-
return {
|
|
873
|
-
"id_.in": rowData[F$6.inventoryLocationIds]
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
if (field === F$6.product) {
|
|
877
|
-
return {
|
|
878
|
-
warehouse_id_: this.paramsWarehouseId
|
|
879
|
-
};
|
|
880
|
-
}
|
|
881
|
-
};
|
|
882
|
-
handleFieldTd = (params) => {
|
|
883
|
-
const { field, tdHandler } = params;
|
|
884
|
-
if (field === F$6.product) {
|
|
885
|
-
tdHandler.mergeTd({
|
|
886
|
-
cellWidget: {
|
|
887
|
-
props: {
|
|
888
|
-
customRenderTag: "allocateProduct",
|
|
889
|
-
stocktakeDimension: this.bizTableConfig?.stocktakeDimension ?? STOCKTAKE_DIMENSION.locationDetail,
|
|
890
|
-
newSpecificConfig: {
|
|
891
|
-
newOptions: []
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
super.handleFieldTd(params);
|
|
898
|
-
};
|
|
899
|
-
calcSubTableActionMenu = (params) => {
|
|
900
|
-
const menus = [
|
|
901
|
-
{
|
|
902
|
-
type: "subtitle",
|
|
903
|
-
label: $t("sys.edhr.bizOperation")
|
|
904
|
-
},
|
|
905
|
-
getMenuByAction(SubTableActionEnum.SCAN),
|
|
906
|
-
{
|
|
907
|
-
type: SubTableActionMenuTypeEnum.DIVIDER
|
|
908
|
-
},
|
|
909
|
-
{
|
|
910
|
-
type: "subtitle",
|
|
911
|
-
label: $t("sys.edhr.editRow")
|
|
912
|
-
},
|
|
913
|
-
getMenuByAction(SubTableActionEnum.Insert1RowAfter),
|
|
914
|
-
getInsertSubMenu(),
|
|
915
|
-
...params.showDelBtn ? [
|
|
916
|
-
{
|
|
917
|
-
type: SubTableActionMenuTypeEnum.DIVIDER
|
|
918
|
-
},
|
|
919
|
-
getMenuByAction(SubTableActionEnum.DeleteRowCurrent)
|
|
920
|
-
] : []
|
|
921
|
-
];
|
|
922
|
-
return menus;
|
|
923
|
-
};
|
|
924
|
-
async init() {
|
|
925
|
-
const config = this.bizTableConfig || {};
|
|
926
|
-
const { autoLoadStock, barcodeParsingRules, stocktakeDimension } = config;
|
|
927
|
-
if (barcodeParsingRules) {
|
|
928
|
-
this.scanRuleProps = barcodeParsingRules;
|
|
929
|
-
this.scanRuleInfo = await getParseRuleInfo({ id: this.scanRuleProps.parsingRuleId });
|
|
930
|
-
}
|
|
931
|
-
if (this.isDataProcessed || !autoLoadStock || !this.paramsWarehouseId) return;
|
|
932
|
-
const res = await getStockData({
|
|
933
|
-
warehouse_id_: this.paramsWarehouseId,
|
|
934
|
-
stocktakeDimension
|
|
935
|
-
});
|
|
936
|
-
this.initData = groupInventoryToStocktakeRows(res, this.isGroupByWarehouse).map((e) => {
|
|
937
|
-
calcRowData(e);
|
|
938
|
-
e.row_source_ = "auto";
|
|
939
|
-
return e;
|
|
940
|
-
});
|
|
941
|
-
}
|
|
942
|
-
handleInitializeFormState(_params) {
|
|
943
|
-
return this.initData;
|
|
944
|
-
}
|
|
945
|
-
handleChange(params) {
|
|
946
|
-
super.handleChange(params);
|
|
947
|
-
const { field, value, option, rowData } = params;
|
|
948
|
-
if (field === F$6.product && option && value !== void 0 && value !== null && value !== "") {
|
|
949
|
-
for (const { optionField, toField } of buildFillFromInventoryOption(
|
|
950
|
-
this.isGroupByWarehouse
|
|
951
|
-
)) {
|
|
952
|
-
rowData[toField] = option[optionField];
|
|
953
|
-
}
|
|
954
|
-
calcRowData(rowData);
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
/**
|
|
958
|
-
* 盘点扫码弹窗回传 { barcode, type };在此解析并走库存扫码接口
|
|
959
|
-
*/
|
|
960
|
-
async onScan(input) {
|
|
961
|
-
const parsed = resolveScanParsedFromInput(input, this.scanRuleInfo?.rules_);
|
|
962
|
-
if (!parsed || !hasLotOrUniqueCode(parsed)) {
|
|
963
|
-
this.error({ content: SCAN_LOT_OR_UNIQUE_REQUIRED_MSG });
|
|
964
|
-
return;
|
|
965
|
-
}
|
|
966
|
-
const records = await matchInventoryScanRecords(parsed, this.paramsWarehouseId);
|
|
967
|
-
if (!records.length) {
|
|
968
|
-
this.error({ content: SCAN_NOT_FOUND_MSG$2 });
|
|
969
|
-
return;
|
|
970
|
-
}
|
|
971
|
-
const selected = await this.pickScanRecord(records);
|
|
972
|
-
if (!selected) return;
|
|
973
|
-
const scanAdjustType = resolveScanAdjustType(input);
|
|
974
|
-
const scanQty = resolveScanQty(parsed.qty, selected.qty_);
|
|
975
|
-
const fillData = this.scanRuleProps?.fillMapArr?.length && parsed ? calcFillData(parsed, this.scanRuleProps.fillMapArr) : {};
|
|
976
|
-
const visibleRows = this.showTableData;
|
|
977
|
-
const deletedRows = this.tableData.filter((e) => e.deleted_);
|
|
978
|
-
const existIndex = visibleRows.findIndex(
|
|
979
|
-
(row2) => isSameStocktakeIdentity(row2, selected, this.isGroupByWarehouse)
|
|
980
|
-
);
|
|
981
|
-
if (existIndex >= 0) {
|
|
982
|
-
const existRow = visibleRows[existIndex];
|
|
983
|
-
const blockReason = getScanQtyDeductionBlockReason(
|
|
984
|
-
existRow[F$6.stocktake],
|
|
985
|
-
scanQty,
|
|
986
|
-
scanAdjustType
|
|
987
|
-
);
|
|
988
|
-
if (blockReason) {
|
|
989
|
-
this.error({ content: blockReason });
|
|
990
|
-
return;
|
|
991
|
-
}
|
|
992
|
-
existRow[F$6.stocktake] = applyScanQtyToStocktake(
|
|
993
|
-
existRow[F$6.stocktake],
|
|
994
|
-
scanQty,
|
|
995
|
-
scanAdjustType
|
|
996
|
-
);
|
|
997
|
-
calcRowData(existRow);
|
|
998
|
-
this.tableData = [...visibleRows, ...deletedRows];
|
|
999
|
-
return;
|
|
1000
|
-
}
|
|
1001
|
-
const stocktakeQty = applyScanQtyToStocktake(void 0, scanQty, scanAdjustType);
|
|
1002
|
-
const row = buildInventoryScanRow(
|
|
1003
|
-
selected,
|
|
1004
|
-
parsed,
|
|
1005
|
-
fillData,
|
|
1006
|
-
stocktakeQty,
|
|
1007
|
-
this.isGroupByWarehouse
|
|
1008
|
-
);
|
|
1009
|
-
calcRowData(row);
|
|
1010
|
-
this.appendOrFillScanRow(row);
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
function resolveScanParsedFromInput(input, rules) {
|
|
1014
|
-
if (input.parsedValue && typeof input.parsedValue === "object") {
|
|
1015
|
-
return input.parsedValue;
|
|
1016
|
-
}
|
|
1017
|
-
const raw = input.barcode ?? input.str;
|
|
1018
|
-
if (!raw || !rules) return void 0;
|
|
1019
|
-
return getParseRuleValue(raw, rules);
|
|
1020
|
-
}
|
|
1021
|
-
function buildAllocateScanRow(record, parsed, fillData) {
|
|
1022
|
-
const row = {
|
|
1023
|
-
[F$7.inventory]: record.id_,
|
|
1024
|
-
[F$7.product]: record.product_id_,
|
|
1025
|
-
[F$7.productName]: record.product_id_name_,
|
|
1026
|
-
[F$7.productCode]: record.product_id_code_,
|
|
1027
|
-
[F$7.productSpec]: record.product_id_spec_,
|
|
1028
|
-
[F$7.batch]: record.production_identification_id_,
|
|
1029
|
-
[F$7.originLocation]: record.location_id_,
|
|
1030
|
-
[F$7.originWarehouse]: record.warehouse_id_,
|
|
1031
|
-
[F$7.stock]: record.stock_num_,
|
|
1032
|
-
[F$7.mfgOrder]: record.mfg_order_id_,
|
|
1033
|
-
[F$7.lotSn]: record.lot_sn_id_,
|
|
1034
|
-
[F$7.uniqueCode]: record.unique_code_,
|
|
1035
|
-
[F$7.reInspectionDate]: record.re_inspection_date_,
|
|
1036
|
-
[F$7.allocateNum]: resolveScanQty(parsed.qty, record.qty_),
|
|
1037
|
-
...fillData
|
|
1038
|
-
};
|
|
1039
|
-
const validityFromRecord = record.validate_ ?? record.validity_;
|
|
1040
|
-
if (parsed.expiration) {
|
|
1041
|
-
row[F$7.validity] = toDateOnly(parsed.expiration);
|
|
1042
|
-
} else if (validityFromRecord != null) {
|
|
1043
|
-
row[F$7.validity] = toDateOnly(validityFromRecord);
|
|
1044
|
-
}
|
|
1045
|
-
return row;
|
|
1046
|
-
}
|
|
1047
|
-
class AllocateTableCore extends ProfileDrivenSubTableCore {
|
|
1048
|
-
/** 绘制UI相关工具 */
|
|
1049
|
-
get render() {
|
|
1050
|
-
return window.NocodeAdapter.allocateRender;
|
|
1051
|
-
}
|
|
1052
|
-
/** 指定的仓库id */
|
|
1053
|
-
get warehouseId() {
|
|
1054
|
-
return this.factory.ctx.paramsConfig?.warehouseId;
|
|
1055
|
-
}
|
|
1056
|
-
handleFieldTd = (params) => {
|
|
1057
|
-
const { field, tdHandler } = params;
|
|
1058
|
-
if (field === F$7.product) {
|
|
1059
|
-
tdHandler.mergeTd({
|
|
1060
|
-
cellWidget: {
|
|
1061
|
-
props: {
|
|
1062
|
-
customRenderTag: "allocateProduct",
|
|
1063
|
-
newSpecificConfig: {
|
|
1064
|
-
newOptions: []
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
super.handleFieldTd(params);
|
|
1071
|
-
};
|
|
1072
|
-
calcFieldQuery = (params) => {
|
|
1073
|
-
const { field, rowData } = params;
|
|
1074
|
-
if (field === F$7.location) {
|
|
1075
|
-
return {
|
|
1076
|
-
"warehouse_id_.eq": rowData[F$7.warehouse]
|
|
1077
|
-
};
|
|
1078
|
-
}
|
|
1079
|
-
if (field === F$7.originLocation) {
|
|
1080
|
-
return {
|
|
1081
|
-
"warehouse_id_.eq": rowData[F$7.originWarehouse]
|
|
1082
|
-
};
|
|
1083
|
-
}
|
|
1084
|
-
if (field === F$7.product) {
|
|
1085
|
-
return {
|
|
1086
|
-
warehouse_id_: this.warehouseId
|
|
1087
|
-
};
|
|
1088
|
-
}
|
|
1089
|
-
};
|
|
1090
|
-
calcSubTableActionMenu = (params) => {
|
|
1091
|
-
const { showDelBtn } = params;
|
|
1092
|
-
return [
|
|
1093
|
-
{
|
|
1094
|
-
type: SubTableActionMenuTypeEnum.SUBTITLE,
|
|
1095
|
-
label: $t("sys.edhr.bizOperation")
|
|
1096
|
-
},
|
|
1097
|
-
getMenuByAction(SubTableActionEnum.SCAN),
|
|
1098
|
-
{
|
|
1099
|
-
type: SubTableActionMenuTypeEnum.DIVIDER
|
|
1100
|
-
},
|
|
1101
|
-
{
|
|
1102
|
-
type: SubTableActionMenuTypeEnum.SUBTITLE,
|
|
1103
|
-
label: $t("sys.edhr.editRow")
|
|
1104
|
-
},
|
|
1105
|
-
getMenuByAction(SubTableActionEnum.Insert1RowAfter),
|
|
1106
|
-
getCopySubMenu(),
|
|
1107
|
-
getInsertSubMenu(),
|
|
1108
|
-
...showDelBtn ? [
|
|
1109
|
-
{
|
|
1110
|
-
type: SubTableActionMenuTypeEnum.DIVIDER
|
|
1111
|
-
},
|
|
1112
|
-
getMenuByAction(SubTableActionEnum.DeleteRowCurrent)
|
|
1113
|
-
] : []
|
|
1114
|
-
].filter(Boolean);
|
|
1115
|
-
};
|
|
1116
|
-
handleChange(params) {
|
|
1117
|
-
super.handleChange(params);
|
|
1118
|
-
const { field, value, option, rowData } = params;
|
|
1119
|
-
if (field !== F$7.product || !option || value === void 0 || value === null || value === "") {
|
|
1120
|
-
return;
|
|
1121
|
-
}
|
|
1122
|
-
for (const { optionField, toField } of FILL_FROM_INVENTORY_OPTION$3) {
|
|
1123
|
-
rowData[toField] = option[optionField];
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
async onScan(input) {
|
|
1127
|
-
const parsed = resolveScanParsedValue(input);
|
|
1128
|
-
if (!parsed || !hasLotOrUniqueCode(parsed)) {
|
|
1129
|
-
this.error({ content: SCAN_LOT_OR_UNIQUE_REQUIRED_MSG });
|
|
1130
|
-
return;
|
|
1131
|
-
}
|
|
1132
|
-
const records = await matchInventoryScanRecords(parsed, this.warehouseId);
|
|
1133
|
-
if (!records.length) {
|
|
1134
|
-
this.error({ content: SCAN_NOT_FOUND_MSG$2 });
|
|
1135
|
-
return;
|
|
1136
|
-
}
|
|
1137
|
-
const selected = await this.pickScanRecord(records);
|
|
1138
|
-
if (!selected) return;
|
|
1139
|
-
const row = buildAllocateScanRow(selected, parsed, resolveScanFillData(input));
|
|
1140
|
-
this.appendOrFillScanRow(row);
|
|
1141
|
-
}
|
|
1142
|
-
beforeBtnClick = async (params) => {
|
|
1143
|
-
const { btn } = params;
|
|
1144
|
-
if (btn.type === "Submit" && btn.buttonType === "builtin") {
|
|
1145
|
-
const calcUniqueKey = (key1, key2) => `${key1 ?? ""}:${key2 ?? ""}`;
|
|
1146
|
-
const find = this.tableData.find(
|
|
1147
|
-
(i) => calcUniqueKey(i.origin_warehouse_id_, i.origin_location_id_) === calcUniqueKey(i.warehouse_id_, i.location_id_)
|
|
1148
|
-
);
|
|
1149
|
-
if (find) {
|
|
1150
|
-
const isPass = await this.openUtil.confirmModal({
|
|
1151
|
-
content: "调拨的源仓库和目标仓库一致,是否确认执行?"
|
|
1152
|
-
});
|
|
1153
|
-
if (!isPass) {
|
|
1154
|
-
throw new Error("用户取消提交");
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
};
|
|
1159
|
-
}
|
|
1160
|
-
const F = {
|
|
1161
|
-
/** 产品 */
|
|
1162
|
-
product: "product_id_",
|
|
1163
|
-
/** 产品标签 */
|
|
1164
|
-
productLb: "product_id__lb_",
|
|
1165
|
-
/** 产品名称 */
|
|
1166
|
-
productName: "product_id_name_",
|
|
1167
|
-
/** 产品编码 */
|
|
1168
|
-
productCode: "product_id_code_",
|
|
1169
|
-
/** 产品规格 */
|
|
1170
|
-
productSpec: "product_id_spec_",
|
|
1171
|
-
/** 生产批次号 */
|
|
1172
|
-
productionContainer: "production_container_id_",
|
|
1173
|
-
/** 数量 */
|
|
1174
|
-
qty: "qty_",
|
|
1175
|
-
/** 工单号 */
|
|
1176
|
-
mfgOrderCode: "mfg_order_code_",
|
|
1177
|
-
/** 工单 */
|
|
1178
|
-
mfgOrder: "mfg_order_id_",
|
|
1179
|
-
/** 工单标签 */
|
|
1180
|
-
mfgOrderLb: "mfg_order_id__lb_",
|
|
1181
|
-
/** 生产日期 */
|
|
1182
|
-
productionDate: "production_date_"
|
|
1183
|
-
};
|
|
1184
|
-
const STERILIZE_ALWAYS_DISABLED_FIELDS = [
|
|
1185
|
-
F.product,
|
|
1186
|
-
F.productCode,
|
|
1187
|
-
F.productSpec,
|
|
1188
|
-
F.productName,
|
|
1189
|
-
F.mfgOrderCode,
|
|
1190
|
-
F.mfgOrder
|
|
1191
|
-
];
|
|
1192
|
-
const CLEAR_ON_PROD_CONTAINER_EMPTY = [
|
|
1193
|
-
F.product,
|
|
1194
|
-
F.productLb,
|
|
1195
|
-
F.productName,
|
|
1196
|
-
F.productCode,
|
|
1197
|
-
F.productSpec,
|
|
1198
|
-
F.qty,
|
|
1199
|
-
F.mfgOrderCode,
|
|
1200
|
-
F.mfgOrder,
|
|
1201
|
-
F.mfgOrderLb,
|
|
1202
|
-
F.productionDate
|
|
1203
|
-
];
|
|
1204
|
-
const fillFromOption = [
|
|
1205
|
-
{
|
|
1206
|
-
optionField: F.product,
|
|
1207
|
-
toField: F.product
|
|
1208
|
-
},
|
|
1209
|
-
{
|
|
1210
|
-
optionField: F.productName,
|
|
1211
|
-
toField: F.productName
|
|
1212
|
-
},
|
|
1213
|
-
{
|
|
1214
|
-
optionField: F.productCode,
|
|
1215
|
-
toField: F.productCode
|
|
1216
|
-
},
|
|
1217
|
-
{
|
|
1218
|
-
optionField: F.productSpec,
|
|
1219
|
-
toField: F.productSpec
|
|
1220
|
-
},
|
|
1221
|
-
{
|
|
1222
|
-
optionField: F.mfgOrder,
|
|
1223
|
-
toField: F.mfgOrder
|
|
1224
|
-
},
|
|
1225
|
-
{
|
|
1226
|
-
optionField: F.mfgOrderCode,
|
|
1227
|
-
//工单号
|
|
1228
|
-
toField: F.mfgOrderCode
|
|
1229
|
-
},
|
|
1230
|
-
{
|
|
1231
|
-
optionField: "real_start_date_",
|
|
1232
|
-
//生产日期
|
|
1233
|
-
toField: F.productionDate
|
|
1234
|
-
},
|
|
1235
|
-
{
|
|
1236
|
-
optionField: F.qty,
|
|
1237
|
-
toField: F.qty
|
|
1238
|
-
}
|
|
1239
|
-
];
|
|
1240
|
-
function applyFillFromOption(A, B) {
|
|
1241
|
-
const writableA = A;
|
|
1242
|
-
fillFromOption.forEach(({ optionField, toField }) => {
|
|
1243
|
-
if (has(B, optionField)) {
|
|
1244
|
-
writableA[toField] = toField === F.productionDate ? toDateOnly(B[optionField]) : B[optionField];
|
|
1245
|
-
}
|
|
1246
|
-
});
|
|
1247
|
-
return A;
|
|
1248
|
-
}
|
|
1249
|
-
function mapContainerRowsToOptions(data = []) {
|
|
1250
|
-
return data.map((item) => ({
|
|
1251
|
-
label: resolveLotDisplayLabel(item, item.name_),
|
|
1252
|
-
value: item.id_ || item.id,
|
|
1253
|
-
disabled: !!item.deleted_,
|
|
1254
|
-
_item: item
|
|
1255
|
-
}));
|
|
1256
|
-
}
|
|
1257
|
-
const SCAN_NOT_FOUND_MSG$1 = "扫描的物料批次不存在";
|
|
1258
|
-
function buildEntrustScanRow(record, parsed, fillData) {
|
|
1259
|
-
return {
|
|
1260
|
-
[F.productionContainer]: record.lot_sn_id_ ?? record.production_container_id_,
|
|
1261
|
-
[F.product]: record.product_id_,
|
|
1262
|
-
[F.productName]: record.product_id_name_,
|
|
1263
|
-
[F.productCode]: record.product_id_code_,
|
|
1264
|
-
[F.productSpec]: record.product_id_spec_,
|
|
1265
|
-
[F.mfgOrderCode]: record.mfg_order_code_,
|
|
1266
|
-
[F.mfgOrder]: record.mfg_order_id_,
|
|
1267
|
-
[F.qty]: parsed.qty ?? record.qty_,
|
|
1268
|
-
[F.productionDate]: toDateOnly(record.production_date_),
|
|
1269
|
-
...fillData
|
|
1270
|
-
};
|
|
1271
|
-
}
|
|
1272
|
-
class SterilizeBatchTableCore extends SubTableCore {
|
|
1273
|
-
/** 绘制UI相关工具,复用调拨表扫码弹窗 */
|
|
1274
|
-
get render() {
|
|
1275
|
-
return window.NocodeAdapter.allocateRender;
|
|
1276
|
-
}
|
|
1277
|
-
async init() {
|
|
1278
|
-
const { barcodeParsingRules } = this.bizTableConfig || {};
|
|
1279
|
-
if (barcodeParsingRules) {
|
|
1280
|
-
this.scanRuleProps = barcodeParsingRules;
|
|
1281
|
-
this.scanRuleInfo = await getParseRuleInfo({ id: this.scanRuleProps.parsingRuleId });
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
calcSubTableActionMenu = (params) => {
|
|
1285
|
-
const { showDelBtn } = params;
|
|
1286
|
-
return [
|
|
1287
|
-
{
|
|
1288
|
-
type: SubTableActionMenuTypeEnum.SUBTITLE,
|
|
1289
|
-
label: $t("sys.edhr.bizOperation")
|
|
1290
|
-
},
|
|
1291
|
-
getMenuByAction(SubTableActionEnum.SCAN),
|
|
1292
|
-
{
|
|
1293
|
-
type: SubTableActionMenuTypeEnum.DIVIDER
|
|
1294
|
-
},
|
|
1295
|
-
{
|
|
1296
|
-
type: SubTableActionMenuTypeEnum.SUBTITLE,
|
|
1297
|
-
label: $t("sys.edhr.editRow")
|
|
1298
|
-
},
|
|
1299
|
-
getMenuByAction(SubTableActionEnum.Insert1RowAfter),
|
|
1300
|
-
getInsertSubMenu(),
|
|
1301
|
-
...showDelBtn ? [
|
|
1302
|
-
{
|
|
1303
|
-
type: SubTableActionMenuTypeEnum.DIVIDER
|
|
1304
|
-
},
|
|
1305
|
-
getMenuByAction(SubTableActionEnum.DeleteRowCurrent)
|
|
1306
|
-
] : []
|
|
1307
|
-
].filter(Boolean);
|
|
1308
|
-
};
|
|
1309
|
-
handleFieldTd = (params) => {
|
|
1310
|
-
const { field, tdHandler } = params;
|
|
1311
|
-
if (field === F.productionContainer) {
|
|
1312
|
-
tdHandler.mergeTd({
|
|
1313
|
-
cellWidget: {
|
|
1314
|
-
props: {
|
|
1315
|
-
newSpecificConfig: {
|
|
1316
|
-
newOptions: []
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
});
|
|
1321
|
-
}
|
|
1322
|
-
super.handleFieldTd(params);
|
|
1323
|
-
};
|
|
1324
|
-
calcFieldStatus(params) {
|
|
1325
|
-
const result = super.calcFieldStatus(params);
|
|
1326
|
-
if (STERILIZE_ALWAYS_DISABLED_FIELDS.includes(params.field)) {
|
|
1327
|
-
result.disabled = true;
|
|
1328
|
-
}
|
|
1329
|
-
return result;
|
|
1330
|
-
}
|
|
1331
|
-
calcFieldDataSource = (params) => {
|
|
1332
|
-
const { field } = params;
|
|
1333
|
-
if (field !== F.productionContainer) return;
|
|
1334
|
-
const loader = async (loaderParams) => {
|
|
1335
|
-
const { mode, queryData = {}, pageNo = 1, pageSize = 100, ids = [] } = loaderParams;
|
|
1336
|
-
const keyword = mode === "byIds" ? "" : extractKeywordFromQueryData(queryData) || "";
|
|
1337
|
-
const { queryData: query, exp } = composeProductionLotListQuery(queryData, keyword);
|
|
1338
|
-
if (mode === "byIds" && ids.length) {
|
|
1339
|
-
query["id_.in"] = ids;
|
|
1340
|
-
}
|
|
1341
|
-
const res = await api.apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey(
|
|
1342
|
-
{
|
|
1343
|
-
modelCategory: "entity",
|
|
1344
|
-
modelKey: "em_production_identification",
|
|
1345
|
-
bsKey: "biz_get_production_identification"
|
|
1346
|
-
},
|
|
1347
|
-
{},
|
|
1348
|
-
{
|
|
1349
|
-
exp,
|
|
1350
|
-
query,
|
|
1351
|
-
pageNo,
|
|
1352
|
-
pageSize,
|
|
1353
|
-
sorts: [{ sortField: "create_time_", sortType: "desc" }]
|
|
1354
|
-
}
|
|
1355
|
-
);
|
|
1356
|
-
const data = res?.data || [];
|
|
1357
|
-
const dict = res?.dict;
|
|
1358
|
-
const totalCount = Number(res?.totalCount ?? data.length);
|
|
1359
|
-
const totalPage = Number(res?.totalPage ?? Math.max(1, Math.ceil(totalCount / pageSize)));
|
|
1360
|
-
const options = mapContainerRowsToOptions(data);
|
|
1361
|
-
if (mode === "byIds") {
|
|
1362
|
-
return {
|
|
1363
|
-
data,
|
|
1364
|
-
dict,
|
|
1365
|
-
options,
|
|
1366
|
-
finished: true,
|
|
1367
|
-
totalCount
|
|
1368
|
-
};
|
|
1369
|
-
}
|
|
1370
|
-
return {
|
|
1371
|
-
data,
|
|
1372
|
-
dict,
|
|
1373
|
-
options,
|
|
1374
|
-
finished: pageNo >= totalPage,
|
|
1375
|
-
totalCount,
|
|
1376
|
-
totalPage
|
|
1377
|
-
};
|
|
1378
|
-
};
|
|
1379
|
-
return loader;
|
|
1380
|
-
};
|
|
1381
|
-
handleChange = (params) => {
|
|
1382
|
-
const { field, option, value, rowData } = params;
|
|
1383
|
-
if (field !== F.productionContainer) return;
|
|
1384
|
-
if (option) {
|
|
1385
|
-
applyFillFromOption(rowData, option._item ?? option);
|
|
1386
|
-
return;
|
|
1387
|
-
}
|
|
1388
|
-
if (value == null || value === "") {
|
|
1389
|
-
CLEAR_ON_PROD_CONTAINER_EMPTY.forEach((key) => {
|
|
1390
|
-
rowData[key] = void 0;
|
|
1391
|
-
});
|
|
1392
|
-
}
|
|
1393
|
-
};
|
|
1394
|
-
prepareSubmitFormState(formState) {
|
|
1395
|
-
const rows = formState[this.subFieldKey];
|
|
1396
|
-
if (!Array.isArray(rows)) return;
|
|
1397
|
-
rows.forEach((row) => {
|
|
1398
|
-
if (row?.[F.productionDate] != null && row[F.productionDate] !== "") {
|
|
1399
|
-
row[F.productionDate] = toDateOnly(row[F.productionDate]);
|
|
1400
|
-
}
|
|
1401
|
-
});
|
|
1402
|
-
}
|
|
1403
|
-
async onScan(input) {
|
|
1404
|
-
const parsed = resolveScanParsedValue(input);
|
|
1405
|
-
if (!parsed || !hasProductionIdentificationScanKey(parsed)) {
|
|
1406
|
-
this.error({ content: PRODUCTION_IDENTIFICATION_SCAN_LOT_OR_UNIQUE_REQUIRED_MSG });
|
|
1407
|
-
return;
|
|
1408
|
-
}
|
|
1409
|
-
const records = await matchProductionIdentificationScanRecords(parsed);
|
|
1410
|
-
if (!records.length) {
|
|
1411
|
-
this.error({ content: SCAN_NOT_FOUND_MSG$1 });
|
|
1412
|
-
return;
|
|
1413
|
-
}
|
|
1414
|
-
const selected = await this.pickScanRecord(records);
|
|
1415
|
-
if (!selected) return;
|
|
1416
|
-
const row = buildEntrustScanRow(selected, parsed, resolveScanFillData(input));
|
|
1417
|
-
this.appendOrFillScanRow(row);
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
function mapRefRowsToOptions(data = [], labelKey = "name_", displayRelatedParent = false) {
|
|
1421
|
-
return data.map((item) => ({
|
|
1422
|
-
label: displayRelatedParent ? resolveLotDisplayLabel(item, item[labelKey]) : item.__LABEL__ ?? item[labelKey] ?? String(item.id_ ?? item.id ?? ""),
|
|
1423
|
-
value: item.id_ || item.id,
|
|
1424
|
-
disabled: !!item.deleted_,
|
|
1425
|
-
_item: item
|
|
1426
|
-
}));
|
|
1427
|
-
}
|
|
1428
|
-
function createProductionContainerLoader() {
|
|
1429
|
-
return async (loaderParams) => {
|
|
1430
|
-
const { mode, queryData = {}, pageNo = 1, pageSize = 100, ids = [] } = loaderParams;
|
|
1431
|
-
const keyword = mode === "byIds" ? "" : extractKeywordFromQueryData(queryData) || "";
|
|
1432
|
-
const { queryData: query, exp } = composeProductionLotListQuery(queryData, keyword);
|
|
1433
|
-
if (mode === "byIds" && ids.length) {
|
|
1434
|
-
query["id_.in"] = ids;
|
|
1435
|
-
}
|
|
1436
|
-
const res = await api.apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey(
|
|
1437
|
-
{
|
|
1438
|
-
modelCategory: "entity",
|
|
1439
|
-
modelKey: "em_production_identification",
|
|
1440
|
-
bsKey: "biz_get_production_identification"
|
|
1441
|
-
},
|
|
1442
|
-
{},
|
|
1443
|
-
{
|
|
1444
|
-
exp,
|
|
1445
|
-
query,
|
|
1446
|
-
pageNo,
|
|
1447
|
-
pageSize,
|
|
1448
|
-
sorts: [{ sortField: "create_time_", sortType: "desc" }]
|
|
1449
|
-
}
|
|
1450
|
-
);
|
|
1451
|
-
const data = res?.data || [];
|
|
1452
|
-
const dict = res?.dict;
|
|
1453
|
-
const totalCount = Number(res?.totalCount ?? data.length);
|
|
1454
|
-
const totalPage = Number(res?.totalPage ?? Math.max(1, Math.ceil(totalCount / pageSize)));
|
|
1455
|
-
const options = mapRefRowsToOptions(data, "name_", true);
|
|
1456
|
-
if (mode === "byIds") {
|
|
1457
|
-
return {
|
|
1458
|
-
data,
|
|
1459
|
-
dict,
|
|
1460
|
-
options,
|
|
1461
|
-
finished: true,
|
|
1462
|
-
totalCount
|
|
1463
|
-
};
|
|
1464
|
-
}
|
|
1465
|
-
return {
|
|
1466
|
-
data,
|
|
1467
|
-
dict,
|
|
1468
|
-
options,
|
|
1469
|
-
finished: pageNo >= totalPage,
|
|
1470
|
-
totalCount,
|
|
1471
|
-
totalPage
|
|
1472
|
-
};
|
|
1473
|
-
};
|
|
1474
|
-
}
|
|
1475
|
-
function createMfgOrderLoader() {
|
|
1476
|
-
return async (loaderParams) => {
|
|
1477
|
-
const pageSize = 99;
|
|
1478
|
-
const { mode, queryData = {}, pageNo = 1, ids = [] } = loaderParams;
|
|
1479
|
-
const query = { ...queryData };
|
|
1480
|
-
if (mode === "byIds" && ids.length) {
|
|
1481
|
-
query["id_.in"] = ids;
|
|
1482
|
-
} else {
|
|
1483
|
-
const keyword = extractKeywordFromQueryData(queryData);
|
|
1484
|
-
if (keyword && !query["code_.like"] && !query["code_.iLike"]) {
|
|
1485
|
-
query["code_.like"] = keyword;
|
|
1486
|
-
}
|
|
1487
|
-
}
|
|
1488
|
-
const res = await api.apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey(
|
|
1489
|
-
{
|
|
1490
|
-
modelCategory: "entity",
|
|
1491
|
-
modelKey: "em_mfg_order",
|
|
1492
|
-
bsKey: "biz_formListByPage"
|
|
1493
|
-
},
|
|
1494
|
-
{},
|
|
1495
|
-
{
|
|
1496
|
-
query,
|
|
1497
|
-
pageNo,
|
|
1498
|
-
pageSize,
|
|
1499
|
-
sorts: [{ sortField: "create_time_", sortType: "desc" }]
|
|
1500
|
-
}
|
|
1501
|
-
);
|
|
1502
|
-
const data = res?.data || [];
|
|
1503
|
-
const totalCount = Number(res?.totalCount ?? data.length);
|
|
1504
|
-
const totalPage = Number(res?.totalPage ?? Math.max(1, Math.ceil(totalCount / pageSize)));
|
|
1505
|
-
const options = mapRefRowsToOptions(data, "code_");
|
|
1506
|
-
if (mode === "byIds") {
|
|
1507
|
-
return {
|
|
1508
|
-
options,
|
|
1509
|
-
finished: true,
|
|
1510
|
-
totalCount
|
|
1511
|
-
};
|
|
1512
|
-
}
|
|
1513
|
-
return {
|
|
1514
|
-
data,
|
|
1515
|
-
options,
|
|
1516
|
-
finished: pageNo >= totalPage,
|
|
1517
|
-
totalCount,
|
|
1518
|
-
totalPage
|
|
1519
|
-
};
|
|
1520
|
-
};
|
|
1521
|
-
}
|
|
1522
|
-
function createMaterialContainerLoader() {
|
|
1523
|
-
return async (loaderParams) => {
|
|
1524
|
-
const { mode, queryData = {}, pageNo = 1, pageSize = 100, ids = [] } = loaderParams;
|
|
1525
|
-
const query = {
|
|
1526
|
-
...queryData,
|
|
1527
|
-
"production_identification_type_.eq": "MATERIAL",
|
|
1528
|
-
"production_identification_type_.isNull": null,
|
|
1529
|
-
"container_role_.ne": LOT_CONTAINER_ROLE.RELATED_PARENT
|
|
1530
|
-
};
|
|
1531
|
-
const keyword = query["material_no_.like"] ?? query["name_.like"];
|
|
1532
|
-
if (keyword) {
|
|
1533
|
-
delete query["material_no_.like"];
|
|
1534
|
-
query["name_.like"] = keyword;
|
|
1535
|
-
}
|
|
1536
|
-
if (mode === "byIds" && ids.length) {
|
|
1537
|
-
query["id_.in"] = ids;
|
|
1538
|
-
}
|
|
1539
|
-
const res = await api.apaas.modelComprehensive.postBizServiceGeneralModelCategoryModelKeyBsKey(
|
|
1540
|
-
{
|
|
1541
|
-
modelCategory: "entity",
|
|
1542
|
-
modelKey: "em_production_identification",
|
|
1543
|
-
bsKey: "biz_get_production_identification"
|
|
1544
|
-
},
|
|
1545
|
-
{},
|
|
1546
|
-
{
|
|
1547
|
-
exp: "AND(OR(production_identification_type_.eq,production_identification_type_.isNull),container_role_.ne)",
|
|
1548
|
-
query,
|
|
1549
|
-
pageNo,
|
|
1550
|
-
pageSize
|
|
1551
|
-
}
|
|
1552
|
-
);
|
|
1553
|
-
const data = res?.data || [];
|
|
1554
|
-
const dict = res?.dict;
|
|
1555
|
-
const totalCount = Number(res?.totalCount ?? data.length);
|
|
1556
|
-
const totalPage = Number(res?.totalPage ?? Math.max(1, Math.ceil(totalCount / pageSize)));
|
|
1557
|
-
if (mode === "byIds") {
|
|
1558
|
-
return {
|
|
1559
|
-
data,
|
|
1560
|
-
dict,
|
|
1561
|
-
options: [],
|
|
1562
|
-
finished: true,
|
|
1563
|
-
totalCount
|
|
1564
|
-
};
|
|
1565
|
-
}
|
|
1566
|
-
return {
|
|
1567
|
-
data,
|
|
1568
|
-
dict,
|
|
1569
|
-
finished: pageNo >= totalPage,
|
|
1570
|
-
totalCount,
|
|
1571
|
-
totalPage
|
|
1572
|
-
};
|
|
1573
|
-
};
|
|
1574
|
-
}
|
|
1575
|
-
function isBlank$1(value) {
|
|
1576
|
-
return value === void 0 || value === null || value === "";
|
|
1577
|
-
}
|
|
1578
|
-
const SCAN_NOT_FOUND_MSG = "扫描的批次/物料不存在";
|
|
1579
|
-
function isProductionLotOrSn(record) {
|
|
1580
|
-
const type = record.production_identification_type_;
|
|
1581
|
-
return type === "LOT" || type === "SN";
|
|
1582
|
-
}
|
|
1583
|
-
function buildProductionContainerRow(record, parsed, fillData) {
|
|
1584
|
-
return {
|
|
1585
|
-
[F$8.productionContainer]: record.lot_sn_id_ ?? record.production_container_id_,
|
|
1586
|
-
[F$8.product]: record.product_id_,
|
|
1587
|
-
[F$8.productName]: record.product_id_name_,
|
|
1588
|
-
[F$8.productCode]: record.product_id_code_,
|
|
1589
|
-
[F$8.productSpec]: record.product_id_spec_,
|
|
1590
|
-
[F$8.mfgOrderCode]: record.mfg_order_code_,
|
|
1591
|
-
[F$8.qty]: parsed.qty ?? record.qty_,
|
|
1592
|
-
[F$8.productionDate]: toDateOnly(record.production_date_),
|
|
1593
|
-
[F$8.materialContainerNo]: void 0,
|
|
1594
|
-
[MATERIAL_CONTAINER_ID]: void 0,
|
|
1595
|
-
[F$8.mfgOrder]: void 0,
|
|
1596
|
-
...fillData
|
|
1597
|
-
};
|
|
1598
|
-
}
|
|
1599
|
-
function buildMaterialContainerRow(record, parsed, fillData) {
|
|
1600
|
-
return {
|
|
1601
|
-
[F$8.materialContainerNo]: record.material_no_,
|
|
1602
|
-
[MATERIAL_CONTAINER_ID]: record.production_identification_id_,
|
|
1603
|
-
[F$8.product]: record.product_id_,
|
|
1604
|
-
[F$8.productName]: record.product_id_name_,
|
|
1605
|
-
[F$8.productCode]: record.product_id_code_,
|
|
1606
|
-
[F$8.productSpec]: record.product_id_spec_,
|
|
1607
|
-
[F$8.mfgOrderCode]: record.mfg_order_code_,
|
|
1608
|
-
[F$8.mfgOrder]: record.mfg_order_id_,
|
|
1609
|
-
[F$8.qty]: parsed.qty ?? record.qty_,
|
|
1610
|
-
[F$8.productionContainer]: void 0,
|
|
1611
|
-
...fillData
|
|
1612
|
-
};
|
|
1613
|
-
}
|
|
1614
|
-
class PretreatmentListTableCore extends ProfileDrivenSubTableCore {
|
|
1615
|
-
/** 绘制UI相关工具,复用调拨表扫码弹窗 */
|
|
1616
|
-
get render() {
|
|
1617
|
-
return window.NocodeAdapter.allocateRender;
|
|
1618
|
-
}
|
|
1619
|
-
async init() {
|
|
1620
|
-
const { barcodeParsingRules } = this.bizTableConfig || {};
|
|
1621
|
-
if (barcodeParsingRules) {
|
|
1622
|
-
this.scanRuleProps = barcodeParsingRules;
|
|
1623
|
-
this.scanRuleInfo = await getParseRuleInfo({ id: this.scanRuleProps.parsingRuleId });
|
|
1624
|
-
}
|
|
1625
|
-
}
|
|
1626
|
-
calcSubTableActionMenu = (params) => {
|
|
1627
|
-
const { showDelBtn } = params;
|
|
1628
|
-
return [
|
|
1629
|
-
{
|
|
1630
|
-
type: SubTableActionMenuTypeEnum.SUBTITLE,
|
|
1631
|
-
label: $t("sys.edhr.bizOperation")
|
|
1632
|
-
},
|
|
1633
|
-
getMenuByAction(SubTableActionEnum.SCAN),
|
|
1634
|
-
{
|
|
1635
|
-
type: SubTableActionMenuTypeEnum.DIVIDER
|
|
1636
|
-
},
|
|
1637
|
-
{
|
|
1638
|
-
type: SubTableActionMenuTypeEnum.SUBTITLE,
|
|
1639
|
-
label: $t("sys.edhr.editRow")
|
|
1640
|
-
},
|
|
1641
|
-
getMenuByAction(SubTableActionEnum.Insert1RowAfter),
|
|
1642
|
-
getInsertSubMenu(),
|
|
1643
|
-
...showDelBtn ? [
|
|
1644
|
-
{
|
|
1645
|
-
type: SubTableActionMenuTypeEnum.DIVIDER
|
|
1646
|
-
},
|
|
1647
|
-
getMenuByAction(SubTableActionEnum.DeleteRowCurrent)
|
|
1648
|
-
] : []
|
|
1649
|
-
].filter(Boolean);
|
|
1650
|
-
};
|
|
1651
|
-
calcFieldStatus(params) {
|
|
1652
|
-
const result = super.calcFieldStatus(params);
|
|
1653
|
-
const { field, rowData } = params;
|
|
1654
|
-
if (field === F$8.product) {
|
|
1655
|
-
result.disabled = !isProductManuallyEditable(rowData);
|
|
1656
|
-
}
|
|
1657
|
-
return result;
|
|
1658
|
-
}
|
|
1659
|
-
calcFieldDataSource = (params) => {
|
|
1660
|
-
const { field } = params;
|
|
1661
|
-
if (field === F$8.productionContainer) return createProductionContainerLoader();
|
|
1662
|
-
if (field === F$8.mfgOrder) return createMfgOrderLoader();
|
|
1663
|
-
if (field === F$8.materialContainerNo) return createMaterialContainerLoader();
|
|
1664
|
-
};
|
|
1665
|
-
handleChange(params) {
|
|
1666
|
-
super.handleChange(params);
|
|
1667
|
-
const { field, option, value, rowData } = params;
|
|
1668
|
-
if (!option || isBlank$1(value)) return;
|
|
1669
|
-
const source = option._item ?? option;
|
|
1670
|
-
if (field === F$8.mfgOrder) {
|
|
1671
|
-
applyFillFromMfgOrderOption(rowData, source);
|
|
1672
|
-
return;
|
|
1673
|
-
}
|
|
1674
|
-
if (field === F$8.productionContainer || field === F$8.materialContainerNo) {
|
|
1675
|
-
applyFillFromOption$1(rowData, source);
|
|
1676
|
-
return;
|
|
1677
|
-
}
|
|
1678
|
-
if (field === F$8.product) {
|
|
1679
|
-
applyFillFromProductOption(rowData, source);
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
1682
|
-
async onScan(input) {
|
|
1683
|
-
const parsed = resolveScanParsedValue(input);
|
|
1684
|
-
if (!parsed || !hasProductionIdentificationScanKey(parsed)) {
|
|
1685
|
-
this.error({ content: PRODUCTION_IDENTIFICATION_SCAN_LOT_OR_UNIQUE_REQUIRED_MSG });
|
|
1686
|
-
return;
|
|
1687
|
-
}
|
|
1688
|
-
const records = await matchProductionIdentificationScanRecords(parsed);
|
|
1689
|
-
if (!records.length) {
|
|
1690
|
-
this.error({ content: SCAN_NOT_FOUND_MSG });
|
|
1691
|
-
return;
|
|
1692
|
-
}
|
|
1693
|
-
const selected = await this.pickScanRecord(records);
|
|
1694
|
-
if (!selected) return;
|
|
1695
|
-
const fillData = resolveScanFillData(input);
|
|
1696
|
-
const row = isProductionLotOrSn(selected) ? buildProductionContainerRow(selected, parsed, fillData) : buildMaterialContainerRow(selected, parsed, fillData);
|
|
1697
|
-
this.appendOrFillScanRow(row);
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
function buildWarehouseInScanRow(record, parsed, fillData) {
|
|
1701
|
-
const row = {
|
|
1702
|
-
[F$9.product]: record.product_id_,
|
|
1703
|
-
[F$9.productName]: record.product_id_name_,
|
|
1704
|
-
[F$9.productCode]: record.product_id_code_,
|
|
1705
|
-
[F$9.productSpec]: record.product_id_spec_,
|
|
1706
|
-
[F$9.materialNo]: record.material_no_,
|
|
1707
|
-
[F$9.materialNoId]: record.production_identification_id_,
|
|
1708
|
-
[F$9.mfgOrder]: record.mfg_order_id_,
|
|
1709
|
-
[F$9.lotSn]: record.lot_sn_id_,
|
|
1710
|
-
[F$9.uniqueCode]: record.unique_code_,
|
|
1711
|
-
[F$9.reInspectionDate]: record.re_inspection_date_,
|
|
1712
|
-
[F$9.qty]: resolveScanQty(parsed.qty, record.qty_),
|
|
1713
|
-
...fillData
|
|
1714
|
-
};
|
|
1715
|
-
const validityFromRecord = record.validity_;
|
|
1716
|
-
if (parsed.expiration && row[F$9.validity] == null) {
|
|
1717
|
-
row[F$9.validity] = toDateOnly(parsed.expiration);
|
|
1718
|
-
} else if (validityFromRecord != null && row[F$9.validity] == null) {
|
|
1719
|
-
row[F$9.validity] = toDateOnly(validityFromRecord);
|
|
1720
|
-
}
|
|
1721
|
-
return row;
|
|
1722
|
-
}
|
|
1723
|
-
function isBlank(value) {
|
|
1724
|
-
return value === void 0 || value === null || value === "";
|
|
1725
|
-
}
|
|
1726
|
-
function resolveOptionRecord(option) {
|
|
1727
|
-
if (!option) return void 0;
|
|
1728
|
-
const nested = option._item;
|
|
1729
|
-
if (nested && typeof nested === "object") {
|
|
1730
|
-
return nested;
|
|
1731
|
-
}
|
|
1732
|
-
return option;
|
|
1733
|
-
}
|
|
1734
|
-
class WarehouseInTableCore extends ProfileDrivenSubTableCore {
|
|
1735
|
-
isEmptyScanRow(row) {
|
|
1736
|
-
return isProductBatchEmptyRow(row);
|
|
1737
|
-
}
|
|
1738
|
-
handleFieldTd = (params) => {
|
|
1739
|
-
const { field, tdHandler } = params;
|
|
1740
|
-
if (field === F$9.product) {
|
|
1741
|
-
const current = tdHandler.td.cellWidget?.props;
|
|
1742
|
-
const searchFields = current?.quickSearchField ?? PRODUCT_QUICK_SEARCH_FIELDS;
|
|
1743
|
-
tdHandler.mergeTd({
|
|
1744
|
-
cellWidget: {
|
|
1745
|
-
props: {
|
|
1746
|
-
quickSearchable: searchFields.length > 0,
|
|
1747
|
-
...current?.quickSearchField !== void 0 ? {} : {
|
|
1748
|
-
quickSearchField: [...PRODUCT_QUICK_SEARCH_FIELDS],
|
|
1749
|
-
quickSearchExp: PRODUCT_QUICK_SEARCH_EXP
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
}
|
|
1753
|
-
});
|
|
1754
|
-
}
|
|
1755
|
-
super.handleFieldTd(params);
|
|
1756
|
-
};
|
|
1757
|
-
calcFieldStatus(params) {
|
|
1758
|
-
const result = super.calcFieldStatus(params);
|
|
1759
|
-
if (params.field === F$9.product) {
|
|
1760
|
-
result.disabled = !isProductManuallyEditable$1(params.rowData);
|
|
1761
|
-
}
|
|
1762
|
-
return result;
|
|
1763
|
-
}
|
|
1764
|
-
handleChange(params) {
|
|
1765
|
-
super.handleChange(params);
|
|
1766
|
-
const { field, value, option, rowData } = params;
|
|
1767
|
-
if (isBlank(value) || !option) return;
|
|
1768
|
-
const source = resolveOptionRecord(option);
|
|
1769
|
-
if (!source) return;
|
|
1770
|
-
if (field === F$9.materialNo) {
|
|
1771
|
-
applyFillFromMaterialNoOption(rowData, source);
|
|
1772
|
-
return;
|
|
1773
|
-
}
|
|
1774
|
-
if (field === F$9.product) {
|
|
1775
|
-
applyFillFromProductOption$1(rowData, source);
|
|
1776
|
-
}
|
|
1777
|
-
}
|
|
1778
|
-
calcSubTableActionMenu = (params) => {
|
|
1779
|
-
const { showDelBtn } = params;
|
|
1780
|
-
return [
|
|
1781
|
-
{
|
|
1782
|
-
type: SubTableActionMenuTypeEnum.SUBTITLE,
|
|
1783
|
-
label: $t("sys.edhr.bizOperation")
|
|
1784
|
-
},
|
|
1785
|
-
getMenuByAction(SubTableActionEnum.SCAN),
|
|
1786
|
-
{
|
|
1787
|
-
type: SubTableActionMenuTypeEnum.DIVIDER
|
|
1788
|
-
},
|
|
1789
|
-
{
|
|
1790
|
-
type: SubTableActionMenuTypeEnum.SUBTITLE,
|
|
1791
|
-
label: $t("sys.edhr.editRow")
|
|
1792
|
-
},
|
|
1793
|
-
getMenuByAction(SubTableActionEnum.Insert1RowAfter),
|
|
1794
|
-
getCopySubMenu(),
|
|
1795
|
-
getInsertSubMenu(),
|
|
1796
|
-
...showDelBtn ? [
|
|
1797
|
-
{
|
|
1798
|
-
type: SubTableActionMenuTypeEnum.DIVIDER
|
|
1799
|
-
},
|
|
1800
|
-
getMenuByAction(SubTableActionEnum.DeleteRowCurrent)
|
|
1801
|
-
] : []
|
|
1802
|
-
].filter(Boolean);
|
|
1803
|
-
};
|
|
1804
|
-
async onScan(input) {
|
|
1805
|
-
const parsed = resolveScanParsedValue(input);
|
|
1806
|
-
if (!parsed || !hasProductionIdentificationScanKey(parsed)) {
|
|
1807
|
-
this.error({ content: PRODUCTION_IDENTIFICATION_SCAN_LOT_OR_UNIQUE_REQUIRED_MSG });
|
|
1808
|
-
return;
|
|
1809
|
-
}
|
|
1810
|
-
const records = await matchProductionIdentificationScanRecords(parsed);
|
|
1811
|
-
if (!records.length) {
|
|
1812
|
-
this.error({ content: PRODUCTION_IDENTIFICATION_SCAN_NOT_FOUND_MSG });
|
|
1813
|
-
return;
|
|
1814
|
-
}
|
|
1815
|
-
const selected = await this.pickScanRecord(records);
|
|
1816
|
-
if (!selected) return;
|
|
1817
|
-
const row = buildWarehouseInScanRow(selected, parsed, resolveScanFillData(input));
|
|
1818
|
-
this.appendOrFillScanRow(row);
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
function isSameMaterialBatch(row, record) {
|
|
1822
|
-
if (row[F$a.product] !== record.product_id_) return false;
|
|
1823
|
-
const rowBatchId = row[F$a.materialNoId];
|
|
1824
|
-
const recordBatchId = record.production_identification_id_;
|
|
1825
|
-
if (rowBatchId && recordBatchId) return rowBatchId === recordBatchId;
|
|
1826
|
-
const rowBatchNo = row[F$a.materialNo];
|
|
1827
|
-
const recordBatchNo = record.material_no_ ?? record.name_;
|
|
1828
|
-
return Boolean(rowBatchNo && recordBatchNo && rowBatchNo === recordBatchNo);
|
|
1829
|
-
}
|
|
1830
|
-
function buildWarehouseOutScanRow(record, parsed, fillData, qty) {
|
|
1831
|
-
const row = {
|
|
1832
|
-
[F$a.inventory]: record.id_,
|
|
1833
|
-
[F$a.product]: record.product_id_,
|
|
1834
|
-
[F$a.productName]: record.product_id_name_,
|
|
1835
|
-
[F$a.productCode]: record.product_id_code_,
|
|
1836
|
-
[F$a.productSpec]: record.product_id_spec_,
|
|
1837
|
-
[F$a.materialNo]: record.material_no_,
|
|
1838
|
-
[F$a.materialNoId]: record.production_identification_id_,
|
|
1839
|
-
[F$a.warehouse]: record.warehouse_id_,
|
|
1840
|
-
[F$a.location]: record.location_id_,
|
|
1841
|
-
[F$a.mfgOrder]: record.mfg_order_id_,
|
|
1842
|
-
[F$a.lotSn]: record.lot_sn_id_,
|
|
1843
|
-
[F$a.uniqueCode]: record.unique_code_,
|
|
1844
|
-
[F$a.reInspectionDate]: record.re_inspection_date_,
|
|
1845
|
-
[F$a.qty]: qty,
|
|
1846
|
-
...fillData
|
|
1847
|
-
};
|
|
1848
|
-
const validityFromRecord = record.validate_ ?? record.validity_;
|
|
1849
|
-
if (parsed.expiration) {
|
|
1850
|
-
row[F$a.validity] = toDateOnly(parsed.expiration);
|
|
1851
|
-
} else if (validityFromRecord != null) {
|
|
1852
|
-
row[F$a.validity] = toDateOnly(validityFromRecord);
|
|
1853
|
-
}
|
|
1854
|
-
return row;
|
|
1855
|
-
}
|
|
1856
|
-
class WarehouseOutTableCore extends ProfileDrivenSubTableCore {
|
|
1857
|
-
get warehouseId() {
|
|
1858
|
-
return this.factory.ctx.paramsConfig?.warehouseId;
|
|
1859
|
-
}
|
|
1860
|
-
isEmptyScanRow(row) {
|
|
1861
|
-
return isProductBatchEmptyRow(row);
|
|
1862
|
-
}
|
|
1863
|
-
handleFieldTd = (params) => {
|
|
1864
|
-
const { field, tdHandler } = params;
|
|
1865
|
-
if (field === F$a.product) {
|
|
1866
|
-
tdHandler.mergeTd({
|
|
1867
|
-
cellWidget: {
|
|
1868
|
-
props: {
|
|
1869
|
-
customRenderTag: "allocateProduct",
|
|
1870
|
-
newSpecificConfig: {
|
|
1871
|
-
newOptions: []
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
}
|
|
1875
|
-
});
|
|
1876
|
-
}
|
|
1877
|
-
super.handleFieldTd(params);
|
|
1878
|
-
};
|
|
1879
|
-
calcFieldQuery = (params) => {
|
|
1880
|
-
const { field } = params;
|
|
1881
|
-
if (field === F$a.product) {
|
|
1882
|
-
return {
|
|
1883
|
-
warehouse_id_: this.warehouseId
|
|
1884
|
-
};
|
|
1885
|
-
}
|
|
1886
|
-
};
|
|
1887
|
-
calcSubTableActionMenu = (params) => {
|
|
1888
|
-
const { showDelBtn } = params;
|
|
1889
|
-
return [
|
|
1890
|
-
{
|
|
1891
|
-
type: SubTableActionMenuTypeEnum.SUBTITLE,
|
|
1892
|
-
label: $t("sys.edhr.bizOperation")
|
|
1893
|
-
},
|
|
1894
|
-
getMenuByAction(SubTableActionEnum.SCAN),
|
|
1895
|
-
{
|
|
1896
|
-
type: SubTableActionMenuTypeEnum.DIVIDER
|
|
1897
|
-
},
|
|
1898
|
-
{
|
|
1899
|
-
type: SubTableActionMenuTypeEnum.SUBTITLE,
|
|
1900
|
-
label: $t("sys.edhr.editRow")
|
|
1901
|
-
},
|
|
1902
|
-
getMenuByAction(SubTableActionEnum.Insert1RowAfter),
|
|
1903
|
-
getCopySubMenu(),
|
|
1904
|
-
getInsertSubMenu(),
|
|
1905
|
-
...showDelBtn ? [
|
|
1906
|
-
{
|
|
1907
|
-
type: SubTableActionMenuTypeEnum.DIVIDER
|
|
1908
|
-
},
|
|
1909
|
-
getMenuByAction(SubTableActionEnum.DeleteRowCurrent)
|
|
1910
|
-
] : []
|
|
1911
|
-
].filter(Boolean);
|
|
1912
|
-
};
|
|
1913
|
-
handleChange(params) {
|
|
1914
|
-
super.handleChange(params);
|
|
1915
|
-
const { field, value, option, rowData } = params;
|
|
1916
|
-
if (field !== F$a.product || !option || value === void 0 || value === null || value === "") {
|
|
1917
|
-
return;
|
|
1918
|
-
}
|
|
1919
|
-
for (const { optionField, toField } of FILL_FROM_INVENTORY_OPTION$4) {
|
|
1920
|
-
rowData[toField] = option[optionField];
|
|
1921
|
-
}
|
|
1922
|
-
}
|
|
1923
|
-
async onScan(input) {
|
|
1924
|
-
const parsed = resolveScanParsedValue(input);
|
|
1925
|
-
if (!parsed || !hasLotOrUniqueCode(parsed)) {
|
|
1926
|
-
this.error({ content: SCAN_LOT_OR_UNIQUE_REQUIRED_MSG });
|
|
1927
|
-
return;
|
|
1928
|
-
}
|
|
1929
|
-
const records = await matchInventoryScanRecords(parsed, this.warehouseId);
|
|
1930
|
-
if (!records.length) {
|
|
1931
|
-
this.error({ content: SCAN_NOT_FOUND_MSG$2 });
|
|
1932
|
-
return;
|
|
1933
|
-
}
|
|
1934
|
-
const selected = await this.pickScanRecord(records);
|
|
1935
|
-
if (!selected) return;
|
|
1936
|
-
const scanQty = resolveScanQty(parsed.qty, selected.qty_);
|
|
1937
|
-
const fillData = resolveScanFillData(input);
|
|
1938
|
-
const visibleRows = this.showTableData;
|
|
1939
|
-
const existIndex = visibleRows.findIndex((row2) => isSameMaterialBatch(row2, selected));
|
|
1940
|
-
if (existIndex >= 0) {
|
|
1941
|
-
const existRow = visibleRows[existIndex];
|
|
1942
|
-
existRow[F$a.qty] = Number(existRow[F$a.qty] ?? 0) + scanQty;
|
|
1943
|
-
this.tableData = [...visibleRows];
|
|
1944
|
-
return;
|
|
1945
|
-
}
|
|
1946
|
-
const row = buildWarehouseOutScanRow(selected, parsed, fillData, scanQty);
|
|
1947
|
-
this.appendOrFillScanRow(row);
|
|
1948
|
-
}
|
|
1949
|
-
}
|
|
1950
|
-
function getClassByType(type) {
|
|
1951
|
-
switch (type) {
|
|
1952
|
-
case SubTableType.STOCKTAKE:
|
|
1953
|
-
return StocktakeTableCore;
|
|
1954
|
-
case SubTableType.ALLOCATE:
|
|
1955
|
-
return AllocateTableCore;
|
|
1956
|
-
case SubTableType.STERILIZE_BATCH:
|
|
1957
|
-
return SterilizeBatchTableCore;
|
|
1958
|
-
case SubTableType.PRETREATMENT_LIST:
|
|
1959
|
-
return PretreatmentListTableCore;
|
|
1960
|
-
case SubTableType.WAREHOUSE_IN:
|
|
1961
|
-
return WarehouseInTableCore;
|
|
1962
|
-
case SubTableType.WAREHOUSE_OUT:
|
|
1963
|
-
return WarehouseOutTableCore;
|
|
1964
|
-
case SubTableType.WAREHOUSE_INBOUND:
|
|
1965
|
-
return WarehouseInboundTableCore;
|
|
1966
|
-
case SubTableType.WAREHOUSE_OUTBOUND:
|
|
1967
|
-
return WarehouseOutboundTableCore;
|
|
1968
|
-
case SubTableType.PART_STOCKTAKE:
|
|
1969
|
-
return PartStocktakeTableCore;
|
|
1970
|
-
case SubTableType.DEVICE_PART_CONSUME:
|
|
1971
|
-
return DevicePartConsumeTableCore;
|
|
1972
|
-
case SubTableType.MATERIAL_REQUISITION:
|
|
1973
|
-
return MaterialRequisitionTableCore;
|
|
1974
|
-
case SubTableType.MATERIAL_SUBSTITUTION:
|
|
1975
|
-
return MaterialSubstitutionTableCore;
|
|
1976
|
-
// 出入库:渲染端暂走通用 SubTableCore,后续按 Profile 迁移
|
|
1977
|
-
default:
|
|
1978
|
-
return SubTableCore;
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
class SubTableCoreFactory {
|
|
1982
|
-
/**上下文参数 */
|
|
1983
|
-
ctx;
|
|
1984
|
-
/** 同一实例下所有 Sheet 的页面上下文 */
|
|
1985
|
-
contexts = [];
|
|
1986
|
-
/** 子表核心映射,key为子表的组件id */
|
|
1987
|
-
coreMap = {};
|
|
1988
|
-
/** 注册表创建后绑定;运行期子表写入必须经过这一入口 */
|
|
1989
|
-
formStateStore;
|
|
1990
|
-
/** 主批次号 */
|
|
1991
|
-
get materialNo() {
|
|
1992
|
-
return this.ctx.paramsConfig?.materialNo || this.ctx.docInfo.materialNo;
|
|
1993
|
-
}
|
|
1994
|
-
// 多 Sheet 初始化时一次传入全部页面上下文,保证未打开 Sheet 的子表核心也会建立
|
|
1995
|
-
constructor(params) {
|
|
1996
|
-
this.contexts = params;
|
|
1997
|
-
if (!this.contexts.length) throw new Error("子表工厂至少需要一个运行时上下文");
|
|
1998
|
-
this.ctx = this.contexts[0];
|
|
1999
|
-
this.contexts.forEach((context) => this.initSubTableCore(context));
|
|
2000
|
-
}
|
|
2001
|
-
// 注册表建立后再绑定 Store,避免工厂在初始化阶段创建第二份表单状态
|
|
2002
|
-
bindFormStateStore(store) {
|
|
2003
|
-
this.formStateStore = store;
|
|
2004
|
-
}
|
|
2005
|
-
/** Sheet 归属必须存在;错误 ID 不能借用第一张纸的版式和业务规则。 */
|
|
2006
|
-
getPageContext(sheetId) {
|
|
2007
|
-
const context = this.contexts.find((item) => item.sheetId === sheetId);
|
|
2008
|
-
if (!context) throw new Error(`子表运行时不存在工作表:${sheetId}`);
|
|
2009
|
-
return context;
|
|
2010
|
-
}
|
|
2011
|
-
/** 异步初始化 */
|
|
2012
|
-
async init() {
|
|
2013
|
-
await Promise.all(Object.values(this.coreMap).map(async (core) => core.init()));
|
|
2014
|
-
}
|
|
2015
|
-
/**
|
|
2016
|
-
* 获取表单里所有的子表对象集合
|
|
2017
|
-
* @return {*}
|
|
2018
|
-
*/
|
|
2019
|
-
// 此处的 runtimeJson 是单个 Sheet 的节点 Map,paper 是该 Sheet 的根节点。
|
|
2020
|
-
getSubTableWidgets(context) {
|
|
2021
|
-
const paper = context.runtimeJson?.paper;
|
|
2022
|
-
if (!paper?.props) {
|
|
2023
|
-
return [];
|
|
2024
|
-
}
|
|
2025
|
-
if (!Array.isArray(paper.props.subTableWidgetIds)) throw new Error("子表运行时缺少结构索引");
|
|
2026
|
-
return paper.props.subTableWidgetIds.map((id) => {
|
|
2027
|
-
const widget = context.runtimeJson[id];
|
|
2028
|
-
if (!widget || widget.component !== "sub-table") throw new Error(`子表结构索引无效:${id}`);
|
|
2029
|
-
return widget;
|
|
2030
|
-
});
|
|
2031
|
-
}
|
|
2032
|
-
/** 初始化子表核心 */
|
|
2033
|
-
initSubTableCore(context) {
|
|
2034
|
-
const { runtimeJson, docInfo } = context;
|
|
2035
|
-
if (docInfo?.formType === FormTypeEnum.FILE) {
|
|
2036
|
-
return;
|
|
2037
|
-
}
|
|
2038
|
-
if (!runtimeJson?.paper?.props) {
|
|
2039
|
-
return;
|
|
2040
|
-
}
|
|
2041
|
-
this.getSubTableWidgets(context)?.forEach((subTable) => {
|
|
2042
|
-
const coreClass = getClassByType(subTable.props.tableType);
|
|
2043
|
-
const SubTableCore2 = new coreClass(
|
|
2044
|
-
{
|
|
2045
|
-
widget: subTable,
|
|
2046
|
-
sheetId: context.sheetId
|
|
2047
|
-
},
|
|
2048
|
-
this
|
|
2049
|
-
);
|
|
2050
|
-
this.coreMap[subTable.id] = SubTableCore2;
|
|
2051
|
-
});
|
|
2052
|
-
}
|
|
2053
|
-
/** 通过tid获取子表核心 */
|
|
2054
|
-
getSubCoreByTid(tid) {
|
|
2055
|
-
return this.coreMap[tid];
|
|
2056
|
-
}
|
|
2057
|
-
/**
|
|
2058
|
-
* 初始化表单数据
|
|
2059
|
-
* @param params
|
|
2060
|
-
*/
|
|
2061
|
-
handleInitializeFormState(params) {
|
|
2062
|
-
Object.values(this.coreMap).map((core) => {
|
|
2063
|
-
const arr = core.handleInitializeFormState(params);
|
|
2064
|
-
if (arr) {
|
|
2065
|
-
const key = core.subFieldKey;
|
|
2066
|
-
const defaultData = params.defaultMap[key];
|
|
2067
|
-
params.formState[key] = transformUtils.transformSourceData2SubTable(
|
|
2068
|
-
arr,
|
|
2069
|
-
void 0,
|
|
2070
|
-
defaultData
|
|
2071
|
-
);
|
|
2072
|
-
}
|
|
2073
|
-
});
|
|
2074
|
-
}
|
|
2075
|
-
/** 提交前让各子表处理表单副本 */
|
|
2076
|
-
prepareSubmitFormState(formState) {
|
|
2077
|
-
Object.values(this.coreMap).forEach((core) => core.prepareSubmitFormState(formState));
|
|
2078
|
-
}
|
|
2079
|
-
/**
|
|
2080
|
-
* 处理子表字段的默认值映射
|
|
2081
|
-
* 往已有的默认值映射里补充额外的默认值
|
|
2082
|
-
*
|
|
2083
|
-
*/
|
|
2084
|
-
handleDefaultMap(params) {
|
|
2085
|
-
const { pageDefaultMap } = params;
|
|
2086
|
-
Object.values(this.coreMap).map((core) => {
|
|
2087
|
-
const defaultMap = core.calcDefaultMap();
|
|
2088
|
-
merge(pageDefaultMap, {
|
|
2089
|
-
[core.subFieldKey]: defaultMap
|
|
2090
|
-
});
|
|
2091
|
-
});
|
|
2092
|
-
}
|
|
2093
|
-
/**
|
|
2094
|
-
* 按钮点击逻辑前处理
|
|
2095
|
-
* 可以报错拦截后续逻辑
|
|
2096
|
-
* @param params
|
|
2097
|
-
*/
|
|
2098
|
-
async beforeBtnClick(params) {
|
|
2099
|
-
await Promise.all(Object.values(this.coreMap).map(async (core) => core.beforeBtnClick(params)));
|
|
2100
|
-
}
|
|
2101
|
-
}
|
|
2102
|
-
export {
|
|
2103
|
-
AllocateTableCore as A,
|
|
2104
|
-
DevicePartConsumeTableCore as D,
|
|
2105
|
-
MaterialRequisitionTableCore as M,
|
|
2106
|
-
PartStocktakeTableCore as P,
|
|
2107
|
-
RuntimeInstanceController as R,
|
|
2108
|
-
SubTableCoreFactory as S,
|
|
2109
|
-
WarehouseInTableCore as W,
|
|
2110
|
-
MaterialSubstitutionTableCore as a,
|
|
2111
|
-
PretreatmentListTableCore as b,
|
|
2112
|
-
ProfileDrivenSubTableCore as c,
|
|
2113
|
-
SterilizeBatchTableCore as d,
|
|
2114
|
-
StocktakeTableCore as e,
|
|
2115
|
-
WarehouseInboundTableCore as f,
|
|
2116
|
-
WarehouseOutTableCore as g,
|
|
2117
|
-
WarehouseOutboundTableCore as h
|
|
2118
|
-
};
|