diff --git a/src/views/oa/crm/crmQuoteInfo/quoteView.vue b/src/views/oa/crm/crmQuoteInfo/quoteView.vue index ea14251..6b054f3 100644 --- a/src/views/oa/crm/crmQuoteInfo/quoteView.vue +++ b/src/views/oa/crm/crmQuoteInfo/quoteView.vue @@ -96,14 +96,14 @@ const renderTemplate = (str: string, data: Record) => { const rowRenderTemplate = (str: string, index: number) => { let res = str; res = res.replace(/\^\{(.*?)\}/g, (_, path) => { - return templateData[`^{${path}}`]?.[index] ?? ' '; + return templateData[`^{${path}}`]?.[index] || ' '; }); res = res.replace(/#\{(.*?)\}/g, (_, path) => { const arr = path.split('.'); if (arr.length > 0) { arr[0] = `#{${arr[0]}}`; } - return arr.reduce((o: any, k: string) => o?.[k], templateData) ?? ' '; + return arr.reduce((o: any, k: string) => o?.[k] || ' ', templateData) ?? ' '; }); return res; }; @@ -209,7 +209,7 @@ onMounted(async () => { const { data: assignData } = await templateAssign({ templateType: 4, quoteId }); templateData = {}; (assignData || []).forEach((item: any) => { - templateData[item.varName] = item.varValue ?? ' '; + templateData[item.varName] = item.varValue || ' '; }); const tplResp = await getPrintTemplate(templateId);