fix(purchase): 修复模版匹配字段名错误

- 将 t.type 改为 t.templateType,与后端返回字段保持一致
- 影响 downloadTemplate 和 getTemplateName 两个函数
This commit is contained in:
吴红兵
2026-03-07 13:17:43 +08:00
parent c571c78788
commit 68a02f2a43

View File

@@ -1603,7 +1603,7 @@ watch(
// 下载模版:统一走后端接口,按原始文件下载(避免前端静态资源被当成 HTML 返回) // 下载模版:统一走后端接口,按原始文件下载(避免前端静态资源被当成 HTML 返回)
const downloadTemplate = async (type: string) => { const downloadTemplate = async (type: string) => {
// 优先从后台模版列表获取模版名称 // 优先从后台模版列表获取模版名称
const backendTemplate = templateList.value.find((t: any) => t.type === type); const backendTemplate = templateList.value.find((t: any) => t.templateType === type);
let displayName = ''; let displayName = '';
if (backendTemplate?.templateTitle) { if (backendTemplate?.templateTitle) {
@@ -1641,7 +1641,7 @@ const downloadTemplate = async (type: string) => {
// 获取模版名称(用于按钮显示,优先从后台获取) // 获取模版名称(用于按钮显示,优先从后台获取)
const getTemplateName = (type: string): string => { const getTemplateName = (type: string): string => {
const backendTemplate = templateList.value.find((t: any) => t.type === type); const backendTemplate = templateList.value.find((t: any) => t.templateType === type);
if (backendTemplate?.templateTitle) { if (backendTemplate?.templateTitle) {
return backendTemplate.templateTitle.replace(/\.(doc|docx)$/i, ''); return backendTemplate.templateTitle.replace(/\.(doc|docx)$/i, '');
} }
@@ -1659,6 +1659,7 @@ const getTemplateName = (type: string): string => {
feasibility_report: '项目可行性论证报告模板', feasibility_report: '项目可行性论证报告模板',
gov_pur_int: '政府采购意向申请表', gov_pur_int: '政府采购意向申请表',
}; };
return fallbackNames[type] || '模版'; return fallbackNames[type] || '模版';
}; };