@gct-paas/word 0.1.48 → 0.1.50

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
@@ -53962,19 +53962,15 @@ class MCDataUtil {
53962
53962
  * @param rowPath $.f_sub[n] n 必须为数字
53963
53963
  */
53964
53964
  static updateFixedFieldsDisablement(option) {
53965
- const fields = ["product_id_", "material_no_", "routing_operation_id_"];
53966
- this._updateDisablement({ ...option, fields });
53965
+ const { disabledFields = [], ...otherOptions } = option;
53966
+ const fields = ["product_id_", "material_no_", "routing_operation_id_", ...disabledFields];
53967
+ this._updateDisablement({ ...otherOptions, fields });
53967
53968
  }
53968
53969
  /**
53969
53970
  * 设置行数据的编辑状态
53970
53971
  */
53971
53972
  static updateRow(option, isConfirmed) {
53972
- const {
53973
- row,
53974
- rowIndex,
53975
- dataManager,
53976
- subFieldKey
53977
- } = option;
53973
+ const { row, rowIndex, dataManager, subFieldKey } = option;
53978
53974
  row.is_confirmed_ = isConfirmed;
53979
53975
  const rows = dataManager.getRawData()[subFieldKey] ?? [];
53980
53976
  rows[rowIndex] = row;
@@ -54140,8 +54136,8 @@ class MaterialConsumeTableController {
54140
54136
  }
54141
54137
  /**
54142
54138
  * 获取是否是 物料查看
54143
- * @param product_id_
54144
- * @returns
54139
+ * @param product_id_
54140
+ * @returns
54145
54141
  */
54146
54142
  getMaterialTypeIsView(product_id_) {
54147
54143
  if (product_id_) {
@@ -54199,7 +54195,6 @@ class MaterialConsumeTableController {
54199
54195
  if (!find) {
54200
54196
  throw new Error(
54201
54197
  "表格数据里没有匹配的物料,请选择该物料后再扫码"
54202
- /*$t('sys.edhr.mcTable.noMatchMaterial')*/
54203
54198
  );
54204
54199
  }
54205
54200
  materialData = find;
@@ -54377,7 +54372,6 @@ class MaterialConsumeTableController {
54377
54372
  if (this.enableSequenceLoading && !isLast) {
54378
54373
  this.error(
54379
54374
  "顺序投料时只能最后一条数据开启编辑状态"
54380
- /*$t('sys.edhr.mcTable.onlyLastRowCanEdit')*/
54381
54375
  );
54382
54376
  return;
54383
54377
  }
@@ -54547,9 +54541,9 @@ class FormTmplBomController {
54547
54541
  /**
54548
54542
  * 根据字段key获取子表控制器
54549
54543
  */
54550
- // findTableControllerByField(subFieldKey: string) {
54551
- // return this.tableControllers[subFieldKey];
54552
- // }
54544
+ findTableControllerByField(subFieldKey) {
54545
+ return this.tableControllers[subFieldKey];
54546
+ }
54553
54547
  // 方法废弃,word 里改在初始化时记录到 paramsConfig
54554
54548
  /**
54555
54549
  * 处理字段组件
@@ -103395,6 +103389,20 @@ function useDependency(doc, widget, ctx) {
103395
103389
  initDependency
103396
103390
  };
103397
103391
  }
103392
+ const syncMaterialConsumeTableBomInfo = async (templateId, docModel) => {
103393
+ const formTmplBomList = await api.apaas.onlineFormTmpl.getGetBomByFormTmplId({ id: templateId });
103394
+ if (formTmplBomList?.length) {
103395
+ if (docModel.document.config) {
103396
+ docModel.document.config.formTmplBomList = formTmplBomList;
103397
+ }
103398
+ docModel.document.children[0]?.children.flatMap((el) => el.regions).filter((r) => r?.type === "material-consume-table").forEach((r) => {
103399
+ const { valuePath } = r;
103400
+ const matchedBom = formTmplBomList.find((bom) => bom.table_key_ === valuePath);
103401
+ if (!matchedBom) return;
103402
+ r.widgetMeta.props = matchedBom;
103403
+ });
103404
+ }
103405
+ };
103398
103406
  async function runDocumentPostLoadEnrichFlush(doc) {
103399
103407
  const instances = doc.model?.getWidgetInstances() ?? [];
103400
103408
  if (!instances.length) return;
@@ -103479,18 +103487,7 @@ async function initializeDocumentEngine(props, payload, result) {
103479
103487
  const linkFieldKey = checkTableRegions[0]?.linkFieldKey;
103480
103488
  const docModel = ModelConverter.toModel(runtimeJsonForModel);
103481
103489
  const templateId = result.tid.split(":")[1];
103482
- const formTmplBomList = await api.apaas.onlineFormTmpl.getGetBomByFormTmplId({ id: templateId });
103483
- if (formTmplBomList?.length) {
103484
- if (docModel.document.config) {
103485
- docModel.document.config.formTmplBomList = formTmplBomList;
103486
- }
103487
- docModel.document.children[0]?.children.flatMap((el) => el.regions).filter((r) => r?.type === "material-consume-table").forEach((r) => {
103488
- const { valuePath } = r;
103489
- const matchedBom = formTmplBomList.find((bom) => bom.table_key_ === valuePath);
103490
- if (!matchedBom) return;
103491
- r.widgetMeta.props = matchedBom;
103492
- });
103493
- }
103490
+ await syncMaterialConsumeTableBomInfo(templateId, docModel);
103494
103491
  const instances = docModel.getWidgetInstances();
103495
103492
  if (fillModeType !== DocModeTypeConst.Edit) {
103496
103493
  instances.forEach((instance2) => {
@@ -103580,11 +103577,19 @@ async function initializeDocumentEngine(props, payload, result) {
103580
103577
  MCDataUtil.disableQtyFields(doc.dataManager, `${table_key_}[${index2}]`);
103581
103578
  });
103582
103579
  rows.forEach((row, rowIndex) => {
103580
+ MCDataUtil.updateViewFieldsDisablement({
103581
+ dataManager: doc.dataManager,
103582
+ rowPath: `$.${subFieldKey}[${rowIndex}]`,
103583
+ disabled: Boolean(
103584
+ tmplBomC?.findTableControllerByField(table_key_)?.getMaterialTypeIsView(row.product_id_)
103585
+ )
103586
+ });
103583
103587
  if (row.is_confirmed_) {
103584
103588
  MCDataUtil.updateFixedFieldsDisablement({
103585
103589
  dataManager: doc.dataManager,
103586
103590
  rowPath: `$.${subFieldKey}[${rowIndex}]`,
103587
- disabled: true
103591
+ disabled: true,
103592
+ disabledFields: ["qty_", "expiration_date_"]
103588
103593
  });
103589
103594
  }
103590
103595
  });
@@ -110395,6 +110400,14 @@ function validateDocDesigner(doc) {
110395
110400
  source: "doc"
110396
110401
  });
110397
110402
  }
110403
+ const materialConsumeTableRegions = children.filter((w2) => w2.name === "w:tbl" && w2.hasMaterialConsumeTable).flatMap((w2) => w2.materialConsumeTable);
110404
+ if (materialConsumeTableRegions.some((r) => !r.widgetMeta.props.barcode_parsing_rules_id_)) {
110405
+ errors.push({
110406
+ code: "barcode-parsing-rules-required",
110407
+ message: "请给物料消耗表设置条码解析规则",
110408
+ source: "doc"
110409
+ });
110410
+ }
110398
110411
  return createDesignerValidationResult(errors);
110399
110412
  }
110400
110413
  function validateDesigner(doc) {
@@ -110497,9 +110510,10 @@ function useDocOperations(docRef) {
110497
110510
  dirty: changedScopes.length > 0
110498
110511
  };
110499
110512
  }
110500
- function markAsSaved() {
110513
+ async function markAsSaved() {
110501
110514
  const doc = getDoc();
110502
110515
  if (!doc) return;
110516
+ await syncMaterialConsumeTableBomInfo(doc.docRuntimeMeta.id, doc.model);
110503
110517
  doc.docRuntimeMeta.handleInfo.initDocModelJson = JSON.stringify(exportModel());
110504
110518
  doc.docRuntimeMeta.handleInfo.initRawDataSnapshot = cloneDeep(doc.dataManager.getRawData());
110505
110519
  }
@@ -130134,7 +130148,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
130134
130148
  renderSlot(_ctx.$slots, "rdo_version_render", normalizeProps(guardReactiveProps({ record, column, rowIndex })), void 0, true)
130135
130149
  ]),
130136
130150
  empty: withCtx(() => [..._cache[0] || (_cache[0] = [
130137
- createElementVNode("div", { class: "vxe-grid-empty" }, [
130151
+ createElementVNode("div", { class: "vxe-grid-empty-word" }, [
130138
130152
  createElementVNode("img", {
130139
130153
  src: _imports_0,
130140
130154
  alt: ""
@@ -130148,7 +130162,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
130148
130162
  };
130149
130163
  }
130150
130164
  });
130151
- const BaseVxeTable = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-a8a422f5"]]);
130165
+ const BaseVxeTable = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-8ae65aef"]]);
130152
130166
  const DEVICE_TYPE_MODEL_KEY = "em_device_type";
130153
130167
  const ENTITY_CATEGORY = "entity";
130154
130168
  const _sfc_main$9 = /* @__PURE__ */ defineComponent({
@@ -65,6 +65,7 @@ export declare class MCDataUtil {
65
65
  dataManager: DataManager;
66
66
  rowPath: string;
67
67
  disabled: boolean;
68
+ disabledFields?: string[];
68
69
  }): void;
69
70
  /**
70
71
  * 设置行数据的编辑状态
@@ -0,0 +1,2 @@
1
+ import { DocModel } from '../../../../../core/model';
2
+ export declare const syncMaterialConsumeTableBomInfo: (templateId: string, docModel: DocModel) => Promise<void>;
@@ -62,6 +62,7 @@ export declare class FormTmplBomController {
62
62
  /**
63
63
  * 根据字段key获取子表控制器
64
64
  */
65
+ findTableControllerByField(subFieldKey: string): MaterialConsumeTableController | undefined;
65
66
  /**
66
67
  * 处理字段组件
67
68
  * - 补充物料字段的额外查询条件
package/dist/word.css CHANGED
@@ -12267,7 +12267,7 @@ svg.portrait-icon[data-v-8bdb451e] {
12267
12267
  width: 100%;
12268
12268
  height: 248px;
12269
12269
  }
12270
- .base-vxe-table-wrapper[data-v-a8a422f5] {
12270
+ .base-vxe-table-wrapper[data-v-8ae65aef] {
12271
12271
  display: flex;
12272
12272
  flex-direction: column;
12273
12273
  flex: 1;
@@ -12275,9 +12275,21 @@ svg.portrait-icon[data-v-8bdb451e] {
12275
12275
  width: 800px;
12276
12276
  height: 360px;
12277
12277
  }
12278
- .base-vxe-table-wrapper[data-v-a8a422f5] .dropdown-vxe-table .row--active {
12278
+ .base-vxe-table-wrapper[data-v-8ae65aef] .dropdown-vxe-table .row--active {
12279
12279
  background: #e6f7ff;
12280
12280
  }
12281
+ .base-vxe-table-wrapper .vxe-grid-empty-word[data-v-8ae65aef] {
12282
+ display: flex;
12283
+ flex-direction: column;
12284
+ align-items: center;
12285
+ justify-content: center;
12286
+ color: rgba(0, 0, 0, 0.45);
12287
+ margin: 32px 0;
12288
+ }
12289
+ .base-vxe-table-wrapper .vxe-grid-empty-word > img[data-v-8ae65aef] {
12290
+ width: 60px;
12291
+ margin-bottom: 12px;
12292
+ }
12281
12293
  .pagination-container[data-v-7a947e96] {
12282
12294
  position: relative;
12283
12295
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/word",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",