From 122d5ab9acd094355011e2e0a397dcc5daf41c62 Mon Sep 17 00:00:00 2001 From: wjh Date: Fri, 12 Apr 2024 17:49:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E5=8D=95=E5=AF=BC=E5=87=BAExcel=E5=90=8D=E7=A7=B0=20(#697)=20f?= =?UTF-8?q?ix=20#696?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Description # Motivation # Key changes - Frontend - Backend # Test plan ## Suggestions ## Underlying risk # Showcase Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachycode/pulls/697 Co-authored-by: wjh Co-committed-by: wjh --- .../actions/SettlementExportExcel.tsx | 16 ++++++++-------- .../src/server/services/settlement-service.ts | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/SettlementExportExcel.tsx b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/SettlementExportExcel.tsx index 38c765d82..4419af3c5 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/SettlementExportExcel.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/SettlementExportExcel.tsx @@ -284,7 +284,7 @@ export const excelDataHandle = (excelData) => { if (!value.is_excluded) { table3.rows.push([ converDate(value.date, 'YYYY-MM-DD'), - value.movement == -1 ? '出库' : value.movement == 1 ? '入库' : '出入库', + value.movement === -1 ? '出库' : value.movement === 1 ? '入库' : '出入库', value.name, '', category, @@ -544,13 +544,13 @@ export const ExportToExcel = async (data) => { const cols = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']; const CellBorder = (row) => { cols.forEach((value) => { - if (value == 'A' && row == `${notesRow}`) { + if (value === 'A' && row === `${notesRow}`) { ws.getCell(`${value}${row}`).border = { top: { style: 'thin' }, left: { style: 'thin' }, bottom: { style: 'thin' }, }; - } else if ((value == 'B' || value == 'C' || value == 'D' || value == 'E') && row == `${notesRow}`) { + } else if ((value === 'B' || value === 'C' || value === 'D' || value === 'E') && row === `${notesRow}`) { ws.getCell(`${value}${row}`).border = { top: { style: 'thin' }, bottom: { style: 'thin' }, @@ -613,7 +613,7 @@ export const ExportToExcel = async (data) => { ws.mergeCells(`A${value['_number']}:B${value['_number']}`); ws.mergeCells(`F${value['_number']}:G${value['_number']}`); ws.mergeCells(`I${value['_number']}:J${value['_number']}`); - if (value['_number'] != table2Row) { + if (value['_number'] !== table2Row) { const row25 = ws.getRow(value['_number']); row25.alignment = { horizontal: 'right' }; } @@ -628,7 +628,7 @@ export const ExportToExcel = async (data) => { const rows37 = ws.getRows(table3Row, calc.list ? calc.list?.length + 1 : 1); rows37.forEach((value) => { ws.mergeCells(`C${value['_number']}:D${value['_number']}`); - if (value['_number'] != table3Row) { + if (value['_number'] !== table3Row) { const row38 = ws.getRow(value['_number']); row38.alignment = { horizontal: 'right' }; } @@ -643,7 +643,7 @@ export const ExportToExcel = async (data) => { ws.mergeCells(`C${value['_number']}:D${value['_number']}`); ws.mergeCells(`F${value['_number']}:G${value['_number']}`); ws.mergeCells(`H${value['_number']}:J${value['_number']}`); - if (value['_number'] != table4row) { + if (value['_number'] !== table4row) { const row38 = ws.getRow(value['_number']); row38.alignment = { horizontal: 'right' }; } @@ -666,7 +666,7 @@ export const ExportToExcel = async (data) => { ws.mergeCells(`D${value['_number']}:E${value['_number']}`); ws.mergeCells(`F${value['_number']}:G${value['_number']}`); ws.mergeCells(`I${value['_number']}:J${value['_number']}`); - if (value['_number'] != table5Row) { + if (value['_number'] !== table5Row) { const row38 = ws.getRow(value['_number']); row38.alignment = { horizontal: 'right' }; } @@ -715,6 +715,6 @@ export const ExportToExcel = async (data) => { const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', }); - await saveAs(blob, '对账单.xlsx'); + await saveAs(blob, `${contracts.project?.name}-${calc.name}.xlsx`); await message.success('导出成功'); }; diff --git a/packages/plugins/@hera/plugin-rental/src/server/services/settlement-service.ts b/packages/plugins/@hera/plugin-rental/src/server/services/settlement-service.ts index 37cf46ea3..8296ac2ab 100644 --- a/packages/plugins/@hera/plugin-rental/src/server/services/settlement-service.ts +++ b/packages/plugins/@hera/plugin-rental/src/server/services/settlement-service.ts @@ -759,6 +759,7 @@ export class SettlementService { addItems: settlementAbout.settlement_add_items, //人工增补项 summary: settlementAbout.settlement_summary_items, //汇总项 utcOffset: utcOffset, + name: settlementAbout.name, }; calc.list = calc.list?.filter(Boolean); const product = await this.db.getRepository('product').find();