From 4a375f117bce31044154a726a524d8834d9abf56 Mon Sep 17 00:00:00 2001 From: huanshuo-W <15258427350@163.com> Date: Sat, 12 Jul 2025 14:43:06 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E4=BF=AE=E6=94=B9Excel=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E6=96=87=E4=BB=B6=E5=90=8D=20&=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MultiLayerPaperTapeWidthAngleCalculate.vue | 16 +++++++++------- src/locale/en.json | 3 ++- src/locale/zh.json | 3 ++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/components/Modules/MultiLayerPaperTapeWidthAngleCalculate.vue b/src/components/Modules/MultiLayerPaperTapeWidthAngleCalculate.vue index 3152563..87652de 100644 --- a/src/components/Modules/MultiLayerPaperTapeWidthAngleCalculate.vue +++ b/src/components/Modules/MultiLayerPaperTapeWidthAngleCalculate.vue @@ -212,11 +212,9 @@ } try { - const filename = `${t('multiLayerPaperTapeWidthAngleCalculate')}-${new Date().toISOString().slice(0, 10)}.xlsx`.replace(/\s+/g, '') - // 创建工作簿和工作表 const workbook = new EXCEL.Workbook() - const worksheet = workbook.addWorksheet(t('results')) + const worksheet = workbook.addWorksheet(t('multiLayerExcelOutputFile')) // 创建样式 // headerStyle: 表头样式,根据Excel内建样式Calculation设置 @@ -340,13 +338,13 @@ // 添加Results表头列名 worksheet.getCell('A8').value = t('layer') worksheet.getCell('A8').style = parameterStyle - worksheet.getCell('B8').value = t('paperGrammage') + worksheet.getCell('B8').value = t('paperGrammage') + ` (${recordList.value[0].grammage.unit})` worksheet.getCell('B8').style = parameterStyle - worksheet.getCell('C8').value = t('cumulativeThickness') + worksheet.getCell('C8').value = t('cumulativeThickness') + ` (${recordList.value[0].cumulativeThickness.unit})` worksheet.getCell('C8').style = parameterStyle - worksheet.getCell('D8').value = t('angle') + worksheet.getCell('D8').value = t('angle') + ` (${recordList.value[0].angle.unit})` worksheet.getCell('D8').style = parameterStyle - worksheet.getCell('E8').value = t('paperWidth') + worksheet.getCell('E8').value = t('paperWidth') + ` (${recordList.value[0].paperWidth.unit})` worksheet.getCell('E8').style = parameterStyle // 添加Results数据 @@ -440,6 +438,10 @@ } } + // 设置文件名 + const timeStamp = new Date().toISOString().replace(/[-:T]/g, '').slice(0, 15) + const filename = `${t('multiLayerExcelOutputFile')}_${timeStamp}.xlsx` + // 导出为文件 const buffer = await workbook.xlsx.writeBuffer() const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }) diff --git a/src/locale/en.json b/src/locale/en.json index feae076..f516c26 100644 --- a/src/locale/en.json +++ b/src/locale/en.json @@ -61,5 +61,6 @@ "maximum": "Maximum", "calculatedValue": "Calculated value", "fit": "FIT", - "notFit": "NOT FIT" + "notFit": "NOT FIT", + "multiLayerExcelOutputFile": "MultiLayerPaperTapeWidthAngle" } diff --git a/src/locale/zh.json b/src/locale/zh.json index e1c005d..4e12d5a 100644 --- a/src/locale/zh.json +++ b/src/locale/zh.json @@ -61,5 +61,6 @@ "maximum": "最小值", "calculatedValue": "计算值", "fit": "符合", - "notFit": "不符合" + "notFit": "不符合", + "multiLayerExcelOutputFile": "多层纸带宽度角度计算" }