@gct-paas/excel 0.1.39-beta.45 → 0.1.39-beta.46

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 (61) hide show
  1. package/dist/{BaseComponent-BcMUXzWr.js → BaseComponent-D_qr1qAV.js} +1 -1
  2. package/dist/{barcode-design-DCo5X-NW.js → barcode-design-B1E1I0h9.js} +1 -1
  3. package/dist/base/index.es.js +34 -11
  4. package/dist/{diagonal-design-CTC7YZ27.js → diagonal-design-vUC0R6G9.js} +1 -1
  5. package/dist/{dynamic-table-action-CTBy77AD.js → dynamic-table-action-BjNAbOiM.js} +53 -33
  6. package/dist/excel.css +8 -8
  7. package/dist/{exceljs.min-BHi5L338.js → exceljs.min-ruMnRdmJ.js} +1 -1
  8. package/dist/{font-editor--mgAlMck.js → font-editor-KgE3aTA7.js} +1 -1
  9. package/dist/{index-CrAk2XO5.js → index-B1Zk4PhS.js} +1 -1
  10. package/dist/{index-Des_Z7g-.js → index-BK2bj0YC.js} +1 -1
  11. package/dist/{index-Dig1Y-WI.js → index-BkrySdbu.js} +2 -2
  12. package/dist/{index-GQjqLjCV.js → index-BtAn5HaV.js} +1 -1
  13. package/dist/{index-Clecgmwq.js → index-C3GeooR3.js} +1 -1
  14. package/dist/{index-DOkOt95L.js → index-CHFipq2D.js} +1 -1
  15. package/dist/{index-D2OOg_P9.js → index-CKKmoHnx.js} +2 -2
  16. package/dist/{index-CDLTNhDs.js → index-CWr2IJif.js} +1 -1
  17. package/dist/{index-CiW7CSPh.js → index-CeUHeApW.js} +1 -1
  18. package/dist/{index-Bz009Lre.js → index-CpDIChOU.js} +1 -1
  19. package/dist/{index-CqDSzVbY.js → index-CquK-4J5.js} +1 -1
  20. package/dist/{index-DMPLAalb.js → index-D0wXTI_4.js} +3 -3
  21. package/dist/{index-B2tkugA7.js → index-DC9Ri3CX.js} +332 -173
  22. package/dist/{index-CPgE97o3.js → index-DPZCDmkK.js} +2 -2
  23. package/dist/{index-B_wIm0c_.js → index-DSFStTXw.js} +1 -1
  24. package/dist/{index-_l9ejJci.js → index-DierjEYd.js} +1 -1
  25. package/dist/{index-CFZlwM2O.js → index-DnmoxMpn.js} +1 -1
  26. package/dist/{index-DtpStBfx.js → index-DoOqRMkR.js} +2 -2
  27. package/dist/{index-B39BtiX-.js → index-Dojxm4da.js} +2 -2
  28. package/dist/{index-CizCUtiP.js → index-DqeDXZCe.js} +1 -1
  29. package/dist/{index-Dnaztyex.js → index-DvzscBgj.js} +1 -1
  30. package/dist/{index-Cit7v0Sn.js → index-DzW9E770.js} +1 -1
  31. package/dist/{index-BMEKVMta.js → index-bBk6szgy.js} +2 -2
  32. package/dist/{index-DAYRbY4X.js → index-owxyHZ4N.js} +1 -1
  33. package/dist/index.es.js +1 -1
  34. package/dist/{pagination-design-D8s2QR4I.js → pagination-design-BqD1xNnj.js} +1 -1
  35. package/dist/paper-widget-design-0Wlu4W7D.js +4 -0
  36. package/dist/{print-runtime-instance-DMKmR64C.js → print-runtime-instance-D-zZ-Pnj.js} +1 -1
  37. package/dist/{print-snapshot-renderer-Dqh4wq32.js → print-snapshot-renderer-CAu5xiAs.js} +3 -3
  38. package/dist/{qrcode-design-CAl6czye.js → qrcode-design-Dx0mGVK1.js} +1 -1
  39. package/dist/seal-design-BSsVnsgS.js +4 -0
  40. package/dist/{single-field-drop-VsopxP2Q.js → single-field-drop-CadWmOmY.js} +1 -1
  41. package/dist/src/nocode-base/src/hooks/material-consume/material-consume-table-controller.d.ts +14 -13
  42. package/dist/src/nocode-base/src/hooks/material-consume/tmpl-bom-controller.d.ts +8 -0
  43. package/dist/src/online-form/src/views/render/__components__/_field_/trace/composables/useReferenceLabel.d.ts +4 -0
  44. package/dist/{sub-table-factory-Ch6_9YNA.js → sub-table-factory-oIHIEDd1.js} +1 -1
  45. package/dist/{text-design-BhAmwouQ.js → text-design-DvaCN4xE.js} +1 -1
  46. package/dist/{trace-like-wrapper-BKilXIvf.js → trace-like-wrapper-DjdghEJk.js} +1 -1
  47. package/dist/{value-editor.vue_vue_type_style_index_0_lang-D8HDJ4_Y.js → value-editor.vue_vue_type_style_index_0_lang-DOoBSxtT.js} +1 -1
  48. package/dist/{widget-barcode-BRgk5gJJ.js → widget-barcode-Bihp8eQf.js} +2 -2
  49. package/dist/{widget-diagonal-ZRIIfCLT.js → widget-diagonal-CU143lb2.js} +2 -2
  50. package/dist/{widget-image-BYbhP5K2.js → widget-image-CvQtHO9u.js} +1 -1
  51. package/dist/{widget-line-D_AZ1rPP.js → widget-line-BWWibbG3.js} +1 -1
  52. package/dist/{widget-pagination-a49kG9bb.js → widget-pagination-BOlbp2M6.js} +2 -2
  53. package/dist/{widget-power-CXpS_5Fa.js → widget-power-BQrjZJ0s.js} +2 -2
  54. package/dist/{widget-qrcode-31D-nG6D.js → widget-qrcode-CMrJuNbq.js} +2 -2
  55. package/dist/{widget-rangelimit-CbKUOqCH.js → widget-rangelimit-CGkoloXm.js} +2 -2
  56. package/dist/{widget-serialnumber-Dd3xlWF_.js → widget-serialnumber-Rwq-qlyD.js} +1 -1
  57. package/dist/{widget-text-B9Sz6JsF.js → widget-text-Qj9jHnAY.js} +3 -3
  58. package/dist/{widget-timediff-DL5l1QV-.js → widget-timediff-DVtLFiEW.js} +1 -1
  59. package/package.json +1 -1
  60. package/dist/paper-widget-design-CEdEkvnQ.js +0 -4
  61. package/dist/seal-design-CWPtNAMf.js +0 -4
@@ -1,4 +1,4 @@
1
- import { h as normalizeFieldWidth } from "./dynamic-table-action-CTBy77AD.js";
1
+ import { h as normalizeFieldWidth } from "./dynamic-table-action-BjNAbOiM.js";
2
2
  import { get, pick } from "lodash-es";
3
3
  import { F as FIELD_TYPE } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-anSsEnF9.js";
4
4
  import { f as fontStyleAttrs } from "./config.enum-B8UZQTON.js";
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, ref, computed, watch, openBlock, createElementBlock, normalizeStyle, normalizeClass, createElementVNode, toDisplayString, createCommentVNode } from "vue";
2
2
  import { pick } from "lodash-es";
3
- import { u as useSpreadSheet, h as useModelFields, l as loadBwip } from "./index-B2tkugA7.js";
3
+ import { u as useSpreadSheet, h as useModelFields, l as loadBwip } from "./index-DC9Ri3CX.js";
4
4
  import { Q as PaperWidgeValueType, a7 as _export_sfc } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-anSsEnF9.js";
5
5
  import "dayjs";
6
6
  import "ant-design-vue";
@@ -1,12 +1,12 @@
1
1
  import { E as api, _ as PlatformEnum, F as FIELD_TYPE, bc as getRowId, bd as findRuntimeTableRow, b5 as RenderModeEnum, C as ComponentTypeEnum, aF as Dependency_ENUM, aE as ASSIGNMENTSTRATEGY_ENUM, bn as fetchHistoryConsume, bo as isBomGranted, aT as renderUtils, bm as uuid2, bp as parseFrontConfig, aI as CheckDsTypeEnum, aC as transformUtils, bq as baseDataUtils, X as FormTypeEnum, br as normalizeToArray, bs as safeParseArray, bt as BpmnNodeTypeEnum, bu as mergeByMultiKey, a7 as _export_sfc, bv as evaluateInspectionDecisionRule, bw as useNocodeEmitter, bx as commonUtils, aG as EntityModelCategoryEnum } from "../dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-anSsEnF9.js";
2
2
  import { aL, aN, a_, a0, by, bz, B, bA, y, af, bB, bC, bD, bb, bE, aQ, av, aM, aJ, aK, bF, ag, ak, bG, bH, aD, a2, ae, aw, aO, $, ai, L, bI, bJ, bK, O, p, P, a9, o, Q, A, bL, bM, au, at, a5, a1, a3, a4, a6, f, bN, aj, an, ah, bO, bP, bQ, bR, ba, bS, bT, bU, bV, bW, bX, bY, bZ, b_, b$, be, c0, c1, aW, c2, a$, b0, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, aV, cd, b1, b8, ce, cf, al, t, aP, cg, ch, bf, aX } from "../dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-anSsEnF9.js";
3
- import { a2 as getRuntimeDataFieldId, O as parseRuntimeFieldPath, a3 as buildRuntimeFieldPath, a4 as resolveRuntimeFieldProps, a5 as resolveRuntimeFieldState, a6 as assembleRules, a7 as isAttachFieldActive, P as calculateFormula, a8 as getRuntimeDependencyOutputKey, a9 as isRowAddedInCurrentFormChange, c as getParseFormulaVarInfos, w as MaterialConsumptionPatternEnum, aa as MaterialConsumeTableController, ab as setFormulaParamsConfig, ac as normalizeRuntime, V as createRuntimeInstanceContext, ad as initializeSealFields, U as RuntimeFormStateStore, ae as RuntimeSheetService, g as getBusinessFieldKey, af as validateObjectBomQtyOnSubmit, ag as areValidationCommentsEqual, ah as closeValidatorPopovers, ai as enrichFormChangeRowDetails, N as NCB_PROVIDE, W as RuntimeInstanceRegistry, aj as useMaterialBalance, ak as collectFormChangeFieldLocations, al as nextFormChangeRowViewHistoryId } from "../dynamic-table-action-CTBy77AD.js";
4
- import { B as B2, am, k, a1 as a12, an as an2, $ as $2, ao, a0 as a02, F, ap, aq, ar, as, at as at2, M, a, au as au2, b, av as av2, aw as aw2, ax, ay, az, aA, aB, aC, C, aD as aD2, t as t2, aE, d, aF, aG, aH, aI, r, E, aJ as aJ2, aK as aK2, aL as aL2, aM as aM2, l, G, j, aN as aN2, aO as aO2, aP as aP2, aQ as aQ2, aR, aS, aT, y as y2, v, aU, z, p as p2, aV as aV2, s, aW as aW2, R, S, u, A as A2, T, o as o2, q, Q as Q2, m, x } from "../dynamic-table-action-CTBy77AD.js";
3
+ import { a2 as getRuntimeDataFieldId, O as parseRuntimeFieldPath, a3 as buildRuntimeFieldPath, a4 as resolveRuntimeFieldProps, a5 as resolveRuntimeFieldState, a6 as assembleRules, a7 as isAttachFieldActive, P as calculateFormula, a8 as getRuntimeDependencyOutputKey, a9 as isRowAddedInCurrentFormChange, c as getParseFormulaVarInfos, w as MaterialConsumptionPatternEnum, aa as MaterialConsumeTableController, ab as setFormulaParamsConfig, ac as normalizeRuntime, V as createRuntimeInstanceContext, ad as initializeSealFields, U as RuntimeFormStateStore, ae as RuntimeSheetService, g as getBusinessFieldKey, af as validateObjectBomQtyOnSubmit, ag as areValidationCommentsEqual, ah as closeValidatorPopovers, ai as enrichFormChangeRowDetails, N as NCB_PROVIDE, W as RuntimeInstanceRegistry, aj as useMaterialBalance, ak as collectFormChangeFieldLocations, al as nextFormChangeRowViewHistoryId } from "../dynamic-table-action-BjNAbOiM.js";
4
+ import { B as B2, am, k, a1 as a12, an as an2, $ as $2, ao, a0 as a02, F, ap, aq, ar, as, at as at2, M, a, au as au2, b, av as av2, aw as aw2, ax, ay, az, aA, aB, aC, C, aD as aD2, t as t2, aE, d, aF, aG, aH, aI, r, E, aJ as aJ2, aK as aK2, aL as aL2, aM as aM2, l, G, j, aN as aN2, aO as aO2, aP as aP2, aQ as aQ2, aR, aS, aT, y as y2, v, aU, z, p as p2, aV as aV2, s, aW as aW2, R, S, u, A as A2, T, o as o2, q, Q as Q2, m, x } from "../dynamic-table-action-BjNAbOiM.js";
5
5
  import { toRaw, watch, toRef, computed, defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, ref, provide, onUnmounted, markRaw, reactive, onBeforeUnmount } from "vue";
6
6
  import { cloneDeep, defaults, isEmpty, merge } from "lodash-es";
7
7
  import "dayjs";
8
- import { S as SubTableCoreFactory, R as RuntimeInstanceController } from "../sub-table-factory-Ch6_9YNA.js";
9
- import { A as A3, D, M as M2, a as a7, P as P2, b as b2, c, d as d2, e, W, f as f2, g, h } from "../sub-table-factory-Ch6_9YNA.js";
8
+ import { S as SubTableCoreFactory, R as RuntimeInstanceController } from "../sub-table-factory-oIHIEDd1.js";
9
+ import { A as A3, D, M as M2, a as a7, P as P2, b as b2, c, d as d2, e, W, f as f2, g, h } from "../sub-table-factory-oIHIEDd1.js";
10
10
  import { B as B3, F as F2, M as M3, a as a8, u as u2 } from "../mb-render-BjNRjLdf.js";
11
11
  const InstanceStatusValues = {
12
12
  /** 作废状态 */
@@ -987,6 +987,28 @@ class FormTmplBomController {
987
987
  });
988
988
  });
989
989
  }
990
+ /** 全部 Sheet 的消耗表统一在 LOADED 前准备。 */
991
+ initializeFormState(opts) {
992
+ Object.entries(this.field2TableMap).forEach(([field, tableKey]) => {
993
+ const controller = this.tableControllers[tableKey];
994
+ if (!controller) return;
995
+ controller.prepareInitialData({
996
+ formState: opts.formState,
997
+ field,
998
+ dataStatus: opts.dataStatus,
999
+ defaultRowData: renderUtils.getDefaultValueInfo({
1000
+ defaultDataMap: opts.defaultDataMap,
1001
+ key: field
1002
+ })
1003
+ });
1004
+ });
1005
+ }
1006
+ /** 钩子若修改数量依赖,在创建 Store 和分页前按原规则重算。 */
1007
+ finalizeInitialQuantities() {
1008
+ Object.values(this.tableControllers).forEach((controller) => {
1009
+ controller.syncQtyRequiredFromBomIfChanged();
1010
+ });
1011
+ }
990
1012
  async submitValidate() {
991
1013
  const results = await Promise.all(
992
1014
  Object.values(this.tableControllers).map((c10) => c10.submitValidate())
@@ -1541,6 +1563,11 @@ function createRuntimeInstanceInitializer(props, payload, getConsumeData) {
1541
1563
  });
1542
1564
  initializeSealFields(floatingFields, formState);
1543
1565
  }
1566
+ tmplBomC.initializeFormState({
1567
+ formState,
1568
+ dataStatus: selfInfo.dataStatus,
1569
+ defaultDataMap
1570
+ });
1544
1571
  await transformUtils.getEventInitDataLoaded({
1545
1572
  formConfig: runtimeContext.formConfig,
1546
1573
  formState,
@@ -1550,6 +1577,7 @@ function createRuntimeInstanceInitializer(props, payload, getConsumeData) {
1550
1577
  }).catch((error) => {
1551
1578
  console.error("Error in getEventInitDataLoaded:", error);
1552
1579
  });
1580
+ tmplBomC.finalizeInitialQuantities();
1553
1581
  runtimeFormStateStore = new RuntimeFormStateStore(
1554
1582
  formState,
1555
1583
  // 子表信息覆盖普通/固定/检验表、二维关联列以及各类业务表;不能只依赖已放置字段。
@@ -1697,18 +1725,13 @@ function bindRuntimeBusinessServices(runtimeRegistry, record, dataStatus) {
1697
1725
  }
1698
1726
  }),
1699
1727
  mainFormState: computed(() => record.formState.state),
1700
- dataStatus,
1701
- defaultRowData: renderUtils.getDefaultValueInfo({
1702
- defaultDataMap: record.context.defaultData,
1703
- key: field
1704
- })
1728
+ dataStatus
1705
1729
  });
1706
1730
  stops.push(
1707
1731
  watch(
1708
1732
  () => controller.materialNoNum,
1709
1733
  () => {
1710
- if (controller.dataStatus === "SUBMIT") return;
1711
- controller.syncQtyRequiredFromBom();
1734
+ controller.syncQtyRequiredFromBomIfChanged();
1712
1735
  },
1713
1736
  { immediate: true }
1714
1737
  )
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, openBlock, createBlock } from "vue";
2
- import { h as useModelFields, D as Diagonal } from "./index-B2tkugA7.js";
2
+ import { h as useModelFields, D as Diagonal } from "./index-DC9Ri3CX.js";
3
3
  import { al as resolveDiagonalVertex, a7 as _export_sfc } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-anSsEnF9.js";
4
4
  import "lodash-es";
5
5
  import "dayjs";
@@ -1,4 +1,4 @@
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";
1
+ import { reactive, toRaw, computed, watch, onScopeDispose, inject, h, shallowReactive, markRaw, ref, toRef, nextTick, 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
2
  import { af as CellWidgetViewState, F as FIELD_TYPE, b5 as RenderModeEnum, X as FormTypeEnum, bt as BpmnNodeTypeEnum, ci as getFieldPlaceholder, bJ as MobileFillTypeEnum, C as ComponentTypeEnum, bd as findRuntimeTableRow, aT as renderUtils, _ as PlatformEnum, E as api, bm as uuid2, bT as calcUtils, bX as ensureTableRowKeys, bQ as bindRuntimeTableColumns, bc as getRowId, cj as FRONT_ROW_KEY, ca as isTableRowKeyMatch, au as RangeCompareOp, at as RangeValidateMode, bU as decodeTableCellRowKey, bW as ensureFrontRowKey, a$ as getParseRuleInfo, aC as transformUtils, aV as materialCheck, aW as getLotLockedReason, aX as validateReinspectionDate, bg as FormulaRuleFieldKeyEnum, f as SubTableType, b0 as getParseRuleValue, H as CreateType, be as findRuntimeParentRow, aF as Dependency_ENUM, aE as ASSIGNMENTSTRATEGY_ENUM, bx as commonUtils, aJ as DeviceLink, a7 as _export_sfc, c4 as getRenderedRuntimeTableCell, y as CellType, ck as resetTableRowIdentity, J as useModal, cl as q, cm as QUICK_FILL_ALLOWED_FIELDS, cn as groupFixedTableRows, co as processQuickFillRows, cp as getIsGroupEmpty } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-anSsEnF9.js";
3
3
  import dayjs from "dayjs";
4
4
  import { cloneDeep, isEmpty, isNil, pickBy, mergeWith, omit, last, pick, merge } from "lodash-es";
@@ -1488,6 +1488,7 @@ class RuntimeFormStateStore {
1488
1488
  constructor(initialState, subtableFields = [], tableRelations = []) {
1489
1489
  this.tableRelations = tableRelations;
1490
1490
  this.subtableFields = new Set(subtableFields);
1491
+ normalizeEmptyReferenceLabels(initialState);
1491
1492
  this.subtableFields.forEach((field) => ensureTableRowKeys(initialState[field]));
1492
1493
  bindRuntimeTableColumns(initialState, this.tableRelations);
1493
1494
  this.reactiveState = reactive(initialState);
@@ -1644,7 +1645,7 @@ class RuntimeFormStateStore {
1644
1645
  this.ensureIncomingRowKeys(target, fieldKey, value);
1645
1646
  const valueChanged = !Object.is(toRaw(this.unwrap(target[fieldKey])), toRaw(value));
1646
1647
  const labelKey = `${fieldKey}_lb_`;
1647
- const clearLabel = (value == null || value === "" || Array.isArray(value) && value.length === 0) && target[labelKey] != null;
1648
+ const clearLabel = isEmptyReferenceValue(value) && target[labelKey] != null;
1648
1649
  if (!valueChanged && !clearLabel) return;
1649
1650
  const paths = valueChanged ? [path] : [];
1650
1651
  if (clearLabel) paths.push(`${path}_lb_`);
@@ -1683,6 +1684,7 @@ class RuntimeFormStateStore {
1683
1684
  this.mutate(Array.from(paths), source, () => {
1684
1685
  Object.keys(this.reactiveState).forEach((key) => delete this.reactiveState[key]);
1685
1686
  this.assignValues(this.reactiveState, values);
1687
+ normalizeEmptyReferenceLabels(this.reactiveState);
1686
1688
  });
1687
1689
  this.userModifiedPaths.clear();
1688
1690
  if (source === "restore") this.dirty = false;
@@ -1863,6 +1865,23 @@ const ARRAY_MUTATIONS = /* @__PURE__ */ new Set([
1863
1865
  "unshift"
1864
1866
  ]);
1865
1867
  const ARRAY_SEARCHES = /* @__PURE__ */ new Set(["includes", "indexOf", "lastIndexOf"]);
1868
+ function isEmptyReferenceValue(value) {
1869
+ return value == null || value === "" || Array.isArray(value) && value.length === 0;
1870
+ }
1871
+ function normalizeEmptyReferenceLabels(value, visited = /* @__PURE__ */ new WeakSet()) {
1872
+ if (!isMutableRecord(value) || visited.has(toRaw(value))) return;
1873
+ visited.add(toRaw(value));
1874
+ Object.entries(value).forEach(([key, child]) => {
1875
+ if (key.endsWith("_lb_")) {
1876
+ const fieldKey = key.slice(0, -4);
1877
+ if (child != null && Object.prototype.hasOwnProperty.call(value, fieldKey) && isEmptyReferenceValue(value[fieldKey])) {
1878
+ value[key] = null;
1879
+ }
1880
+ } else if (key !== "_DICT") {
1881
+ normalizeEmptyReferenceLabels(child, visited);
1882
+ }
1883
+ });
1884
+ }
1866
1885
  function joinPath(basePath, key) {
1867
1886
  return basePath ? `${basePath}.${key}` : key;
1868
1887
  }
@@ -5857,8 +5876,10 @@ class MaterialConsumeTableController {
5857
5876
  mainFormState = ref({});
5858
5877
  /** 表单数据状态(由 factory bindRuntime 注入):未填报 / STASH / SUBMIT */
5859
5878
  dataStatus;
5860
- /** factory 是否已绑定过运行时(避免重复 initTableData) */
5861
- runtimeBound = false;
5879
+ /** 实例数据只在 LOADED 前准备一次,运行时绑定不再重新生成行。 */
5880
+ initialDataPrepared = false;
5881
+ /** 最近一次同步需求数量时使用的数量依赖。 */
5882
+ syncedMaterialNoNum;
5862
5883
  /** 多 Sheet / 同屏多实例下,弹层和异步交互使用该键隔离。 */
5863
5884
  runtimeOwnerId = "";
5864
5885
  /** 表单是否已暂存或提交(已处理过则不再跑初始化) */
@@ -6249,40 +6270,36 @@ class MaterialConsumeTableController {
6249
6270
  });
6250
6271
  this.isScanOpen = false;
6251
6272
  }
6252
- /**
6253
- * 打开扫描弹窗
6254
- * @param opts
6255
- */
6256
- async openBomModal() {
6257
- if (!this.actualBomEntries) {
6258
- return;
6273
+ /** Store 创建前准备物料行和数量,全部 Sheet 的 LOADED 共用这份数据。 */
6274
+ prepareInitialData(opts) {
6275
+ if (this.initialDataPrepared) return;
6276
+ this.tableDataRef = toRef(opts.formState, opts.field, []);
6277
+ this.mainFormState = toRef(() => opts.formState);
6278
+ this.dataStatus = opts.dataStatus;
6279
+ this.initTableData(opts.defaultRowData);
6280
+ const rows = this.actualTableData;
6281
+ if (rows.length === 1 && !rows[0].product_id_) {
6282
+ MCDataUtil.setRowEditing(rows[0], true);
6259
6283
  }
6260
- await MaterialConsumeTableController.render?.openBomModal({
6261
- ownerId: this.runtimeOwnerId,
6262
- bomList: this.actualBomEntries,
6263
- onSubstitute: async () => {
6264
- console.log("一键导入数据逻辑");
6265
- }
6266
- });
6284
+ if (this.dataStatus !== "SUBMIT") {
6285
+ this.syncQtyRequiredFromBom();
6286
+ }
6287
+ this.syncedMaterialNoNum = this.materialNoNum;
6288
+ this.initialDataPrepared = true;
6267
6289
  }
6268
- /**
6269
- * 表单加载时由 factory 调用:绑定稳定数据源并初始化行数据。
6270
- * 不在分页组件 setup 中调用,避免跨页挂载重复 init。
6271
- */
6290
+ /** 数量依赖实际变化时才重算,避免首次绑定覆盖 LOADED 中的回填。 */
6291
+ syncQtyRequiredFromBomIfChanged() {
6292
+ if (this.dataStatus === "SUBMIT") return;
6293
+ const materialNoNum = this.materialNoNum;
6294
+ if (this.initialDataPrepared && Object.is(materialNoNum, this.syncedMaterialNoNum)) return;
6295
+ this.syncQtyRequiredFromBom();
6296
+ this.syncedMaterialNoNum = materialNoNum;
6297
+ }
6298
+ /** 只绑定运行时 Store,不重新生成行或修改行内容。 */
6272
6299
  bindRuntime(opts) {
6273
6300
  this.tableDataRef = opts.tableDataRef;
6274
- this.runtimeOwnerId = opts.ownerId;
6275
6301
  this.mainFormState = opts.mainFormState ?? ref({});
6276
6302
  this.dataStatus = opts.dataStatus;
6277
- if (this.runtimeBound) return;
6278
- this.runtimeBound = true;
6279
- this.initTableData(opts.defaultRowData);
6280
- if (this.actualTableData.length === 1) {
6281
- const firstRow = this.actualTableData[0];
6282
- if (!firstRow.product_id_) {
6283
- MCDataUtil.setRowEditing(firstRow, true);
6284
- }
6285
- }
6286
6303
  }
6287
6304
  /**
6288
6305
  * 消耗表组件挂载时调用:只同步视图依赖,不初始化数据、不注册 watch。
@@ -6296,7 +6313,10 @@ class MaterialConsumeTableController {
6296
6313
  * 按当前 materialNoNum 回写各行 qty_required_(校验侧 total 已通过 getter 实时读取)
6297
6314
  */
6298
6315
  syncQtyRequiredFromBom() {
6299
- if (this.tmplBom.required_qty_calc_rule_ === RequiredQtyCalcRule.Custom) return;
6316
+ if (this.tmplBom.required_qty_calc_rule_ === RequiredQtyCalcRule.Custom) {
6317
+ this.updateDerivedQtyFields();
6318
+ return;
6319
+ }
6300
6320
  this.actualTableData.forEach((row) => {
6301
6321
  if (!row.product_id_) return;
6302
6322
  const util = this.bomEntriesValidator.findUtilByProductId(row.product_id_);
package/dist/excel.css CHANGED
@@ -22925,11 +22925,11 @@ svg[data-v-9a7c8184] {
22925
22925
  .base-vxe-search-form-container .ant-input-affix-wrapper[data-v-16374060] .ant-input {
22926
22926
  background: #f6f8fa;
22927
22927
  }
22928
- .allocate-part__dropdown[data-v-8620f4a0] {
22928
+ .allocate-part__dropdown[data-v-6c8bafae] {
22929
22929
  height: 520px;
22930
22930
  padding: 6px 10px;
22931
22931
  }
22932
- .search-more[data-v-9cd98049] {
22932
+ .search-more[data-v-fefa9ebf] {
22933
22933
  display: flex;
22934
22934
  justify-content: center;
22935
22935
  align-items: center;
@@ -22940,7 +22940,7 @@ svg[data-v-9a7c8184] {
22940
22940
  margin-top: 4px;
22941
22941
  padding-top: 4px;
22942
22942
  }
22943
- .search-more[data-v-8b3e2bc3] {
22943
+ .search-more[data-v-104db85d] {
22944
22944
  display: flex;
22945
22945
  align-items: center;
22946
22946
  justify-content: center;
@@ -22951,22 +22951,22 @@ svg[data-v-9a7c8184] {
22951
22951
  font-size: 14px;
22952
22952
  line-height: 24px;
22953
22953
  }
22954
- .trace-device__dropdown[data-v-8b3e2bc3] {
22954
+ .trace-device__dropdown[data-v-104db85d] {
22955
22955
  height: 568px;
22956
22956
  padding: 6px 10px;
22957
22957
  }
22958
- .trace-device__search-form[data-v-8b3e2bc3] {
22958
+ .trace-device__search-form[data-v-104db85d] {
22959
22959
  height: 44px;
22960
22960
  }
22961
- .trace-device__search-form[data-v-8b3e2bc3] .ant-select-selector {
22961
+ .trace-device__search-form[data-v-104db85d] .ant-select-selector {
22962
22962
  width: 259px;
22963
22963
  }
22964
- .trace-device__search-form .ant-input-affix-wrapper[data-v-8b3e2bc3] {
22964
+ .trace-device__search-form .ant-input-affix-wrapper[data-v-104db85d] {
22965
22965
  height: 32px;
22966
22966
  border: none;
22967
22967
  background: #f6f8fa;
22968
22968
  }
22969
- .trace-device__search-form .ant-input-affix-wrapper[data-v-8b3e2bc3] .ant-input {
22969
+ .trace-device__search-form .ant-input-affix-wrapper[data-v-104db85d] .ant-input {
22970
22970
  background: #f6f8fa;
22971
22971
  }
22972
22972
  .content-highlight[data-v-b2337210]::after {
@@ -1,5 +1,5 @@
1
1
  import { M as commonjsGlobal, N as getDefaultExportFromCjs } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-anSsEnF9.js";
2
- import { c as commonjsRequire } from "./index-B2tkugA7.js";
2
+ import { c as commonjsRequire } from "./index-DC9Ri3CX.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  for (var i = 0; i < m.length; i++) {
5
5
  const e = m[i];
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, computed, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, unref, normalizeClass, withCtx, normalizeStyle } from "vue";
2
2
  import { A as AlignEditor } from "./align-editor-CUUJFEyr.js";
3
3
  import { pick } from "lodash-es";
4
- import { z as _sfc_main$1, C as ColorPicker } from "./index-B2tkugA7.js";
4
+ import { z as _sfc_main$1, C as ColorPicker } from "./index-DC9Ri3CX.js";
5
5
  import { a7 as _export_sfc } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-anSsEnF9.js";
6
6
  const _hoisted_1 = { class: "ks-row-middle mb-6px" };
7
7
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -3,7 +3,7 @@ import { C as ComponentTypeEnum } from "./dynamic-table-action.vue_vue_type_styl
3
3
  import "vue";
4
4
  import "dayjs";
5
5
  import "ant-design-vue";
6
- import { B as BaseComponent } from "./BaseComponent-BcMUXzWr.js";
6
+ import { B as BaseComponent } from "./BaseComponent-D_qr1qAV.js";
7
7
  class Timepicker extends BaseComponent {
8
8
  component = ComponentTypeEnum.Timepicker;
9
9
  wrapperCmpConfig({ data }) {
@@ -3,7 +3,7 @@ import "vue";
3
3
  import { pick } from "lodash-es";
4
4
  import "dayjs";
5
5
  import "ant-design-vue";
6
- import { B as BaseComponent } from "./BaseComponent-BcMUXzWr.js";
6
+ import { B as BaseComponent } from "./BaseComponent-D_qr1qAV.js";
7
7
  class Diagonal extends BaseComponent {
8
8
  component = ComponentTypeEnum.Diagonal;
9
9
  wrapperCmpConfig({ data }) {
@@ -1,6 +1,6 @@
1
1
  import { pick, has, cloneDeep, get } from "lodash-es";
2
- import { A as AsyncGctOnlineComponents, g as getFieldWidget } from "./index-B2tkugA7.js";
3
- import { i as isCellAutoLineBreak } from "./dynamic-table-action-CTBy77AD.js";
2
+ import { A as AsyncGctOnlineComponents, g as getFieldWidget } from "./index-DC9Ri3CX.js";
3
+ import { i as isCellAutoLineBreak } from "./dynamic-table-action-BjNAbOiM.js";
4
4
  import { C as ComponentTypeEnum, y as CellType, o as PaperWidgeType } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-anSsEnF9.js";
5
5
  import "vue";
6
6
  import "dayjs";
@@ -3,7 +3,7 @@ import { C as ComponentTypeEnum, a_ as BindCmpStyleEnum } from "./dynamic-table-
3
3
  import "vue";
4
4
  import "dayjs";
5
5
  import "ant-design-vue";
6
- import { B as BaseComponent } from "./BaseComponent-BcMUXzWr.js";
6
+ import { B as BaseComponent } from "./BaseComponent-D_qr1qAV.js";
7
7
  class Textarea extends BaseComponent {
8
8
  component = ComponentTypeEnum.Textarea;
9
9
  wrapperCmpConfig({ data }) {
@@ -3,7 +3,7 @@ import "vue";
3
3
  import { pick, has, isEmpty, cloneDeep, get } from "lodash-es";
4
4
  import "dayjs";
5
5
  import "ant-design-vue";
6
- import { A as AsyncGctOnlineComponents } from "./index-B2tkugA7.js";
6
+ import { A as AsyncGctOnlineComponents } from "./index-DC9Ri3CX.js";
7
7
  class Tr {
8
8
  component = "tr";
9
9
  wrapperCmpConfig({ data, parent }) {
@@ -3,7 +3,7 @@ import { C as ComponentTypeEnum } from "./dynamic-table-action.vue_vue_type_styl
3
3
  import "vue";
4
4
  import "dayjs";
5
5
  import "ant-design-vue";
6
- import { B as BaseComponent } from "./BaseComponent-BcMUXzWr.js";
6
+ import { B as BaseComponent } from "./BaseComponent-D_qr1qAV.js";
7
7
  class Department extends BaseComponent {
8
8
  component = ComponentTypeEnum.Department;
9
9
  wrapperCmpConfig({ data }) {
@@ -3,8 +3,8 @@ import "vue";
3
3
  import "lodash-es";
4
4
  import "dayjs";
5
5
  import "ant-design-vue";
6
- import { B as BaseComponent } from "./BaseComponent-BcMUXzWr.js";
7
- import { g as getTraceLikeSelectProps } from "./trace-like-wrapper-BKilXIvf.js";
6
+ import { B as BaseComponent } from "./BaseComponent-D_qr1qAV.js";
7
+ import { g as getTraceLikeSelectProps } from "./trace-like-wrapper-DjdghEJk.js";
8
8
  class AutoComplete extends BaseComponent {
9
9
  component = ComponentTypeEnum.AutoComplete;
10
10
  wrapperCmpConfig({ data }) {
@@ -3,7 +3,7 @@ import { C as ComponentTypeEnum } from "./dynamic-table-action.vue_vue_type_styl
3
3
  import "vue";
4
4
  import "dayjs";
5
5
  import "ant-design-vue";
6
- import { B as BaseComponent } from "./BaseComponent-BcMUXzWr.js";
6
+ import { B as BaseComponent } from "./BaseComponent-D_qr1qAV.js";
7
7
  class UploadFile extends BaseComponent {
8
8
  component = ComponentTypeEnum.UploadFile;
9
9
  wrapperCmpConfig({ data }) {
@@ -3,7 +3,7 @@ import { C as ComponentTypeEnum, au as RangeCompareOp, at as RangeValidateMode }
3
3
  import "vue";
4
4
  import "dayjs";
5
5
  import "ant-design-vue";
6
- import { B as BaseComponent } from "./BaseComponent-BcMUXzWr.js";
6
+ import { B as BaseComponent } from "./BaseComponent-D_qr1qAV.js";
7
7
  class Datepicker extends BaseComponent {
8
8
  component = ComponentTypeEnum.Datepicker;
9
9
  wrapperCmpConfig({ data }) {
@@ -3,7 +3,7 @@ import { C as ComponentTypeEnum, aw as ImageDisplayModeEnum } from "./dynamic-ta
3
3
  import "vue";
4
4
  import "dayjs";
5
5
  import "ant-design-vue";
6
- import { B as BaseComponent } from "./BaseComponent-BcMUXzWr.js";
6
+ import { B as BaseComponent } from "./BaseComponent-D_qr1qAV.js";
7
7
  class UploadImage extends BaseComponent {
8
8
  component = ComponentTypeEnum.UploadImage;
9
9
  wrapperCmpConfig({ data }) {
@@ -3,7 +3,7 @@ import { C as ComponentTypeEnum, a1 as SignatureImageDirectionEnum, a2 as Fallba
3
3
  import "vue";
4
4
  import "dayjs";
5
5
  import "ant-design-vue";
6
- import { B as BaseComponent } from "./BaseComponent-BcMUXzWr.js";
6
+ import { B as BaseComponent } from "./BaseComponent-D_qr1qAV.js";
7
7
  class Sign extends BaseComponent {
8
8
  component = ComponentTypeEnum.Sign;
9
9
  wrapperCmpConfig({ data }) {
@@ -1,11 +1,11 @@
1
1
  import { get, pick } from "lodash-es";
2
- import { h as normalizeFieldWidth, D as DEFAULT_BOOLEAN_FIELD_WIDTH } from "./dynamic-table-action-CTBy77AD.js";
2
+ import { h as normalizeFieldWidth, D as DEFAULT_BOOLEAN_FIELD_WIDTH } from "./dynamic-table-action-BjNAbOiM.js";
3
3
  import { C as ComponentTypeEnum, O as Orientation, a0 as BooleanShowMode, $ as LabelPosition, a_ as BindCmpStyleEnum } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-anSsEnF9.js";
4
4
  import "vue";
5
5
  import "dayjs";
6
6
  import "ant-design-vue";
7
- import { g as getFieldWidget } from "./index-B2tkugA7.js";
8
- import { B as BaseComponent } from "./BaseComponent-BcMUXzWr.js";
7
+ import { g as getFieldWidget } from "./index-DC9Ri3CX.js";
8
+ import { B as BaseComponent } from "./BaseComponent-D_qr1qAV.js";
9
9
  class Switch extends BaseComponent {
10
10
  component = ComponentTypeEnum.Switch;
11
11
  wrapperCmpConfig({ data }) {