@gct-paas/word 0.1.47-beta.14 → 0.1.47-beta.15

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/index.es.js CHANGED
@@ -53405,7 +53405,7 @@ class BomEntryValidator {
53405
53405
  */
53406
53406
  calcQtyConsumed(arr = this.historyData) {
53407
53407
  const groupData = this.filterGroupData(arr);
53408
- return groupData.reduce((acc, cur) => acc + (cur.qty_ ?? 0), 0);
53408
+ return groupData.reduce((acc, cur) => acc + (Number(cur.qty_) ?? 0), 0);
53409
53409
  }
53410
53410
  /**
53411
53411
  * 计算自定义的数量校验的最大值和最小值
@@ -53857,20 +53857,20 @@ class McWebRender extends MCRender {
53857
53857
  });
53858
53858
  }
53859
53859
  }
53860
- const KEY = "_subFieldConfig";
53860
+ const SUB_FIELD_CONFIG_KEY = "_subFieldConfig";
53861
53861
  const getSubFieldConfig = (paramsConfig) => {
53862
53862
  return {
53863
53863
  init(subConfig) {
53864
53864
  if (!paramsConfig) return;
53865
- paramsConfig[KEY] = subConfig;
53865
+ paramsConfig[SUB_FIELD_CONFIG_KEY] = subConfig;
53866
53866
  },
53867
53867
  get(valuePath) {
53868
- if (!valuePath || !paramsConfig?.[KEY]) return {};
53869
- return paramsConfig[KEY][valuePath] || {};
53868
+ if (!valuePath || !paramsConfig?.[SUB_FIELD_CONFIG_KEY]) return {};
53869
+ return paramsConfig[SUB_FIELD_CONFIG_KEY][valuePath] || {};
53870
53870
  },
53871
53871
  set(valuePath, subConfig) {
53872
- if (!valuePath || !paramsConfig?.[KEY]) return;
53873
- paramsConfig[KEY][valuePath] = subConfig;
53872
+ if (!valuePath || !paramsConfig?.[SUB_FIELD_CONFIG_KEY]) return;
53873
+ paramsConfig[SUB_FIELD_CONFIG_KEY][valuePath] = subConfig;
53874
53874
  }
53875
53875
  };
53876
53876
  };
@@ -53911,6 +53911,26 @@ class MCDataUtil {
53911
53911
  const { row, keys: keys2 = this.allFields, disabled = true } = opts;
53912
53912
  this.editMCTable(row, { fieldDisabled: this.arrToObj(keys2, disabled) });
53913
53913
  }
53914
+ /**
53915
+ * 物料消耗表 需求数量、已消耗数量 不可修改
53916
+ * @param rowPath $.f_sub[n] n 必须为数字
53917
+ */
53918
+ static disableQtyFields(dataManager, rowPath) {
53919
+ const config = { newDisabled: true };
53920
+ dataManager.setFieldRuntimeSpecificConfig(`${rowPath}.qty_required_`, config);
53921
+ dataManager.setFieldRuntimeSpecificConfig(`${rowPath}.qty_consumed_`, config);
53922
+ }
53923
+ /**
53924
+ * 物料消耗表 更新[需求数量、已消耗数量]以外字段是否禁用
53925
+ * @param rowPath $.f_sub[n] n 必须为数字
53926
+ */
53927
+ static updateOtherFieldsDisabled(option) {
53928
+ const { dataManager, rowPath, row, disabled } = option;
53929
+ const config = { newDisabled: disabled };
53930
+ Object.keys(row).filter((key) => !["qty_required_", "qty_consumed_"].includes(key)).forEach((key) => {
53931
+ dataManager.setFieldRuntimeSpecificConfig(`${rowPath}.${key}`, config);
53932
+ });
53933
+ }
53914
53934
  /**
53915
53935
  * 设置行数据的编辑状态
53916
53936
  */
@@ -53925,13 +53945,11 @@ class MCDataUtil {
53925
53945
  const rows = dataManager.getRawData()[subFieldKey] ?? [];
53926
53946
  rows[rowIndex] = row;
53927
53947
  dataManager.set(subFieldKey, rows);
53928
- dataManager.getFieldRuntimeSpecificConfigKeys().forEach((key) => {
53929
- if (key.startsWith(`$.${subFieldKey}[${rowIndex}]`)) {
53930
- dataManager.setFieldRuntimeSpecificConfig(key, { newDisabled: isConfirmed });
53931
- }
53932
- if ([`$.${subFieldKey}[${rowIndex}].qty_required_`, `$.${subFieldKey}[${rowIndex}].qty_consumed_`].includes(key)) {
53933
- dataManager.setFieldRuntimeSpecificConfig(key, { newDisabled: true });
53934
- }
53948
+ MCDataUtil.updateOtherFieldsDisabled({
53949
+ dataManager,
53950
+ rowPath: `$.${subFieldKey}[${rowIndex}]`,
53951
+ row,
53952
+ disabled: isConfirmed
53935
53953
  });
53936
53954
  }
53937
53955
  }
@@ -54317,7 +54335,7 @@ class MaterialConsumeTableController {
54317
54335
  if (this.hasEditingRow()) {
54318
54336
  return;
54319
54337
  }
54320
- const isLast = this.actualTableData[this.actualTableData.length - 1] === option.row;
54338
+ const isLast = option.rowIndex === this.actualTableData.length - 1;
54321
54339
  if (this.enableSequenceLoading && !isLast) {
54322
54340
  this.error(
54323
54341
  "顺序投料时只能最后一条数据开启编辑状态"
@@ -54394,8 +54412,7 @@ class MaterialConsumeTableController {
54394
54412
  return data;
54395
54413
  }, {});
54396
54414
  doc.dataManager.setMultiple(wordValue);
54397
- doc.dataManager.setFieldRuntimeSpecificConfig(`${rowPath}.qty_required_`, { newDisabled: true });
54398
- doc.dataManager.setFieldRuntimeSpecificConfig(`${rowPath}.qty_consumed_`, { newDisabled: true });
54415
+ MCDataUtil.disableQtyFields(doc.dataManager, rowPath);
54399
54416
  }
54400
54417
  }
54401
54418
  }
@@ -103434,14 +103451,6 @@ async function initializeDocumentEngine(props, payload, result) {
103434
103451
  r.widgetMeta.props = matchedBom;
103435
103452
  });
103436
103453
  }
103437
- if (paramsConfig && tmplBomC?.formInstBom?.formTmplBomList) {
103438
- const subConfig = {};
103439
- tmplBomC.formInstBom.formTmplBomList.forEach(({ table_key_, entries_ }) => {
103440
- const includedIds = (entries_ || []).map((e) => e.product_id_.split(":").pop());
103441
- subConfig[`${table_key_}[n].product_id_`] = { "id_.in": includedIds };
103442
- });
103443
- getSubFieldConfig(paramsConfig).init(subConfig);
103444
- }
103445
103454
  const instances = docModel.getWidgetInstances();
103446
103455
  if (fillModeType !== DocModeTypeConst.Edit) {
103447
103456
  instances.forEach((instance2) => {
@@ -103513,6 +103522,30 @@ async function initializeDocumentEngine(props, payload, result) {
103513
103522
  });
103514
103523
  doc.dataManager.setRawData(rawData, defaultDataMap);
103515
103524
  doc.dataManager.applyInitData({ ...paramMap, ...dsMap });
103525
+ if (tmplBomC?.formInstBom?.formTmplBomList) {
103526
+ const subConfig = {};
103527
+ tmplBomC.formInstBom.formTmplBomList.forEach(({ table_key_, entries_ }) => {
103528
+ const includedIds = (entries_ || []).map((e) => e.product_id_.split(":").pop());
103529
+ subConfig[`${table_key_}[n].product_id_`] = { "id_.in": includedIds };
103530
+ const subFieldKey = table_key_.replace("$.", "");
103531
+ const rows = doc.dataManager.getRawData()[subFieldKey] || [];
103532
+ const rowCount = rows.length;
103533
+ repeat(rowCount || 1, (index2) => {
103534
+ MCDataUtil.disableQtyFields(doc.dataManager, `${table_key_}[${index2}]`);
103535
+ });
103536
+ rows.forEach((row, rowIndex) => {
103537
+ if (row.is_confirmed_) {
103538
+ MCDataUtil.updateOtherFieldsDisabled({
103539
+ dataManager: doc.dataManager,
103540
+ rowPath: `$.${subFieldKey}[${rowIndex}]`,
103541
+ row,
103542
+ disabled: true
103543
+ });
103544
+ }
103545
+ });
103546
+ });
103547
+ getSubFieldConfig(doc.paramsConfig).init(subConfig);
103548
+ }
103516
103549
  await runDocumentPostLoadEnrichFlush(doc);
103517
103550
  await waitForDataManagerSettle();
103518
103551
  syncInitRawDataSnapshot(doc);
@@ -103614,6 +103647,7 @@ function useDocumentFactory(props, payload) {
103614
103647
  }
103615
103648
  async function refreshData() {
103616
103649
  const doc = docIns.value;
103650
+ const subFieldConfigCache = docIns.value?.paramsConfig?.[SUB_FIELD_CONFIG_KEY];
103617
103651
  const execute = lastExecute.value;
103618
103652
  const requestId = unref(props.requestId) ?? execute?.id;
103619
103653
  if (!doc || !execute || !requestId) return;
@@ -103646,6 +103680,7 @@ function useDocumentFactory(props, payload) {
103646
103680
  initDocModelJson
103647
103681
  };
103648
103682
  doc.paramsConfig = paramsConfig ?? {};
103683
+ doc.paramsConfig[SUB_FIELD_CONFIG_KEY] = subFieldConfigCache;
103649
103684
  if (doc.mode !== fillModeType) {
103650
103685
  doc.setMode(fillModeType);
103651
103686
  }
@@ -109526,19 +109561,44 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
109526
109561
  tableController.changeScanRule(props.doc.mainModelKey, subModelKey);
109527
109562
  }
109528
109563
  };
109564
+ const getIsAddable = () => {
109565
+ if (isMaterialConsumeTable.value) {
109566
+ const { subFieldKey } = getCtx();
109567
+ const tableData = docInst.value.dataManager.getRawData()[subFieldKey] ?? [];
109568
+ const isAllConfirmed = tableData.every((row) => row.is_confirmed_);
109569
+ if (!isAllConfirmed) {
109570
+ GctMessage.error("同时只能有一条数据开启编辑状态");
109571
+ }
109572
+ return isAllConfirmed;
109573
+ }
109574
+ return true;
109575
+ };
109576
+ const handleAddRowAfter = (subFieldKey, rowIndex) => {
109577
+ if (isMaterialConsumeTable.value) {
109578
+ MCDataUtil.disableQtyFields(props.doc.dataManager, `$.${subFieldKey}[${rowIndex}]`);
109579
+ }
109580
+ };
109529
109581
  const insertRows = (index2, count = 1) => {
109530
- const { path } = getCtx();
109582
+ if (!getIsAddable()) return;
109583
+ const { path, subFieldKey } = getCtx();
109531
109584
  props.doc.dataManager.insertAt(path, index2, ...Array.from({ length: count }, () => ({})));
109585
+ handleAddRowAfter(subFieldKey, index2);
109532
109586
  };
109533
109587
  const removeRow = () => {
109534
109588
  const { path, index: index2 } = getCtx();
109535
109589
  props.doc.dataManager.removeAt(path, index2);
109536
109590
  };
109537
109591
  const copyRow = () => {
109538
- const { path, index: index2 } = getCtx();
109592
+ if (!getIsAddable()) return;
109593
+ const { path, index: index2, subFieldKey } = getCtx();
109539
109594
  const storageIndex = props.doc.dataManager.resolveSubtableVisibleIndex(path, index2);
109540
- const data = props.doc.dataManager.get(`${path}[${storageIndex}]`) || {};
109541
- props.doc.dataManager.insertAt(path, index2 + 1, omit(data, "id_"));
109595
+ let data = props.doc.dataManager.get(`${path}[${storageIndex}]`) || {};
109596
+ data = omit(data, "id_");
109597
+ if (isMaterialConsumeTable.value) {
109598
+ data = omit(data, "is_confirmed_");
109599
+ }
109600
+ props.doc.dataManager.insertAt(path, index2 + 1, data);
109601
+ handleAddRowAfter(subFieldKey, index2 + 1);
109542
109602
  };
109543
109603
  const actionHandlers = {
109544
109604
  insertRowAfter() {
@@ -109619,7 +109679,8 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
109619
109679
  ]),
109620
109680
  _cache[12] || (_cache[12] = createElementVNode("div", { class: "item-label" }, " 复制行 ", -1))
109621
109681
  ]),
109622
- createElementVNode("div", {
109682
+ !isMaterialConsumeTable.value ? (openBlock(), createElementBlock("div", {
109683
+ key: 0,
109623
109684
  class: "menu-item",
109624
109685
  onClick: _cache[4] || (_cache[4] = ($event) => handleAction("insertRowBeforeMore"))
109625
109686
  }, [
@@ -109638,8 +109699,9 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
109638
109699
  }, ["stop"]))
109639
109700
  }, null, 8, ["modelValue"])
109640
109701
  ])
109641
- ]),
109642
- createElementVNode("div", {
109702
+ ])) : createCommentVNode("", true),
109703
+ !isMaterialConsumeTable.value ? (openBlock(), createElementBlock("div", {
109704
+ key: 1,
109643
109705
  class: "menu-item",
109644
109706
  onClick: _cache[7] || (_cache[7] = ($event) => handleAction("insertRowAfterMore"))
109645
109707
  }, [
@@ -109658,7 +109720,7 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
109658
109720
  }, ["stop"]))
109659
109721
  }, null, 8, ["modelValue"])
109660
109722
  ])
109661
- ])
109723
+ ])) : createCommentVNode("", true)
109662
109724
  ]),
109663
109725
  computedInfo.value.isDeleteBtnVisible ? (openBlock(), createElementBlock("div", _hoisted_13$3, [
109664
109726
  createElementVNode("div", {
@@ -109699,7 +109761,7 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
109699
109761
  };
109700
109762
  }
109701
109763
  });
109702
- const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2w, [["__scopeId", "data-v-13501110"]]);
109764
+ const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2w, [["__scopeId", "data-v-59412dfb"]]);
109703
109765
  const _sfc_main$2v = /* @__PURE__ */ defineComponent({
109704
109766
  __name: "index",
109705
109767
  props: {
@@ -42,6 +42,21 @@ export declare class MCDataUtil {
42
42
  /** 设置的值(不给则true) */
43
43
  disabled?: boolean;
44
44
  }): void;
45
+ /**
46
+ * 物料消耗表 需求数量、已消耗数量 不可修改
47
+ * @param rowPath $.f_sub[n] n 必须为数字
48
+ */
49
+ static disableQtyFields(dataManager: DataManager, rowPath: string): void;
50
+ /**
51
+ * 物料消耗表 更新[需求数量、已消耗数量]以外字段是否禁用
52
+ * @param rowPath $.f_sub[n] n 必须为数字
53
+ */
54
+ static updateOtherFieldsDisabled(option: {
55
+ dataManager: DataManager;
56
+ rowPath: string;
57
+ row: any;
58
+ disabled: boolean;
59
+ }): void;
45
60
  /**
46
61
  * 设置行数据的编辑状态
47
62
  */
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * 存取 doc.paramsConfig._subFieldConfig
3
3
  */
4
+ export declare const SUB_FIELD_CONFIG_KEY = "_subFieldConfig";
4
5
  export declare const getSubFieldConfig: (paramsConfig: any) => {
5
6
  init(subConfig: any): void;
6
7
  get(valuePath: string | undefined): any;
package/dist/word.css CHANGED
@@ -8680,20 +8680,20 @@ textarea[data-v-57fe54a3]::placeholder {
8680
8680
  .table-action .row-headers .row-header:last-child .row-add-btn[data-v-c40eef9f] .gct-icon.bottom {
8681
8681
  transform: translateY(-100%);
8682
8682
  }
8683
- .sub-table-action-container[data-v-13501110] {
8683
+ .sub-table-action-container[data-v-59412dfb] {
8684
8684
  position: absolute;
8685
8685
  z-index: 999;
8686
8686
  }
8687
- .sub-table-action-bar[data-v-13501110],
8688
- .sub-table-action-popper[data-v-13501110] {
8687
+ .sub-table-action-bar[data-v-59412dfb],
8688
+ .sub-table-action-popper[data-v-59412dfb] {
8689
8689
  pointer-events: auto;
8690
8690
  user-select: none;
8691
8691
  }
8692
- .sub-table-action-bar[data-v-13501110] {
8692
+ .sub-table-action-bar[data-v-59412dfb] {
8693
8693
  display: flex;
8694
8694
  }
8695
- .sub-table-action-bar .more-btn[data-v-13501110],
8696
- .sub-table-action-bar .confirm-btn[data-v-13501110] {
8695
+ .sub-table-action-bar .more-btn[data-v-59412dfb],
8696
+ .sub-table-action-bar .confirm-btn[data-v-59412dfb] {
8697
8697
  display: flex;
8698
8698
  justify-content: center;
8699
8699
  align-items: center;
@@ -8702,44 +8702,44 @@ textarea[data-v-57fe54a3]::placeholder {
8702
8702
  cursor: pointer;
8703
8703
  box-sizing: border-box;
8704
8704
  }
8705
- .sub-table-action-bar .more-btn[data-v-13501110] {
8705
+ .sub-table-action-bar .more-btn[data-v-59412dfb] {
8706
8706
  width: 10px;
8707
8707
  background: #026ac8;
8708
8708
  border-radius: 0 4px 4px 0;
8709
8709
  }
8710
- .sub-table-action-bar .confirm-btn[data-v-13501110] {
8710
+ .sub-table-action-bar .confirm-btn[data-v-59412dfb] {
8711
8711
  margin-left: 4px;
8712
8712
  border-radius: 4px;
8713
8713
  border: 1px solid #4ec262;
8714
8714
  }
8715
- .sub-table-action-popper[data-v-13501110] {
8715
+ .sub-table-action-popper[data-v-59412dfb] {
8716
8716
  padding: 2px 8px;
8717
8717
  }
8718
- .sub-table-action-popper .action-menu[data-v-13501110] {
8718
+ .sub-table-action-popper .action-menu[data-v-59412dfb] {
8719
8719
  padding: 4px 0;
8720
8720
  width: 220px;
8721
8721
  user-select: none;
8722
8722
  }
8723
- .sub-table-action-popper .action-menu + .action-menu[data-v-13501110] {
8723
+ .sub-table-action-popper .action-menu + .action-menu[data-v-59412dfb] {
8724
8724
  margin-top: 4px;
8725
8725
  padding-top: 4px;
8726
8726
  border-top: 1px solid #efefef;
8727
8727
  }
8728
- .sub-table-action-popper .action-menu .menu-title[data-v-13501110] {
8728
+ .sub-table-action-popper .action-menu .menu-title[data-v-59412dfb] {
8729
8729
  color: #bcbcbc;
8730
8730
  margin: 4px 0;
8731
8731
  }
8732
- .sub-table-action-popper .action-menu .menu-item[data-v-13501110] {
8732
+ .sub-table-action-popper .action-menu .menu-item[data-v-59412dfb] {
8733
8733
  display: flex;
8734
8734
  align-items: center;
8735
8735
  padding: 8px 10px;
8736
8736
  border-radius: 4px;
8737
8737
  }
8738
- .sub-table-action-popper .action-menu .menu-item[data-v-13501110]:hover {
8738
+ .sub-table-action-popper .action-menu .menu-item[data-v-59412dfb]:hover {
8739
8739
  cursor: pointer;
8740
8740
  background-color: #f2f5f8;
8741
8741
  }
8742
- .sub-table-action-popper .action-menu .menu-item .item-icon[data-v-13501110] {
8742
+ .sub-table-action-popper .action-menu .menu-item .item-icon[data-v-59412dfb] {
8743
8743
  display: flex;
8744
8744
  align-items: center;
8745
8745
  justify-content: start;
@@ -8747,14 +8747,14 @@ textarea[data-v-57fe54a3]::placeholder {
8747
8747
  width: 20px;
8748
8748
  height: 20px;
8749
8749
  }
8750
- .sub-table-action-popper .action-menu .menu-item .item-icon.scale-large[data-v-13501110] {
8750
+ .sub-table-action-popper .action-menu .menu-item .item-icon.scale-large[data-v-59412dfb] {
8751
8751
  transform: scale(1.5);
8752
8752
  }
8753
- .sub-table-action-popper .action-menu .menu-item .item-label[data-v-13501110] {
8753
+ .sub-table-action-popper .action-menu .menu-item .item-label[data-v-59412dfb] {
8754
8754
  flex-grow: 1;
8755
8755
  margin-left: 8px;
8756
8756
  }
8757
- .sub-table-action-popper .action-menu .menu-item .item-label.flex-between-center[data-v-13501110] {
8757
+ .sub-table-action-popper .action-menu .menu-item .item-label.flex-between-center[data-v-59412dfb] {
8758
8758
  display: flex;
8759
8759
  justify-content: space-between;
8760
8760
  align-items: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/word",
3
- "version": "0.1.47-beta.14",
3
+ "version": "0.1.47-beta.15",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",