|
@@ -33,8 +33,7 @@
|
|
|
size="mini"
|
|
|
@click="renew"
|
|
|
v-if="
|
|
|
- docAttr.is_template == 0 &&
|
|
|
- docAttr.id > 0 &&
|
|
|
+ articleId !== undefined &&
|
|
|
type !== 'module' &&
|
|
|
type == 'document'
|
|
|
"
|
|
@@ -1221,7 +1220,6 @@ export default {
|
|
|
});
|
|
|
|
|
|
this.coms = [data];
|
|
|
- console.log("11", this.coms);
|
|
|
} catch (error) {
|
|
|
console.error("加载模板信息失败:", error);
|
|
|
}
|
|
@@ -1289,7 +1287,6 @@ export default {
|
|
|
},
|
|
|
//加载文档信息
|
|
|
async onLoadArticle(id) {
|
|
|
- console.log("文档");
|
|
|
try {
|
|
|
this.loading = true;
|
|
|
const res = await getDocumentInfo({ id });
|
|
@@ -1315,20 +1312,20 @@ export default {
|
|
|
typeof res.data.data === "string"
|
|
|
? JSON.parse(res.data.data)
|
|
|
: res.data.data;
|
|
|
-
|
|
|
+
|
|
|
const updatedComs = await Promise.all(
|
|
|
templateData.map(async (el) => {
|
|
|
- let templateInfo = { data: {} };
|
|
|
+ /* let templateInfo = { data: {} };
|
|
|
if (this.type !== "document") {
|
|
|
templateInfo = await getTemplateInfo({ id: el.id });
|
|
|
- }
|
|
|
+ } */
|
|
|
const formulaData = await searchFormula({ page: 1, pageSize: 999 });
|
|
|
|
|
|
- const attrs =
|
|
|
- typeof templateInfo.data.attrs === "string"
|
|
|
+ const attrs =el.attrs
|
|
|
+ /* typeof templateInfo.data.attrs === "string"
|
|
|
? JSON.parse(templateInfo.data.attrs)
|
|
|
- : templateInfo.data.attrs || []; // Add a fallback empty array
|
|
|
-
|
|
|
+ : templateInfo.data.attrs || []; // Add a fallback empty array */
|
|
|
+
|
|
|
attrs.forEach((item) => {
|
|
|
const matchedFormula = formulaData.data.dataList.find(
|
|
|
(ite) => ite.id === item.data.id
|
|
@@ -1339,7 +1336,7 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- return { ...el, ...templateInfo.data, attrs };
|
|
|
+ return { ...el/* , ...templateInfo.data, attrs */ };
|
|
|
})
|
|
|
);
|
|
|
|
|
@@ -1369,9 +1366,9 @@ export default {
|
|
|
}
|
|
|
|
|
|
this.docAttr = {
|
|
|
- id: res.data.id,
|
|
|
- category_id: Number(res.data.category_id),
|
|
|
- title: res.data.title,
|
|
|
+ id: this.docAttr.id,
|
|
|
+ category_id: Number(this.docAttr.category_id),
|
|
|
+ title: this.docAttr.title,
|
|
|
content: "",
|
|
|
status: res.data.status,
|
|
|
is_template: res.data.is_template,
|