@gct-paas/word 0.1.47 → 0.1.48

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
@@ -53934,29 +53934,36 @@ class MCDataUtil {
53934
53934
  const { row, keys: keys2 = this.allFields, disabled = true } = opts;
53935
53935
  this.editMCTable(row, { fieldDisabled: this.arrToObj(keys2, disabled) });
53936
53936
  }
53937
+ static _updateDisablement(option) {
53938
+ const { dataManager, rowPath, fields, disabled } = option;
53939
+ const config = { newDisabled: disabled };
53940
+ fields.forEach((field) => {
53941
+ dataManager.setFieldRuntimeSpecificConfig(`${rowPath}.${field}`, config);
53942
+ });
53943
+ }
53937
53944
  /**
53938
- * 物料消耗表 需求数量、已消耗数量 不可修改
53945
+ * 物料消耗表[需求数量、已消耗数量]一直禁用
53939
53946
  * @param rowPath $.f_sub[n] n 必须为数字
53940
53947
  */
53941
53948
  static disableQtyFields(dataManager, rowPath) {
53942
- const config = { newDisabled: true };
53943
- dataManager.setFieldRuntimeSpecificConfig(`${rowPath}.qty_required_`, config);
53944
- dataManager.setFieldRuntimeSpecificConfig(`${rowPath}.qty_consumed_`, config);
53949
+ const fields = ["qty_consumed_", "qty_required_"];
53950
+ this._updateDisablement({ dataManager, rowPath, fields, disabled: true });
53945
53951
  }
53946
53952
  /**
53947
- * 物料消耗表 更新部分字段是否禁用
53953
+ * 物料消耗表 物料类型是否是[查看物料]时需要更新[物料批号、数量]字段是否禁用
53948
53954
  * @param rowPath $.f_sub[n] n 必须为数字
53949
53955
  */
53950
- static updateOtherFieldsDisabled(option) {
53951
- const { dataManager, rowPath, disabled } = option;
53952
- const config = { newDisabled: disabled };
53953
- [
53954
- "product_id_",
53955
- "material_no_",
53956
- "routing_operation_id_"
53957
- ].forEach((key) => {
53958
- dataManager.setFieldRuntimeSpecificConfig(`${rowPath}.${key}`, config);
53959
- });
53956
+ static updateViewFieldsDisablement(option) {
53957
+ const fields = ["material_no_", "qty_"];
53958
+ this._updateDisablement({ ...option, fields });
53959
+ }
53960
+ /**
53961
+ * 物料消耗表 更新固定几个字段是否禁用
53962
+ * @param rowPath $.f_sub[n] n 必须为数字
53963
+ */
53964
+ static updateFixedFieldsDisablement(option) {
53965
+ const fields = ["product_id_", "material_no_", "routing_operation_id_"];
53966
+ this._updateDisablement({ ...option, fields });
53960
53967
  }
53961
53968
  /**
53962
53969
  * 设置行数据的编辑状态
@@ -53972,7 +53979,7 @@ class MCDataUtil {
53972
53979
  const rows = dataManager.getRawData()[subFieldKey] ?? [];
53973
53980
  rows[rowIndex] = row;
53974
53981
  dataManager.set(subFieldKey, rows);
53975
- MCDataUtil.updateOtherFieldsDisabled({
53982
+ MCDataUtil.updateFixedFieldsDisablement({
53976
53983
  dataManager,
53977
53984
  rowPath: `$.${subFieldKey}[${rowIndex}]`,
53978
53985
  disabled: isConfirmed
@@ -54132,19 +54139,16 @@ class MaterialConsumeTableController {
54132
54139
  }
54133
54140
  }
54134
54141
  /**
54135
- * 根据数据计算需要禁用的字段
54136
- * @param row
54137
- * @return {*}
54142
+ * 获取是否是 物料查看
54143
+ * @param product_id_
54144
+ * @returns
54138
54145
  */
54139
- calcDisabledFields(row) {
54140
- const disabledKeys = ["qty_consumed_", "qty_required_"];
54141
- if (row.product_id_) {
54142
- const util = this.bomEntriesValidator.findUtilByProductId(row.product_id_);
54143
- if (util?.bomEntry.type_ === "view") {
54144
- disabledKeys.push("material_no_", "qty_");
54145
- }
54146
+ getMaterialTypeIsView(product_id_) {
54147
+ if (product_id_) {
54148
+ const util = this.bomEntriesValidator.findUtilByProductId(product_id_);
54149
+ return util?.bomEntry.type_ === "view";
54146
54150
  }
54147
- return disabledKeys;
54151
+ return false;
54148
54152
  }
54149
54153
  /**
54150
54154
  * 获取bom内主物料,替换物料查询的算子
@@ -54422,7 +54426,8 @@ class MaterialConsumeTableController {
54422
54426
  if (["product_id_", "material_no_"].includes(fieldKey)) {
54423
54427
  const rowPath = `${parentFieldPath}[${dataIndex}]`;
54424
54428
  if (fieldKey === "product_id_") {
54425
- const versionId = changedData[`${rowPath}.product_id_`]?.split(":").pop();
54429
+ const product_id_ = changedData[`${rowPath}.product_id_`];
54430
+ const versionId = product_id_?.split(":").pop();
54426
54431
  if (versionId) {
54427
54432
  getSubFieldConfig(doc.paramsConfig).set(`${rowPath}.material_no_`, {
54428
54433
  "product_id_.versionIn": [versionId]
@@ -54433,6 +54438,8 @@ class MaterialConsumeTableController {
54433
54438
  [`${rowPath}.material_no__lb_`]: void 0,
54434
54439
  [`${rowPath}.qty_`]: void 0
54435
54440
  });
54441
+ const disabled = this.getMaterialTypeIsView(product_id_);
54442
+ MCDataUtil.updateViewFieldsDisablement({ dataManager: doc.dataManager, rowPath, disabled });
54436
54443
  } else if (fieldKey === "material_no_") {
54437
54444
  doc.dataManager.setMultiple({
54438
54445
  [`${rowPath}.product_id_`]: selectedOption.product_id_
@@ -54446,7 +54453,6 @@ class MaterialConsumeTableController {
54446
54453
  return data;
54447
54454
  }, {});
54448
54455
  doc.dataManager.setMultiple(wordValue);
54449
- MCDataUtil.disableQtyFields(doc.dataManager, rowPath);
54450
54456
  }
54451
54457
  }
54452
54458
  }
@@ -103575,7 +103581,7 @@ async function initializeDocumentEngine(props, payload, result) {
103575
103581
  });
103576
103582
  rows.forEach((row, rowIndex) => {
103577
103583
  if (row.is_confirmed_) {
103578
- MCDataUtil.updateOtherFieldsDisabled({
103584
+ MCDataUtil.updateFixedFieldsDisablement({
103579
103585
  dataManager: doc.dataManager,
103580
103586
  rowPath: `$.${subFieldKey}[${rowIndex}]`,
103581
103587
  disabled: true
@@ -109538,6 +109544,13 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
109538
109544
  index: yDataIndex ?? dataIndex ?? 0
109539
109545
  };
109540
109546
  };
109547
+ const getTableRows = (subFieldKey, visible) => {
109548
+ const rows = docInst.value.dataManager.getRawData()[subFieldKey] ?? [];
109549
+ if (visible) {
109550
+ return rows.filter((row) => !row.deleted_);
109551
+ }
109552
+ return rows;
109553
+ };
109541
109554
  const readonly2 = computed(() => {
109542
109555
  const state = resolveWidgetState({
109543
109556
  doc: props.doc,
@@ -109551,9 +109564,9 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
109551
109564
  });
109552
109565
  const computedInfo = computed(() => {
109553
109566
  const { index: rowIndex, subFieldKey } = getCtx();
109554
- const tableData = docInst.value.dataManager.getRawData()[subFieldKey] ?? [];
109555
- const isDeleteBtnVisible = tableData.length > 1;
109556
- const isRowConfirmed = !!tableData[rowIndex]?.is_confirmed_;
109567
+ const visibleRows = getTableRows(subFieldKey, true);
109568
+ const isDeleteBtnVisible = visibleRows.length > 1;
109569
+ const isRowConfirmed = !!visibleRows[rowIndex]?.is_confirmed_;
109557
109570
  return {
109558
109571
  isDeleteBtnVisible,
109559
109572
  isRowConfirmed
@@ -109575,23 +109588,23 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
109575
109588
  if (!subFieldKey) return;
109576
109589
  const subModelKey = mainFields.find((f) => f.key === subFieldKey)?.bindInfo;
109577
109590
  const { dataManager } = docInst.value;
109578
- const tableData = dataManager.getRawData()[subFieldKey] ?? [];
109591
+ const allRows = getTableRows(subFieldKey);
109579
109592
  const { tableName } = props.cell.subRenderer;
109580
- let row = tableData[rowIndex];
109581
- const insertEmptyRow = (row2, rowIndex2, cb) => {
109582
- if (!row2) {
109583
- row2 = {};
109584
- tableData[rowIndex2] = row2;
109585
- dataManager.set(subFieldKey, tableData);
109593
+ const row = allRows[rowIndex];
109594
+ const checkTargetRow = (_row, cb) => {
109595
+ if (!_row) {
109596
+ _row = {};
109597
+ allRows.splice(rowIndex, 0, _row);
109598
+ dataManager.set(subFieldKey, allRows);
109586
109599
  }
109587
109600
  setTimeout(cb);
109588
109601
  };
109589
109602
  if (val === "confirm") {
109590
- insertEmptyRow(row, rowIndex, () => {
109603
+ checkTargetRow(row, () => {
109591
109604
  tableController.confirm({ row, rowIndex, dataManager, subFieldKey }, subModelKey);
109592
109605
  });
109593
109606
  } else if (val === "scan") {
109594
- insertEmptyRow(row, rowIndex, () => {
109607
+ checkTargetRow(row, () => {
109595
109608
  tableController.openScanModal(tableName, { dataManager, subFieldKey }, subModelKey);
109596
109609
  });
109597
109610
  } else if (val === "edit") {
@@ -109605,8 +109618,8 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
109605
109618
  const getIsAddable = () => {
109606
109619
  if (isMaterialConsumeTable.value) {
109607
109620
  const { subFieldKey } = getCtx();
109608
- const tableData = docInst.value.dataManager.getRawData()[subFieldKey] ?? [];
109609
- const isAllConfirmed = tableData.length && tableData.every((row) => row.is_confirmed_);
109621
+ const visibleRows = getTableRows(subFieldKey, true);
109622
+ const isAllConfirmed = visibleRows.length && visibleRows.every((row) => row.is_confirmed_);
109610
109623
  if (!isAllConfirmed) {
109611
109624
  GctMessage.error("同时只能有一条数据开启编辑状态");
109612
109625
  }
@@ -109802,7 +109815,7 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
109802
109815
  };
109803
109816
  }
109804
109817
  });
109805
- const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2w, [["__scopeId", "data-v-8fbc11fb"]]);
109818
+ const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2w, [["__scopeId", "data-v-9ca63e84"]]);
109806
109819
  const _sfc_main$2v = /* @__PURE__ */ defineComponent({
109807
109820
  __name: "index",
109808
109821
  props: {
@@ -42,16 +42,26 @@ export declare class MCDataUtil {
42
42
  /** 设置的值(不给则true) */
43
43
  disabled?: boolean;
44
44
  }): void;
45
+ private static _updateDisablement;
45
46
  /**
46
- * 物料消耗表 需求数量、已消耗数量 不可修改
47
+ * 物料消耗表[需求数量、已消耗数量]一直禁用
47
48
  * @param rowPath $.f_sub[n] n 必须为数字
48
49
  */
49
50
  static disableQtyFields(dataManager: DataManager, rowPath: string): void;
50
51
  /**
51
- * 物料消耗表 更新部分字段是否禁用
52
+ * 物料消耗表 物料类型是否是[查看物料]时需要更新[物料批号、数量]字段是否禁用
52
53
  * @param rowPath $.f_sub[n] n 必须为数字
53
54
  */
54
- static updateOtherFieldsDisabled(option: {
55
+ static updateViewFieldsDisablement(option: {
56
+ dataManager: DataManager;
57
+ rowPath: string;
58
+ disabled: boolean;
59
+ }): void;
60
+ /**
61
+ * 物料消耗表 更新固定几个字段是否禁用
62
+ * @param rowPath $.f_sub[n] n 必须为数字
63
+ */
64
+ static updateFixedFieldsDisablement(option: {
55
65
  dataManager: DataManager;
56
66
  rowPath: string;
57
67
  disabled: boolean;
@@ -139,11 +149,11 @@ export declare class MaterialConsumeTableController {
139
149
  */
140
150
  calcFormState(): IMaterialConsumeData[] | undefined;
141
151
  /**
142
- * 根据数据计算需要禁用的字段
143
- * @param row
144
- * @return {*}
152
+ * 获取是否是 物料查看
153
+ * @param product_id_
154
+ * @returns
145
155
  */
146
- calcDisabledFields(row: IMaterialConsumeData): (keyof IMaterialConsumeData)[];
156
+ getMaterialTypeIsView(product_id_?: string): boolean;
147
157
  /**
148
158
  * 获取bom内主物料,替换物料查询的算子
149
159
  * @return {*}
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-8fbc11fb] {
8683
+ .sub-table-action-container[data-v-9ca63e84] {
8684
8684
  position: absolute;
8685
8685
  z-index: 999;
8686
8686
  }
8687
- .sub-table-action-bar[data-v-8fbc11fb],
8688
- .sub-table-action-popper[data-v-8fbc11fb] {
8687
+ .sub-table-action-bar[data-v-9ca63e84],
8688
+ .sub-table-action-popper[data-v-9ca63e84] {
8689
8689
  pointer-events: auto;
8690
8690
  user-select: none;
8691
8691
  }
8692
- .sub-table-action-bar[data-v-8fbc11fb] {
8692
+ .sub-table-action-bar[data-v-9ca63e84] {
8693
8693
  display: flex;
8694
8694
  }
8695
- .sub-table-action-bar .more-btn[data-v-8fbc11fb],
8696
- .sub-table-action-bar .confirm-btn[data-v-8fbc11fb] {
8695
+ .sub-table-action-bar .more-btn[data-v-9ca63e84],
8696
+ .sub-table-action-bar .confirm-btn[data-v-9ca63e84] {
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-8fbc11fb] {
8705
+ .sub-table-action-bar .more-btn[data-v-9ca63e84] {
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-8fbc11fb] {
8710
+ .sub-table-action-bar .confirm-btn[data-v-9ca63e84] {
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-8fbc11fb] {
8715
+ .sub-table-action-popper[data-v-9ca63e84] {
8716
8716
  padding: 2px 8px;
8717
8717
  }
8718
- .sub-table-action-popper .action-menu[data-v-8fbc11fb] {
8718
+ .sub-table-action-popper .action-menu[data-v-9ca63e84] {
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-8fbc11fb] {
8723
+ .sub-table-action-popper .action-menu + .action-menu[data-v-9ca63e84] {
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-8fbc11fb] {
8728
+ .sub-table-action-popper .action-menu .menu-title[data-v-9ca63e84] {
8729
8729
  color: #bcbcbc;
8730
8730
  margin: 4px 0;
8731
8731
  }
8732
- .sub-table-action-popper .action-menu .menu-item[data-v-8fbc11fb] {
8732
+ .sub-table-action-popper .action-menu .menu-item[data-v-9ca63e84] {
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-8fbc11fb]:hover {
8738
+ .sub-table-action-popper .action-menu .menu-item[data-v-9ca63e84]: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-8fbc11fb] {
8742
+ .sub-table-action-popper .action-menu .menu-item .item-icon[data-v-9ca63e84] {
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-8fbc11fb] {
8750
+ .sub-table-action-popper .action-menu .menu-item .item-icon.scale-large[data-v-9ca63e84] {
8751
8751
  transform: scale(1.5);
8752
8752
  }
8753
- .sub-table-action-popper .action-menu .menu-item .item-label[data-v-8fbc11fb] {
8753
+ .sub-table-action-popper .action-menu .menu-item .item-label[data-v-9ca63e84] {
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-8fbc11fb] {
8757
+ .sub-table-action-popper .action-menu .menu-item .item-label.flex-between-center[data-v-9ca63e84] {
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",
3
+ "version": "0.1.48",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",