@gct-paas/excel 0.1.39-beta.1 → 0.1.39-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/{BaseComponent-wXAepA6P.js → BaseComponent-DD4LDp1n.js} +2 -2
  2. package/dist/{VueVideoPlayer-C--qHZWs.js → VueVideoPlayer-4DekRqdD.js} +2 -2
  3. package/dist/{align-editor-BMFoEgQf.js → align-editor-CIX4Rrsu.js} +1 -1
  4. package/dist/{barcode-design-M3FjUJNm.js → barcode-design-Dn-gX9GM.js} +2 -2
  5. package/dist/base/index.es.js +205 -151
  6. package/dist/{diagonal-design-C2lATeRX.js → diagonal-design-DV9k2Etq.js} +2 -2
  7. package/dist/{dynamic-table-action-Cm8HO12b.js → dynamic-table-action-eba__tU0.js} +200 -105
  8. package/dist/{dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-CYRNF_U3.js → dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-BLw_6wwg.js} +375 -278
  9. package/dist/{edit.utils-CXmmCnxE-CaZuzVd6.js → edit.utils-CXmmCnxE-C3z8OkUI.js} +1 -1
  10. package/dist/excel.css +271 -156
  11. package/dist/{exceljs.min-CeIQpaOT.js → exceljs.min-owy1KJaV.js} +2 -2
  12. package/dist/{font-editor-CPn2F_OZ.js → font-editor-MmsbsBDL.js} +3 -3
  13. package/dist/{image-design-DWjjBFQa.js → image-design-BiqnMucs.js} +2 -2
  14. package/dist/{index-pxBPpLrG.js → index-81qnvwlE.js} +2 -2
  15. package/dist/{index-BZcapeWR.js → index-B-e6Kihk.js} +2 -2
  16. package/dist/{index-BEQELF4E.js → index-B1OoCza6.js} +3 -3
  17. package/dist/{index-DTSHn9ii.js → index-BDORrzH1.js} +5 -4
  18. package/dist/{index-BuNKNsIb.js → index-BVWDRLWZ.js} +2 -2
  19. package/dist/{index-CcBF1mOx.js → index-Bv7iaCJj.js} +2 -2
  20. package/dist/{index-B3oqnny_.js → index-ByIi1RJW.js} +1 -1
  21. package/dist/{index-DhkQma-u.js → index-C-VMvGfb.js} +3 -3
  22. package/dist/{index-CIiCyyBv.js → index-C5Latipd.js} +1 -1
  23. package/dist/{index-DdVlAV0_.js → index-CHgHFEqC.js} +1 -1
  24. package/dist/{index-DtS3ze0S.js → index-CQNHhNL1.js} +3 -3
  25. package/dist/{index-DHPRpllA.js → index-ClLFatlo.js} +1 -1
  26. package/dist/{index-DSSJ8S81.js → index-CpLgYWth.js} +2 -2
  27. package/dist/{index-CED1SWU9.js → index-Cpab65SE.js} +2 -2
  28. package/dist/{index-OIXBBHHu.js → index-CsO0OYyu.js} +2 -2
  29. package/dist/{index-CNlb3Y3A.js → index-DImWs6MW.js} +1 -1
  30. package/dist/{index-BatfBVeN.js → index-DPNyf4cT.js} +4 -4
  31. package/dist/{index-gra19syg.js → index-DSexWSnr.js} +2 -2
  32. package/dist/{index-ChRhjdl_.js → index-DZLAoFoR.js} +1 -1
  33. package/dist/{index-ClVsGQoQ.js → index-DcKgjW9I.js} +1 -1
  34. package/dist/{index-C__Qm3ub.js → index-DcgZMsRI.js} +2 -2
  35. package/dist/{index-BcpTVyHa.js → index-DiRArs8U.js} +2 -2
  36. package/dist/{index-CWmsgguT.js → index-DjZv4nuy.js} +3 -3
  37. package/dist/{index-CRGOLDI8.js → index-DtIe3wc5.js} +1 -1
  38. package/dist/{index-mA7F37nK.js → index-JS-FVx4n.js} +2 -2
  39. package/dist/{index-DxCN78vg.js → index-K9NcSlYx.js} +3 -3
  40. package/dist/{index-CpN3c_Lk.js → index-V9N1ZqDQ.js} +2 -2
  41. package/dist/{index-DqQ2ZxDn.js → index-bw-kdRhV.js} +2 -2
  42. package/dist/{index-B3S5QpVz.js → index-e8M3CfRR.js} +746 -536
  43. package/dist/{index-BrZiEGAB.js → index-ggSmw_Nu.js} +2 -2
  44. package/dist/{index-yfTjcRJ8.js → index-jRu9XYcy.js} +2 -2
  45. package/dist/{index-Cg0trWkY.js → index-qCD6xLhX.js} +2 -2
  46. package/dist/{index-DC8dEMj4.js → index-tPtqInyF.js} +1 -1
  47. package/dist/{index-B72KgWBu.js → index-w0e3f1tE.js} +1 -1
  48. package/dist/{index-C3GHvYcj.js → index-wA6cn_up.js} +2 -2
  49. package/dist/index.es.js +2 -2
  50. package/dist/{mb-render-BZXw-tG7.js → mb-render-Cg1jp9G0.js} +2 -2
  51. package/dist/{online-form-model-select.vue_vue_type_script_setup_true_name_online-form-model-select_lang-uXt_kyMo.js → online-form-model-select.vue_vue_type_script_setup_true_name_online-form-model-select_lang-B4sjJ1pf.js} +8 -1
  52. package/dist/{pagination-design-CCRMgYhc.js → pagination-design-DSf8uUvV.js} +2 -2
  53. package/dist/paper-widget-design-YsuYJgiL.js +4 -0
  54. package/dist/{print-runtime-instance-MA7UVZdA.js → print-runtime-instance-DurRHpiW.js} +1 -1
  55. package/dist/{print-snapshot-renderer-BavXucNu.js → print-snapshot-renderer-CGjb7n5x.js} +3 -3
  56. package/dist/{qrcode-design-BC1PBKf_.js → qrcode-design-CAhJUkWv.js} +1 -1
  57. package/dist/{revo-grid.entry-DjiOpHRm.js → revo-grid.entry-C-d6JxHO.js} +1 -1
  58. package/dist/{revogr-attribution_7.entry-CDnB9lLs.js → revogr-attribution_7.entry-CEmwC2qj.js} +3 -3
  59. package/dist/{revogr-clipboard_3.entry-C6O9JrN7.js → revogr-clipboard_3.entry-SinmTCuk.js} +2 -2
  60. package/dist/{revogr-data_4.entry-y1feqF9h.js → revogr-data_4.entry-BFMPGhkG.js} +2 -2
  61. package/dist/{revogr-filter-panel.entry-By9rD4Y9.js → revogr-filter-panel.entry-CRhsxkJ5.js} +1 -1
  62. package/dist/seal-design-DMoxaJpb.js +4 -0
  63. package/dist/{serialnumber-design-Bb75HRGq.js → serialnumber-design-DFrw9aMl.js} +1 -1
  64. package/dist/shared/index.es.js +10 -8
  65. package/dist/{single-field-drop-BlAQcTBT.js → single-field-drop-D5pPJfWf.js} +2 -2
  66. package/dist/{size-editor-BWnv8oH4.js → size-editor-BEJHhTPS.js} +1 -1
  67. package/dist/src/nocode-base/src/core/sub-table/pretreatment-list-table-core.d.ts +1 -0
  68. package/dist/src/nocode-base/src/hooks/material-consume/material-consume-table-controller.d.ts +1 -0
  69. package/dist/src/nocode-base/src/hooks/material-consume/tmpl-bom-controller.d.ts +12 -7
  70. package/dist/src/nocode-base/src/runtime/async-task-coordinator.d.ts +6 -2
  71. package/dist/src/nocode-base/src/runtime/multi-sheet-runtime.d.ts +2 -0
  72. package/dist/src/nocode-base/src/runtime/runtime-field-initializer.d.ts +1 -1
  73. package/dist/src/nocode-base/src/runtime/runtime-form-state-store.d.ts +6 -0
  74. package/dist/src/nocode-base/src/runtime/runtime-validation-service.d.ts +1 -0
  75. package/dist/src/nocode-base/src/runtime/table-row-identity.d.ts +11 -2
  76. package/dist/src/nocode-base/src/types/fields/i-sign.d.ts +1 -1
  77. package/dist/src/nocode-base/src/types/render/mc-render.d.ts +1 -1
  78. package/dist/src/nocode-web-render/src/render/sub-table/material-consume/mc-web-render.d.ts +1 -1
  79. package/dist/src/online-form/src/views/designer/conversions/normalize-paper-grid.d.ts +3 -0
  80. package/dist/src/online-form/src/views/render/sheet-tab-bar.vue.d.ts +5 -3
  81. package/dist/src/shared/components/Signature/logic/index.d.ts +1 -1
  82. package/dist/src/shared/enum/index.d.ts +2 -0
  83. package/dist/src/shared/enum/product-type.d.ts +9 -0
  84. package/dist/src/shared/enum/production-identification.d.ts +19 -0
  85. package/dist/{sub-table-factory-CGELiUkd.js → sub-table-factory-B3KBbZsY.js} +22 -9
  86. package/dist/{text-design-CiWiGhwN.js → text-design-CJhcSRF9.js} +2 -2
  87. package/dist/{throttle-Cpk1LoGk-B466AVFI.js → throttle-Cpk1LoGk-BrHInZAq.js} +1 -1
  88. package/dist/{timediff-design-CnCXGLgF.js → timediff-design-Di90S4w3.js} +1 -1
  89. package/dist/{trace-like-wrapper-CPFayyjF.js → trace-like-wrapper-BVcK30RS.js} +2 -2
  90. package/dist/{value-editor.vue_vue_type_style_index_0_lang-DyTtWYrg.js → value-editor.vue_vue_type_style_index_0_lang-CSdqlors.js} +2 -2
  91. package/dist/web-render/index.es.js +3 -3
  92. package/dist/{widget-barcode-DMt5IwNO.js → widget-barcode-CS7s22AA.js} +4 -4
  93. package/dist/{widget-diagonal-D073XXKw.js → widget-diagonal-B_ElDgMy.js} +3 -3
  94. package/dist/{widget-image-Bc-6H2uA.js → widget-image-CqvGjdH2.js} +5 -5
  95. package/dist/{widget-line-BtfMvVGp.js → widget-line-CBXxpl7f.js} +2 -2
  96. package/dist/{widget-pagination-CIlAAI2a.js → widget-pagination-DcPVAkyB.js} +5 -5
  97. package/dist/{widget-power-Bu16c4bS.js → widget-power-Cq2O_Nhv.js} +3 -3
  98. package/dist/{widget-qrcode-AfILjhmH.js → widget-qrcode-nH4o7lHq.js} +3 -3
  99. package/dist/{widget-rangelimit-B-mhBJN4.js → widget-rangelimit-BFk1XcbP.js} +3 -3
  100. package/dist/{widget-serialnumber-DVoe5bqh.js → widget-serialnumber-CkYwampF.js} +1 -1
  101. package/dist/{widget-text-DWNEbQUk.js → widget-text-C0OIisGK.js} +5 -5
  102. package/dist/{widget-timediff-B2mjc1qy.js → widget-timediff-CeImFor9.js} +2 -2
  103. package/package.json +1 -1
  104. package/dist/paper-widget-design-BbQeY4Hv.js +0 -4
  105. package/dist/seal-design-CN_B6div.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 { ai as CellWidgetViewState, F as FIELD_TYPE, b8 as RenderModeEnum, Y as FormTypeEnum, bE as BpmnNodeTypeEnum, cr as getFieldPlaceholder, bU as MobileFillTypeEnum, C as ComponentTypeEnum, $ as PlatformEnum, cs as isReferenceOptionActive, E as api, bu as uuid2, c2 as calcUtils, bj as findRuntimeTableRow, c4 as ensureTableRowKeys, b$ as bindRuntimeTableColumns, bi as getRowId, ct as FRONT_ROW_KEY, bw as isAttachFieldActive, cu as filterRulesByTrigger, cv as isEmptyValue$1, c3 as ensureFrontRowKey, b0 as getParseRuleInfo, aF as transformUtils, aY as materialCheck, aZ as getLotLockedReason, a_ as validateReinspectionDate, bn as FormulaRuleFieldKeyEnum, f as SubTableType, b1 as getParseRuleValue, cw as buildError, H as CreateType, bl as findRuntimeParentRow, aI as Dependency_ENUM, aH as ASSIGNMENTSTRATEGY_ENUM, bJ as commonUtils, aM as DeviceLink, a8 as _export_sfc, cd as getRenderedRuntimeTableCell, y as CellType, cm as relocateDeletedRowsToEnd, cx as resetTableRowIdentity, J as useModal, cy as q, cz as QUICK_FILL_ALLOWED_FIELDS, cA as groupFixedTableRows, cB as processQuickFillRows, cC as getIsGroupEmpty } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-CYRNF_U3.js";
2
+ import { ai as CellWidgetViewState, F as FIELD_TYPE, b9 as RenderModeEnum, Y as FormTypeEnum, bF as BpmnNodeTypeEnum, cw as getFieldPlaceholder, bW as MobileFillTypeEnum, C as ComponentTypeEnum, $ as PlatformEnum, cx as isReferenceOptionActive, E as api, bv as uuid2, c4 as calcUtils, bk as findRuntimeTableRow, c8 as ensureTableRowKeys, c1 as bindRuntimeTableColumns, bj as getRowId, cy as FRONT_ROW_KEY, cn as isTableRowKeyMatch, bx as isAttachFieldActive, cz as filterRulesByTrigger, cA as isEmptyValue$1, c5 as decodeTableCellRowKey, c7 as ensureFrontRowKey, b1 as getParseRuleInfo, aF as transformUtils, aY as materialCheck, aZ as getLotLockedReason, a_ as validateReinspectionDate, bo as FormulaRuleFieldKeyEnum, f as SubTableType, b2 as getParseRuleValue, cB as buildError, H as CreateType, bm as findRuntimeParentRow, aI as Dependency_ENUM, aH as ASSIGNMENTSTRATEGY_ENUM, bK as commonUtils, aM as DeviceLink, a8 as _export_sfc, ch as getRenderedRuntimeTableCell, y as CellType, cr as relocateDeletedRowsToEnd, cC as resetTableRowIdentity, J as useModal, cD as q, cE as QUICK_FILL_ALLOWED_FIELDS, cF as groupFixedTableRows, cG as processQuickFillRows, cH as getIsGroupEmpty } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-BLw_6wwg.js";
3
3
  import { cloneDeep, isEmpty, has, pickBy, isNil, mergeWith, omit, last, pick, merge } from "lodash-es";
4
4
  import dayjs from "dayjs";
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-BZXw-tG7.js";
7
+ import { u as useFormModel } from "./mb-render-Cg1jp9G0.js";
8
8
  var MaterialConsumptionPatternEnum = /* @__PURE__ */ ((MaterialConsumptionPatternEnum2) => {
9
9
  MaterialConsumptionPatternEnum2["RECORD"] = "record";
10
10
  MaterialConsumptionPatternEnum2["BOM"] = "bom";
@@ -942,6 +942,8 @@ function convertV1Runtime(runtime) {
942
942
  return { schemaVersion: 1, formConfig, sheets: [sheet] };
943
943
  }
944
944
  const MULTI_SHEET_SCHEMA_VERSION = 2;
945
+ const MAX_RUNTIME_SHEETS = 100;
946
+ const MAX_RUNTIME_SHEET_TITLE_LENGTH = 255;
945
947
  function assertObject(value, message2) {
946
948
  if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(message2);
947
949
  }
@@ -1007,7 +1009,9 @@ function normalizeRuntime(runtime) {
1007
1009
  if (!Array.isArray(runtime.sheets) || runtime.sheets.length === 0) {
1008
1010
  throw new Error("多 Sheet 运行时至少需要一个工作表");
1009
1011
  }
1010
- if (runtime.sheets.length > 10) throw new Error("每份表单最多支持 10 个工作表");
1012
+ if (runtime.sheets.length > MAX_RUNTIME_SHEETS) {
1013
+ throw new Error(`每份表单最多支持 ${MAX_RUNTIME_SHEETS} 个工作表`);
1014
+ }
1011
1015
  const formConfig = runtime.formConfig ?? {};
1012
1016
  assertObject(formConfig, "多 Sheet 运行时的 formConfig 格式无效");
1013
1017
  const ids = /* @__PURE__ */ new Set();
@@ -1018,7 +1022,9 @@ function normalizeRuntime(runtime) {
1018
1022
  const sheetId = String(rawSheet.sheetId ?? "").trim();
1019
1023
  const title = String(rawSheet.title ?? "").trim();
1020
1024
  if (!sheetId) throw new Error(`第 ${index + 1} 个工作表缺少 sheetId`);
1021
- if (!title || title.length > 20) throw new Error(`工作表名称必须为 1 到 20 个字符:${title}`);
1025
+ if (!title || title.length > MAX_RUNTIME_SHEET_TITLE_LENGTH) {
1026
+ throw new Error(`工作表名称必须为 1 到 ${MAX_RUNTIME_SHEET_TITLE_LENGTH} 个字符:${title}`);
1027
+ }
1022
1028
  if (ids.has(sheetId)) throw new Error(`重复的 sheetId:${sheetId}`);
1023
1029
  if (titles.has(title)) throw new Error(`重复的工作表名称:${title}`);
1024
1030
  ids.add(sheetId);
@@ -1589,6 +1595,14 @@ class RuntimeFormStateStore {
1589
1595
  const paths = Object.keys(values);
1590
1596
  this.mutate(paths, source, () => this.assignValues(this.reactiveState, values));
1591
1597
  }
1598
+ /**
1599
+ * 保存后只回填后端身份元数据,不能用仅含 id_/front_row_key_ 的数组覆盖当前业务行。
1600
+ * 二维内置复合键可通过原始子行键匹配保存前的本地行。
1601
+ */
1602
+ patchSavedMetadata(values) {
1603
+ const paths = Object.keys(values);
1604
+ this.mutate(paths, "restore", () => this.mergeSavedMetadata(this.reactiveState, values));
1605
+ }
1592
1606
  /**
1593
1607
  * 用新对象整体替换实例数据,删除旧对象中多余的顶层字段。
1594
1608
  * 草稿/接口恢复后会清空用户修改标记;restore 来源同时恢复为非脏状态。
@@ -1700,6 +1714,46 @@ class RuntimeFormStateStore {
1700
1714
  target[key] = incoming;
1701
1715
  });
1702
1716
  }
1717
+ mergeSavedMetadata(target, incoming, path = "") {
1718
+ if (Array.isArray(incoming)) {
1719
+ const isTableRows = this.subtableFields.has(path) || path.endsWith("._2DTABLE_");
1720
+ if (!isTableRows || !Array.isArray(target)) return incoming;
1721
+ incoming.forEach((savedRow) => {
1722
+ const rowKey = savedRow?.[FRONT_ROW_KEY];
1723
+ const savedId = savedRow?.id_;
1724
+ let currentRow = target.find((row) => {
1725
+ if (!row || typeof row !== "object") return false;
1726
+ if (rowKey != null && isTableRowKeyMatch(rowKey, row[FRONT_ROW_KEY])) return true;
1727
+ return savedId != null && row.id_ != null && String(row.id_) === String(savedId);
1728
+ });
1729
+ let matchedByGroup = false;
1730
+ if (!currentRow && Array.isArray(savedRow?._2DTABLE_) && savedRow.group_ != null && String(savedRow.group_).trim() !== "") {
1731
+ const matchingGroups = target.filter(
1732
+ (row) => Array.isArray(row?._2DTABLE_) && row.group_ != null && String(row.group_) === String(savedRow.group_)
1733
+ );
1734
+ if (matchingGroups.length === 1) {
1735
+ currentRow = matchingGroups[0];
1736
+ matchedByGroup = true;
1737
+ }
1738
+ }
1739
+ if (currentRow) {
1740
+ this.mergeSavedMetadata(
1741
+ currentRow,
1742
+ matchedByGroup ? { ...savedRow, [FRONT_ROW_KEY]: currentRow[FRONT_ROW_KEY] } : savedRow,
1743
+ path
1744
+ );
1745
+ }
1746
+ });
1747
+ return target;
1748
+ }
1749
+ if (!incoming || typeof incoming !== "object") return incoming;
1750
+ if (!target || typeof target !== "object" || Array.isArray(target)) return incoming;
1751
+ Object.entries(incoming).forEach(([key, value]) => {
1752
+ const childPath = path ? `${path}.${key}` : key;
1753
+ target[key] = this.mergeSavedMetadata(target[key], value, childPath);
1754
+ });
1755
+ return target;
1756
+ }
1703
1757
  /**
1704
1758
  * 所有写入口共用的表格身份边界:整表恢复/回填、数组插入、二维子行替换均在通知前补齐。
1705
1759
  * 只处理业务索引声明的表格及 _2DTABLE_,不把多选值、上传文件等数组当作表格。
@@ -1784,6 +1838,7 @@ class RuntimeAsyncTaskCoordinator {
1784
1838
  fieldIdentity: options.fieldIdentity,
1785
1839
  sheetId: options.sheetId,
1786
1840
  required: options.required !== false,
1841
+ blockOnFailure: options.blockOnFailure !== false,
1787
1842
  status: "pending",
1788
1843
  sequence,
1789
1844
  promise: task,
@@ -1827,7 +1882,7 @@ class RuntimeAsyncTaskCoordinator {
1827
1882
  * 等待全部 required 任务达到稳定状态。
1828
1883
  *
1829
1884
  * 一轮任务完成后的字段回填可能触发新的公式或远程任务,因此这里循环读取任务表,直到
1830
- * 没有新的 pending required 任务。稳定后统一检查失败项,使提交事务得到明确失败原因。
1885
+ * 没有新的 pending required 任务。稳定后只检查需要阻断提交的失败项。
1831
1886
  */
1832
1887
  async waitForRequired(keyPrefix) {
1833
1888
  const matches = (task) => task.required && (!keyPrefix || task.key.startsWith(keyPrefix));
@@ -1839,7 +1894,7 @@ class RuntimeAsyncTaskCoordinator {
1839
1894
  await Promise.allSettled(pending.map((task) => task.promise));
1840
1895
  }
1841
1896
  const failed = Array.from(this.tasks.values()).filter(
1842
- (task) => matches(task) && task.status === "rejected"
1897
+ (task) => matches(task) && task.blockOnFailure && task.status === "rejected"
1843
1898
  );
1844
1899
  if (failed.length) {
1845
1900
  const details = failed.map((task) => {
@@ -3185,11 +3240,12 @@ class RuntimeValidationService {
3185
3240
  this.pendingLive = this.pendingLive === "blur" ? "blur" : trigger;
3186
3241
  if (this.liveTimer) clearTimeout(this.liveTimer);
3187
3242
  this.liveTimer = void 0;
3188
- if (immediate) void this.flushLive().catch((error) => console.error("字段校验失败", error));
3243
+ if (immediate)
3244
+ void this.flushLive().catch((error) => this.logBackgroundError("字段校验失败", error));
3189
3245
  else
3190
3246
  this.liveTimer = setTimeout(() => {
3191
3247
  this.liveTimer = void 0;
3192
- void this.flushLive().catch((error) => console.error("字段校验失败", error));
3248
+ void this.flushLive().catch((error) => this.logBackgroundError("字段校验失败", error));
3193
3249
  }, 300);
3194
3250
  }
3195
3251
  async flushLive() {
@@ -3211,11 +3267,17 @@ class RuntimeValidationService {
3211
3267
  this.displayTimer = void 0;
3212
3268
  const run = () => {
3213
3269
  this.displayTimer = void 0;
3214
- void this.validate("display").catch((error) => console.error("字段展示校验失败", error));
3270
+ void this.validate("display").catch(
3271
+ (error) => this.logBackgroundError("字段展示校验失败", error)
3272
+ );
3215
3273
  };
3216
3274
  if (immediate) run();
3217
3275
  else this.displayTimer = setTimeout(run, 320);
3218
3276
  }
3277
+ logBackgroundError(label, error) {
3278
+ if (error instanceof Error && error.message.startsWith("以下异步任务执行失败:")) return;
3279
+ console.error(label, error);
3280
+ }
3219
3281
  pruneComments() {
3220
3282
  if (!this.binding || this.disposed) return;
3221
3283
  this.binding.applyComments(
@@ -3813,8 +3875,10 @@ const SNAPSHOT_SKIP = /* @__PURE__ */ new Set([
3813
3875
  ]);
3814
3876
  function rowIdentityKeys(row) {
3815
3877
  if (!row) return [];
3878
+ const frontRowKey = row[FRONT_ROW_KEY] != null && String(row[FRONT_ROW_KEY]).trim() !== "" ? String(row[FRONT_ROW_KEY]) : void 0;
3816
3879
  return [
3817
- row[FRONT_ROW_KEY] != null && String(row[FRONT_ROW_KEY]).trim() !== "" ? String(row[FRONT_ROW_KEY]) : void 0,
3880
+ frontRowKey,
3881
+ decodeTableCellRowKey(frontRowKey)?.cellRowKey,
3818
3882
  row.id_ != null && row.id_ !== "" ? String(row.id_) : void 0
3819
3883
  ].filter(Boolean);
3820
3884
  }
@@ -4548,7 +4612,16 @@ class BomEntriesValidator {
4548
4612
  memberIndexes.push(idx);
4549
4613
  if (byLot && !row.material_no_) emptyLotIndexes.push(idx);
4550
4614
  });
4551
- const needInsert = !this.groupExistsInTable(arr, target);
4615
+ const targetExists = this.groupExistsInTable(arr, target);
4616
+ if (!targetExists) {
4617
+ const index = arr.findIndex((row2) => !row2.deleted_);
4618
+ const row = arr[index];
4619
+ const canReuse = row && !row.product_id_ && !row.bom_entry_id_ && !row.is_confirmed_ && arr.every((item, idx) => item.deleted_ || idx === index);
4620
+ if (canReuse) {
4621
+ emptyProductIndexes.push(index);
4622
+ }
4623
+ }
4624
+ const needInsert = !targetExists && emptyProductIndexes.length === 0;
4552
4625
  const last2 = memberIndexes[memberIndexes.length - 1];
4553
4626
  let groupInsertIndex = -1;
4554
4627
  if (needInsert) {
@@ -5173,7 +5246,8 @@ class MaterialConsumeTableController {
5173
5246
  constructor(tmplBomController, tmplBom, options = {}) {
5174
5247
  this.tmplBomController = tmplBomController;
5175
5248
  this.tmplBom = tmplBom;
5176
- if (!options.printOnly) this.initScanRule(this.tmplBom.barcode_parsing_rules_id_);
5249
+ if (!options.printOnly && this.hasFormInstance)
5250
+ this.initScanRule(this.tmplBom.barcode_parsing_rules_id_);
5177
5251
  this.scanParamType = this.tmplBom.scan_param_type_;
5178
5252
  markRaw(this);
5179
5253
  this.bomEntriesValidator = new BomEntriesValidator(
@@ -5236,6 +5310,9 @@ class MaterialConsumeTableController {
5236
5310
  get mcPattern() {
5237
5311
  return this.tmplBom.material_consumption_pattern_ ?? this.tmplBomController.defaultMCPattern;
5238
5312
  }
5313
+ get hasFormInstance() {
5314
+ return this.tmplBomController.hasFormInstance;
5315
+ }
5239
5316
  /**
5240
5317
  * 解析规则数据对象
5241
5318
  */
@@ -5488,6 +5565,10 @@ class MaterialConsumeTableController {
5488
5565
  }
5489
5566
  const isRecordPattern = this.mcPattern === MaterialConsumptionPatternEnum.RECORD && !this.tmplBom.personal_bom_enabled_;
5490
5567
  console.log("parseScanStr", data);
5568
+ if (!data.lot && !data.uniqueCode) {
5569
+ this.error($t("sys.edhr.mcTable.lotOrUniqueCodeRequired"));
5570
+ return;
5571
+ }
5491
5572
  const arr = await materialCheck({
5492
5573
  material_no_: data.materialCode,
5493
5574
  production_identification_name_: data.lot,
@@ -5982,7 +6063,16 @@ class MaterialConsumeTableController {
5982
6063
  this.error(msg);
5983
6064
  return;
5984
6065
  }
5985
- if (!value) return;
6066
+ if (!value) {
6067
+ if (row.product_id_ && !this.isCustomRequiredQty) {
6068
+ const util = this.bomEntriesValidator.findUtilByProductId(row.product_id_);
6069
+ if (util) {
6070
+ row.qty_required_ = util.total;
6071
+ }
6072
+ }
6073
+ this.updateDerivedQtyFields();
6074
+ return;
6075
+ }
5986
6076
  try {
5987
6077
  await validateReinspectionDate({
5988
6078
  product_id_: option.product_id_ ?? row.product_id_,
@@ -6006,6 +6096,7 @@ class MaterialConsumeTableController {
6006
6096
  const qty = oldGroupId && row.bom_entry_id_ === oldGroupId ? oldRequiredQty : this.getCustomGroupRequiredQty(row);
6007
6097
  this.setCustomGroupRequiredQty(row, qty);
6008
6098
  }
6099
+ this.updateDerivedQtyFields();
6009
6100
  } else if (field === "qty_") {
6010
6101
  this.updateDerivedQtyFields();
6011
6102
  }
@@ -8690,7 +8781,7 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
8690
8781
  const {
8691
8782
  showDisplayStatus,
8692
8783
  dataRelationShip
8693
- } = useWidgetStaticAttrs(props);
8784
+ } = useWidgetStaticAttrs(props.widget);
8694
8785
  const sheetId = () => fields.value?.findWidgetById(props.widget.id)?.sheetId;
8695
8786
  const formModelController = useFormModel().injectController();
8696
8787
  const tableController = props.tableController;
@@ -8879,6 +8970,7 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
8879
8970
  }));
8880
8971
  };
8881
8972
  const handleAction = (action, rowData) => {
8973
+ if (!tableController.hasFormInstance) return;
8882
8974
  switch (action) {
8883
8975
  case MaterialConsumeActionType.CONFIRM:
8884
8976
  tableController.confirm(rowData);
@@ -8951,6 +9043,7 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
8951
9043
  key,
8952
9044
  actionValue
8953
9045
  }) => {
9046
+ if (!tableController.hasFormInstance) return;
8954
9047
  switch (key) {
8955
9048
  case "rowEdit":
8956
9049
  await tableController.editRow(rowData);
@@ -10223,109 +10316,111 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10223
10316
  });
10224
10317
  const DynamicTableAction = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-53d7e66c"]]);
10225
10318
  export {
10226
- closeValidatorPopovers as $,
10227
- useFieldPresentation as A,
10319
+ RuntimeSheetService as $,
10320
+ useStyles as A,
10228
10321
  BorderTD as B,
10229
- useRuntimeEditorFlusher as C,
10322
+ useDependency as C,
10230
10323
  DEFAULT_BOOLEAN_FIELD_WIDTH as D,
10231
10324
  EMPTY_PRODUCT_VERSION_ID as E,
10232
- createRuntimeInstanceContext as F,
10233
- RuntimeInstanceRegistry as G,
10234
- RequiredQtyCalcRule as H,
10235
- registerFormulaFuncs as I,
10236
- DocumentPaper as J,
10237
- DynamicTableAction as K,
10238
- getRuntimeDataFieldId as L,
10239
- MULTI_SHEET_SCHEMA_VERSION as M,
10325
+ useFieldPresentation as F,
10326
+ useRuntimeEditorFlusher as G,
10327
+ createRuntimeInstanceContext as H,
10328
+ RuntimeInstanceRegistry as I,
10329
+ RequiredQtyCalcRule as J,
10330
+ registerFormulaFuncs as K,
10331
+ DocumentPaper as L,
10332
+ MAX_RUNTIME_SHEETS as M,
10240
10333
  NCB_PROVIDE as N,
10241
- buildRuntimeFieldPath as O,
10242
- resolveRuntimeFieldProps as P,
10243
- resolveRuntimeFieldState as Q,
10334
+ DynamicTableAction as O,
10335
+ getRuntimeDataFieldId as P,
10336
+ buildRuntimeFieldPath as Q,
10244
10337
  RuntimeFormStateStore as R,
10245
10338
  ScanParamType as S,
10246
- getRuntimeDependencyOutputKey as T,
10247
- isRowAddedInCurrentFormChange as U,
10248
- MaterialConsumeTableController as V,
10249
- setFormulaParamsConfig as W,
10250
- normalizeRuntime as X,
10251
- RuntimeSheetService as Y,
10252
- validateObjectBomQtyOnSubmit as Z,
10339
+ resolveRuntimeFieldProps as T,
10340
+ resolveRuntimeFieldState as U,
10341
+ getRuntimeDependencyOutputKey as V,
10342
+ isRowAddedInCurrentFormChange as W,
10343
+ MaterialConsumeTableController as X,
10344
+ setFormulaParamsConfig as Y,
10345
+ normalizeRuntime as Z,
10253
10346
  _sfc_main$5 as _,
10254
- normalizeHistoricalBusinessRow as a,
10255
- enrichFormChangeRowDetails as a0,
10256
- useMaterialBalance as a1,
10257
- collectFormChangeFieldLocations as a2,
10258
- nextFormChangeRowViewHistoryId as a3,
10259
- DeviceConnector as a4,
10260
- DocumentLoading as a5,
10261
- DynamicQuickFillModal as a6,
10262
- FixedQuickFillModal as a7,
10263
- FormTmplConfigController as a8,
10264
- LEGACY_RUNTIME_FORM_CONFIG_KEYS as a9,
10265
- resolveFormChangeRowUi as aA,
10266
- resolveRowFormChangeMark as aB,
10267
- setSelectMobileTdId as aC,
10268
- stripLegacyFormConfigFromPaper as aD,
10269
- SubTableActionMenuTypeEnum as aE,
10270
- getMenuByAction as aF,
10271
- SubTableActionEnum as aG,
10272
- resolveScanFillData as aH,
10273
- getInsertSubMenu as aI,
10274
- resolveScanAdjustType as aJ,
10275
- resolveScanQty as aK,
10276
- toDateOnly as aL,
10277
- getCopySubMenu as aM,
10278
- resolveScanParsedValue as aN,
10279
- isProductBatchEmptyRow as aO,
10280
- LEGACY_RUNTIME_SHEET_ID as aa,
10281
- LEGACY_RUNTIME_SHEET_TITLE as ab,
10282
- MCDataUtil as ac,
10283
- OCR_MODEL_PRECISION_ENUM_KEY as ad,
10284
- RuntimeAsyncTaskCoordinator as ae,
10285
- RuntimeDependencyService as af,
10286
- RuntimeFieldRegistry as ag,
10287
- RuntimeInstanceEventBus as ah,
10288
- RuntimePersistenceCoordinator as ai,
10289
- RuntimeValidationService as aj,
10290
- SubTableCore as ak,
10291
- buildFormChangeDisplayRows as al,
10292
- convertV1Runtime as am,
10293
- detailsHaveFormChangeRowOps as an,
10294
- extractFormChangeRowDetails as ao,
10295
- getFormChangeRowKey as ap,
10296
- getFormChangeRowOp as aq,
10297
- getSubTableQuickFillInfo as ar,
10298
- isAnnLocationSelected as as,
10299
- isBlank as at,
10300
- isFormChangeGhostRow as au,
10301
- normalizeHistoricalFieldConfig as av,
10302
- pickObjectFieldKeys as aw,
10303
- recordSubtableRowAdd as ax,
10304
- recordSubtableRowDelete as ay,
10305
- resolveAnnotationFieldLocation as az,
10306
- DeviceLinkTmplUtil as b,
10347
+ MAX_RUNTIME_SHEET_TITLE_LENGTH as a,
10348
+ validateObjectBomQtyOnSubmit as a0,
10349
+ closeValidatorPopovers as a1,
10350
+ enrichFormChangeRowDetails as a2,
10351
+ useMaterialBalance as a3,
10352
+ collectFormChangeFieldLocations as a4,
10353
+ nextFormChangeRowViewHistoryId as a5,
10354
+ DeviceConnector as a6,
10355
+ DocumentLoading as a7,
10356
+ DynamicQuickFillModal as a8,
10357
+ FixedQuickFillModal as a9,
10358
+ recordSubtableRowDelete as aA,
10359
+ resolveAnnotationFieldLocation as aB,
10360
+ resolveFormChangeRowUi as aC,
10361
+ resolveRowFormChangeMark as aD,
10362
+ setSelectMobileTdId as aE,
10363
+ stripLegacyFormConfigFromPaper as aF,
10364
+ SubTableActionMenuTypeEnum as aG,
10365
+ getMenuByAction as aH,
10366
+ SubTableActionEnum as aI,
10367
+ resolveScanFillData as aJ,
10368
+ getInsertSubMenu as aK,
10369
+ resolveScanAdjustType as aL,
10370
+ resolveScanQty as aM,
10371
+ toDateOnly as aN,
10372
+ getCopySubMenu as aO,
10373
+ resolveScanParsedValue as aP,
10374
+ isProductBatchEmptyRow as aQ,
10375
+ FormTmplConfigController as aa,
10376
+ LEGACY_RUNTIME_FORM_CONFIG_KEYS as ab,
10377
+ LEGACY_RUNTIME_SHEET_ID as ac,
10378
+ LEGACY_RUNTIME_SHEET_TITLE as ad,
10379
+ MCDataUtil as ae,
10380
+ OCR_MODEL_PRECISION_ENUM_KEY as af,
10381
+ RuntimeAsyncTaskCoordinator as ag,
10382
+ RuntimeDependencyService as ah,
10383
+ RuntimeFieldRegistry as ai,
10384
+ RuntimeInstanceEventBus as aj,
10385
+ RuntimePersistenceCoordinator as ak,
10386
+ RuntimeValidationService as al,
10387
+ SubTableCore as am,
10388
+ buildFormChangeDisplayRows as an,
10389
+ convertV1Runtime as ao,
10390
+ detailsHaveFormChangeRowOps as ap,
10391
+ extractFormChangeRowDetails as aq,
10392
+ getFormChangeRowKey as ar,
10393
+ getFormChangeRowOp as as,
10394
+ getSubTableQuickFillInfo as at,
10395
+ isAnnLocationSelected as au,
10396
+ isBlank as av,
10397
+ isFormChangeGhostRow as aw,
10398
+ normalizeHistoricalFieldConfig as ax,
10399
+ pickObjectFieldKeys as ay,
10400
+ recordSubtableRowAdd as az,
10401
+ MULTI_SHEET_SCHEMA_VERSION as b,
10307
10402
  createRuntimeDocumentV2 as c,
10308
- normalizeAIOcrTmpl as d,
10309
- useWidgetStaticAttrs as e,
10310
- useRuntimeInstanceServices as f,
10403
+ normalizeHistoricalBusinessRow as d,
10404
+ DeviceLinkTmplUtil as e,
10405
+ normalizeAIOcrTmpl as f,
10311
10406
  getBusinessFieldKey as g,
10312
- setSelectAnnotationId as h,
10313
- useRuntimeRowState as i,
10314
- getObjectBomMaterialLotQuery as j,
10315
- buildObjectLotExtraQuery as k,
10316
- MaterialConsumptionPatternEnum as l,
10317
- resolveObjectBomEntry as m,
10407
+ useWidgetStaticAttrs as h,
10408
+ useRuntimeInstanceServices as i,
10409
+ setSelectAnnotationId as j,
10410
+ useRuntimeRowState as k,
10411
+ getObjectBomMaterialLotQuery as l,
10412
+ buildObjectLotExtraQuery as m,
10318
10413
  normalizeFieldWidth as n,
10319
- runWithFillProduct as o,
10320
- useNocodeFormWidget as p,
10321
- applyConsumeObjectTraceChange as q,
10414
+ MaterialConsumptionPatternEnum as o,
10415
+ resolveObjectBomEntry as p,
10416
+ runWithFillProduct as q,
10322
10417
  resolveObjectFieldKeys as r,
10323
10418
  setSelectValidatorId as s,
10324
- getObjectBomProductQuery as t,
10419
+ useNocodeFormWidget as t,
10325
10420
  useFormTmplConfig as u,
10326
10421
  validateObjectBomForScan as v,
10327
- normalizeHistoricalAutofillRow as w,
10328
- parseRuntimeFieldPath as x,
10329
- useStyles as y,
10330
- useDependency as z
10422
+ applyConsumeObjectTraceChange as w,
10423
+ getObjectBomProductQuery as x,
10424
+ normalizeHistoricalAutofillRow as y,
10425
+ parseRuntimeFieldPath as z
10331
10426
  };