소스 검색

报表,uat和prod导出Excel问题

MaiXinRong 5 년 전
부모
커밋
868b2e0e07
1개의 변경된 파일1개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 4
      app/controller/report_controller.js

+ 1 - 4
app/controller/report_controller.js

@@ -385,14 +385,11 @@ module.exports = app => {
                 const filePath = this.app.baseDir + '/app/public/download/';
                 // console.log('filePath: ' + filePath);
                 // await this.ctx.helper.recursiveMkdirSync(this.app.baseDir + '/app/public/download');
-                const filestream = fs.createReadStream(filePath + uuid + suffix);
-                const chunk = await getUuidFile(filestream);
                 ctx.set({
                     'Content-Type': 'application/vnd.openxmlformats',
                     'Content-Disposition': 'attachment; filename="' + rptNameURI + suffix + "\"; filename*=utf-8''" + rptNameURI + suffix,
-                    'Content-Length': chunk.length,
                 });
-                ctx.body = chunk;
+                ctx.body = await fs.readFileSync(filePath + uuid + suffix);
             } catch (e) {
                 console.log(e);
             }