@gct-paas/word 0.1.43 → 0.1.44
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
|
@@ -115,13 +115,22 @@ class AssetHelper {
|
|
|
115
115
|
static init(opts) {
|
|
116
116
|
this.transfer = opts.transfer;
|
|
117
117
|
}
|
|
118
|
+
static normalizeUploadedPath(path2) {
|
|
119
|
+
if (!path2) return path2;
|
|
120
|
+
if (/^https?:\/\//.test(path2)) return path2;
|
|
121
|
+
return path2.startsWith("/") ? path2 : `/${path2}`;
|
|
122
|
+
}
|
|
118
123
|
/** 上传(基础版) */
|
|
119
124
|
static async upload(file, opts) {
|
|
120
|
-
|
|
125
|
+
const res = await serviceUtil.uploadFile(file, {
|
|
121
126
|
modelKey: opts?.modelKey,
|
|
122
127
|
signal: opts?.signal,
|
|
123
128
|
onProgress: opts?.onProgress
|
|
124
129
|
});
|
|
130
|
+
if (res?.data && typeof res.data === "string") {
|
|
131
|
+
res.data = this.normalizeUploadedPath(res.data);
|
|
132
|
+
}
|
|
133
|
+
return res;
|
|
125
134
|
}
|
|
126
135
|
/** 上传(带进度) */
|
|
127
136
|
static async uploadWithProgress(file, opts = {}) {
|
|
@@ -51883,8 +51892,33 @@ function resolveSubmitCrossKeys(formData, subTableInfoList) {
|
|
|
51883
51892
|
}
|
|
51884
51893
|
return Object.keys(formData).filter((k) => k.includes(":"));
|
|
51885
51894
|
}
|
|
51895
|
+
const handleSyncCheckValue = (row) => {
|
|
51896
|
+
const { type_, value_ } = row;
|
|
51897
|
+
if (type_ === "boolean") {
|
|
51898
|
+
row.bool_value_ = value_;
|
|
51899
|
+
} else if (type_ === "string") {
|
|
51900
|
+
row.text_value_ = value_;
|
|
51901
|
+
} else if (type_ === "integer") {
|
|
51902
|
+
row.int_value_ = value_;
|
|
51903
|
+
} else if (type_ === "decimal") {
|
|
51904
|
+
row.double_value_ = value_;
|
|
51905
|
+
} else if (type_ === "user") {
|
|
51906
|
+
row.user_value_ = value_;
|
|
51907
|
+
} else if (type_ === "org") {
|
|
51908
|
+
row.org_value_ = value_;
|
|
51909
|
+
} else if (type_ === "date") {
|
|
51910
|
+
row.date_value_ = value_;
|
|
51911
|
+
} else if (type_ === "date_time") {
|
|
51912
|
+
row.date_time_value_ = value_;
|
|
51913
|
+
} else if (type_ === "image") {
|
|
51914
|
+
row.image_value_ = value_;
|
|
51915
|
+
} else if (type_ === "attachment") {
|
|
51916
|
+
row.attachment_value_ = value_;
|
|
51917
|
+
}
|
|
51918
|
+
};
|
|
51886
51919
|
function getSubmitFormData(formData, subTableInfoList) {
|
|
51887
51920
|
const _formData = { ...formData };
|
|
51921
|
+
const checkTableFieldList = (subTableInfoList || []).filter((o) => o.subType === "check-table-2d").map((o) => o.field);
|
|
51888
51922
|
resolveSubmitCrossKeys(_formData, subTableInfoList).forEach((crossKey) => {
|
|
51889
51923
|
const [subKey, linkKey] = crossKey.split(":");
|
|
51890
51924
|
const subData = _formData[subKey] || [];
|
|
@@ -51906,6 +51940,7 @@ function getSubmitFormData(formData, subTableInfoList) {
|
|
|
51906
51940
|
delete _formData[crossKey];
|
|
51907
51941
|
});
|
|
51908
51942
|
const realFormData = Object.keys(_formData).reduce((reducedData, fieldKey) => {
|
|
51943
|
+
const isCheckTable = checkTableFieldList.includes(fieldKey);
|
|
51909
51944
|
const fieldValue = _formData[fieldKey];
|
|
51910
51945
|
if (Array.isArray(fieldValue)) {
|
|
51911
51946
|
fieldValue.forEach((row) => {
|
|
@@ -51913,6 +51948,9 @@ function getSubmitFormData(formData, subTableInfoList) {
|
|
|
51913
51948
|
if (__gw_x_uid) {
|
|
51914
51949
|
row.group_ = __gw_x_uid;
|
|
51915
51950
|
}
|
|
51951
|
+
if (isCheckTable) {
|
|
51952
|
+
handleSyncCheckValue(row);
|
|
51953
|
+
}
|
|
51916
51954
|
});
|
|
51917
51955
|
reducedData[fieldKey] = _formData[fieldKey].map(
|
|
51918
51956
|
(row) => Object.fromEntries(
|
|
@@ -100048,9 +100086,7 @@ async function addSubModelsToFieldScope(modelKey, ctx) {
|
|
|
100048
100086
|
try {
|
|
100049
100087
|
const res = await api.apaas.modelMeta.getListSlaveModel({ modelKey });
|
|
100050
100088
|
const subModelKeys = Array.isArray(res) ? res.map((item) => item?.key || "").filter(Boolean) : [];
|
|
100051
|
-
subModelKeys.
|
|
100052
|
-
ctx.runtime.fieldScope.addModel(subKey);
|
|
100053
|
-
});
|
|
100089
|
+
await Promise.all(subModelKeys.map((subKey) => ctx.runtime.fieldScope.addModel(subKey)));
|
|
100054
100090
|
} catch (error) {
|
|
100055
100091
|
console.error("拉取子模型key失败", { modelKey, error });
|
|
100056
100092
|
return;
|