@gct-paas/excel 0.1.39-beta.3 → 0.1.39-beta.32
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-MsYFQjlq.js → BaseComponent-BZ7vpBcD.js} +2 -2
- package/dist/{VueVideoPlayer-B-X9Kvhp.js → VueVideoPlayer-CTtss6-e.js} +2 -2
- package/dist/{align-editor-1IbAiPBg.js → align-editor-0EJDQ9xk.js} +1 -1
- package/dist/{barcode-design-DPH8Uh2K.js → barcode-design-CU6ykxXr.js} +2 -2
- package/dist/base/index.es.js +543 -240
- package/dist/{diagonal-design-AJOcMvxo.js → diagonal-design-bgZAeLZP.js} +2 -2
- package/dist/{dynamic-table-action-Bi7RdYoy.js → dynamic-table-action-BvHth2cC.js} +935 -295
- package/dist/{dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-ClcBVLO0.js → dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-vRTNdchM.js} +636 -1140
- package/dist/{edit.utils-CXmmCnxE-88-QvdIv.js → edit.utils-CXmmCnxE-Cj0XviBc.js} +1 -1
- package/dist/excel.css +590 -349
- package/dist/{exceljs.min-D7RI5VAg.js → exceljs.min-Cr5txU5w.js} +2 -2
- package/dist/{font-editor-ttnkgG9j.js → font-editor-BIEWxnat.js} +3 -3
- package/dist/{image-design-B84grap7.js → image-design-AOi1nT_M.js} +2 -2
- package/dist/{index-_h9yoejq.js → index-0cS2b0oE.js} +2 -2
- package/dist/{index-jRA6sXVY.js → index-2SyQ6xAT.js} +1 -1
- package/dist/{index-UCNknVxk.js → index-B1JboJFx.js} +1 -1
- package/dist/{index-D9xmHJZc.js → index-B4aDuWy4.js} +2 -2
- package/dist/{index-_-ORWa-m.js → index-BFhX3ACB.js} +1 -1
- package/dist/{index-CR2Qyh5l.js → index-BOo6MotZ.js} +6 -5
- package/dist/{index-BbDITMyp.js → index-BRirBsMg.js} +2 -2
- package/dist/{index-C_FegWKd.js → index-BYOG-n0c.js} +2 -2
- package/dist/{index-ChncMTkv.js → index-BeFJ_RCt.js} +1 -1
- package/dist/{index-DmBNvVlZ.js → index-Bk8rU908.js} +2221 -1924
- package/dist/{index-ab9KSEKp.js → index-BzgVexIB.js} +2 -2
- package/dist/{index-EhaPjLBG.js → index-C5rtaFud.js} +2 -2
- package/dist/{index-C90vW_gE.js → index-C7veczU_.js} +3 -3
- package/dist/{index-D0Q-6EtG.js → index-CDhZoiEf.js} +1 -1
- package/dist/{index-Db-ix7hC.js → index-CTLIQVKX.js} +2 -2
- package/dist/{index-Bb41zgXE.js → index-CX4Pp6kw.js} +2 -2
- package/dist/{index-B5NG2ONv.js → index-CZD5cYIe.js} +2 -2
- package/dist/{index-7YbJRzdP.js → index-CfS4Vi7D.js} +3 -2
- package/dist/{index-CUHfI8cg.js → index-Cfe2Q-hG.js} +1 -1
- package/dist/{index-n1HZa-Ar.js → index-Cip1bDDj.js} +2 -2
- package/dist/{index-IRXUwksU.js → index-CkgcA21r.js} +2 -2
- package/dist/{index-CX6LqGJP.js → index-Cld2wf77.js} +1 -1
- package/dist/{index-DBT8-Qit.js → index-CwSEWCP8.js} +3 -3
- package/dist/{index-89I_eBZ-.js → index-D-8Q9FIL.js} +3 -3
- package/dist/{index-DNmbm6HV.js → index-D9GxA4Uy.js} +6 -5
- package/dist/{index-DCzL4GOP.js → index-DThgFjEo.js} +53 -5
- package/dist/{index-CLL_9LZB.js → index-DzchEThV.js} +2 -2
- package/dist/{index-_ZsA68LD.js → index-Ezicwad7.js} +2 -2
- package/dist/{index-BKBn7Evl.js → index-LJlRgrPE.js} +2 -2
- package/dist/{index-Doz8Gf_5.js → index-SXIZsVts.js} +1 -1
- package/dist/{index-CuGZ6C7l.js → index-chIttzzx.js} +2 -2
- package/dist/{index-DgdosgZd.js → index-g5NmWlup.js} +2 -2
- package/dist/{index-DHHyy4mL.js → index-n97S5YRD.js} +1 -1
- package/dist/{index-MJFci9IB.js → index-nl7I1bLi.js} +1 -1
- package/dist/{index-DAN58pC9.js → index-sbz8PAuq.js} +2 -2
- package/dist/index.es.js +2 -2
- package/dist/{mb-render-BZDgmpm9.js → mb-render-FUO_-FXR.js} +9 -3
- package/dist/{online-form-model-select.vue_vue_type_script_setup_true_name_online-form-model-select_lang-Ciue53Ue.js → online-form-model-select.vue_vue_type_script_setup_true_name_online-form-model-select_lang-DOYhOffQ.js} +8 -1
- package/dist/{pagination-design-DU2ZuaY4.js → pagination-design-BXWK58mU.js} +2 -2
- package/dist/paper-widget-design-DGRbbkYV.js +4 -0
- package/dist/{print-runtime-instance-ydLRVd0y.js → print-runtime-instance-CwdH93fy.js} +1 -1
- package/dist/{print-snapshot-renderer-C3fEtvNI.js → print-snapshot-renderer-CzlFqiSh.js} +3 -3
- package/dist/{qrcode-design-BXlQ5QTm.js → qrcode-design-8A5a_F1s.js} +1 -1
- package/dist/{revo-grid.entry-DdE6cuGJ.js → revo-grid.entry-DKvA7bUR.js} +1 -1
- package/dist/{revogr-attribution_7.entry-Er1fVrov.js → revogr-attribution_7.entry-C2PtJ_Tj.js} +3 -3
- package/dist/{revogr-clipboard_3.entry-COq2SN-B.js → revogr-clipboard_3.entry-BM7_JY0U.js} +2 -2
- package/dist/{revogr-data_4.entry--CfGDdVK.js → revogr-data_4.entry-CdMQPL7I.js} +2 -2
- package/dist/{revogr-filter-panel.entry-DoNXkBy6.js → revogr-filter-panel.entry-BJiGVhcw.js} +1 -1
- package/dist/seal-design-BFQUgxHz.js +4 -0
- package/dist/{serialnumber-design-fMRSi9jn.js → serialnumber-design-QaDIsxYT.js} +1 -1
- package/dist/shared/index.es.js +23 -21
- package/dist/{single-field-drop-CYcOH6mT.js → single-field-drop-C-Af1KzB.js} +2 -2
- package/dist/{size-editor-BKJfYgbR.js → size-editor-BV0KrQ37.js} +1 -1
- package/dist/src/domain/table/business/material/material-balance/profile/fields.d.ts +2 -0
- package/dist/src/domain/table/business/preprocess/pretreatment-list/profile/field-keys.d.ts +1 -7
- package/dist/src/domain/table/business/sterilize/entrust-steril-batch-list/profile/fields.d.ts +2 -0
- package/dist/src/nocode-base/src/core/sub-table/allocate-table-core.d.ts +2 -1
- package/dist/src/nocode-base/src/core/sub-table/sub-table-core.d.ts +2 -1
- package/dist/src/nocode-base/src/hooks/form-model/form-model-controller.d.ts +2 -0
- package/dist/src/nocode-base/src/hooks/material-consume/material-consume-table-controller.d.ts +1 -0
- package/dist/src/nocode-base/src/hooks/material-consume/tmpl-bom-controller.d.ts +12 -7
- package/dist/src/nocode-base/src/hooks/material-consume-object/bom-validator.d.ts +4 -3
- package/dist/src/nocode-base/src/hooks/material-consume-object/initialize-autofill.d.ts +19 -0
- package/dist/src/nocode-base/src/hooks/material-consume-object/object-validation-controller.d.ts +24 -0
- package/dist/src/nocode-base/src/interface/render.d.ts +3 -1
- package/dist/src/nocode-base/src/interface/transform.d.ts +9 -1
- package/dist/src/nocode-base/src/runtime/async-task-coordinator.d.ts +6 -2
- package/dist/src/nocode-base/src/runtime/multi-sheet-runtime.d.ts +5 -1
- package/dist/src/nocode-base/src/runtime/runtime-context.d.ts +4 -0
- package/dist/src/nocode-base/src/runtime/runtime-field-initializer.d.ts +1 -1
- package/dist/src/nocode-base/src/runtime/runtime-validation-service.d.ts +1 -0
- package/dist/src/nocode-base/src/types/render/mc-render.d.ts +1 -1
- package/dist/src/nocode-base/src/types/render/sub-table-render.d.ts +5 -1
- package/dist/src/nocode-web-render/src/render/sub-table/common/inventory-scan-columns.d.ts +6 -0
- package/dist/src/nocode-web-render/src/render/sub-table/material-consume/mc-web-render.d.ts +1 -1
- package/dist/src/online-form/src/views/__cell_widgets__/cell-widget-design.vue.d.ts +1 -0
- package/dist/src/online-form/src/views/__cell_widgets__/common/display-fields-editor/display-fields.util.d.ts +2 -2
- package/dist/src/online-form/src/views/__cell_widgets__/common/quick-search-editor/quick-search.util.d.ts +8 -0
- package/dist/src/online-form/src/views/__cell_widgets__/fake-field/fake-option-select.vue.d.ts +1 -0
- package/dist/src/online-form/src/views/designer/conversions/normalize-paper-grid.d.ts +3 -0
- package/dist/src/online-form/src/views/designer/hooks/useAllSpreadSheets.d.ts +11 -0
- package/dist/src/online-form/src/views/designer/modules/base/designer-wrapper.vue.d.ts +1 -0
- package/dist/src/online-form/src/views/designer/modules/duplicate-field-notice.vue.d.ts +2 -0
- package/dist/src/online-form/src/views/designer/types/sheets.d.ts +2 -0
- package/dist/src/online-form/src/views/render/__components__/_field_/trace/utils/use-rule-props.d.ts +0 -3
- package/dist/src/online-form/src/views/render/sheet-tab-bar.vue.d.ts +5 -3
- package/dist/src/shared/enum/field-type.d.ts +2 -0
- package/dist/src/shared/enum/index.d.ts +2 -0
- package/dist/src/shared/enum/product-type.d.ts +9 -0
- package/dist/src/shared/enum/production-identification.d.ts +19 -0
- package/dist/{sub-table-factory-DxM8KQoS.js → sub-table-factory-b8fCKT0z.js} +19 -7
- package/dist/{text-design-8Za9qOSI.js → text-design-C35O7YR4.js} +2 -2
- package/dist/{throttle-Cpk1LoGk-BI0wP2Le.js → throttle-Cpk1LoGk-HQvkISS4.js} +1 -1
- package/dist/{timediff-design-O1IfzLVD.js → timediff-design-CKjl56qS.js} +1 -1
- package/dist/{trace-like-wrapper-BPNmxIDn.js → trace-like-wrapper-CvZpyPlh.js} +2 -2
- package/dist/{value-editor.vue_vue_type_style_index_0_lang-CQ0YP-OF.js → value-editor.vue_vue_type_style_index_0_lang-Bk7ZLZxh.js} +2 -2
- package/dist/web-render/index.es.js +3 -3
- package/dist/{widget-barcode-C38yawCK.js → widget-barcode-CNkIguP5.js} +4 -4
- package/dist/{widget-diagonal-abcgVyu4.js → widget-diagonal-Mi9aX6hU.js} +3 -3
- package/dist/{widget-image-DcSNslZ-.js → widget-image-i2JtNBbz.js} +5 -5
- package/dist/{widget-line-CttlnK7g.js → widget-line-OIsUSKiO.js} +2 -2
- package/dist/{widget-pagination-BNG9Rszh.js → widget-pagination--EyLbrPC.js} +5 -5
- package/dist/{widget-power-DaC1id-m.js → widget-power-FPby3ucD.js} +3 -3
- package/dist/{widget-qrcode-BRFsOH44.js → widget-qrcode-D5P4cW3m.js} +3 -3
- package/dist/{widget-rangelimit-fA6YF2E2.js → widget-rangelimit-DdwIzSFH.js} +3 -3
- package/dist/{widget-serialnumber-mnpGMXuB.js → widget-serialnumber-C-T8DI3m.js} +1 -1
- package/dist/{widget-text-gHJcpS1w.js → widget-text-BHlQYZUH.js} +5 -5
- package/dist/{widget-timediff-ByHm9Dg3.js → widget-timediff--QTyT_AT.js} +2 -2
- package/package.json +2 -2
- package/dist/paper-widget-design-BE_wOTpv.js +0 -4
- package/dist/seal-design-7aKsQ6RT.js +0 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { reactive, toRaw, computed, watch, onScopeDispose, inject, h, shallowReactive, markRaw, ref, nextTick, toRef, provide, defineComponent, openBlock, createElementBlock, mergeProps, unref, createElementVNode, normalizeClass, renderSlot, createCommentVNode, createVNode, toDisplayString, Fragment, renderList, onUnmounted, isVNode, onMounted, onBeforeMount, resolveComponent, createBlock, withCtx, createTextVNode } from "vue";
|
|
2
|
-
import {
|
|
3
|
-
import { cloneDeep, isEmpty, has, pickBy, isNil, mergeWith, omit, last, pick, merge } from "lodash-es";
|
|
2
|
+
import { af as CellWidgetViewState, F as FIELD_TYPE, b4 as RenderModeEnum, X as FormTypeEnum, bs as BpmnNodeTypeEnum, ch as getFieldPlaceholder, bI as MobileFillTypeEnum, C as ComponentTypeEnum, bc as findRuntimeTableRow, aT as renderUtils, _ as PlatformEnum, E as api, bl as uuid2, bS as calcUtils, bW as ensureTableRowKeys, bP as bindRuntimeTableColumns, bb as getRowId, ci as FRONT_ROW_KEY, c9 as isTableRowKeyMatch, au as RangeCompareOp, at as RangeValidateMode, bT as decodeTableCellRowKey, bV as ensureFrontRowKey, a_ as getParseRuleInfo, aC as transformUtils, aV as materialCheck, aW as getLotLockedReason, aX as validateReinspectionDate, bf as FormulaRuleFieldKeyEnum, f as SubTableType, a$ as getParseRuleValue, H as CreateType, bd as findRuntimeParentRow, aF as Dependency_ENUM, aE as ASSIGNMENTSTRATEGY_ENUM, bw as commonUtils, aJ as DeviceLink, a7 as _export_sfc, c3 as getRenderedRuntimeTableCell, y as CellType, cj as resetTableRowIdentity, J as useModal, ck as q, cl as QUICK_FILL_ALLOWED_FIELDS, cm as groupFixedTableRows, cn as processQuickFillRows, co as getIsGroupEmpty } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-vRTNdchM.js";
|
|
4
3
|
import dayjs from "dayjs";
|
|
4
|
+
import { cloneDeep, isEmpty, has, isNil, pickBy, mergeWith, omit, last, pick, merge } from "lodash-es";
|
|
5
5
|
import { a as useNamespace, I as Icon } from "./AntdIcon-DCIaV352.js";
|
|
6
6
|
import { Modal, message } from "ant-design-vue";
|
|
7
|
-
import { u as useFormModel } from "./mb-render-
|
|
7
|
+
import { u as useFormModel } from "./mb-render-FUO_-FXR.js";
|
|
8
8
|
var MaterialConsumptionPatternEnum = /* @__PURE__ */ ((MaterialConsumptionPatternEnum2) => {
|
|
9
9
|
MaterialConsumptionPatternEnum2["RECORD"] = "record";
|
|
10
10
|
MaterialConsumptionPatternEnum2["BOM"] = "bom";
|
|
@@ -703,6 +703,49 @@ function getSubTableQuickFillInfo(subTableFieldId, mobileTdIdGroups) {
|
|
|
703
703
|
if (!subTableFieldId) return;
|
|
704
704
|
return assignWidgetInfo(MobileFillTypeEnum.SUB_TABLE, { rowSubFieldKey: subTableFieldId });
|
|
705
705
|
}
|
|
706
|
+
function getCurrentFormData(_rule, options) {
|
|
707
|
+
if (!_rule._subtableFieldId) return options?.formData;
|
|
708
|
+
return findRuntimeTableRow(options?.formData?.[_rule._subtableFieldId], _rule._rowKey);
|
|
709
|
+
}
|
|
710
|
+
function isSameOptionValue(current, expected) {
|
|
711
|
+
if (typeof expected === "boolean") {
|
|
712
|
+
return renderUtils.getBoolValue(current) === expected;
|
|
713
|
+
}
|
|
714
|
+
if (current === void 0 || current === null || current === "") {
|
|
715
|
+
return false;
|
|
716
|
+
}
|
|
717
|
+
return String(current) === String(expected);
|
|
718
|
+
}
|
|
719
|
+
function isAttachFieldActive(attach, formData) {
|
|
720
|
+
if (attach?.parent && !isAttachFieldActive(attach.parent, formData)) return false;
|
|
721
|
+
if (!attach?.belongFieldId || isNil(attach.optionValue)) {
|
|
722
|
+
return true;
|
|
723
|
+
}
|
|
724
|
+
const row = attach.subtableFieldId ? findRuntimeTableRow(formData?.[attach.subtableFieldId], attach.rowKey) : formData;
|
|
725
|
+
if (attach.subtableFieldId && (!attach.rowKey || !row || row === formData)) {
|
|
726
|
+
return false;
|
|
727
|
+
}
|
|
728
|
+
const raw = row?.[attach.belongFieldId];
|
|
729
|
+
if (attach.multiple) {
|
|
730
|
+
const current = renderUtils.getValue(raw, true);
|
|
731
|
+
if (!Array.isArray(current)) return false;
|
|
732
|
+
return current.some((v) => isSameOptionValue(v, attach.optionValue));
|
|
733
|
+
}
|
|
734
|
+
return isSameOptionValue(raw, attach.optionValue);
|
|
735
|
+
}
|
|
736
|
+
function isReferenceOptionActive(referenceInfo, rowFormData) {
|
|
737
|
+
if (!referenceInfo?.belongFieldId || isNil(referenceInfo.optionValue)) {
|
|
738
|
+
return true;
|
|
739
|
+
}
|
|
740
|
+
return isAttachFieldActive(
|
|
741
|
+
{
|
|
742
|
+
belongFieldId: referenceInfo.belongFieldId,
|
|
743
|
+
optionValue: referenceInfo.optionValue,
|
|
744
|
+
multiple: referenceInfo.multiple
|
|
745
|
+
},
|
|
746
|
+
rowFormData
|
|
747
|
+
);
|
|
748
|
+
}
|
|
706
749
|
function fieldChromeStyles(state) {
|
|
707
750
|
const required4 = state === "required";
|
|
708
751
|
const disabled = state === "disabled";
|
|
@@ -942,6 +985,8 @@ function convertV1Runtime(runtime) {
|
|
|
942
985
|
return { schemaVersion: 1, formConfig, sheets: [sheet] };
|
|
943
986
|
}
|
|
944
987
|
const MULTI_SHEET_SCHEMA_VERSION = 2;
|
|
988
|
+
const MAX_RUNTIME_SHEETS = 100;
|
|
989
|
+
const MAX_RUNTIME_SHEET_TITLE_LENGTH = 255;
|
|
945
990
|
function assertObject(value, message2) {
|
|
946
991
|
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(message2);
|
|
947
992
|
}
|
|
@@ -983,7 +1028,7 @@ function normalizeSheetMetadata(sheet) {
|
|
|
983
1028
|
};
|
|
984
1029
|
return { ...sheet, paper, nodes, dataCenter: { [ComponentTypeEnum.PAPER]: paper, ...nodes } };
|
|
985
1030
|
}
|
|
986
|
-
function normalizeRuntime(runtime) {
|
|
1031
|
+
function normalizeRuntime(runtime, formType) {
|
|
987
1032
|
if (typeof runtime === "string") {
|
|
988
1033
|
if (!runtime.trim()) throw new Error("运行时数据不能为空");
|
|
989
1034
|
try {
|
|
@@ -994,7 +1039,16 @@ function normalizeRuntime(runtime) {
|
|
|
994
1039
|
}
|
|
995
1040
|
assertObject(runtime, "运行时数据格式无效");
|
|
996
1041
|
if (runtime.schemaVersion == null || runtime.schemaVersion === 1) {
|
|
997
|
-
const
|
|
1042
|
+
const legacyRuntime = formType === FormTypeEnum.FILE && runtime[ComponentTypeEnum.PAPER] == null ? {
|
|
1043
|
+
...runtime,
|
|
1044
|
+
[ComponentTypeEnum.PAPER]: {
|
|
1045
|
+
id: ComponentTypeEnum.PAPER,
|
|
1046
|
+
component: ComponentTypeEnum.PAPER,
|
|
1047
|
+
props: {},
|
|
1048
|
+
nextIds: []
|
|
1049
|
+
}
|
|
1050
|
+
} : runtime;
|
|
1051
|
+
const normalized = convertV1Runtime(legacyRuntime);
|
|
998
1052
|
normalized.sheets.forEach(validateSheetGraph);
|
|
999
1053
|
return { ...normalized, sheets: normalized.sheets.map(normalizeSheetMetadata) };
|
|
1000
1054
|
}
|
|
@@ -1007,7 +1061,9 @@ function normalizeRuntime(runtime) {
|
|
|
1007
1061
|
if (!Array.isArray(runtime.sheets) || runtime.sheets.length === 0) {
|
|
1008
1062
|
throw new Error("多 Sheet 运行时至少需要一个工作表");
|
|
1009
1063
|
}
|
|
1010
|
-
if (runtime.sheets.length >
|
|
1064
|
+
if (runtime.sheets.length > MAX_RUNTIME_SHEETS) {
|
|
1065
|
+
throw new Error(`每份表单最多支持 ${MAX_RUNTIME_SHEETS} 个工作表`);
|
|
1066
|
+
}
|
|
1011
1067
|
const formConfig = runtime.formConfig ?? {};
|
|
1012
1068
|
assertObject(formConfig, "多 Sheet 运行时的 formConfig 格式无效");
|
|
1013
1069
|
const ids = /* @__PURE__ */ new Set();
|
|
@@ -1018,7 +1074,9 @@ function normalizeRuntime(runtime) {
|
|
|
1018
1074
|
const sheetId = String(rawSheet.sheetId ?? "").trim();
|
|
1019
1075
|
const title = String(rawSheet.title ?? "").trim();
|
|
1020
1076
|
if (!sheetId) throw new Error(`第 ${index + 1} 个工作表缺少 sheetId`);
|
|
1021
|
-
if (!title || title.length >
|
|
1077
|
+
if (!title || title.length > MAX_RUNTIME_SHEET_TITLE_LENGTH) {
|
|
1078
|
+
throw new Error(`工作表名称必须为 1 到 ${MAX_RUNTIME_SHEET_TITLE_LENGTH} 个字符:${title}`);
|
|
1079
|
+
}
|
|
1022
1080
|
if (ids.has(sheetId)) throw new Error(`重复的 sheetId:${sheetId}`);
|
|
1023
1081
|
if (titles.has(title)) throw new Error(`重复的工作表名称:${title}`);
|
|
1024
1082
|
ids.add(sheetId);
|
|
@@ -1127,6 +1185,7 @@ function createRuntimeInstanceContext(options) {
|
|
|
1127
1185
|
uniqueId: options.uniqueId,
|
|
1128
1186
|
instanceId: options.instanceId,
|
|
1129
1187
|
templateId: options.templateId,
|
|
1188
|
+
formType: options.formType,
|
|
1130
1189
|
schemaVersion: options.runtime.schemaVersion,
|
|
1131
1190
|
formConfig: options.runtime.formConfig,
|
|
1132
1191
|
defaultData: options.defaultData,
|
|
@@ -1216,7 +1275,7 @@ class RuntimeSheetService {
|
|
|
1216
1275
|
this.calculatingDepth += 1;
|
|
1217
1276
|
let succeeded = false;
|
|
1218
1277
|
try {
|
|
1219
|
-
const pageData = RuntimeSheetService.calculatePages(sheet.dataCenter, this.formState.state);
|
|
1278
|
+
const pageData = this.context.formType === FormTypeEnum.FILE ? [] : RuntimeSheetService.calculatePages(sheet.dataCenter, this.formState.state);
|
|
1220
1279
|
this.assertAlive();
|
|
1221
1280
|
sheet.pageData = pageData;
|
|
1222
1281
|
sheet.paginationError = void 0;
|
|
@@ -1571,9 +1630,15 @@ class RuntimeFormStateStore {
|
|
|
1571
1630
|
target = this.unwrap(target);
|
|
1572
1631
|
value = this.unwrap(value);
|
|
1573
1632
|
this.ensureIncomingRowKeys(target, fieldKey, value);
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1633
|
+
const valueChanged = !Object.is(toRaw(this.unwrap(target[fieldKey])), toRaw(value));
|
|
1634
|
+
const labelKey = `${fieldKey}_lb_`;
|
|
1635
|
+
const clearLabel = (value == null || value === "" || Array.isArray(value) && value.length === 0) && target[labelKey] != null;
|
|
1636
|
+
if (!valueChanged && !clearLabel) return;
|
|
1637
|
+
const paths = valueChanged ? [path] : [];
|
|
1638
|
+
if (clearLabel) paths.push(`${path}_lb_`);
|
|
1639
|
+
this.mutate(paths, source, () => {
|
|
1640
|
+
if (valueChanged) target[fieldKey] = value;
|
|
1641
|
+
if (clearLabel) target[labelKey] = null;
|
|
1577
1642
|
});
|
|
1578
1643
|
}
|
|
1579
1644
|
/** 合并当前行的一组关联字段,累计稳定业务路径,只提交一次变更。 */
|
|
@@ -1715,12 +1780,28 @@ class RuntimeFormStateStore {
|
|
|
1715
1780
|
incoming.forEach((savedRow) => {
|
|
1716
1781
|
const rowKey = savedRow?.[FRONT_ROW_KEY];
|
|
1717
1782
|
const savedId = savedRow?.id_;
|
|
1718
|
-
|
|
1783
|
+
let currentRow = target.find((row) => {
|
|
1719
1784
|
if (!row || typeof row !== "object") return false;
|
|
1720
1785
|
if (rowKey != null && isTableRowKeyMatch(rowKey, row[FRONT_ROW_KEY])) return true;
|
|
1721
1786
|
return savedId != null && row.id_ != null && String(row.id_) === String(savedId);
|
|
1722
1787
|
});
|
|
1723
|
-
|
|
1788
|
+
let matchedByGroup = false;
|
|
1789
|
+
if (!currentRow && Array.isArray(savedRow?._2DTABLE_) && savedRow.group_ != null && String(savedRow.group_).trim() !== "") {
|
|
1790
|
+
const matchingGroups = target.filter(
|
|
1791
|
+
(row) => Array.isArray(row?._2DTABLE_) && row.group_ != null && String(row.group_) === String(savedRow.group_)
|
|
1792
|
+
);
|
|
1793
|
+
if (matchingGroups.length === 1) {
|
|
1794
|
+
currentRow = matchingGroups[0];
|
|
1795
|
+
matchedByGroup = true;
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
if (currentRow) {
|
|
1799
|
+
this.mergeSavedMetadata(
|
|
1800
|
+
currentRow,
|
|
1801
|
+
matchedByGroup ? { ...savedRow, [FRONT_ROW_KEY]: currentRow[FRONT_ROW_KEY] } : savedRow,
|
|
1802
|
+
path
|
|
1803
|
+
);
|
|
1804
|
+
}
|
|
1724
1805
|
});
|
|
1725
1806
|
return target;
|
|
1726
1807
|
}
|
|
@@ -1816,6 +1897,7 @@ class RuntimeAsyncTaskCoordinator {
|
|
|
1816
1897
|
fieldIdentity: options.fieldIdentity,
|
|
1817
1898
|
sheetId: options.sheetId,
|
|
1818
1899
|
required: options.required !== false,
|
|
1900
|
+
blockOnFailure: options.blockOnFailure !== false,
|
|
1819
1901
|
status: "pending",
|
|
1820
1902
|
sequence,
|
|
1821
1903
|
promise: task,
|
|
@@ -1859,7 +1941,7 @@ class RuntimeAsyncTaskCoordinator {
|
|
|
1859
1941
|
* 等待全部 required 任务达到稳定状态。
|
|
1860
1942
|
*
|
|
1861
1943
|
* 一轮任务完成后的字段回填可能触发新的公式或远程任务,因此这里循环读取任务表,直到
|
|
1862
|
-
* 没有新的 pending required
|
|
1944
|
+
* 没有新的 pending required 任务。稳定后只检查需要阻断提交的失败项。
|
|
1863
1945
|
*/
|
|
1864
1946
|
async waitForRequired(keyPrefix) {
|
|
1865
1947
|
const matches = (task) => task.required && (!keyPrefix || task.key.startsWith(keyPrefix));
|
|
@@ -1871,7 +1953,7 @@ class RuntimeAsyncTaskCoordinator {
|
|
|
1871
1953
|
await Promise.allSettled(pending.map((task) => task.promise));
|
|
1872
1954
|
}
|
|
1873
1955
|
const failed = Array.from(this.tasks.values()).filter(
|
|
1874
|
-
(task) => matches(task) && task.status === "rejected"
|
|
1956
|
+
(task) => matches(task) && task.blockOnFailure && task.status === "rejected"
|
|
1875
1957
|
);
|
|
1876
1958
|
if (failed.length) {
|
|
1877
1959
|
const details = failed.map((task) => {
|
|
@@ -2047,7 +2129,7 @@ function format(template) {
|
|
|
2047
2129
|
function isNativeStringType(type4) {
|
|
2048
2130
|
return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
|
|
2049
2131
|
}
|
|
2050
|
-
function isEmptyValue(value, type4) {
|
|
2132
|
+
function isEmptyValue$1(value, type4) {
|
|
2051
2133
|
if (value === void 0 || value === null) {
|
|
2052
2134
|
return true;
|
|
2053
2135
|
}
|
|
@@ -2206,7 +2288,7 @@ function deepMerge(target, source) {
|
|
|
2206
2288
|
return target;
|
|
2207
2289
|
}
|
|
2208
2290
|
var required$1 = function required(rule, value, source, errors, options, type4) {
|
|
2209
|
-
if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
|
|
2291
|
+
if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue$1(value, type4 || rule.type))) {
|
|
2210
2292
|
errors.push(format(options.messages.required, rule.fullField));
|
|
2211
2293
|
}
|
|
2212
2294
|
};
|
|
@@ -2393,11 +2475,11 @@ var string = function string2(rule, value, callback, source, options) {
|
|
|
2393
2475
|
var errors = [];
|
|
2394
2476
|
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
2395
2477
|
if (validate) {
|
|
2396
|
-
if (isEmptyValue(value, "string") && !rule.required) {
|
|
2478
|
+
if (isEmptyValue$1(value, "string") && !rule.required) {
|
|
2397
2479
|
return callback();
|
|
2398
2480
|
}
|
|
2399
2481
|
rules.required(rule, value, source, errors, options, "string");
|
|
2400
|
-
if (!isEmptyValue(value, "string")) {
|
|
2482
|
+
if (!isEmptyValue$1(value, "string")) {
|
|
2401
2483
|
rules.type(rule, value, source, errors, options);
|
|
2402
2484
|
rules.range(rule, value, source, errors, options);
|
|
2403
2485
|
rules.pattern(rule, value, source, errors, options);
|
|
@@ -2412,7 +2494,7 @@ var method2 = function method3(rule, value, callback, source, options) {
|
|
|
2412
2494
|
var errors = [];
|
|
2413
2495
|
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
2414
2496
|
if (validate) {
|
|
2415
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
2497
|
+
if (isEmptyValue$1(value) && !rule.required) {
|
|
2416
2498
|
return callback();
|
|
2417
2499
|
}
|
|
2418
2500
|
rules.required(rule, value, source, errors, options);
|
|
@@ -2429,7 +2511,7 @@ var number2 = function number3(rule, value, callback, source, options) {
|
|
|
2429
2511
|
if (value === "") {
|
|
2430
2512
|
value = void 0;
|
|
2431
2513
|
}
|
|
2432
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
2514
|
+
if (isEmptyValue$1(value) && !rule.required) {
|
|
2433
2515
|
return callback();
|
|
2434
2516
|
}
|
|
2435
2517
|
rules.required(rule, value, source, errors, options);
|
|
@@ -2444,7 +2526,7 @@ var _boolean = function _boolean2(rule, value, callback, source, options) {
|
|
|
2444
2526
|
var errors = [];
|
|
2445
2527
|
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
2446
2528
|
if (validate) {
|
|
2447
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
2529
|
+
if (isEmptyValue$1(value) && !rule.required) {
|
|
2448
2530
|
return callback();
|
|
2449
2531
|
}
|
|
2450
2532
|
rules.required(rule, value, source, errors, options);
|
|
@@ -2458,11 +2540,11 @@ var regexp2 = function regexp3(rule, value, callback, source, options) {
|
|
|
2458
2540
|
var errors = [];
|
|
2459
2541
|
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
2460
2542
|
if (validate) {
|
|
2461
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
2543
|
+
if (isEmptyValue$1(value) && !rule.required) {
|
|
2462
2544
|
return callback();
|
|
2463
2545
|
}
|
|
2464
2546
|
rules.required(rule, value, source, errors, options);
|
|
2465
|
-
if (!isEmptyValue(value)) {
|
|
2547
|
+
if (!isEmptyValue$1(value)) {
|
|
2466
2548
|
rules.type(rule, value, source, errors, options);
|
|
2467
2549
|
}
|
|
2468
2550
|
}
|
|
@@ -2472,7 +2554,7 @@ var integer2 = function integer3(rule, value, callback, source, options) {
|
|
|
2472
2554
|
var errors = [];
|
|
2473
2555
|
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
2474
2556
|
if (validate) {
|
|
2475
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
2557
|
+
if (isEmptyValue$1(value) && !rule.required) {
|
|
2476
2558
|
return callback();
|
|
2477
2559
|
}
|
|
2478
2560
|
rules.required(rule, value, source, errors, options);
|
|
@@ -2487,7 +2569,7 @@ var floatFn = function floatFn2(rule, value, callback, source, options) {
|
|
|
2487
2569
|
var errors = [];
|
|
2488
2570
|
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
2489
2571
|
if (validate) {
|
|
2490
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
2572
|
+
if (isEmptyValue$1(value) && !rule.required) {
|
|
2491
2573
|
return callback();
|
|
2492
2574
|
}
|
|
2493
2575
|
rules.required(rule, value, source, errors, options);
|
|
@@ -2517,7 +2599,7 @@ var object2 = function object3(rule, value, callback, source, options) {
|
|
|
2517
2599
|
var errors = [];
|
|
2518
2600
|
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
2519
2601
|
if (validate) {
|
|
2520
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
2602
|
+
if (isEmptyValue$1(value) && !rule.required) {
|
|
2521
2603
|
return callback();
|
|
2522
2604
|
}
|
|
2523
2605
|
rules.required(rule, value, source, errors, options);
|
|
@@ -2532,7 +2614,7 @@ var enumerable2 = function enumerable3(rule, value, callback, source, options) {
|
|
|
2532
2614
|
var errors = [];
|
|
2533
2615
|
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
2534
2616
|
if (validate) {
|
|
2535
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
2617
|
+
if (isEmptyValue$1(value) && !rule.required) {
|
|
2536
2618
|
return callback();
|
|
2537
2619
|
}
|
|
2538
2620
|
rules.required(rule, value, source, errors, options);
|
|
@@ -2546,11 +2628,11 @@ var pattern2 = function pattern3(rule, value, callback, source, options) {
|
|
|
2546
2628
|
var errors = [];
|
|
2547
2629
|
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
2548
2630
|
if (validate) {
|
|
2549
|
-
if (isEmptyValue(value, "string") && !rule.required) {
|
|
2631
|
+
if (isEmptyValue$1(value, "string") && !rule.required) {
|
|
2550
2632
|
return callback();
|
|
2551
2633
|
}
|
|
2552
2634
|
rules.required(rule, value, source, errors, options);
|
|
2553
|
-
if (!isEmptyValue(value, "string")) {
|
|
2635
|
+
if (!isEmptyValue$1(value, "string")) {
|
|
2554
2636
|
rules.pattern(rule, value, source, errors, options);
|
|
2555
2637
|
}
|
|
2556
2638
|
}
|
|
@@ -2560,11 +2642,11 @@ var date2 = function date3(rule, value, callback, source, options) {
|
|
|
2560
2642
|
var errors = [];
|
|
2561
2643
|
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
2562
2644
|
if (validate) {
|
|
2563
|
-
if (isEmptyValue(value, "date") && !rule.required) {
|
|
2645
|
+
if (isEmptyValue$1(value, "date") && !rule.required) {
|
|
2564
2646
|
return callback();
|
|
2565
2647
|
}
|
|
2566
2648
|
rules.required(rule, value, source, errors, options);
|
|
2567
|
-
if (!isEmptyValue(value, "date")) {
|
|
2649
|
+
if (!isEmptyValue$1(value, "date")) {
|
|
2568
2650
|
var dateObject;
|
|
2569
2651
|
if (value instanceof Date) {
|
|
2570
2652
|
dateObject = value;
|
|
@@ -2590,11 +2672,11 @@ var type2 = function type3(rule, value, callback, source, options) {
|
|
|
2590
2672
|
var errors = [];
|
|
2591
2673
|
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
2592
2674
|
if (validate) {
|
|
2593
|
-
if (isEmptyValue(value, ruleType) && !rule.required) {
|
|
2675
|
+
if (isEmptyValue$1(value, ruleType) && !rule.required) {
|
|
2594
2676
|
return callback();
|
|
2595
2677
|
}
|
|
2596
2678
|
rules.required(rule, value, source, errors, options, ruleType);
|
|
2597
|
-
if (!isEmptyValue(value, ruleType)) {
|
|
2679
|
+
if (!isEmptyValue$1(value, ruleType)) {
|
|
2598
2680
|
rules.type(rule, value, source, errors, options);
|
|
2599
2681
|
}
|
|
2600
2682
|
}
|
|
@@ -2604,7 +2686,7 @@ var any = function any2(rule, value, callback, source, options) {
|
|
|
2604
2686
|
var errors = [];
|
|
2605
2687
|
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
2606
2688
|
if (validate) {
|
|
2607
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
2689
|
+
if (isEmptyValue$1(value) && !rule.required) {
|
|
2608
2690
|
return callback();
|
|
2609
2691
|
}
|
|
2610
2692
|
rules.required(rule, value, source, errors, options);
|
|
@@ -2941,6 +3023,504 @@ Schema.register = function register(type4, validator) {
|
|
|
2941
3023
|
Schema.warning = warning;
|
|
2942
3024
|
Schema.messages = messages;
|
|
2943
3025
|
Schema.validators = validators;
|
|
3026
|
+
const stampKeys = [
|
|
3027
|
+
"sealId",
|
|
3028
|
+
"sealName",
|
|
3029
|
+
"sealType",
|
|
3030
|
+
"sealImage",
|
|
3031
|
+
"sealUserId",
|
|
3032
|
+
"sealUserName",
|
|
3033
|
+
"sealUserTime"
|
|
3034
|
+
];
|
|
3035
|
+
function isSealPosition(value) {
|
|
3036
|
+
if (!value || typeof value !== "object") return false;
|
|
3037
|
+
const p = value;
|
|
3038
|
+
return typeof p.sheetId === "string" && !!p.sheetId && Number.isInteger(p.pageIndex) && p.pageIndex >= 0 && Number.isFinite(p.leftMm) && p.leftMm >= 0 && Number.isFinite(p.topMm) && p.topMm >= 0;
|
|
3039
|
+
}
|
|
3040
|
+
function readSealValue(raw, fallback) {
|
|
3041
|
+
let parsed = {};
|
|
3042
|
+
try {
|
|
3043
|
+
const value = typeof raw === "string" ? JSON.parse(raw || "{}") : raw;
|
|
3044
|
+
if (value && typeof value === "object" && !Array.isArray(value)) parsed = value;
|
|
3045
|
+
} catch {
|
|
3046
|
+
}
|
|
3047
|
+
const stamp = Object.fromEntries(
|
|
3048
|
+
stampKeys.map((key) => [key, typeof parsed[key] === "string" ? parsed[key] : ""])
|
|
3049
|
+
);
|
|
3050
|
+
return {
|
|
3051
|
+
...stamp,
|
|
3052
|
+
sealPosition: { ...isSealPosition(parsed.sealPosition) ? parsed.sealPosition : fallback }
|
|
3053
|
+
};
|
|
3054
|
+
}
|
|
3055
|
+
function isSealStamped(raw) {
|
|
3056
|
+
try {
|
|
3057
|
+
const value = typeof raw === "string" ? JSON.parse(raw || "{}") : raw;
|
|
3058
|
+
return !!value && typeof value.sealId === "string" && !!value.sealId && typeof value.sealImage === "string" && !!value.sealImage;
|
|
3059
|
+
} catch {
|
|
3060
|
+
return false;
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
function isValidSealValue(raw) {
|
|
3064
|
+
try {
|
|
3065
|
+
const value = typeof raw === "string" ? JSON.parse(raw || "{}") : raw;
|
|
3066
|
+
return !!value && stampKeys.every((key) => typeof value[key] === "string") && isSealPosition(value.sealPosition) && (stampKeys.every((key) => !value[key]) || stampKeys.every((key) => !!value[key]));
|
|
3067
|
+
} catch {
|
|
3068
|
+
return false;
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
function moveSealValue(raw, fallback, position) {
|
|
3072
|
+
return JSON.stringify({ ...readSealValue(raw, fallback), sealPosition: { ...position } });
|
|
3073
|
+
}
|
|
3074
|
+
function stampSealValue(raw, fallback, stamp) {
|
|
3075
|
+
const current = readSealValue(raw, fallback);
|
|
3076
|
+
const next = readSealValue({ ...stamp, sealPosition: current.sealPosition }, fallback);
|
|
3077
|
+
return JSON.stringify(next);
|
|
3078
|
+
}
|
|
3079
|
+
function clearSealValue(raw, fallback) {
|
|
3080
|
+
return JSON.stringify(
|
|
3081
|
+
readSealValue({ sealPosition: readSealValue(raw, fallback).sealPosition }, fallback)
|
|
3082
|
+
);
|
|
3083
|
+
}
|
|
3084
|
+
function normalizeSealDiameter(value) {
|
|
3085
|
+
const diameter = Number(value);
|
|
3086
|
+
return Number.isFinite(diameter) && diameter > 0 ? Math.min(diameter, 200) : 42;
|
|
3087
|
+
}
|
|
3088
|
+
function clampSealPosition(position, widthMm, heightMm, diameterMm) {
|
|
3089
|
+
return {
|
|
3090
|
+
...position,
|
|
3091
|
+
leftMm: Math.max(0, Math.min(position.leftMm, Math.max(0, widthMm - diameterMm))),
|
|
3092
|
+
topMm: Math.max(0, Math.min(position.topMm, Math.max(0, heightMm - diameterMm)))
|
|
3093
|
+
};
|
|
3094
|
+
}
|
|
3095
|
+
function initializeSealFields(fields, formData) {
|
|
3096
|
+
for (const { props } of fields) {
|
|
3097
|
+
if (!props.field || props.isFieldModel || props.subFieldKey) continue;
|
|
3098
|
+
const raw = formData[props.field];
|
|
3099
|
+
if (raw == null || raw === "") {
|
|
3100
|
+
formData[props.field] = JSON.stringify(readSealValue("", props.sealPosition));
|
|
3101
|
+
continue;
|
|
3102
|
+
}
|
|
3103
|
+
try {
|
|
3104
|
+
const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
3105
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) continue;
|
|
3106
|
+
if (!isSealPosition(parsed.sealPosition)) {
|
|
3107
|
+
formData[props.field] = JSON.stringify({
|
|
3108
|
+
...parsed,
|
|
3109
|
+
sealPosition: { ...props.sealPosition }
|
|
3110
|
+
});
|
|
3111
|
+
} else if (typeof raw !== "string") {
|
|
3112
|
+
formData[props.field] = JSON.stringify(parsed);
|
|
3113
|
+
}
|
|
3114
|
+
} catch {
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
}
|
|
3118
|
+
const { identify, calculate: calculate$1 } = {
|
|
3119
|
+
identify: (expression) => window.NocodeAdapter.utils?.formulaIdentify?.(expression) ?? [],
|
|
3120
|
+
calculate: (expression, data) => window.NocodeAdapter.utils?.formulaCalculate?.(expression, data)
|
|
3121
|
+
};
|
|
3122
|
+
const getFieldDataValue = (parseInfo, formData) => {
|
|
3123
|
+
const getTextValue = (processedKey, value) => {
|
|
3124
|
+
const textValue = value ?? formData?.[processedKey] ?? "";
|
|
3125
|
+
return Array.isArray(textValue) ? textValue.join() : textValue;
|
|
3126
|
+
};
|
|
3127
|
+
const { type: type4, processed, hashValue } = parseInfo;
|
|
3128
|
+
if (type4 === "hash") {
|
|
3129
|
+
const tableData = toRaw(formData?.[hashValue] || []);
|
|
3130
|
+
return tableData.filter((d) => !d.deleted_).map((row) => getTextValue(processed, row?.[processed])).filter((i) => !isNil(i));
|
|
3131
|
+
}
|
|
3132
|
+
return getTextValue(processed, formData?.[processed]);
|
|
3133
|
+
};
|
|
3134
|
+
const parseFormulaVar = (formulaVar) => {
|
|
3135
|
+
const result = {
|
|
3136
|
+
original: formulaVar,
|
|
3137
|
+
type: "",
|
|
3138
|
+
processed: "",
|
|
3139
|
+
hashValue: "",
|
|
3140
|
+
dataType: ""
|
|
3141
|
+
};
|
|
3142
|
+
if (/^\$([^$]+)\$\.(.+)$/.test(formulaVar)) {
|
|
3143
|
+
const match = formulaVar.match(/^\$([^$]+)\$\.(.+)$/);
|
|
3144
|
+
result.type = "hash";
|
|
3145
|
+
result.processed = match[2];
|
|
3146
|
+
result.hashValue = match[1];
|
|
3147
|
+
result.dataType = "globType";
|
|
3148
|
+
} else if (/^_\.(.+)$/.test(formulaVar)) {
|
|
3149
|
+
const match = formulaVar.match(/^_\.(.+)$/);
|
|
3150
|
+
result.type = "underscore";
|
|
3151
|
+
result.processed = match[1];
|
|
3152
|
+
result.dataType = "currentRowType";
|
|
3153
|
+
} else {
|
|
3154
|
+
result.type = "plain";
|
|
3155
|
+
result.processed = formulaVar;
|
|
3156
|
+
result.dataType = "globType";
|
|
3157
|
+
}
|
|
3158
|
+
return result;
|
|
3159
|
+
};
|
|
3160
|
+
const getParseFormulaVarInfos = (expr) => {
|
|
3161
|
+
const rowArgs = expr ? identify(expr) : [];
|
|
3162
|
+
return {
|
|
3163
|
+
rowArgs,
|
|
3164
|
+
parseInfos: rowArgs.map((curr) => parseFormulaVar(curr))
|
|
3165
|
+
};
|
|
3166
|
+
};
|
|
3167
|
+
const calculateFormula = async (expr, formData, instanceFormState) => {
|
|
3168
|
+
const rowArgs = identify(expr);
|
|
3169
|
+
const formulaData = isEmpty(rowArgs) ? {} : rowArgs.reduce((total, curr) => {
|
|
3170
|
+
const parseInfo = parseFormulaVar(curr);
|
|
3171
|
+
total[curr] = getFieldDataValue(
|
|
3172
|
+
parseInfo,
|
|
3173
|
+
parseInfo.dataType === "currentRowType" ? formData : instanceFormState
|
|
3174
|
+
);
|
|
3175
|
+
return total;
|
|
3176
|
+
}, {});
|
|
3177
|
+
return calculate$1(expr, formulaData);
|
|
3178
|
+
};
|
|
3179
|
+
const isEmptyValue = (value) => {
|
|
3180
|
+
return value === void 0 || value === null || typeof value === "string" && value.trim() === "" || Array.isArray(value) && value.length === 0;
|
|
3181
|
+
};
|
|
3182
|
+
const compareByOp = (left, right, op) => {
|
|
3183
|
+
switch (op) {
|
|
3184
|
+
case RangeCompareOp.LT:
|
|
3185
|
+
return left < right;
|
|
3186
|
+
case RangeCompareOp.LE:
|
|
3187
|
+
return left <= right;
|
|
3188
|
+
case RangeCompareOp.GT:
|
|
3189
|
+
return left > right;
|
|
3190
|
+
case RangeCompareOp.GE:
|
|
3191
|
+
default:
|
|
3192
|
+
return left >= right;
|
|
3193
|
+
}
|
|
3194
|
+
};
|
|
3195
|
+
const rangeCompareMessage = (op, val) => {
|
|
3196
|
+
switch (op) {
|
|
3197
|
+
case RangeCompareOp.LT:
|
|
3198
|
+
return $t("sys.fieldValueNotGreaterOrEqual", { val });
|
|
3199
|
+
case RangeCompareOp.LE:
|
|
3200
|
+
return $t("sys.fieldValueNoMoreThan", { val });
|
|
3201
|
+
case RangeCompareOp.GT:
|
|
3202
|
+
return $t("sys.fieldValueNotLessOrEqual", { val });
|
|
3203
|
+
case RangeCompareOp.GE:
|
|
3204
|
+
default:
|
|
3205
|
+
return $t("sys.fieldValueNotLessThan", { val });
|
|
3206
|
+
}
|
|
3207
|
+
};
|
|
3208
|
+
const toUnixTimestamp = (input) => {
|
|
3209
|
+
if (isNil(input) || input === "") return null;
|
|
3210
|
+
const asNumber = typeof input === "number" || typeof input === "string" && /^-?\d+(\.\d+)?$/.test(input.trim());
|
|
3211
|
+
if (asNumber) {
|
|
3212
|
+
const n = Number(input);
|
|
3213
|
+
if (Number.isNaN(n)) return null;
|
|
3214
|
+
const parsed2 = n > 1e12 ? dayjs(n) : dayjs.unix(n);
|
|
3215
|
+
return parsed2.isValid() ? parsed2.unix() : null;
|
|
3216
|
+
}
|
|
3217
|
+
const parsed = dayjs(input);
|
|
3218
|
+
return parsed.isValid() ? parsed.unix() : null;
|
|
3219
|
+
};
|
|
3220
|
+
const buildError = (validatorInfo, message2) => JSON.stringify({ ...validatorInfo, message: message2 });
|
|
3221
|
+
function areValidationCommentsEqual(left, right) {
|
|
3222
|
+
const serialize = (comments) => JSON.stringify(
|
|
3223
|
+
comments,
|
|
3224
|
+
(_key, value) => value && typeof value === "object" && "message" in value ? { ...value, message: value.message } : value
|
|
3225
|
+
);
|
|
3226
|
+
return serialize(left) === serialize(right);
|
|
3227
|
+
}
|
|
3228
|
+
const createRule = (validator, message2, trigger = "change") => ({
|
|
3229
|
+
required: true,
|
|
3230
|
+
validator,
|
|
3231
|
+
message: message2,
|
|
3232
|
+
trigger
|
|
3233
|
+
});
|
|
3234
|
+
function relocateDeletedRowsToEnd(rows = []) {
|
|
3235
|
+
const active = [];
|
|
3236
|
+
const deleted = [];
|
|
3237
|
+
for (const row of rows) {
|
|
3238
|
+
if (row?.deleted_) deleted.push(row);
|
|
3239
|
+
else active.push(row);
|
|
3240
|
+
}
|
|
3241
|
+
return [...active, ...deleted];
|
|
3242
|
+
}
|
|
3243
|
+
function filterRulesByTrigger(rules2, trigger) {
|
|
3244
|
+
return rules2.filter((rule) => {
|
|
3245
|
+
const ruleTrigger = rule.trigger;
|
|
3246
|
+
if (!ruleTrigger) return trigger === "change";
|
|
3247
|
+
if (trigger === "blur") {
|
|
3248
|
+
return ruleTrigger === "blur" || ruleTrigger === "change";
|
|
3249
|
+
}
|
|
3250
|
+
return ruleTrigger === trigger;
|
|
3251
|
+
});
|
|
3252
|
+
}
|
|
3253
|
+
function assembleRules(input) {
|
|
3254
|
+
const { showRequired, fieldType, validatorInfo, props } = input;
|
|
3255
|
+
const {
|
|
3256
|
+
minlength,
|
|
3257
|
+
maxlength,
|
|
3258
|
+
regex,
|
|
3259
|
+
regexHint,
|
|
3260
|
+
validateTrue,
|
|
3261
|
+
validateFalse,
|
|
3262
|
+
enableRangeValidate,
|
|
3263
|
+
maxValidateMode,
|
|
3264
|
+
minValidateMode,
|
|
3265
|
+
maxCompareOp,
|
|
3266
|
+
minCompareOp,
|
|
3267
|
+
minValue,
|
|
3268
|
+
maxValue,
|
|
3269
|
+
minFormulaExpr,
|
|
3270
|
+
maxFormulaExpr,
|
|
3271
|
+
minDate,
|
|
3272
|
+
maxDate,
|
|
3273
|
+
minDateFormulaExpr,
|
|
3274
|
+
maxDateFormulaExpr,
|
|
3275
|
+
maxDateValidateMode,
|
|
3276
|
+
minDateValidateMode
|
|
3277
|
+
} = props;
|
|
3278
|
+
const resolvedMaxCompareOp = maxCompareOp ?? RangeCompareOp.LE;
|
|
3279
|
+
const resolvedMinCompareOp = minCompareOp ?? RangeCompareOp.GE;
|
|
3280
|
+
const RuleProps = [];
|
|
3281
|
+
if (props.bizType === FIELD_TYPE.SEAL) {
|
|
3282
|
+
if (showRequired) {
|
|
3283
|
+
RuleProps.push(
|
|
3284
|
+
createRule(
|
|
3285
|
+
(_rule, value) => isSealStamped(value),
|
|
3286
|
+
buildError(
|
|
3287
|
+
{ ...validatorInfo, validationCode: "seal-required" },
|
|
3288
|
+
$t("sys.fieldRequired")
|
|
3289
|
+
),
|
|
3290
|
+
"manual"
|
|
3291
|
+
)
|
|
3292
|
+
);
|
|
3293
|
+
}
|
|
3294
|
+
RuleProps.push(createRule((_rule, value) => isEmptyValue(value) || isValidSealValue(value), buildError(validatorInfo, $t("sys.seal.invalid"))));
|
|
3295
|
+
return RuleProps;
|
|
3296
|
+
}
|
|
3297
|
+
if (showRequired) {
|
|
3298
|
+
RuleProps.push(
|
|
3299
|
+
createRule(
|
|
3300
|
+
(_rule, value) => !isEmptyValue(value),
|
|
3301
|
+
buildError(validatorInfo, $t("sys.fieldRequired")),
|
|
3302
|
+
"manual"
|
|
3303
|
+
)
|
|
3304
|
+
);
|
|
3305
|
+
}
|
|
3306
|
+
if (!isNil(minlength)) {
|
|
3307
|
+
RuleProps.push(
|
|
3308
|
+
createRule((_rule, value) => {
|
|
3309
|
+
if (isEmptyValue(value)) return true;
|
|
3310
|
+
return String(value).length >= minlength;
|
|
3311
|
+
}, buildError(validatorInfo, $t("sys.fieldLengthNotLessThan", { len: minlength })))
|
|
3312
|
+
);
|
|
3313
|
+
}
|
|
3314
|
+
const effectiveMaxlength = isNil(maxlength) && fieldType === FIELD_TYPE.TEXT ? 1024 : maxlength;
|
|
3315
|
+
if (!isNil(effectiveMaxlength)) {
|
|
3316
|
+
RuleProps.push(
|
|
3317
|
+
createRule((_rule, value) => {
|
|
3318
|
+
if (isEmptyValue(value)) return true;
|
|
3319
|
+
return String(value).length <= effectiveMaxlength;
|
|
3320
|
+
}, buildError(validatorInfo, $t("sys.fieldLengthNoMoreThan", { len: effectiveMaxlength })))
|
|
3321
|
+
);
|
|
3322
|
+
}
|
|
3323
|
+
if (regex) {
|
|
3324
|
+
RuleProps.push(
|
|
3325
|
+
createRule((_rule, value) => {
|
|
3326
|
+
if (isEmptyValue(value)) return true;
|
|
3327
|
+
return new RegExp(regex).test(value);
|
|
3328
|
+
}, buildError(validatorInfo, regexHint ?? $t("sys.fieldFormatError")))
|
|
3329
|
+
);
|
|
3330
|
+
}
|
|
3331
|
+
if (validateTrue) {
|
|
3332
|
+
RuleProps.push({
|
|
3333
|
+
required: true,
|
|
3334
|
+
trigger: "manual",
|
|
3335
|
+
validator: (_rule, value) => value === true,
|
|
3336
|
+
message: buildError(validatorInfo, $t("sys.fieldValueNeedTrue"))
|
|
3337
|
+
});
|
|
3338
|
+
}
|
|
3339
|
+
if (validateFalse) {
|
|
3340
|
+
RuleProps.push({
|
|
3341
|
+
required: true,
|
|
3342
|
+
trigger: "manual",
|
|
3343
|
+
validator: (_rule, value) => value === false,
|
|
3344
|
+
message: buildError(validatorInfo, $t("sys.fieldValueNeedFalse"))
|
|
3345
|
+
});
|
|
3346
|
+
}
|
|
3347
|
+
if (!enableRangeValidate) {
|
|
3348
|
+
return RuleProps;
|
|
3349
|
+
}
|
|
3350
|
+
if (minValidateMode === RangeValidateMode.Fixed_Number && !isEmptyValue(minValue)) {
|
|
3351
|
+
RuleProps.push(
|
|
3352
|
+
createRule((_rule, value) => {
|
|
3353
|
+
if (isEmptyValue(value)) return true;
|
|
3354
|
+
return compareByOp(Number(value), Number(minValue), resolvedMinCompareOp);
|
|
3355
|
+
}, buildError(validatorInfo, rangeCompareMessage(resolvedMinCompareOp, minValue)))
|
|
3356
|
+
);
|
|
3357
|
+
}
|
|
3358
|
+
if (minValidateMode === RangeValidateMode.Variable_Validate && minFormulaExpr) {
|
|
3359
|
+
RuleProps.push({
|
|
3360
|
+
required: true,
|
|
3361
|
+
trigger: "change",
|
|
3362
|
+
validator: async (_rule, value, _callback, _source, options) => {
|
|
3363
|
+
const currentFormData = getCurrentFormData(_rule, options);
|
|
3364
|
+
const formulaValue = await calculateFormula(
|
|
3365
|
+
minFormulaExpr,
|
|
3366
|
+
currentFormData,
|
|
3367
|
+
options?.formData
|
|
3368
|
+
);
|
|
3369
|
+
if (isEmptyValue(formulaValue)) {
|
|
3370
|
+
return Promise.resolve();
|
|
3371
|
+
}
|
|
3372
|
+
const parsedMin = parseFloat(formulaValue);
|
|
3373
|
+
if (!isNaN(parsedMin)) {
|
|
3374
|
+
if (isEmptyValue(value)) {
|
|
3375
|
+
return Promise.resolve();
|
|
3376
|
+
}
|
|
3377
|
+
if (!compareByOp(Number(value), parsedMin, resolvedMinCompareOp)) {
|
|
3378
|
+
return Promise.reject(
|
|
3379
|
+
new Error(
|
|
3380
|
+
buildError(validatorInfo, rangeCompareMessage(resolvedMinCompareOp, parsedMin))
|
|
3381
|
+
)
|
|
3382
|
+
);
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
return Promise.resolve();
|
|
3386
|
+
}
|
|
3387
|
+
});
|
|
3388
|
+
}
|
|
3389
|
+
if (maxValidateMode === RangeValidateMode.Fixed_Number && !isEmptyValue(maxValue)) {
|
|
3390
|
+
RuleProps.push(
|
|
3391
|
+
createRule((_rule, value) => {
|
|
3392
|
+
if (isEmptyValue(value)) return true;
|
|
3393
|
+
return compareByOp(Number(value), Number(maxValue), resolvedMaxCompareOp);
|
|
3394
|
+
}, buildError(validatorInfo, rangeCompareMessage(resolvedMaxCompareOp, maxValue)))
|
|
3395
|
+
);
|
|
3396
|
+
}
|
|
3397
|
+
if (maxValidateMode === RangeValidateMode.Variable_Validate && maxFormulaExpr) {
|
|
3398
|
+
RuleProps.push({
|
|
3399
|
+
required: true,
|
|
3400
|
+
trigger: "change",
|
|
3401
|
+
validator: async (_rule, value, _callback, _source, options) => {
|
|
3402
|
+
const currentFormData = getCurrentFormData(_rule, options);
|
|
3403
|
+
const formulaValue = await calculateFormula(
|
|
3404
|
+
maxFormulaExpr,
|
|
3405
|
+
currentFormData,
|
|
3406
|
+
options?.formData
|
|
3407
|
+
);
|
|
3408
|
+
if (isEmptyValue(formulaValue)) {
|
|
3409
|
+
return Promise.resolve();
|
|
3410
|
+
}
|
|
3411
|
+
const parsedMax = parseFloat(formulaValue);
|
|
3412
|
+
if (!isNaN(parsedMax)) {
|
|
3413
|
+
if (isEmptyValue(value)) {
|
|
3414
|
+
return Promise.resolve();
|
|
3415
|
+
}
|
|
3416
|
+
if (!compareByOp(Number(value), parsedMax, resolvedMaxCompareOp)) {
|
|
3417
|
+
return Promise.reject(
|
|
3418
|
+
new Error(
|
|
3419
|
+
buildError(validatorInfo, rangeCompareMessage(resolvedMaxCompareOp, parsedMax))
|
|
3420
|
+
)
|
|
3421
|
+
);
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
return Promise.resolve();
|
|
3425
|
+
}
|
|
3426
|
+
});
|
|
3427
|
+
}
|
|
3428
|
+
if (minDateValidateMode === RangeValidateMode.Fixed_Number && minDate) {
|
|
3429
|
+
RuleProps.push(
|
|
3430
|
+
createRule((_rule, value) => {
|
|
3431
|
+
if (isEmptyValue(value)) return true;
|
|
3432
|
+
const inputTime = dayjs(value).unix();
|
|
3433
|
+
const minTimestamp = dayjs(minDate).unix();
|
|
3434
|
+
if (!dayjs(value).isValid() || !dayjs(minDate).isValid()) return true;
|
|
3435
|
+
return compareByOp(inputTime, minTimestamp, resolvedMinCompareOp);
|
|
3436
|
+
}, buildError(validatorInfo, rangeCompareMessage(resolvedMinCompareOp, minDate)))
|
|
3437
|
+
);
|
|
3438
|
+
}
|
|
3439
|
+
if (maxDateValidateMode === RangeValidateMode.Fixed_Number && maxDate) {
|
|
3440
|
+
RuleProps.push(
|
|
3441
|
+
createRule((_rule, value) => {
|
|
3442
|
+
if (isEmptyValue(value)) return true;
|
|
3443
|
+
const inputTime = dayjs(value).unix();
|
|
3444
|
+
const maxTimestamp = dayjs(maxDate).unix();
|
|
3445
|
+
if (!dayjs(value).isValid() || !dayjs(maxDate).isValid()) return true;
|
|
3446
|
+
return compareByOp(inputTime, maxTimestamp, resolvedMaxCompareOp);
|
|
3447
|
+
}, buildError(validatorInfo, rangeCompareMessage(resolvedMaxCompareOp, maxDate)))
|
|
3448
|
+
);
|
|
3449
|
+
}
|
|
3450
|
+
if (minDateValidateMode === RangeValidateMode.Variable_Validate && minDateFormulaExpr) {
|
|
3451
|
+
RuleProps.push({
|
|
3452
|
+
required: true,
|
|
3453
|
+
trigger: "change",
|
|
3454
|
+
validator: async (_rule, value, _callback, _source, options) => {
|
|
3455
|
+
const currentFormData = getCurrentFormData(_rule, options);
|
|
3456
|
+
const formulaValue = await calculateFormula(
|
|
3457
|
+
minDateFormulaExpr,
|
|
3458
|
+
currentFormData,
|
|
3459
|
+
options?.formData
|
|
3460
|
+
);
|
|
3461
|
+
const limitTime = toUnixTimestamp(formulaValue);
|
|
3462
|
+
if (limitTime !== null) {
|
|
3463
|
+
if (isEmptyValue(value)) {
|
|
3464
|
+
return Promise.resolve();
|
|
3465
|
+
}
|
|
3466
|
+
if (!dayjs(value).isValid()) {
|
|
3467
|
+
return Promise.resolve();
|
|
3468
|
+
}
|
|
3469
|
+
const inputTime = dayjs(value).unix();
|
|
3470
|
+
const fmt = fieldType === FIELD_TYPE.DATE_TIME ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
3471
|
+
if (!compareByOp(inputTime, limitTime, resolvedMinCompareOp)) {
|
|
3472
|
+
return Promise.reject(
|
|
3473
|
+
new Error(
|
|
3474
|
+
buildError(
|
|
3475
|
+
validatorInfo,
|
|
3476
|
+
rangeCompareMessage(resolvedMinCompareOp, dayjs.unix(limitTime).format(fmt))
|
|
3477
|
+
)
|
|
3478
|
+
)
|
|
3479
|
+
);
|
|
3480
|
+
}
|
|
3481
|
+
}
|
|
3482
|
+
return Promise.resolve();
|
|
3483
|
+
}
|
|
3484
|
+
});
|
|
3485
|
+
}
|
|
3486
|
+
if (maxDateValidateMode === RangeValidateMode.Variable_Validate && maxDateFormulaExpr) {
|
|
3487
|
+
RuleProps.push({
|
|
3488
|
+
required: true,
|
|
3489
|
+
trigger: "change",
|
|
3490
|
+
validator: async (_rule, value, _callback, _source, options) => {
|
|
3491
|
+
const currentFormData = getCurrentFormData(_rule, options);
|
|
3492
|
+
const formulaValue = await calculateFormula(
|
|
3493
|
+
maxDateFormulaExpr,
|
|
3494
|
+
currentFormData,
|
|
3495
|
+
options?.formData
|
|
3496
|
+
);
|
|
3497
|
+
const limitTime = toUnixTimestamp(formulaValue);
|
|
3498
|
+
if (limitTime !== null) {
|
|
3499
|
+
if (isEmptyValue(value)) {
|
|
3500
|
+
return Promise.resolve();
|
|
3501
|
+
}
|
|
3502
|
+
if (!dayjs(value).isValid()) {
|
|
3503
|
+
return Promise.resolve();
|
|
3504
|
+
}
|
|
3505
|
+
const inputTime = dayjs(value).unix();
|
|
3506
|
+
const fmt = fieldType === FIELD_TYPE.DATE_TIME ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
3507
|
+
if (!compareByOp(inputTime, limitTime, resolvedMaxCompareOp)) {
|
|
3508
|
+
return Promise.reject(
|
|
3509
|
+
new Error(
|
|
3510
|
+
buildError(
|
|
3511
|
+
validatorInfo,
|
|
3512
|
+
rangeCompareMessage(resolvedMaxCompareOp, dayjs.unix(limitTime).format(fmt))
|
|
3513
|
+
)
|
|
3514
|
+
)
|
|
3515
|
+
);
|
|
3516
|
+
}
|
|
3517
|
+
}
|
|
3518
|
+
return Promise.resolve();
|
|
3519
|
+
}
|
|
3520
|
+
});
|
|
3521
|
+
}
|
|
3522
|
+
return RuleProps;
|
|
3523
|
+
}
|
|
2944
3524
|
function resolveKeepExceptionHighlight(formValue, fieldValue) {
|
|
2945
3525
|
if (typeof fieldValue === "boolean") {
|
|
2946
3526
|
return fieldValue;
|
|
@@ -3066,7 +3646,7 @@ function clearResolvedManualErrors(map, resolvePayload) {
|
|
|
3066
3646
|
if (!payload) continue;
|
|
3067
3647
|
const hasManual = filterRulesByTrigger(payload.rules, "manual").length > 0;
|
|
3068
3648
|
const hasLive = filterRulesByTrigger(payload.rules, "change").length > 0;
|
|
3069
|
-
if (hasManual && !hasLive && !isEmptyValue
|
|
3649
|
+
if (hasManual && !hasLive && !isEmptyValue(payload.value)) {
|
|
3070
3650
|
delete next[path];
|
|
3071
3651
|
}
|
|
3072
3652
|
}
|
|
@@ -3080,7 +3660,7 @@ function mergeLiveValidation(current, liveResult, livePaths, resolvePayload) {
|
|
|
3080
3660
|
continue;
|
|
3081
3661
|
}
|
|
3082
3662
|
const payload = resolvePayload(path);
|
|
3083
|
-
const keepManualComment = !!payload && filterRulesByTrigger(payload.rules, "manual").length > 0 && isEmptyValue
|
|
3663
|
+
const keepManualComment = !!payload && filterRulesByTrigger(payload.rules, "manual").length > 0 && isEmptyValue(payload.value) && !!base[path]?.length;
|
|
3084
3664
|
if (!keepManualComment) {
|
|
3085
3665
|
delete base[path];
|
|
3086
3666
|
}
|
|
@@ -3123,7 +3703,7 @@ function mergeDisplayValidation(current, displayResult, ruleKeys, validatedPaths
|
|
|
3123
3703
|
next[path] = displayResult[path];
|
|
3124
3704
|
} else {
|
|
3125
3705
|
const payload = resolvePayload(path);
|
|
3126
|
-
const keepManualComment = !!payload && filterRulesByTrigger(payload.rules, "manual").length > 0 && isEmptyValue
|
|
3706
|
+
const keepManualComment = !!payload && filterRulesByTrigger(payload.rules, "manual").length > 0 && isEmptyValue(payload.value) && !!next[path]?.length;
|
|
3127
3707
|
if (!keepManualComment) delete next[path];
|
|
3128
3708
|
}
|
|
3129
3709
|
}
|
|
@@ -3217,11 +3797,12 @@ class RuntimeValidationService {
|
|
|
3217
3797
|
this.pendingLive = this.pendingLive === "blur" ? "blur" : trigger;
|
|
3218
3798
|
if (this.liveTimer) clearTimeout(this.liveTimer);
|
|
3219
3799
|
this.liveTimer = void 0;
|
|
3220
|
-
if (immediate)
|
|
3800
|
+
if (immediate)
|
|
3801
|
+
void this.flushLive().catch((error) => this.logBackgroundError("字段校验失败", error));
|
|
3221
3802
|
else
|
|
3222
3803
|
this.liveTimer = setTimeout(() => {
|
|
3223
3804
|
this.liveTimer = void 0;
|
|
3224
|
-
void this.flushLive().catch((error) =>
|
|
3805
|
+
void this.flushLive().catch((error) => this.logBackgroundError("字段校验失败", error));
|
|
3225
3806
|
}, 300);
|
|
3226
3807
|
}
|
|
3227
3808
|
async flushLive() {
|
|
@@ -3243,11 +3824,17 @@ class RuntimeValidationService {
|
|
|
3243
3824
|
this.displayTimer = void 0;
|
|
3244
3825
|
const run = () => {
|
|
3245
3826
|
this.displayTimer = void 0;
|
|
3246
|
-
void this.validate("display").catch(
|
|
3827
|
+
void this.validate("display").catch(
|
|
3828
|
+
(error) => this.logBackgroundError("字段展示校验失败", error)
|
|
3829
|
+
);
|
|
3247
3830
|
};
|
|
3248
3831
|
if (immediate) run();
|
|
3249
3832
|
else this.displayTimer = setTimeout(run, 320);
|
|
3250
3833
|
}
|
|
3834
|
+
logBackgroundError(label, error) {
|
|
3835
|
+
if (error instanceof Error && error.message.startsWith("以下异步任务执行失败:")) return;
|
|
3836
|
+
console.error(label, error);
|
|
3837
|
+
}
|
|
3251
3838
|
pruneComments() {
|
|
3252
3839
|
if (!this.binding || this.disposed) return;
|
|
3253
3840
|
this.binding.applyComments(
|
|
@@ -4582,7 +5169,16 @@ class BomEntriesValidator {
|
|
|
4582
5169
|
memberIndexes.push(idx);
|
|
4583
5170
|
if (byLot && !row.material_no_) emptyLotIndexes.push(idx);
|
|
4584
5171
|
});
|
|
4585
|
-
const
|
|
5172
|
+
const targetExists = this.groupExistsInTable(arr, target);
|
|
5173
|
+
if (!targetExists) {
|
|
5174
|
+
const index = arr.findIndex((row2) => !row2.deleted_);
|
|
5175
|
+
const row = arr[index];
|
|
5176
|
+
const canReuse = row && !row.product_id_ && !row.bom_entry_id_ && !row.is_confirmed_ && arr.every((item, idx) => item.deleted_ || idx === index);
|
|
5177
|
+
if (canReuse) {
|
|
5178
|
+
emptyProductIndexes.push(index);
|
|
5179
|
+
}
|
|
5180
|
+
}
|
|
5181
|
+
const needInsert = !targetExists && emptyProductIndexes.length === 0;
|
|
4586
5182
|
const last2 = memberIndexes[memberIndexes.length - 1];
|
|
4587
5183
|
let groupInsertIndex = -1;
|
|
4588
5184
|
if (needInsert) {
|
|
@@ -5207,7 +5803,8 @@ class MaterialConsumeTableController {
|
|
|
5207
5803
|
constructor(tmplBomController, tmplBom, options = {}) {
|
|
5208
5804
|
this.tmplBomController = tmplBomController;
|
|
5209
5805
|
this.tmplBom = tmplBom;
|
|
5210
|
-
if (!options.printOnly
|
|
5806
|
+
if (!options.printOnly && this.hasFormInstance)
|
|
5807
|
+
this.initScanRule(this.tmplBom.barcode_parsing_rules_id_);
|
|
5211
5808
|
this.scanParamType = this.tmplBom.scan_param_type_;
|
|
5212
5809
|
markRaw(this);
|
|
5213
5810
|
this.bomEntriesValidator = new BomEntriesValidator(
|
|
@@ -5270,6 +5867,9 @@ class MaterialConsumeTableController {
|
|
|
5270
5867
|
get mcPattern() {
|
|
5271
5868
|
return this.tmplBom.material_consumption_pattern_ ?? this.tmplBomController.defaultMCPattern;
|
|
5272
5869
|
}
|
|
5870
|
+
get hasFormInstance() {
|
|
5871
|
+
return this.tmplBomController.hasFormInstance;
|
|
5872
|
+
}
|
|
5273
5873
|
/**
|
|
5274
5874
|
* 解析规则数据对象
|
|
5275
5875
|
*/
|
|
@@ -5522,6 +6122,10 @@ class MaterialConsumeTableController {
|
|
|
5522
6122
|
}
|
|
5523
6123
|
const isRecordPattern = this.mcPattern === MaterialConsumptionPatternEnum.RECORD && !this.tmplBom.personal_bom_enabled_;
|
|
5524
6124
|
console.log("parseScanStr", data);
|
|
6125
|
+
if (!data.lot && !data.uniqueCode) {
|
|
6126
|
+
this.error($t("sys.edhr.mcTable.lotOrUniqueCodeRequired"));
|
|
6127
|
+
return;
|
|
6128
|
+
}
|
|
5525
6129
|
const arr = await materialCheck({
|
|
5526
6130
|
material_no_: data.materialCode,
|
|
5527
6131
|
production_identification_name_: data.lot,
|
|
@@ -6016,7 +6620,16 @@ class MaterialConsumeTableController {
|
|
|
6016
6620
|
this.error(msg);
|
|
6017
6621
|
return;
|
|
6018
6622
|
}
|
|
6019
|
-
if (!value)
|
|
6623
|
+
if (!value) {
|
|
6624
|
+
if (row.product_id_ && !this.isCustomRequiredQty) {
|
|
6625
|
+
const util = this.bomEntriesValidator.findUtilByProductId(row.product_id_);
|
|
6626
|
+
if (util) {
|
|
6627
|
+
row.qty_required_ = util.total;
|
|
6628
|
+
}
|
|
6629
|
+
}
|
|
6630
|
+
this.updateDerivedQtyFields();
|
|
6631
|
+
return;
|
|
6632
|
+
}
|
|
6020
6633
|
try {
|
|
6021
6634
|
await validateReinspectionDate({
|
|
6022
6635
|
product_id_: option.product_id_ ?? row.product_id_,
|
|
@@ -6040,6 +6653,7 @@ class MaterialConsumeTableController {
|
|
|
6040
6653
|
const qty = oldGroupId && row.bom_entry_id_ === oldGroupId ? oldRequiredQty : this.getCustomGroupRequiredQty(row);
|
|
6041
6654
|
this.setCustomGroupRequiredQty(row, qty);
|
|
6042
6655
|
}
|
|
6656
|
+
this.updateDerivedQtyFields();
|
|
6043
6657
|
} else if (field === "qty_") {
|
|
6044
6658
|
this.updateDerivedQtyFields();
|
|
6045
6659
|
}
|
|
@@ -6674,11 +7288,12 @@ class SubTableCore {
|
|
|
6674
7288
|
/**
|
|
6675
7289
|
* 扫码多条候选时选择一行(1 条自动选中)
|
|
6676
7290
|
*/
|
|
6677
|
-
async pickScanRecord(records) {
|
|
7291
|
+
async pickScanRecord(records, options = {}) {
|
|
6678
7292
|
if (!records.length) return void 0;
|
|
6679
7293
|
if (records.length === 1) return records[0];
|
|
6680
7294
|
return this.render.openMultiRowsModal({
|
|
6681
|
-
rows: mapScanRecordsForPicker(records)
|
|
7295
|
+
rows: mapScanRecordsForPicker(records),
|
|
7296
|
+
...options
|
|
6682
7297
|
});
|
|
6683
7298
|
}
|
|
6684
7299
|
/**
|
|
@@ -6904,7 +7519,7 @@ async function validateObjectBomQtyOnSubmit(opts) {
|
|
|
6904
7519
|
for (const obj of objectFieldList) {
|
|
6905
7520
|
if (!obj?.objectField) continue;
|
|
6906
7521
|
const objectBom = findObjectBom(formInstBom, obj.objectField);
|
|
6907
|
-
if (objectBom?.material_consumption_pattern_ === MaterialConsumptionPatternEnum.RECORD) {
|
|
7522
|
+
if (objectBom?.material_consumption_pattern_ === MaterialConsumptionPatternEnum.RECORD && !objectBom.personal_bom_enabled_) {
|
|
6908
7523
|
continue;
|
|
6909
7524
|
}
|
|
6910
7525
|
const { productKey, productFieldName, qtyKey, qtyRequiredKey, qtyFieldName } = pickObjectFieldKeys(obj.subFields, obj.objectField);
|
|
@@ -6965,150 +7580,6 @@ async function validateObjectBomQtyOnSubmit(opts) {
|
|
|
6965
7580
|
}
|
|
6966
7581
|
return errors;
|
|
6967
7582
|
}
|
|
6968
|
-
function isBlank(value) {
|
|
6969
|
-
return value == null || value === "";
|
|
6970
|
-
}
|
|
6971
|
-
function pickPresent(preferred, fallback) {
|
|
6972
|
-
return isBlank(preferred) ? fallback : preferred;
|
|
6973
|
-
}
|
|
6974
|
-
function resolveObjectFieldKeys(opts) {
|
|
6975
|
-
const obj = opts.objectFieldList?.find((item) => item.objectField === opts.belongingObject);
|
|
6976
|
-
const fromList = obj?.subFields ? pickObjectFieldKeys(obj.subFields, opts.belongingObject) : {};
|
|
6977
|
-
const fromFallback = pickObjectFieldKeys(opts.fallbackFields, opts.belongingObject, {
|
|
6978
|
-
requireUsed: false
|
|
6979
|
-
});
|
|
6980
|
-
return {
|
|
6981
|
-
productKey: pickPresent(fromList.productKey, fromFallback.productKey),
|
|
6982
|
-
productFieldName: fromList.productFieldName ?? fromFallback.productFieldName,
|
|
6983
|
-
materialNoKey: pickPresent(fromList.materialNoKey, fromFallback.materialNoKey),
|
|
6984
|
-
materialNoFieldName: fromList.materialNoFieldName ?? fromFallback.materialNoFieldName,
|
|
6985
|
-
qtyKey: pickPresent(fromList.qtyKey, fromFallback.qtyKey),
|
|
6986
|
-
qtyRequiredKey: pickPresent(fromList.qtyRequiredKey, fromFallback.qtyRequiredKey),
|
|
6987
|
-
qtyFieldName: fromList.qtyFieldName ?? fromFallback.qtyFieldName,
|
|
6988
|
-
bomEntryIdKey: pickPresent(fromList.bomEntryIdKey, fromFallback.bomEntryIdKey)
|
|
6989
|
-
};
|
|
6990
|
-
}
|
|
6991
|
-
function buildObjectLotExtraQuery(productId) {
|
|
6992
|
-
if (isBlank(productId)) return {};
|
|
6993
|
-
const versionId = String(productId).split(":").pop();
|
|
6994
|
-
if (!versionId) return {};
|
|
6995
|
-
return { "product_id_.versionEq": versionId };
|
|
6996
|
-
}
|
|
6997
|
-
function clearedLotFields(materialNoKey) {
|
|
6998
|
-
if (!materialNoKey) return {};
|
|
6999
|
-
return {
|
|
7000
|
-
[materialNoKey]: void 0,
|
|
7001
|
-
[`${materialNoKey}_id_`]: void 0,
|
|
7002
|
-
[`${materialNoKey}_lb_`]: void 0
|
|
7003
|
-
};
|
|
7004
|
-
}
|
|
7005
|
-
function shouldClearLotOnProductChange(opts) {
|
|
7006
|
-
const { prevProduct, nextProduct, lotValue } = opts;
|
|
7007
|
-
if (isBlank(prevProduct) && isBlank(nextProduct)) return false;
|
|
7008
|
-
if (prevProduct === nextProduct) return false;
|
|
7009
|
-
if (isBlank(prevProduct) && !isBlank(nextProduct) && !isBlank(lotValue)) {
|
|
7010
|
-
return false;
|
|
7011
|
-
}
|
|
7012
|
-
return true;
|
|
7013
|
-
}
|
|
7014
|
-
let fillingProduct = false;
|
|
7015
|
-
function runWithFillProduct(fn) {
|
|
7016
|
-
fillingProduct = true;
|
|
7017
|
-
try {
|
|
7018
|
-
fn();
|
|
7019
|
-
} finally {
|
|
7020
|
-
nextTick(() => {
|
|
7021
|
-
fillingProduct = false;
|
|
7022
|
-
});
|
|
7023
|
-
}
|
|
7024
|
-
}
|
|
7025
|
-
function resolveLotValidateParams(keys, formData, option) {
|
|
7026
|
-
return {
|
|
7027
|
-
product_id_: option?.product_id_ ?? option?._item?.product_id_ ?? (keys.productKey ? formData[keys.productKey] : void 0),
|
|
7028
|
-
material_no_: option?.name_ ?? option?.__VALUE__ ?? (keys.materialNoKey ? formData[keys.materialNoKey] : void 0),
|
|
7029
|
-
material_no_id_: option?.id_ ?? (keys.materialNoKey ? formData[`${keys.materialNoKey}_id_`] : void 0)
|
|
7030
|
-
};
|
|
7031
|
-
}
|
|
7032
|
-
async function applyConsumeObjectTraceChange(opts) {
|
|
7033
|
-
const { belongingObject, role, formData } = opts;
|
|
7034
|
-
if (!belongingObject || !formData) return {};
|
|
7035
|
-
const keys = resolveObjectFieldKeys({
|
|
7036
|
-
belongingObject,
|
|
7037
|
-
objectFieldList: opts.objectFieldList,
|
|
7038
|
-
fallbackFields: opts.fallbackFields
|
|
7039
|
-
});
|
|
7040
|
-
if (role === FIELD_TYPE.PRODUCT) {
|
|
7041
|
-
if (!("prevProduct" in opts) || fillingProduct) return {};
|
|
7042
|
-
const values = {};
|
|
7043
|
-
if (shouldClearLotOnProductChange({
|
|
7044
|
-
prevProduct: opts.prevProduct,
|
|
7045
|
-
nextProduct: opts.nextValue,
|
|
7046
|
-
lotValue: keys.materialNoKey ? formData[keys.materialNoKey] : void 0
|
|
7047
|
-
})) {
|
|
7048
|
-
Object.assign(values, clearedLotFields(keys.materialNoKey));
|
|
7049
|
-
}
|
|
7050
|
-
if (keys.bomEntryIdKey) {
|
|
7051
|
-
values[keys.bomEntryIdKey] = null;
|
|
7052
|
-
if (!isBlank(opts.nextValue) && opts.formInstBom) {
|
|
7053
|
-
const entry = resolveObjectBomEntry({
|
|
7054
|
-
formInstBom: opts.formInstBom,
|
|
7055
|
-
belongingObject,
|
|
7056
|
-
productId: String(opts.nextValue)
|
|
7057
|
-
});
|
|
7058
|
-
if (entry) values[keys.bomEntryIdKey] = entry.id_;
|
|
7059
|
-
}
|
|
7060
|
-
}
|
|
7061
|
-
opts.rowWriter.patchRow(values, "autofill");
|
|
7062
|
-
const lotValue = keys.materialNoKey ? formData[keys.materialNoKey] : void 0;
|
|
7063
|
-
if (!isBlank(opts.nextValue) && !isBlank(lotValue)) {
|
|
7064
|
-
try {
|
|
7065
|
-
await validateReinspectionDate({
|
|
7066
|
-
product_id_: String(opts.nextValue),
|
|
7067
|
-
material_no_: lotValue,
|
|
7068
|
-
material_no_id_: keys.materialNoKey ? formData[`${keys.materialNoKey}_id_`] : void 0
|
|
7069
|
-
});
|
|
7070
|
-
} catch (e) {
|
|
7071
|
-
return { abortReinspection: e?.message || String(e) };
|
|
7072
|
-
}
|
|
7073
|
-
}
|
|
7074
|
-
return {};
|
|
7075
|
-
}
|
|
7076
|
-
if (role === FIELD_TYPE.MATERIAL_NO) {
|
|
7077
|
-
if (opts.option?.is_locked_) {
|
|
7078
|
-
opts.rowWriter.patchRow(clearedLotFields(keys.materialNoKey), "autofill");
|
|
7079
|
-
return { abortLocked: opts.option.id_ };
|
|
7080
|
-
}
|
|
7081
|
-
const params = resolveLotValidateParams(keys, formData, opts.option);
|
|
7082
|
-
if (isBlank(params.material_no_) && isBlank(params.material_no_id_)) return {};
|
|
7083
|
-
try {
|
|
7084
|
-
await validateReinspectionDate(params);
|
|
7085
|
-
} catch (e) {
|
|
7086
|
-
opts.rowWriter.patchRow(clearedLotFields(keys.materialNoKey), "async");
|
|
7087
|
-
return { abortReinspection: e?.message || String(e) };
|
|
7088
|
-
}
|
|
7089
|
-
const values = {};
|
|
7090
|
-
const productId = opts.option?.product_id_ ?? opts.option?._item?.product_id_;
|
|
7091
|
-
if (keys.productKey && !isBlank(productId)) values[keys.productKey] = productId;
|
|
7092
|
-
if (keys.bomEntryIdKey && opts.formInstBom) {
|
|
7093
|
-
if (!isBlank(productId)) {
|
|
7094
|
-
const entry = resolveObjectBomEntry({
|
|
7095
|
-
formInstBom: opts.formInstBom,
|
|
7096
|
-
belongingObject,
|
|
7097
|
-
productId: String(productId)
|
|
7098
|
-
});
|
|
7099
|
-
if (entry) values[keys.bomEntryIdKey] = entry.id_;
|
|
7100
|
-
}
|
|
7101
|
-
}
|
|
7102
|
-
const patchRelatedFields = () => opts.rowWriter.patchRow(values, "autofill");
|
|
7103
|
-
if (keys.productKey && !isBlank(productId)) {
|
|
7104
|
-
runWithFillProduct(patchRelatedFields);
|
|
7105
|
-
} else {
|
|
7106
|
-
patchRelatedFields();
|
|
7107
|
-
}
|
|
7108
|
-
return {};
|
|
7109
|
-
}
|
|
7110
|
-
return {};
|
|
7111
|
-
}
|
|
7112
7583
|
function useRuntimeRowState(rowSource) {
|
|
7113
7584
|
const { formStateStore } = useRuntimeInstanceServices();
|
|
7114
7585
|
function requireStore() {
|
|
@@ -7855,6 +8326,150 @@ function useFormTmplConfig() {
|
|
|
7855
8326
|
injectController
|
|
7856
8327
|
};
|
|
7857
8328
|
}
|
|
8329
|
+
function isBlank(value) {
|
|
8330
|
+
return value == null || value === "";
|
|
8331
|
+
}
|
|
8332
|
+
function pickPresent(preferred, fallback) {
|
|
8333
|
+
return isBlank(preferred) ? fallback : preferred;
|
|
8334
|
+
}
|
|
8335
|
+
function resolveObjectFieldKeys(opts) {
|
|
8336
|
+
const obj = opts.objectFieldList?.find((item) => item.objectField === opts.belongingObject);
|
|
8337
|
+
const fromList = obj?.subFields ? pickObjectFieldKeys(obj.subFields, opts.belongingObject) : {};
|
|
8338
|
+
const fromFallback = pickObjectFieldKeys(opts.fallbackFields, opts.belongingObject, {
|
|
8339
|
+
requireUsed: false
|
|
8340
|
+
});
|
|
8341
|
+
return {
|
|
8342
|
+
productKey: pickPresent(fromList.productKey, fromFallback.productKey),
|
|
8343
|
+
productFieldName: fromList.productFieldName ?? fromFallback.productFieldName,
|
|
8344
|
+
materialNoKey: pickPresent(fromList.materialNoKey, fromFallback.materialNoKey),
|
|
8345
|
+
materialNoFieldName: fromList.materialNoFieldName ?? fromFallback.materialNoFieldName,
|
|
8346
|
+
qtyKey: pickPresent(fromList.qtyKey, fromFallback.qtyKey),
|
|
8347
|
+
qtyRequiredKey: pickPresent(fromList.qtyRequiredKey, fromFallback.qtyRequiredKey),
|
|
8348
|
+
qtyFieldName: fromList.qtyFieldName ?? fromFallback.qtyFieldName,
|
|
8349
|
+
bomEntryIdKey: pickPresent(fromList.bomEntryIdKey, fromFallback.bomEntryIdKey)
|
|
8350
|
+
};
|
|
8351
|
+
}
|
|
8352
|
+
function buildObjectLotExtraQuery(productId) {
|
|
8353
|
+
if (isBlank(productId)) return {};
|
|
8354
|
+
const versionId = String(productId).split(":").pop();
|
|
8355
|
+
if (!versionId) return {};
|
|
8356
|
+
return { "product_id_.versionEq": versionId };
|
|
8357
|
+
}
|
|
8358
|
+
function clearedLotFields(materialNoKey) {
|
|
8359
|
+
if (!materialNoKey) return {};
|
|
8360
|
+
return {
|
|
8361
|
+
[materialNoKey]: void 0,
|
|
8362
|
+
[`${materialNoKey}_id_`]: void 0,
|
|
8363
|
+
[`${materialNoKey}_lb_`]: void 0
|
|
8364
|
+
};
|
|
8365
|
+
}
|
|
8366
|
+
function shouldClearLotOnProductChange(opts) {
|
|
8367
|
+
const { prevProduct, nextProduct, lotValue } = opts;
|
|
8368
|
+
if (isBlank(prevProduct) && isBlank(nextProduct)) return false;
|
|
8369
|
+
if (prevProduct === nextProduct) return false;
|
|
8370
|
+
if (isBlank(prevProduct) && !isBlank(nextProduct) && !isBlank(lotValue)) {
|
|
8371
|
+
return false;
|
|
8372
|
+
}
|
|
8373
|
+
return true;
|
|
8374
|
+
}
|
|
8375
|
+
let fillingProduct = false;
|
|
8376
|
+
function runWithFillProduct(fn) {
|
|
8377
|
+
fillingProduct = true;
|
|
8378
|
+
try {
|
|
8379
|
+
fn();
|
|
8380
|
+
} finally {
|
|
8381
|
+
nextTick(() => {
|
|
8382
|
+
fillingProduct = false;
|
|
8383
|
+
});
|
|
8384
|
+
}
|
|
8385
|
+
}
|
|
8386
|
+
function resolveLotValidateParams(keys, formData, option) {
|
|
8387
|
+
return {
|
|
8388
|
+
product_id_: option?.product_id_ ?? option?._item?.product_id_ ?? (keys.productKey ? formData[keys.productKey] : void 0),
|
|
8389
|
+
material_no_: option?.name_ ?? option?.__VALUE__ ?? (keys.materialNoKey ? formData[keys.materialNoKey] : void 0),
|
|
8390
|
+
material_no_id_: option?.id_ ?? (keys.materialNoKey ? formData[`${keys.materialNoKey}_id_`] : void 0)
|
|
8391
|
+
};
|
|
8392
|
+
}
|
|
8393
|
+
async function applyConsumeObjectTraceChange(opts) {
|
|
8394
|
+
const { belongingObject, role, formData } = opts;
|
|
8395
|
+
if (!belongingObject || !formData) return {};
|
|
8396
|
+
const keys = resolveObjectFieldKeys({
|
|
8397
|
+
belongingObject,
|
|
8398
|
+
objectFieldList: opts.objectFieldList,
|
|
8399
|
+
fallbackFields: opts.fallbackFields
|
|
8400
|
+
});
|
|
8401
|
+
if (role === FIELD_TYPE.PRODUCT) {
|
|
8402
|
+
if (!("prevProduct" in opts) || fillingProduct) return {};
|
|
8403
|
+
const values = {};
|
|
8404
|
+
if (shouldClearLotOnProductChange({
|
|
8405
|
+
prevProduct: opts.prevProduct,
|
|
8406
|
+
nextProduct: opts.nextValue,
|
|
8407
|
+
lotValue: keys.materialNoKey ? formData[keys.materialNoKey] : void 0
|
|
8408
|
+
})) {
|
|
8409
|
+
Object.assign(values, clearedLotFields(keys.materialNoKey));
|
|
8410
|
+
}
|
|
8411
|
+
if (keys.bomEntryIdKey) {
|
|
8412
|
+
values[keys.bomEntryIdKey] = null;
|
|
8413
|
+
if (!isBlank(opts.nextValue) && opts.formInstBom) {
|
|
8414
|
+
const entry = resolveObjectBomEntry({
|
|
8415
|
+
formInstBom: opts.formInstBom,
|
|
8416
|
+
belongingObject,
|
|
8417
|
+
productId: String(opts.nextValue)
|
|
8418
|
+
});
|
|
8419
|
+
if (entry) values[keys.bomEntryIdKey] = entry.id_;
|
|
8420
|
+
}
|
|
8421
|
+
}
|
|
8422
|
+
opts.rowWriter.patchRow(values, "autofill");
|
|
8423
|
+
const lotValue = keys.materialNoKey ? formData[keys.materialNoKey] : void 0;
|
|
8424
|
+
if (!isBlank(opts.nextValue) && !isBlank(lotValue)) {
|
|
8425
|
+
try {
|
|
8426
|
+
await validateReinspectionDate({
|
|
8427
|
+
product_id_: String(opts.nextValue),
|
|
8428
|
+
material_no_: lotValue,
|
|
8429
|
+
material_no_id_: keys.materialNoKey ? formData[`${keys.materialNoKey}_id_`] : void 0
|
|
8430
|
+
});
|
|
8431
|
+
} catch (e) {
|
|
8432
|
+
return { abortReinspection: e?.message || String(e) };
|
|
8433
|
+
}
|
|
8434
|
+
}
|
|
8435
|
+
return {};
|
|
8436
|
+
}
|
|
8437
|
+
if (role === FIELD_TYPE.MATERIAL_NO) {
|
|
8438
|
+
if (opts.option?.is_locked_) {
|
|
8439
|
+
opts.rowWriter.patchRow(clearedLotFields(keys.materialNoKey), "autofill");
|
|
8440
|
+
return { abortLocked: opts.option.id_ };
|
|
8441
|
+
}
|
|
8442
|
+
const params = resolveLotValidateParams(keys, formData, opts.option);
|
|
8443
|
+
if (isBlank(params.material_no_) && isBlank(params.material_no_id_)) return {};
|
|
8444
|
+
try {
|
|
8445
|
+
await validateReinspectionDate(params);
|
|
8446
|
+
} catch (e) {
|
|
8447
|
+
opts.rowWriter.patchRow(clearedLotFields(keys.materialNoKey), "async");
|
|
8448
|
+
return { abortReinspection: e?.message || String(e) };
|
|
8449
|
+
}
|
|
8450
|
+
const values = {};
|
|
8451
|
+
const productId = opts.option?.product_id_ ?? opts.option?._item?.product_id_;
|
|
8452
|
+
if (keys.productKey && !isBlank(productId)) values[keys.productKey] = productId;
|
|
8453
|
+
if (keys.bomEntryIdKey && opts.formInstBom) {
|
|
8454
|
+
if (!isBlank(productId)) {
|
|
8455
|
+
const entry = resolveObjectBomEntry({
|
|
8456
|
+
formInstBom: opts.formInstBom,
|
|
8457
|
+
belongingObject,
|
|
8458
|
+
productId: String(productId)
|
|
8459
|
+
});
|
|
8460
|
+
if (entry) values[keys.bomEntryIdKey] = entry.id_;
|
|
8461
|
+
}
|
|
8462
|
+
}
|
|
8463
|
+
const patchRelatedFields = () => opts.rowWriter.patchRow(values, "autofill");
|
|
8464
|
+
if (keys.productKey && !isBlank(productId)) {
|
|
8465
|
+
runWithFillProduct(patchRelatedFields);
|
|
8466
|
+
} else {
|
|
8467
|
+
patchRelatedFields();
|
|
8468
|
+
}
|
|
8469
|
+
return {};
|
|
8470
|
+
}
|
|
8471
|
+
return {};
|
|
8472
|
+
}
|
|
7858
8473
|
const _hoisted_1$5 = ["data-merge", "data-fill-direction"];
|
|
7859
8474
|
const _hoisted_2$1 = {
|
|
7860
8475
|
key: 0,
|
|
@@ -8175,6 +8790,7 @@ const DocumentSubTable = /* @__PURE__ */ defineComponent({
|
|
|
8175
8790
|
showDisplayStatus,
|
|
8176
8791
|
dataRelationShip
|
|
8177
8792
|
} = useWidgetStaticAttrs(props.widget);
|
|
8793
|
+
const isMockMaterialConsume = computed(() => !!dataRelationShip?.isMockReport && !!props.widget.props.isMaterialConsumeTable);
|
|
8178
8794
|
const sheetId = () => fields.value?.findWidgetById(props.widget.id)?.sheetId;
|
|
8179
8795
|
const subTableCore = props.subTableCore;
|
|
8180
8796
|
provide(NCB_PROVIDE.SUB_TABLE_CORE, subTableCore);
|
|
@@ -8315,6 +8931,9 @@ const DocumentSubTable = /* @__PURE__ */ defineComponent({
|
|
|
8315
8931
|
key,
|
|
8316
8932
|
actionValue
|
|
8317
8933
|
}) => {
|
|
8934
|
+
if (isMockMaterialConsume.value && (key === SubTableActionEnum.SCAN || key === SubTableActionEnum.Insert1GroupAfter)) {
|
|
8935
|
+
return;
|
|
8936
|
+
}
|
|
8318
8937
|
switch (key) {
|
|
8319
8938
|
case "insertRowBefore":
|
|
8320
8939
|
handleAddRow({
|
|
@@ -8408,10 +9027,11 @@ const DocumentSubTable = /* @__PURE__ */ defineComponent({
|
|
|
8408
9027
|
showRowWatermark,
|
|
8409
9028
|
rowGroupKey
|
|
8410
9029
|
}) => {
|
|
8411
|
-
const
|
|
9030
|
+
const baseMenus = subTableCore?.calcSubTableActionMenu({
|
|
8412
9031
|
rowData,
|
|
8413
9032
|
showDelBtn
|
|
8414
9033
|
});
|
|
9034
|
+
const menus = isMockMaterialConsume.value ? [getMenuByAction(SubTableActionEnum.SCAN), getMenuByAction(SubTableActionEnum.Insert1GroupAfter), ...baseMenus ?? []] : baseMenus;
|
|
8415
9035
|
const annRowDetails = dataRelationShip?.annRowDetails;
|
|
8416
9036
|
const rowMark = dataIdx !== -1 && annRowDetails?.length ? resolveRowFormChangeMark(field, rowData, annRowDetails) : null;
|
|
8417
9037
|
const rowUi = resolveFormChangeRowUi(rowData, rowMark);
|
|
@@ -8724,7 +9344,7 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
|
|
|
8724
9344
|
const {
|
|
8725
9345
|
showDisplayStatus,
|
|
8726
9346
|
dataRelationShip
|
|
8727
|
-
} = useWidgetStaticAttrs(props);
|
|
9347
|
+
} = useWidgetStaticAttrs(props.widget);
|
|
8728
9348
|
const sheetId = () => fields.value?.findWidgetById(props.widget.id)?.sheetId;
|
|
8729
9349
|
const formModelController = useFormModel().injectController();
|
|
8730
9350
|
const tableController = props.tableController;
|
|
@@ -8913,6 +9533,7 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
|
|
|
8913
9533
|
}));
|
|
8914
9534
|
};
|
|
8915
9535
|
const handleAction = (action, rowData) => {
|
|
9536
|
+
if (!tableController.hasFormInstance) return;
|
|
8916
9537
|
switch (action) {
|
|
8917
9538
|
case MaterialConsumeActionType.CONFIRM:
|
|
8918
9539
|
tableController.confirm(rowData);
|
|
@@ -8985,6 +9606,7 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
|
|
|
8985
9606
|
key,
|
|
8986
9607
|
actionValue
|
|
8987
9608
|
}) => {
|
|
9609
|
+
if (!tableController.hasFormInstance) return;
|
|
8988
9610
|
switch (key) {
|
|
8989
9611
|
case "rowEdit":
|
|
8990
9612
|
await tableController.editRow(rowData);
|
|
@@ -9355,7 +9977,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9355
9977
|
createElementVNode("i", { class: "iconfont icon-zhuyi" }),
|
|
9356
9978
|
createElementVNode("ul", { class: "tips-list" }, [
|
|
9357
9979
|
createElementVNode("li", null, "可将Excel内容粘贴到表格中,支持使用复制、粘贴、删除快捷键"),
|
|
9358
|
-
createElementVNode("li", null, "
|
|
9980
|
+
createElementVNode("li", null, " 表单中支持快速填报的字段类型:文本、长文本、整数、长整数、小数、精度小数、日期、时间、日期时间、批次/SN、报废物料批次、枚举单选、枚举多选(选项间以“,”分割) ")
|
|
9359
9981
|
])
|
|
9360
9982
|
], -1)),
|
|
9361
9983
|
createElementVNode("div", {
|
|
@@ -9380,7 +10002,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9380
10002
|
};
|
|
9381
10003
|
}
|
|
9382
10004
|
});
|
|
9383
|
-
const FixedQuickFillModal = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
10005
|
+
const FixedQuickFillModal = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-58540cb3"]]);
|
|
9384
10006
|
const _hoisted_1$1 = {
|
|
9385
10007
|
key: 1,
|
|
9386
10008
|
class: "sub-table-action__subtitle"
|
|
@@ -10082,7 +10704,7 @@ const DocumentPaper = /* @__PURE__ */ defineComponent({
|
|
|
10082
10704
|
}) : null,
|
|
10083
10705
|
// 在[固定表]顶部的可见单元格上加装操作按钮
|
|
10084
10706
|
tableAction: (() => {
|
|
10085
|
-
const fixedTableActionVisible = fixedTableInfo?.quickFillVisible && !filledFixedTableKeys.value.includes(fixedTableInfo.subFieldKey);
|
|
10707
|
+
const fixedTableActionVisible = props.basicInfo.renderModeType !== RenderModeEnum.ViewMode && fixedTableInfo?.quickFillVisible && !filledFixedTableKeys.value.includes(fixedTableInfo.subFieldKey);
|
|
10086
10708
|
return () => fixedTableActionVisible ? createVNode(_sfc_main$2, {
|
|
10087
10709
|
"tdId": tdId,
|
|
10088
10710
|
"formState": formState.value,
|
|
@@ -10153,7 +10775,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
10153
10775
|
createElementVNode("i", { class: "iconfont icon-zhuyi" }),
|
|
10154
10776
|
createElementVNode("ul", { class: "tips-list" }, [
|
|
10155
10777
|
createElementVNode("li", null, "可将Excel内容粘贴到表格中,支持使用复制、粘贴、删除快捷键"),
|
|
10156
|
-
createElementVNode("li", null, "
|
|
10778
|
+
createElementVNode("li", null, "表单中支持快速填报的字段类型:文本、长文本、整数、长整数、小数、精度小数、日期、时间、日期时间、批次/SN、报废物料批次、枚举单选、枚举多选(选项间以“,”分割)"),
|
|
10157
10779
|
createElementVNode("li", null, "当前快速填报最多支持200行")
|
|
10158
10780
|
])
|
|
10159
10781
|
], -1)),
|
|
@@ -10173,7 +10795,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
10173
10795
|
};
|
|
10174
10796
|
}
|
|
10175
10797
|
});
|
|
10176
|
-
const DynamicQuickFillModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
10798
|
+
const DynamicQuickFillModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-840aca0a"]]);
|
|
10177
10799
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10178
10800
|
__name: "dynamic-table-action",
|
|
10179
10801
|
props: {
|
|
@@ -10257,109 +10879,127 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10257
10879
|
});
|
|
10258
10880
|
const DynamicTableAction = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-53d7e66c"]]);
|
|
10259
10881
|
export {
|
|
10260
|
-
|
|
10261
|
-
|
|
10882
|
+
_sfc_main$5 as $,
|
|
10883
|
+
getObjectBomProductQuery as A,
|
|
10262
10884
|
BorderTD as B,
|
|
10263
|
-
|
|
10885
|
+
normalizeHistoricalAutofillRow as C,
|
|
10264
10886
|
DEFAULT_BOOLEAN_FIELD_WIDTH as D,
|
|
10265
10887
|
EMPTY_PRODUCT_VERSION_ID as E,
|
|
10266
|
-
|
|
10267
|
-
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
|
|
10888
|
+
readSealValue as F,
|
|
10889
|
+
isSealStamped as G,
|
|
10890
|
+
stampSealValue as H,
|
|
10891
|
+
isValidSealValue as I,
|
|
10892
|
+
clearSealValue as J,
|
|
10893
|
+
parseRuntimeFieldPath as K,
|
|
10894
|
+
calculateFormula as L,
|
|
10895
|
+
MAX_RUNTIME_SHEETS as M,
|
|
10274
10896
|
NCB_PROVIDE as N,
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
|
|
10354
|
-
|
|
10355
|
-
|
|
10897
|
+
useStyles as O,
|
|
10898
|
+
useDependency as P,
|
|
10899
|
+
useFieldPresentation as Q,
|
|
10900
|
+
useRuntimeEditorFlusher as R,
|
|
10901
|
+
RuntimeFormStateStore as S,
|
|
10902
|
+
createRuntimeInstanceContext as T,
|
|
10903
|
+
RuntimeInstanceRegistry as U,
|
|
10904
|
+
ScanParamType as V,
|
|
10905
|
+
RequiredQtyCalcRule as W,
|
|
10906
|
+
registerFormulaFuncs as X,
|
|
10907
|
+
moveSealValue as Y,
|
|
10908
|
+
DocumentPaper as Z,
|
|
10909
|
+
DynamicTableAction as _,
|
|
10910
|
+
MAX_RUNTIME_SHEET_TITLE_LENGTH as a,
|
|
10911
|
+
resolveScanQty as a$,
|
|
10912
|
+
getRuntimeDataFieldId as a0,
|
|
10913
|
+
buildRuntimeFieldPath as a1,
|
|
10914
|
+
resolveRuntimeFieldProps as a2,
|
|
10915
|
+
resolveRuntimeFieldState as a3,
|
|
10916
|
+
assembleRules as a4,
|
|
10917
|
+
isAttachFieldActive as a5,
|
|
10918
|
+
getRuntimeDependencyOutputKey as a6,
|
|
10919
|
+
isRowAddedInCurrentFormChange as a7,
|
|
10920
|
+
MaterialConsumeTableController as a8,
|
|
10921
|
+
setFormulaParamsConfig as a9,
|
|
10922
|
+
SubTableCore as aA,
|
|
10923
|
+
buildFormChangeDisplayRows as aB,
|
|
10924
|
+
convertV1Runtime as aC,
|
|
10925
|
+
detailsHaveFormChangeRowOps as aD,
|
|
10926
|
+
extractFormChangeRowDetails as aE,
|
|
10927
|
+
getFormChangeRowKey as aF,
|
|
10928
|
+
getFormChangeRowOp as aG,
|
|
10929
|
+
getSubTableQuickFillInfo as aH,
|
|
10930
|
+
isAnnLocationSelected as aI,
|
|
10931
|
+
isBlank as aJ,
|
|
10932
|
+
isFormChangeGhostRow as aK,
|
|
10933
|
+
normalizeHistoricalFieldConfig as aL,
|
|
10934
|
+
pickObjectFieldKeys as aM,
|
|
10935
|
+
recordSubtableRowAdd as aN,
|
|
10936
|
+
recordSubtableRowDelete as aO,
|
|
10937
|
+
relocateDeletedRowsToEnd as aP,
|
|
10938
|
+
resolveAnnotationFieldLocation as aQ,
|
|
10939
|
+
resolveFormChangeRowUi as aR,
|
|
10940
|
+
resolveRowFormChangeMark as aS,
|
|
10941
|
+
setSelectMobileTdId as aT,
|
|
10942
|
+
stripLegacyFormConfigFromPaper as aU,
|
|
10943
|
+
SubTableActionMenuTypeEnum as aV,
|
|
10944
|
+
getMenuByAction as aW,
|
|
10945
|
+
SubTableActionEnum as aX,
|
|
10946
|
+
resolveScanFillData as aY,
|
|
10947
|
+
getInsertSubMenu as aZ,
|
|
10948
|
+
resolveScanAdjustType as a_,
|
|
10949
|
+
normalizeRuntime as aa,
|
|
10950
|
+
initializeSealFields as ab,
|
|
10951
|
+
RuntimeSheetService as ac,
|
|
10952
|
+
validateObjectBomQtyOnSubmit as ad,
|
|
10953
|
+
areValidationCommentsEqual as ae,
|
|
10954
|
+
closeValidatorPopovers as af,
|
|
10955
|
+
enrichFormChangeRowDetails as ag,
|
|
10956
|
+
useMaterialBalance as ah,
|
|
10957
|
+
collectFormChangeFieldLocations as ai,
|
|
10958
|
+
nextFormChangeRowViewHistoryId as aj,
|
|
10959
|
+
DeviceConnector as ak,
|
|
10960
|
+
DocumentLoading as al,
|
|
10961
|
+
DynamicQuickFillModal as am,
|
|
10962
|
+
FixedQuickFillModal as an,
|
|
10963
|
+
FormTmplConfigController as ao,
|
|
10964
|
+
LEGACY_RUNTIME_FORM_CONFIG_KEYS as ap,
|
|
10965
|
+
LEGACY_RUNTIME_SHEET_ID as aq,
|
|
10966
|
+
LEGACY_RUNTIME_SHEET_TITLE as ar,
|
|
10967
|
+
MCDataUtil as as,
|
|
10968
|
+
OCR_MODEL_PRECISION_ENUM_KEY as at,
|
|
10969
|
+
RuntimeAsyncTaskCoordinator as au,
|
|
10970
|
+
RuntimeDependencyService as av,
|
|
10971
|
+
RuntimeFieldRegistry as aw,
|
|
10972
|
+
RuntimeInstanceEventBus as ax,
|
|
10973
|
+
RuntimePersistenceCoordinator as ay,
|
|
10974
|
+
RuntimeValidationService as az,
|
|
10975
|
+
MULTI_SHEET_SCHEMA_VERSION as b,
|
|
10976
|
+
toDateOnly as b0,
|
|
10977
|
+
hasSubtableBusinessData as b1,
|
|
10978
|
+
getCopySubMenu as b2,
|
|
10979
|
+
resolveScanParsedValue as b3,
|
|
10980
|
+
isProductBatchEmptyRow as b4,
|
|
10981
|
+
getBusinessFieldKey as c,
|
|
10982
|
+
createRuntimeDocumentV2 as d,
|
|
10983
|
+
clampSealPosition as e,
|
|
10984
|
+
normalizeFieldWidth as f,
|
|
10985
|
+
getParseFormulaVarInfos as g,
|
|
10986
|
+
normalizeHistoricalBusinessRow as h,
|
|
10987
|
+
DeviceLinkTmplUtil as i,
|
|
10988
|
+
normalizeAIOcrTmpl as j,
|
|
10989
|
+
useWidgetStaticAttrs as k,
|
|
10990
|
+
useRuntimeInstanceServices as l,
|
|
10991
|
+
setSelectAnnotationId as m,
|
|
10992
|
+
normalizeSealDiameter as n,
|
|
10993
|
+
useRuntimeRowState as o,
|
|
10994
|
+
getObjectBomMaterialLotQuery as p,
|
|
10995
|
+
buildObjectLotExtraQuery as q,
|
|
10356
10996
|
resolveObjectFieldKeys as r,
|
|
10357
10997
|
setSelectValidatorId as s,
|
|
10358
|
-
|
|
10998
|
+
MaterialConsumptionPatternEnum as t,
|
|
10359
10999
|
useFormTmplConfig as u,
|
|
10360
11000
|
validateObjectBomForScan as v,
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
11001
|
+
resolveObjectBomEntry as w,
|
|
11002
|
+
runWithFillProduct as x,
|
|
11003
|
+
useNocodeFormWidget as y,
|
|
11004
|
+
applyConsumeObjectTraceChange as z
|
|
10365
11005
|
};
|