@gct-paas/word 0.1.48 → 0.1.49
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
|
@@ -103395,6 +103395,20 @@ function useDependency(doc, widget, ctx) {
|
|
|
103395
103395
|
initDependency
|
|
103396
103396
|
};
|
|
103397
103397
|
}
|
|
103398
|
+
const syncMaterialConsumeTableBomInfo = async (templateId, docModel) => {
|
|
103399
|
+
const formTmplBomList = await api.apaas.onlineFormTmpl.getGetBomByFormTmplId({ id: templateId });
|
|
103400
|
+
if (formTmplBomList?.length) {
|
|
103401
|
+
if (docModel.document.config) {
|
|
103402
|
+
docModel.document.config.formTmplBomList = formTmplBomList;
|
|
103403
|
+
}
|
|
103404
|
+
docModel.document.children[0]?.children.flatMap((el) => el.regions).filter((r) => r?.type === "material-consume-table").forEach((r) => {
|
|
103405
|
+
const { valuePath } = r;
|
|
103406
|
+
const matchedBom = formTmplBomList.find((bom) => bom.table_key_ === valuePath);
|
|
103407
|
+
if (!matchedBom) return;
|
|
103408
|
+
r.widgetMeta.props = matchedBom;
|
|
103409
|
+
});
|
|
103410
|
+
}
|
|
103411
|
+
};
|
|
103398
103412
|
async function runDocumentPostLoadEnrichFlush(doc) {
|
|
103399
103413
|
const instances = doc.model?.getWidgetInstances() ?? [];
|
|
103400
103414
|
if (!instances.length) return;
|
|
@@ -103479,18 +103493,7 @@ async function initializeDocumentEngine(props, payload, result) {
|
|
|
103479
103493
|
const linkFieldKey = checkTableRegions[0]?.linkFieldKey;
|
|
103480
103494
|
const docModel = ModelConverter.toModel(runtimeJsonForModel);
|
|
103481
103495
|
const templateId = result.tid.split(":")[1];
|
|
103482
|
-
|
|
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
|
-
}
|
|
103496
|
+
await syncMaterialConsumeTableBomInfo(templateId, docModel);
|
|
103494
103497
|
const instances = docModel.getWidgetInstances();
|
|
103495
103498
|
if (fillModeType !== DocModeTypeConst.Edit) {
|
|
103496
103499
|
instances.forEach((instance2) => {
|
|
@@ -110395,6 +110398,14 @@ function validateDocDesigner(doc) {
|
|
|
110395
110398
|
source: "doc"
|
|
110396
110399
|
});
|
|
110397
110400
|
}
|
|
110401
|
+
const materialConsumeTableRegions = children.filter((w2) => w2.name === "w:tbl" && w2.hasMaterialConsumeTable).flatMap((w2) => w2.materialConsumeTable);
|
|
110402
|
+
if (materialConsumeTableRegions.some((r) => !r.widgetMeta.props.barcode_parsing_rules_id_)) {
|
|
110403
|
+
errors.push({
|
|
110404
|
+
code: "barcode-parsing-rules-required",
|
|
110405
|
+
message: "请给物料消耗表设置条码解析规则",
|
|
110406
|
+
source: "doc"
|
|
110407
|
+
});
|
|
110408
|
+
}
|
|
110398
110409
|
return createDesignerValidationResult(errors);
|
|
110399
110410
|
}
|
|
110400
110411
|
function validateDesigner(doc) {
|
|
@@ -110497,9 +110508,10 @@ function useDocOperations(docRef) {
|
|
|
110497
110508
|
dirty: changedScopes.length > 0
|
|
110498
110509
|
};
|
|
110499
110510
|
}
|
|
110500
|
-
function markAsSaved() {
|
|
110511
|
+
async function markAsSaved() {
|
|
110501
110512
|
const doc = getDoc();
|
|
110502
110513
|
if (!doc) return;
|
|
110514
|
+
await syncMaterialConsumeTableBomInfo(doc.docRuntimeMeta.id, doc.model);
|
|
110503
110515
|
doc.docRuntimeMeta.handleInfo.initDocModelJson = JSON.stringify(exportModel());
|
|
110504
110516
|
doc.docRuntimeMeta.handleInfo.initRawDataSnapshot = cloneDeep(doc.dataManager.getRawData());
|
|
110505
110517
|
}
|