Kaynağa Gözat

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

MaiXinRong 3 yıl önce
ebeveyn
işleme
f71bd4cab4
38 değiştirilmiş dosya ile 2750 ekleme ve 188 silme
  1. 3 0
      app.js
  2. 8 5
      app/controller/advance_controller.js
  3. 10 5
      app/controller/change_controller.js
  4. 16 9
      app/controller/ledger_controller.js
  5. 8 5
      app/controller/material_controller.js
  6. 10 10
      app/controller/report_archive_controller.js
  7. 42 26
      app/controller/stage_controller.js
  8. 7 4
      app/controller/wap_controller.js
  9. 14 0
      app/extend/helper.js
  10. 1 1
      app/public/js/advance.js
  11. 3 3
      app/public/js/advance_audit.js
  12. 2274 0
      app/public/js/axios/axios.js
  13. 1 0
      app/public/js/axios/axios.min.js
  14. 33 14
      app/public/js/change_information.js
  15. 8 3
      app/public/js/change_information_set.js
  16. 1 0
      app/public/js/file-saver/FileSaver.min.js
  17. 13 0
      app/public/js/js-xlsx/jszip.min.js
  18. 38 17
      app/public/js/ledger.js
  19. 41 20
      app/public/js/material_file.js
  20. 35 14
      app/public/js/stage.js
  21. 55 0
      app/public/js/zip_oss.js
  22. 9 7
      app/service/advance.js
  23. 3 1
      app/service/advance_file.js
  24. 8 6
      app/service/change.js
  25. 13 2
      app/service/change_att.js
  26. 8 3
      app/service/ledger_att.js
  27. 4 1
      app/service/material_file.js
  28. 20 4
      app/service/stage_att.js
  29. 10 4
      app/service/stage_detail_att.js
  30. 17 14
      app/service/stage_shoufang.js
  31. 10 3
      app/service/stage_shoufang_att.js
  32. 2 1
      app/view/change/information.ejs
  33. 1 0
      app/view/ledger/explode.ejs
  34. 1 0
      app/view/material/file.ejs
  35. 2 1
      app/view/measure/stage.ejs
  36. 1 0
      app/view/stage/index.ejs
  37. 11 2
      config/config.default.js
  38. 9 3
      config/web.js

+ 3 - 0
app.js

@@ -112,4 +112,7 @@ module.exports = app => {
         }
         return fmt;
     };
+
+    app.signPdfOss = app.oss.get('signPdf');
+    app.fujianOss = app.oss.get('fujian');
 };

+ 8 - 5
app/controller/advance_controller.js

@@ -423,8 +423,9 @@ module.exports = app => {
                         return;
                     }
                     const fileInfo = path.parse(stream.filename);
-                    const filepath = `public/upload/${this.ctx.tender.id.toString()}/yfk/fujian_${create_time + idx.toString() + fileInfo.ext}`;
-                    await ctx.helper.saveStreamFile(stream, path.resolve(this.app.baseDir, 'app', filepath));
+                    const filepath = `app/public/upload/${this.ctx.tender.id.toString()}/yfk/fujian_${create_time + idx.toString() + fileInfo.ext}`;
+                    // await ctx.helper.saveStreamFile(stream, path.resolve(this.app.baseDir, 'app', filepath));
+                    await ctx.app.fujianOss.put(filepath, stream);
                     files.push({ filepath, name: stream.filename, ext: fileInfo.ext });
                     ++idx;
                     stream && (await sendToWormhole(stream));
@@ -472,7 +473,8 @@ module.exports = app => {
                 const fileInfo = await ctx.service.advanceFile.getDataById(id);
                 if (fileInfo || Object.keys(fileInfo).length) {
                     // 先删除文件
-                    await fs.unlinkSync(path.resolve(this.app.baseDir, './app', fileInfo.filepath));
+                    // await fs.unlinkSync(path.resolve(this.app.baseDir, './app', fileInfo.filepath));
+                    await ctx.app.fujianOss.delete(fileInfo.filepath);
                     // 再删除数据库
                     await ctx.service.advanceFile.delete(id);
                 } else {
@@ -497,7 +499,7 @@ module.exports = app => {
                 try {
                     const fileInfo = await ctx.service.advanceFile.getDataById(id);
                     if (fileInfo !== undefined && fileInfo !== '') {
-                        const fileName = path.join(__dirname, '../', fileInfo.filepath);
+                        // const fileName = path.join(__dirname, '../', fileInfo.filepath);
                         // 解决中文无法下载问题
                         const userAgent = (ctx.request.header['user-agent'] || '').toLowerCase();
                         let disposition = '';
@@ -514,7 +516,8 @@ module.exports = app => {
                             'Content-Disposition': disposition,
                             'Content-Length': fileInfo.filesize,
                         });
-                        ctx.body = await fs.createReadStream(fileName);
+                        // ctx.body = await fs.createReadStream(fileName);
+                        ctx.body = await ctx.helper.ossFileGet(fileInfo.filepath);
                     } else {
                         throw '不存在该文件';
                     }

+ 10 - 5
app/controller/change_controller.js

@@ -1096,8 +1096,10 @@ module.exports = app => {
                     // await ctx.helper.saveStreamFile(stream, path.join(this.app.baseDir, dirName, fileName));
                     const fileInfo = path.parse(stream.filename);
                     const create_time = Date.parse(new Date()) / 1000;
-                    const filepath = `app/public/upload/change/fujian_${create_time + index.toString() + fileInfo.ext}`;
-                    await ctx.helper.saveStreamFile(stream, path.resolve(this.app.baseDir, filepath));
+                    // const filepath = `app/public/upload/change/fujian_${create_time + index.toString() + fileInfo.ext}`;
+                    const filepath = `app/public/upload/${parts.field.tid}/change/fujian_${create_time + index.toString() + fileInfo.ext}`;
+                    // await ctx.helper.saveStreamFile(stream, path.resolve(this.app.baseDir, filepath));
+                    await ctx.app.fujianOss.put(filepath, stream);
                     await sendToWormhole(stream);
                     // 保存数据到att表
                     const fileData = {
@@ -1106,6 +1108,7 @@ module.exports = app => {
                         fileext: fileInfo.ext,
                         filesize: Array.isArray(parts.field.size) ? parts.field.size[index] : parts.field.size,
                         filepath,
+                        orginpath: ctx.app.config.fujianOssPath + filepath,
                         extra_upload,
                     };
                     const result = await ctx.service.changeAtt.save(parts.field, fileData, ctx.session.sessionUser.accountId);
@@ -1143,7 +1146,7 @@ module.exports = app => {
                 try {
                     const fileInfo = await ctx.service.changeAtt.getDataById(id);
                     if (fileInfo !== undefined && fileInfo !== '') {
-                        const fileName = path.join(this.app.baseDir, fileInfo.filepath);
+                        // const fileName = path.join(this.app.baseDir, fileInfo.filepath);
                         // 解决中文无法下载问题
                         const userAgent = (ctx.request.header['user-agent'] || '').toLowerCase();
                         let disposition = '';
@@ -1160,7 +1163,8 @@ module.exports = app => {
                             'Content-Disposition': disposition,
                             'Content-Length': fileInfo.filesize,
                         });
-                        ctx.body = await fs.createReadStream(fileName);
+                        // ctx.body = await fs.createReadStream(fileName);
+                        ctx.body = await ctx.helper.ossFileGet(fileInfo.filepath);
                     } else {
                         throw '不存在该文件';
                     }
@@ -1258,7 +1262,8 @@ module.exports = app => {
                 }
                 if (fileInfo !== undefined && fileInfo !== '') {
                     // 先删除文件
-                    await fs.unlinkSync(path.join(this.app.baseDir, fileInfo.filepath));
+                    // await fs.unlinkSync(path.join(this.app.baseDir, fileInfo.filepath));
+                    await ctx.app.fujianOss.delete(fileInfo.filepath);
                     // 再删除数据库
                     await ctx.service.changeAtt.deleteById(data.id);
                     responseData.data = '';

+ 16 - 9
app/controller/ledger_controller.js

@@ -155,6 +155,8 @@ module.exports = app => {
                 const attData = await ctx.service.ledgerAtt.getDataByTenderId(ctx.tender.id);
                 for (const index in attData) {
                     attData[index].in_time = moment(attData[index].in_time * 1000).format('YYYY-MM-DD');
+                    attData[index].orginpath = ctx.app.config.fujianOssPath + attData[index].filepath;
+                    delete attData[index].filepath;
                 }
 
                 const whiteList = this.ctx.app.config.multipart.whitelist;
@@ -820,7 +822,8 @@ module.exports = app => {
                     const fileInfo = path.parse(stream.filename);
                     const create_time = Date.parse(new Date()) / 1000;
                     const filepath = `app/public/upload/${this.ctx.tender.id}/ledger/fujian_${create_time + index.toString() + fileInfo.ext}`;
-                    await ctx.helper.saveStreamFile(stream, path.resolve(this.app.baseDir, filepath));
+                    // await ctx.helper.saveStreamFile(stream, path.resolve(this.app.baseDir, filepath));
+                    await ctx.app.fujianOss.put(filepath, stream);
                     if (stream) {
                         await sendToWormhole(stream);
                     }
@@ -867,7 +870,7 @@ module.exports = app => {
                 try {
                     const fileInfo = await ctx.service.ledgerAtt.getDataById(id);
                     if (fileInfo !== undefined && fileInfo !== '') {
-                        const fileName = path.join(this.app.baseDir, fileInfo.filepath);
+                        // const fileName = path.join(this.app.baseDir, fileInfo.filepath);
                         // 解决中文无法下载问题
                         const userAgent = (ctx.request.header['user-agent'] || '').toLowerCase();
                         let disposition = '';
@@ -884,7 +887,8 @@ module.exports = app => {
                             'Content-Disposition': disposition,
                             'Content-Length': fileInfo.filesize,
                         });
-                        ctx.body = await fs.createReadStream(fileName);
+                        // ctx.body = await fs.createReadStream(fileName);
+                        ctx.body = await ctx.helper.ossFileGet(fileInfo.filepath);
                     } else {
                         throw '不存在该文件';
                     }
@@ -911,7 +915,8 @@ module.exports = app => {
                         if (!ctx.helper.canPreview(fileInfo.fileext)) {
                             filepath = `/tender/${ctx.tender.id}/ledger/download/file/${fileInfo.id}`;
                         } else {
-                            filepath = filepath.replace(/^app|\/app/, '');
+                            // filepath = filepath.replace(/^app|\/app/, '');
+                            filepath = ctx.app.config.fujianOssPath + filepath;
                         }
                         fileInfo.filepath && (responseData.data = { filepath });
                     }
@@ -949,7 +954,8 @@ module.exports = app => {
                 }
                 if (fileInfo !== undefined && fileInfo !== '') {
                     // 先删除文件
-                    await fs.unlinkSync(path.join(this.app.baseDir, fileInfo.filepath));
+                    // await fs.unlinkSync(path.join(this.app.baseDir, fileInfo.filepath));
+                    await ctx.app.fujianOss.delete(fileInfo.filepath);
                     // 再删除数据库
                     await ctx.service.ledgerAtt.deleteById(data.id);
                     responseData.data = '';
@@ -987,11 +993,12 @@ module.exports = app => {
                     const fileName = 'fujian_' + create_time + fileInfo.ext;
 
                     // 判断文件夹是否存在,不存在则直接创建文件夹
-                    if (!fs.existsSync(path.join(this.app.baseDir, dirName))) {
-                        await fs.mkdirSync(path.join(this.app.baseDir, dirName));
-                    }
+                    // if (!fs.existsSync(path.join(this.app.baseDir, dirName))) {
+                    //     await fs.mkdirSync(path.join(this.app.baseDir, dirName));
+                    // }
                     // 保存文件
-                    await ctx.helper.saveStreamFile(stream, path.join(this.app.baseDir, dirName, fileName));
+                    // await ctx.helper.saveStreamFile(stream, path.join(this.app.baseDir, dirName, fileName));
+                    await ctx.app.fujianOss.put(path.join(dirName, fileName), stream);
                     // 保存数据到att表
                     fileData = {
                         filesize: stream.fields.size,

+ 8 - 5
app/controller/material_controller.js

@@ -971,8 +971,9 @@ module.exports = app => {
                     }
                     const fileInfo = path.parse(stream.filename);
                     // const filepath = path.join('public/upload', this.ctx.tender.id.toString(), 'tc', 'fujian_' + create_time + fileInfo.ext);
-                    const filepath = `public/upload/${this.ctx.tender.id.toString()}/tc/fujian_${create_time + idx.toString() + fileInfo.ext}`;
-                    await ctx.helper.saveStreamFile(stream, path.resolve(this.app.baseDir, 'app', filepath));
+                    const filepath = `app/public/upload/${this.ctx.tender.id.toString()}/tc/fujian_${create_time + idx.toString() + fileInfo.ext}`;
+                    // await ctx.helper.saveStreamFile(stream, path.resolve(this.app.baseDir, 'app', filepath));
+                    await ctx.app.fujianOss.put(filepath, stream);
                     files.push({ filepath, name: stream.filename, ext: fileInfo.ext });
                     ++idx;
                 }
@@ -1021,7 +1022,7 @@ module.exports = app => {
                 try {
                     const fileInfo = await ctx.service.materialFile.getDataById(id);
                     if (fileInfo !== undefined && fileInfo !== '') {
-                        const fileName = path.join(__dirname, '../', fileInfo.filepath);
+                        // const fileName = path.join(__dirname, '../', fileInfo.filepath);
                         // 解决中文无法下载问题
                         const userAgent = (ctx.request.header['user-agent'] || '').toLowerCase();
                         let disposition = '';
@@ -1038,7 +1039,8 @@ module.exports = app => {
                             'Content-Disposition': disposition,
                             'Content-Length': fileInfo.file_size,
                         });
-                        ctx.body = await fs.createReadStream(fileName);
+                        // ctx.body = await fs.createReadStream(fileName);
+                        ctx.body = await ctx.helper.ossFileGet(fileInfo.filepath);
                     } else {
                         throw '不存在该文件';
                     }
@@ -1082,7 +1084,8 @@ module.exports = app => {
                 }
                 if (fileInfo) {
                     // 先删除文件
-                    await fs.unlinkSync(path.resolve(this.app.baseDir, './app', fileInfo.filepath));
+                    // await fs.unlinkSync(path.resolve(this.app.baseDir, './app', fileInfo.filepath));
+                    await ctx.app.fujianOss.delete(fileInfo.filepath);
                     // 再删除数据库
                     await ctx.service.materialFile.delete(id);
                 } else {

+ 10 - 10
app/controller/report_archive_controller.js

@@ -230,7 +230,7 @@ module.exports = app => {
                 const fileName = newUuidName + '.PDF';
                 // console.log('adding fileName: ' + fileName);
                 // await ctx.helper.saveStreamFile(stream, path.join(this.app.baseDir, 'app', 'public/archive', fileName));
-                const oss_result = await ctx.oss.put('archive/' + fileName, stream);
+                const oss_result = await ctx.app.signPdfOss.put('archive/' + fileName, stream);
                 if (!(oss_result && oss_result.url && oss_result.res.status === 200)) {
                     throw '上传文件失败';
                 }
@@ -268,7 +268,7 @@ module.exports = app => {
                                     }
                                 }
                                 // 同时删除oss文件
-                                await ctx.oss.delete('archive/' + item.items[rmIdx].uuid + '.PDF');
+                                await ctx.app.signPdfOss.delete('archive/' + item.items[rmIdx].uuid + '.PDF');
                                 item.items.splice(rmIdx, 1);
                             }
                             const newItem = { uuid: newUuidName, updateDate_time: dtStr };
@@ -312,14 +312,14 @@ module.exports = app => {
                 const fileName = orgUuidName + '.PDF';
                 console.log('updating fileName: ' + fileName);
                 // await ctx.helper.saveStreamFile(stream, path.join(this.app.baseDir, 'app', 'public/archive', fileName));
-                const oss_result = await ctx.oss.put('archive/' + fileName, stream);
+                const oss_result = await ctx.app.signPdfOss.put('archive/' + fileName, stream);
                 if (!(oss_result && oss_result.url && oss_result.res.status === 200)) {
                     throw '上传文件失败';
                 }
                 // 判断是否存在已签名文档,存在则删除文档并删除签名记录
                 const pdfMsg = await ctx.curl(signConst.path.oss + '/sign/' + orgUuidName + '.PDF');
                 if (pdfMsg && pdfMsg.status === 200) {
-                    const oss_reuslt = await ctx.oss.delete('archive/sign/' + fileName);
+                    const oss_reuslt = await ctx.app.signPdfOss.delete('archive/sign/' + fileName);
                     if (oss_reuslt && oss_reuslt.res && oss_reuslt.res.status === 204) {
                         const delSign_result = await ctx.service.netcasignLog.removeSign(orgUuidName);
                     } else {
@@ -422,7 +422,7 @@ module.exports = app => {
                 //         });
                 //     }
                 // });
-                const oss_result = await ctx.oss.delete('archive/' + fileName);
+                const oss_result = await ctx.app.signPdfOss.delete('archive/' + fileName);
                 if (!(oss_result && oss_result.res.status === 204)) {
                     throw '删除归档文件失败';
                 }
@@ -593,14 +593,14 @@ module.exports = app => {
                 const netcaSignApi = signConst.path.api;
                 switch (data.type) {
                     case 'getPdfBase64':
-                        const pdfResult = await ctx.oss.get(data.path);
+                        const pdfResult = await ctx.app.signPdfOss.get(data.path);
                         if (pdfResult.res.status !== 200) {
                             throw '该文件不存在';
                         }
                         response.data = Buffer.from(pdfResult.content, 'binary').toString('base64');
                         break;
                     case 'pdfIsExist':
-                        const pdfMsg = await ctx.oss.head('archive/sign/' + data.uuid + '.PDF');
+                        const pdfMsg = await ctx.app.signPdfOss.head('archive/sign/' + data.uuid + '.PDF');
                         response.data = pdfMsg.res.status === 200;
                         break;
                     // 获取摘要值
@@ -623,7 +623,7 @@ module.exports = app => {
                         // console.log(result3);
                         if (result3.code === 0) {
                             // const result3 = await ctx.helper.sendMoreRequest(netcaSignApi + result2.data);
-                            const oss_result = await ctx.oss.put('archive/sign/' + data.requestJson.fileName + '.PDF', result3.data);
+                            const oss_result = await ctx.app.signPdfOss.put('archive/sign/' + data.requestJson.fileName + '.PDF', result3.data);
                             if (oss_result && oss_result.res && oss_result.res.status === 200) {
                                 if (data.end) {
                                     const versionId = oss_result.res.headers['x-oss-version-id'];
@@ -643,7 +643,7 @@ module.exports = app => {
                         break;
                     // 移除签名和已签移除pdf
                     case 'removeSign':
-                        const oss_reuslt = await ctx.oss.delete('archive/sign/' + data.uuid + '.PDF');
+                        const oss_reuslt = await ctx.app.signPdfOss.delete('archive/sign/' + data.uuid + '.PDF');
                         if (oss_reuslt && oss_reuslt.res && oss_reuslt.res.status === 204) {
                             const delSign_result = await ctx.service.netcasignLog.removeSign(data.uuid);
                             const signLogList = await ctx.service.netcasignLog.getLogList(ctx.tender.id);
@@ -677,7 +677,7 @@ module.exports = app => {
             try {
                 const uuid = stream.fields.uuid;
                 const role = stream.fields.role;
-                const oss_result = await ctx.oss.put('archive/sign/' + uuid + '.PDF', stream);
+                const oss_result = await ctx.app.signPdfOss.put('archive/sign/' + uuid + '.PDF', stream);
                 if (!(oss_result && oss_result.url && oss_result.res.status === 200)) {
                     throw '上传文件失败';
                 }

+ 42 - 26
app/controller/stage_controller.js

@@ -199,6 +199,7 @@ module.exports = app => {
                 // 获取收方单列表
                 const sfData = await ctx.service.stageShoufang.getAllDataByCondition({ where: { sid: ctx.stage.id }, orders: [['id', 'desc']] });
                 for (const sf of sfData) {
+                    sf.qrcode = ctx.app.config.fujianOssPath + sf.qrcode;
                     sf.filenum = await ctx.service.stageShoufangAtt.count({ sfid: sf.id });
                 }
                 renderData.sfData = sfData;
@@ -754,11 +755,13 @@ module.exports = app => {
                     if (!stream.filename) throw '未发现上传文件!';
 
                     const fileInfo = path.parse(stream.filename);
-                    const dirName = path.join('app', 'public', 'upload', this.ctx.tender.id.toString(), 'im');
-                    const fileName = `${ctx.session.sessionUser.accountId}_${create_time}_${index}${fileInfo.ext}`;
+                    // const dirName = path.join('app', 'public', 'upload', this.ctx.tender.id.toString(), 'im');
+                    // const fileName = `${ctx.session.sessionUser.accountId}_${create_time}_${index}${fileInfo.ext}`;
+                    const filepath = `app/public/upload/${this.ctx.tender.id}/im/${ctx.session.sessionUser.accountId}_${create_time}_${index}${fileInfo.ext}`;
 
                     // 保存文件
-                    await ctx.helper.saveStreamFile(stream, path.join(this.app.baseDir, dirName, fileName));
+                    // await ctx.helper.saveStreamFile(stream, path.join(this.app.baseDir, dirName, fileName));
+                    await ctx.app.fujianOss.put(filepath, stream);
                     await sendToWormhole(stream);
 
                     // 插入到stage_pay对应的附件列表中
@@ -767,7 +770,7 @@ module.exports = app => {
                         filename: fileInfo.name,
                         fileext: fileInfo.ext,
                         filesize: Array.isArray(parts.field.size) ? parts.field.size[index] : parts.field.size,
-                        filepath: path.join(dirName, fileName),
+                        filepath,
                         uid: ctx.session.sessionUser.accountId,
                         in_time: moment(create_time * 1000).format('YYYY-MM-DD'),
                         renew: ctx.stage.status === auditConst.status.checked,
@@ -813,7 +816,7 @@ module.exports = app => {
                 const fileInfo = await ctx.service.stageDetailAtt.getFiles(uuid, file_id);
                 if (!fileInfo) throw '文件不存在';
 
-                const fileName = path.join(this.app.baseDir, fileInfo.filepath);
+                // const fileName = path.join(this.app.baseDir, fileInfo.filepath);
                 // 解决中文无法下载问题
                 const userAgent = (ctx.request.header['user-agent'] || '').toLowerCase();
                 let disposition = '';
@@ -830,7 +833,8 @@ module.exports = app => {
                     'Content-Disposition': disposition,
                     'Content-Length': fileInfo.filesize,
                 });
-                ctx.body = await fs.createReadStream(fileName);
+                // ctx.body = await fs.createReadStream(fileName);
+                ctx.body = await ctx.helper.ossFileGet(fileInfo.filepath);
             } catch (err) {
                 ctx.log(err);
                 ctx.postError(err, '下载文件失败');
@@ -1450,7 +1454,8 @@ module.exports = app => {
                     const fileInfo = path.parse(stream.filename);
                     const create_time = Date.parse(new Date()) / 1000;
                     const filepath = `app/public/upload/${this.ctx.tender.id}/stage/fujian_${create_time + index.toString() + fileInfo.ext}`;
-                    await ctx.helper.saveStreamFile(stream, path.resolve(this.app.baseDir, filepath));
+                    // await ctx.helper.saveStreamFile(stream, path.resolve(this.app.baseDir, filepath));
+                    await ctx.app.fujianOss.put(filepath, stream);
                     // console.log(await fs.existsSync(path.resolve(this.app.baseDir, 'app', filepath)));
                     // const fileInfo = path.parse(stream.filename);
                     // const fileName = 'stage' + create_time + '_' + index + fileInfo.ext;
@@ -1509,7 +1514,7 @@ module.exports = app => {
                 try {
                     const fileInfo = await ctx.service.stageAtt.getDataById(id);
                     if (fileInfo !== undefined && fileInfo !== '') {
-                        const fileName = path.join(this.app.baseDir, fileInfo.filepath);
+                        // const fileName = path.join(this.app.baseDir, fileInfo.filepath);
                         // 解决中文无法下载问题
                         const userAgent = (ctx.request.header['user-agent'] || '').toLowerCase();
                         let disposition = '';
@@ -1526,7 +1531,8 @@ module.exports = app => {
                             'Content-Disposition': disposition,
                             'Content-Length': fileInfo.filesize,
                         });
-                        ctx.body = await fs.createReadStream(fileName);
+                        // ctx.body = await fs.createReadStream(fileName);
+                        ctx.body = await ctx.helper.ossFileGet(fileInfo.filepath);
                     } else {
                         throw '不存在该文件';
                     }
@@ -1553,7 +1559,8 @@ module.exports = app => {
                         if (!ctx.helper.canPreview(fileInfo.fileext)) {
                             filepath = `/tender/${ctx.tender.id}/measure/stage/${ctx.params.order}/download/file/${fileInfo.id}`;
                         } else {
-                            filepath = filepath.replace(/^app|\/app/, '');
+                            // filepath = filepath.replace(/^app|\/app/, '');
+                            filepath = ctx.app.config.fujianOssPath + filepath;
                         }
                         fileInfo.filepath && (responseData.data = { filepath });
                     }
@@ -1591,7 +1598,8 @@ module.exports = app => {
                 }
                 if (fileInfo !== undefined && fileInfo !== '') {
                     // 先删除文件
-                    await fs.unlinkSync(path.join(this.app.baseDir, fileInfo.filepath));
+                    // await fs.unlinkSync(path.join(this.app.baseDir, fileInfo.filepath));
+                    await ctx.app.fujianOss.delete(fileInfo.filepath);
                     // 再删除数据库
                     await ctx.service.stageAtt.deleteById(data.id);
                     responseData.data = '';
@@ -1636,7 +1644,8 @@ module.exports = app => {
                     const fileName = 'fujian_' + create_time + fileInfo.ext;
 
                     // 保存文件
-                    await ctx.helper.saveStreamFile(stream, path.join(this.app.baseDir, dirName, fileName));
+                    // await ctx.helper.saveStreamFile(stream, path.join(this.app.baseDir, dirName, fileName));
+                    await ctx.app.fujianOss.put(path.join(dirName, fileName), stream);
                     // 保存数据到att表
                     fileData = {
                         filesize: stream.fields.size,
@@ -1749,15 +1758,19 @@ module.exports = app => {
                         throw '请选择上传的文件!';
                     }
                     const fileInfo = path.parse(stream.filename);
-                    const dirName = 'app/public/upload/pay/' + moment().format('YYYYMMDD');
-                    const fileName = 'pay' + create_time + '_' + index + fileInfo.ext;
+                    // const dirName = 'app/public/upload/pay/' + moment().format('YYYYMMDD');
+                    // const dirName = 'app/public/upload/' + this.ctx.tender.id + '/pay';
+                    // const dirName = `app/public/upload/${this.ctx.tender.id}/pay`;
+                    // const fileName = 'pay' + create_time + '_' + index + fileInfo.ext;
+                    const filepath = `app/public/upload/${this.ctx.tender.id}/pay/fujian_${create_time + index.toString() + fileInfo.ext}`;
 
                     // 判断文件夹是否存在,不存在则直接创建文件夹
-                    if (!fs.existsSync(path.join(this.app.baseDir, dirName))) {
-                        await fs.mkdirSync(path.join(this.app.baseDir, dirName));
-                    }
+                    // if (!fs.existsSync(path.join(this.app.baseDir, dirName))) {
+                    //     await fs.mkdirSync(path.join(this.app.baseDir, dirName));
+                    // }
                     // 保存文件
-                    await ctx.helper.saveStreamFile(stream, path.join(this.app.baseDir, dirName, fileName));
+                    // await ctx.helper.saveStreamFile(stream, path.join(this.app.baseDir, dirName, fileName));
+                    await ctx.app.fujianOss.put(filepath, stream);
                     await sendToWormhole(stream);
                     // 插入到stage_pay对应的附件列表中
                     const attData = {
@@ -1768,7 +1781,7 @@ module.exports = app => {
                         filename: fileInfo.name,
                         fileext: fileInfo.ext,
                         filesize: Array.isArray(parts.field.size) ? parts.field.size[index] : parts.field.size,
-                        filepath: path.join(dirName, fileName),
+                        filepath,
                         in_time: moment(create_time * 1000).format('YYYY-MM-DD'),
                         renew: this.ctx.stage.status === auditConst.status.checked,
                     };
@@ -1802,7 +1815,7 @@ module.exports = app => {
                 const fileInfo = await ctx.service.payAtt.getDataById(id);
                 if (!fileInfo) throw '不存在该文件';
 
-                const fileName = path.join(this.app.baseDir, fileInfo.filepath);
+                // const fileName = path.join(this.app.baseDir, fileInfo.filepath);
                 // 解决中文无法下载问题
                 const userAgent = (ctx.request.header['user-agent'] || '').toLowerCase();
                 let disposition = '';
@@ -1819,7 +1832,8 @@ module.exports = app => {
                     'Content-Disposition': disposition,
                     'Content-Length': fileInfo.filesize,
                 });
-                ctx.body = await fs.createReadStream(fileName);
+                // ctx.body = await fs.createReadStream(fileName);
+                ctx.body = await ctx.helper.ossFileGet(fileInfo.filepath);
             } catch (err) {
                 this.log(err);
                 this.setMessage(err.toString(), this.messageType.ERROR);
@@ -1836,11 +1850,11 @@ module.exports = app => {
                 const data = JSON.parse(ctx.request.body.data);
                 const fileInfo = await ctx.service.payAtt.getDataById(data.id);
                 if (!fileInfo) throw '不存在该文件';
-
+                await ctx.app.fujianOss.delete(fileInfo.filepath);
                 const result = await ctx.service.payAtt.delFiles(data.id);
-                if (fs.existsSync(path.join(ctx.app.baseDir, fileInfo.filepath))) {
-                    await fs.unlinkSync(path.join(ctx.app.baseDir, fileInfo.filepath));
-                }
+                // if (fs.existsSync(path.join(ctx.app.baseDir, fileInfo.filepath))) {
+                //     await fs.unlinkSync(path.join(ctx.app.baseDir, fileInfo.filepath));
+                // }
                 ctx.body = { err: 0, msg: '', data: result };
             } catch (err) {
                 ctx.log(err);
@@ -1958,7 +1972,9 @@ module.exports = app => {
                         }
                         const result = await ctx.service.stageShoufang.add(data.postData);
                         // responseData.data.cooperationConfirm = await ctx.service.cooperationConfirm.getValidData(ctx.tender.id, ctx.stage.id, ctx.stage.times, ctx.session.sessionUser.accountId);
-                        responseData.data = await ctx.service.stageShoufang.getDataById(result.insertId);
+                        const info = await ctx.service.stageShoufang.getDataById(result.insertId);
+                        info.qrcode = ctx.app.config.fujianOssPath + info.qrcode;
+                        responseData.data = info;
                         break;
                     case 'del':
                         // 判断收方单是否已存在

+ 7 - 4
app/controller/wap_controller.js

@@ -593,7 +593,8 @@ module.exports = app => {
                     const now_time = new Date();
                     const create_time = Date.parse(now_time) / 1000;
                     const filepath = `app/public/upload/${sfInfo.tid}/stage/shoufang/fujian_${create_time + index.toString() + fileInfo.ext}`;
-                    await ctx.helper.saveStreamFile(stream, path.resolve(this.app.baseDir, filepath));
+                    // await ctx.helper.saveStreamFile(stream, path.resolve(this.app.baseDir, filepath));
+                    await ctx.app.fujianOss.put(filepath, stream);
                     // console.log(await fs.existsSync(path.resolve(this.app.baseDir, 'app', filepath)));
                     // const fileInfo = path.parse(stream.filename);
                     // const fileName = 'stage' + create_time + '_' + index + fileInfo.ext;
@@ -661,7 +662,8 @@ module.exports = app => {
                 }
                 if (fileInfo !== undefined && fileInfo !== '') {
                     // 先删除文件
-                    await fs.unlinkSync(path.join(this.app.baseDir, fileInfo.filepath));
+                    // await fs.unlinkSync(path.join(this.app.baseDir, fileInfo.filepath));
+                    await ctx.app.fujianOss.delete(fileInfo.filepath);
                     // 再删除数据库
                     await ctx.service.stageShoufangAtt.deleteById(data.id);
                     responseData.data = '';
@@ -714,7 +716,7 @@ module.exports = app => {
                 try {
                     const fileInfo = await ctx.service.stageShoufangAtt.getDataById(id);
                     if (fileInfo !== undefined && fileInfo !== '') {
-                        const fileName = path.join(this.app.baseDir, fileInfo.filepath);
+                        // const fileName = path.join(this.app.baseDir, fileInfo.filepath);
                         // 解决中文无法下载问题
                         const userAgent = (ctx.request.header['user-agent'] || '').toLowerCase();
                         let disposition = '';
@@ -731,7 +733,8 @@ module.exports = app => {
                             'Content-Disposition': disposition,
                             'Content-Length': fileInfo.filesize,
                         });
-                        ctx.body = await fs.createReadStream(fileName);
+                        // ctx.body = await fs.createReadStream(fileName);
+                        ctx.body = await ctx.helper.ossFileGet(fileInfo.filepath);
                     } else {
                         throw '不存在该文件';
                     }

+ 14 - 0
app/extend/helper.js

@@ -1217,6 +1217,8 @@ module.exports = {
             for (const att of fileList) {
                 if (att.filepath && fs.existsSync(path.join(this.app.baseDir, att.filepath))) {
                     await fs.unlinkSync(path.join(this.app.baseDir, att.filepath));
+                } else if (att.filepath) {
+                    await this.ctx.app.fujianOss.delete(att.filepath);
                 }
             }
         }
@@ -1416,4 +1418,16 @@ module.exports = {
             timing: true,
         });
     },
+
+    async ossFileGet(path) {
+        // 判断开头是否带app,否则加上
+        if (!_.includes(path, 'app/')) {
+            path = 'app/' + path;
+        }
+        const result = await this.ctx.app.fujianOss.get(path);
+        if (result.res.status !== 200) {
+            throw '该文件不存在';
+        }
+        return result.content;
+    },
 };

+ 1 - 1
app/public/js/advance.js

@@ -70,7 +70,7 @@ $(document).ready(function () {
                             <td>${file.filename}</td>
                             <td>${new Date(file.create_time).toLocaleDateString()}</td>
                             <td>
-                                <a href="/${file.filepath}" target="_blank" title="下载"><i class="fa fa-download"></i></a>
+                                <a href="${file.filepath}" target="_blank" title="下载"><i class="fa fa-download"></i></a>
                             </td>
                         </tr>`
         })

+ 3 - 3
app/public/js/advance_audit.js

@@ -253,7 +253,7 @@ $(document).ready(function () {
                 val = re_amount
                 isLimitMax = true
             }
-            
+
             $(this).val(isLimitMax ? val : fixedToSub(val, decimal)) // 重新赋值限制只有两位小数
             const pay_a_input = $(`.pay-input[data-type=${reverse(type)}]`)
             pay_ratio = ZhCalc.mul(ZhCalc.div(val, advancePayTotal), 100).toFixed(2)
@@ -381,9 +381,9 @@ $(document).ready(function () {
         let html = advance.filePermission ? `<tr><td colspan="3"><a href="#addfujian" data-toggle="modal" class="btn btn-sm btn-light text-primary" data-placement="bottom" title="" data-original-title="添加清单"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 上传附件</a></td></tr>` : '';
         newFiles.forEach((file, idx) => {
             if (file.showDel) {
-                html += `<tr><td width="70">${idx + 1}</td><td><a href="/${file.filepath}" target="_blank">${file.filename}</a></td><td width="90"><a href="javascript: void(0);" class="text-danger file-del" data-id="${file.id}">移除</a></td></tr>`
+                html += `<tr><td width="70">${idx + 1}</td><td><a href="${file.filepath}" target="_blank">${file.filename}</a></td><td width="90"><a href="javascript: void(0);" class="text-danger file-del" data-id="${file.id}">移除</a></td></tr>`
             } else {
-                html += `<tr><td width="70">${idx + 1}</td><td><a href="/${file.filepath}" target="_blank">${file.filename}</a></td><td width="90"></td></tr>`
+                html += `<tr><td width="70">${idx + 1}</td><td><a href="${file.filepath}" target="_blank">${file.filename}</a></td><td width="90"></td></tr>`
             }
         })
         $('#file-content').append(html)

Dosya farkı çok büyük olduğundan ihmal edildi
+ 2274 - 0
app/public/js/axios/axios.js


Dosya farkı çok büyük olduğundan ihmal edildi
+ 1 - 0
app/public/js/axios/axios.min.js


+ 33 - 14
app/public/js/change_information.js

@@ -185,23 +185,41 @@ $(document).ready(() => {
             }
             const tid = $('#tenderId').val();
             const cid = $('#changeId').val();
-            
+
             toastr.success('正在进行压缩文件...', '', { timeOut: 0, extendedTimeOut: 0});
             $(this).attr('disabled', "true");
             const btn = $(this);
-            postCompressFile(`/tender/${tid}/change/${cid}/download/compresse-file`, {fileIds}, function(result) {
-              toastr.clear();
-              toastr.success('压缩文件成功');
-              btn.removeAttr('disabled');
-              const href = window.URL.createObjectURL(result);
-              $('#zipDown').attr('href', href);
-              $('#zipDown').attr('download', `${tenderName}-工程变更-${changeName}-附件.zip`);
-              $("#zipDown")[0].click();
-            }, () => {
-              btn.removeAttr('disabled');
-              toastr.clear();
-              toastr.error('批量下载失败');
-            });
+
+            const fileArr = [];
+            for (const id of fileIds) {
+                const fileInfo = _.find(currPageFileData, { id: parseInt(id) });
+                fileArr.push({
+                    url: fileInfo.orginpath, //文件的oss存储路径 (必填)
+                    name: fileInfo.filename, // 文件名 (可选, 不需要填扩展名)
+                    foldPath: '' // (可选, 文件在压缩包中的存储路径)
+                });
+            }
+            const packageName = `${tenderName}-工程变更-${changeName}-附件.zip`;
+            try {
+                zipOss.downloadFromAliOss(fileArr, packageName, btn);
+            } catch (e) {
+                btn.removeAttr('disabled');
+                toastr.clear();
+                toastr.error('批量下载失败');
+            }
+            // postCompressFile(`/tender/${tid}/change/${cid}/download/compresse-file`, {fileIds}, function(result) {
+            //   toastr.clear();
+            //   toastr.success('压缩文件成功');
+            //   btn.removeAttr('disabled');
+            //   const href = window.URL.createObjectURL(result);
+            //   $('#zipDown').attr('href', href);
+            //   $('#zipDown').attr('download', `${tenderName}-工程变更-${changeName}-附件.zip`);
+            //   $("#zipDown")[0].click();
+            // }, () => {
+            //   btn.removeAttr('disabled');
+            //   toastr.clear();
+            //   toastr.error('批量下载失败');
+            // });
         }
     });
 
@@ -288,6 +306,7 @@ function getAllList(currPageNum = 1) {
     $('#currentPage').text(total === 0 ? 0 : currPageNum);
     // 当前页附件内容
     const currPageAttData = attData.slice((currPageNum-1)*pageCount, currPageNum*pageCount);
+    currPageFileData = currPageAttData;
     let html = '';
     // '/tender/' + tender.id + '/measure/stage/' + stage.order + '/download/file/' + att.id
     for(const [index,att] of currPageAttData.entries()) {

+ 8 - 3
app/public/js/change_information_set.js

@@ -1245,6 +1245,7 @@ function makeCodeTable(search = '') {
         $('#code-list tr').css('display', 'table-row');
         return;
     }
+    $('#code-list tr').css('display', 'table-row');
     for(let i = 0; i < $('#code-list tr').length; i++) {
         const length = $('#code-list tr').eq(i).children('td').length;
         if (length === 9) {
@@ -1252,10 +1253,14 @@ function makeCodeTable(search = '') {
             const name = $('#code-list tr').eq(i).children('td').eq(2).text();
             const jldy = $('#code-list tr').eq(i).children('td').eq(6).text();
             const isShow = code.indexOf(search) !== -1 || name.indexOf(search) !== -1 || jldy.indexOf(search) !== -1;
-            $('#code-list tr').eq(i).css('display', (isShow ? 'table-row' : 'none'));
-        } else {
-            return;
+            if (isShow) {
+                $('#code-list tr').eq(i).css('display', 'none');
+            }
+            // $('#code-list tr').eq(i).css('display', (isShow ? 'table-row' : 'none'));
         }
+        // else {
+        //     return;
+        // }
     }
 }
 

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1 - 0
app/public/js/file-saver/FileSaver.min.js


Dosya farkı çok büyük olduğundan ihmal edildi
+ 13 - 0
app/public/js/js-xlsx/jszip.min.js


+ 38 - 17
app/public/js/ledger.js

@@ -883,6 +883,8 @@ $(document).ready(function() {
                 SpreadJsObj.resetTopAndSelect(posSpread.getActiveSheet());
                 posOperationObj.loadCurPosData();
                 posSearch.search($('#pos-keyword').val());
+                // 全选去除
+                $('#dqjiedian').find('.check-all-file').prop('checked', false);
             }
             SpreadJsObj.saveTopAndSelect(info.sheet, ckBillsSpread);
             treeOperationObj.loadExprToInput(info.sheet);
@@ -3421,7 +3423,7 @@ $(document).ready(function() {
           $('#bach-download').prop('type', 'curr');
       } else {
           $('#showPage').show();
-          $('#bach-download').prop('type', 'all')
+          $('#bach-download').prop('type', 'all');
       }
       $('#showAttachment').hide();
     });
@@ -3431,7 +3433,7 @@ $(document).ready(function() {
         //     return toastr.error('当前操作没有权限!');
         // }
         const node = SpreadJsObj.getSelectObject(ledgerSpread.getActiveSheet());
-        if (!node) return
+        if (!node) return;
         const files = $('#upload-file')[0].files;
         // console.log(node);
         const formData = new FormData();
@@ -3664,27 +3666,45 @@ $(document).ready(function() {
         const fileId = $(this).attr('file-id');
         fileId && fileIds.push(fileId);
       });
-      
+
       if (fileIds.length) {
         if (fileIds.length > 10) {
           return toastr.warning(`最大允许10个文件(当前${fileIds.length}个)`)
         }
         toastr.success('正在进行压缩文件...', '', { timeOut: 0, extendedTimeOut: 0})
         $(this).attr('disabled', "true")
-        const btn = $(this)
-        postCompressFile(`/tender/${tender.id}/ledger/compresse/file`, {fileIds}, function(result) {
-          toastr.clear()
-          toastr.success('压缩文件成功')
-          btn.removeAttr('disabled')
-          const href = window.URL.createObjectURL(result)
-          $('#zipDown').attr('href', href);
-          $('#zipDown').attr('download', `${tender.name}-台账分解-附件.zip`);
-          $("#zipDown")[0].click();
-        }, () => {
-          btn.removeAttr('disabled')
-          toastr.clear()
-          toastr.error('批量下载失败')
-        });
+        const btn = $(this);
+
+          const fileArr = [];
+          for (const id of fileIds) {
+              const fileInfo = _.find(currPageFileData, { id: parseInt(id) });
+              fileArr.push({
+                  url: fileInfo.orginpath, //文件的oss存储路径 (必填)
+                  name: fileInfo.filename, // 文件名 (可选, 不需要填扩展名)
+                  foldPath: '' // (可选, 文件在压缩包中的存储路径)
+              });
+          }
+          const packageName = `${tender.name}-台账分解-附件.zip`;
+          try {
+              zipOss.downloadFromAliOss(fileArr, packageName, btn);
+          } catch (e) {
+              btn.removeAttr('disabled');
+              toastr.clear();
+              toastr.error('批量下载失败');
+          }
+        // postCompressFile(`/tender/${tender.id}/ledger/compresse/file`, {fileIds}, function(result) {
+        //   toastr.clear()
+        //   toastr.success('压缩文件成功')
+        //   btn.removeAttr('disabled')
+        //   const href = window.URL.createObjectURL(result)
+        //   $('#zipDown').attr('href', href);
+        //   $('#zipDown').attr('download', `${tender.name}-台账分解-附件.zip`);
+        //   $("#zipDown")[0].click();
+        // }, () => {
+        //   btn.removeAttr('disabled')
+        //   toastr.clear()
+        //   toastr.error('批量下载失败')
+        // });
           // const url = `/tender/${tender.id}/ledger/compresse/file?fileIds=${JSON.stringify(fileIds)}`;
           // console.log(url);
       }
@@ -3743,6 +3763,7 @@ function getAllList(currPageNum = 1) {
   $('#currentPage').text(total === 0 ? 0 : currPageNum);
   // 当前页附件内容
   const currPageAttData = attData.slice((currPageNum-1)*pageCount, currPageNum*pageCount);
+  currPageFileData = currPageAttData;
   let html = '';
   for(const att of currPageAttData) {
       html += `<tr>

+ 41 - 20
app/public/js/material_file.js

@@ -12,6 +12,7 @@ $(document).ready(function () {
     const pageCount = 15;
     // 全局fileData初始化
     let fileData = fileList || []
+    // let currPageFileData = [];
     handleFileList(fileData)
     getAllList()
     $('#upload-file-ok').click(function () {
@@ -129,7 +130,8 @@ $(document).ready(function () {
         : filterFileData.map((v, index) => {
             return {...v, index }
         }).slice((currPageNum-1)*pageCount, currPageNum*pageCount);
-        renderHtml(currPageAttData)
+        currPageFileData = currPageAttData;
+        renderHtml(currPageAttData);
         // 渲染分页器
         renderPagination(currPageNum, pageNum)
     };
@@ -210,7 +212,7 @@ $(document).ready(function () {
             html += `<tr style="height: 31px;">
             <td width="25"><input type="checkbox" class="check-file" file-id=${fileInfo.id}></td>
             <td>${fileInfo.index + 1}</td>
-            <td><a href="/${fileInfo.filepath}" target="_blank">${fileInfo.file_name}</a></td>
+            <td><a href="${fileInfo.filepath}" target="_blank">${fileInfo.file_name}</a></td>
             <td>${fileInfo.file_size}</td>
             <td>第${fileInfo.s_order}期</td>
             <td>${fileInfo.upload_time}</td>`
@@ -222,7 +224,7 @@ $(document).ready(function () {
                 </a>
                 </td></tr>`
             } else {
-                html += `<td><a href="/${fileInfo.filepath}" class="btn btn-light btn-sm" title="下载"><span class="fa fa-download text-primary"></span></a></td></tr>`
+                html += `<td><a href="${fileInfo.filepath}" class="btn btn-light btn-sm" title="下载"><span class="fa fa-download text-primary"></span></a></td></tr>`
             }
         })
         $('#file-list').empty();
@@ -246,7 +248,7 @@ $(document).ready(function () {
         })
     });
 
-    $('#bach-download').click(function() {
+    $('#bach-download').click(async function() {
         const fileIds = []
         $( '#file-list .check-file:checked').each(function() {
             const fileId = $(this).attr('file-id')
@@ -258,22 +260,41 @@ $(document).ready(function () {
             if (fileIds.length > 10) {
               return toastr.warning(`最大允许10个文件(当前${fileIds.length}个)`)
             }
-            toastr.success('正在进行压缩文件...', '', { timeOut: 0, extendedTimeOut: 0})
-            $(this).attr('disabled', "true")
-            const btn = $(this)
-            postCompressFile(`/tender/${tid}/measure/material/${order}/file/download/compresse-file`, {fileIds}, function(result) {
-              toastr.clear()
-              toastr.success('压缩文件成功')
-              btn.removeAttr('disabled')
-              const href = window.URL.createObjectURL(result)
-              $('#zipDown').attr('href', href);
-              $('#zipDown').attr('download', `${tender.name}-材料调差-第${order}期-附件.zip`);
-              $("#zipDown")[0].click();
-            }, () => {
-              btn.removeAttr('disabled')
-              toastr.clear()
-              toastr.error('批量下载失败')
-            });
+            toastr.success('正在进行下载并压缩文件...', '', { timeOut: 0, extendedTimeOut: 0})
+            $(this).attr('disabled', "true");
+            const btn = $(this);
+
+            const fileArr = [];
+            for (const id of fileIds) {
+                const fileInfo = _.find(currPageFileData, { id: parseInt(id) });
+                fileArr.push({
+                    url: fileInfo.orginpath, //文件的oss存储路径 (必填)
+                    name: fileInfo.file_name.substring(0, fileInfo.file_name.lastIndexOf(".")), // 文件名 (可选, 不需要填扩展名)
+                    foldPath: '' // (可选, 文件在压缩包中的存储路径)
+                });
+            }
+            const packageName = `${tender.name}-材料调差-第${order}期-附件.zip`;
+            try {
+                zipOss.downloadFromAliOss(fileArr, packageName, btn);
+            } catch (e) {
+                btn.removeAttr('disabled');
+                toastr.clear();
+                toastr.error('批量下载失败');
+            }
+
+            // postCompressFile(`/tender/${tid}/measure/material/${order}/file/download/compresse-file`, {fileIds}, function(result) {
+            //   toastr.clear()
+            //   toastr.success('压缩文件成功')
+            //   btn.removeAttr('disabled')
+            //   const href = window.URL.createObjectURL(result)
+            //   $('#zipDown').attr('href', href);
+            //   $('#zipDown').attr('download', `${tender.name}-材料调差-第${order}期-附件.zip`);
+            //   $("#zipDown")[0].click();
+            // }, () => {
+            //   btn.removeAttr('disabled')
+            //   toastr.clear()
+            //   toastr.error('批量下载失败')
+            // });
             // postData( `/tender/${tid}/measure/material/${order}/file/download/compresse-file`, { fileIds })
             // $('#downloadZip').attr('href', `/tender/${tid}/measure/material/${order}/file/download/compresse-file?fileIds=${JSON.stringify(fileIds)}`);
             // $('#downloadZip')[0].click();

+ 35 - 14
app/public/js/stage.js

@@ -118,6 +118,7 @@ function getAllList(currPageNum = 1) {
     $('#currentPage').text(total === 0 ? 0 : currPageNum);
     // 当前页附件内容
     const currPageAttData = attData.slice((currPageNum-1)*pageCount, currPageNum*pageCount);
+    currPageFileData = currPageAttData;
     let html = '';
     // '/tender/' + tender.id + '/measure/stage/' + stage.order + '/download/file/' + att.id
     for(const att of currPageAttData) {
@@ -967,6 +968,8 @@ $(document).ready(() => {
                 if (posSearch) {
                     posSearch.search();
                 }
+                // 全选去除
+                $('#dqjiedian').find('.check-all-file').prop('checked', false);
             }
             SpreadJsObj.saveTopAndSelect(info.sheet, ckBillsSpread);
             stageTreeSpreadObj.loadExprToInput(info.sheet);
@@ -4202,20 +4205,38 @@ $(document).ready(() => {
             }
             toastr.success('正在进行压缩文件...', '', { timeOut: 0, extendedTimeOut: 0})
             $(this).attr('disabled', "true")
-            const btn = $(this)
-            postCompressFile(`/tender/${tender.id}/measure/stage/${stage.order}/download/compresse-file`, {fileIds}, function(result) {
-              toastr.clear()
-              toastr.success('压缩文件成功')
-              btn.removeAttr('disabled')
-              const href = window.URL.createObjectURL(result)
-              $('#zipDown').attr('href', href);
-              $('#zipDown').attr('download', `${tender.name}-计量台账-第${stage.order}期-附件.zip`);
-              $("#zipDown")[0].click();
-            }, () => {
-              btn.removeAttr('disabled')
-              toastr.clear()
-              toastr.error('批量下载失败')
-            });
+            const btn = $(this);
+
+            const fileArr = [];
+            for (const id of fileIds) {
+                const fileInfo = _.find(currPageFileData, { id: parseInt(id) });
+                fileArr.push({
+                    url: fileInfo.orginpath, //文件的oss存储路径 (必填)
+                    name: fileInfo.filename, // 文件名 (可选, 不需要填扩展名)
+                    foldPath: '' // (可选, 文件在压缩包中的存储路径)
+                });
+            }
+            const packageName = `${tender.name}-计量台账-第${stage.order}期-附件.zip`;
+            try {
+                zipOss.downloadFromAliOss(fileArr, packageName, btn);
+            } catch (e) {
+                btn.removeAttr('disabled');
+                toastr.clear();
+                toastr.error('批量下载失败');
+            }
+            // postCompressFile(`/tender/${tender.id}/measure/stage/${stage.order}/download/compresse-file`, {fileIds}, function(result) {
+            //   toastr.clear()
+            //   toastr.success('压缩文件成功')
+            //   btn.removeAttr('disabled')
+            //   const href = window.URL.createObjectURL(result)
+            //   $('#zipDown').attr('href', href);
+            //   $('#zipDown').attr('download', `${tender.name}-计量台账-第${stage.order}期-附件.zip`);
+            //   $("#zipDown")[0].click();
+            // }, () => {
+            //   btn.removeAttr('disabled')
+            //   toastr.clear()
+            //   toastr.error('批量下载失败')
+            // });
             // const url = `/tender/${tender.id}/measure/stage/${stage.order}/download/compresse-file?fileIds=${JSON.stringify(fileIds)}`;
             // $('#zipDown').attr('href', url);
             // $("#zipDown")[0].click();

+ 55 - 0
app/public/js/zip_oss.js

@@ -0,0 +1,55 @@
+// var axios = require("axios");
+// var jszip = require("jszip");
+// var FileSaver = require("file-saver");
+
+const zipOss = {
+    getFile: function(url) {
+        return new Promise((resolve, reject) => {
+            axios({
+                headers:{
+                    'Cache-control': 'no-cache',
+                },
+                method: "get",
+                url,
+                responseType: "arraybuffer"
+            })
+                .then(data => {
+                    resolve(data.data);
+                })
+                .catch(error => {
+                    reject(error);
+                });
+        });
+    },
+    downloadFromAliOss: function (fileArr, zipName, btn) {
+        const zip = new JSZip();
+        const promises = [];
+        fileArr.forEach(item => {
+            let promise = zipOss.getFile(item.url).then(data => {
+                // 获取文件类型
+                const typeArr = item.url.split(".");
+                const type = typeArr[typeArr.length - 1];
+                // 默认文件名·
+                const nameArr = item.url.split("/");
+                const name = item.name ? (item.name + '.' + type) : nameArr[nameArr.length - 1];
+                const foldPath = item.foldPath || "";
+                zip.file(foldPath + name, data, {
+                    binary: true
+                });
+            });
+            promises.push(promise);
+        });
+
+        Promise.all(promises).then(() => {
+            zip.generateAsync({ type: "blob" }).then(content => {
+                saveAs(content, zipName || `文件.zip`);
+                toastr.clear();
+                toastr.success('下载成功');
+                btn.removeAttr('disabled');
+            });
+        });
+    }
+};
+
+
+// module.exports = zipOss;

+ 9 - 7
app/service/advance.js

@@ -217,14 +217,16 @@ module.exports = app => {
                 // 删除附件
                 const fileInfo = await this.db.select(this.ctx.service.advanceFile.tableName, { where: { vid: id, tid } });
                 await transaction.delete(this.ctx.service.advanceFile.tableName, { vid: id, tid });
+                await this.ctx.helper.delFiles(fileInfo);
                 // 先删除文件
-                for (let i = 0; i < fileInfo.length; i++) {
-                    const file = fileInfo[i];
-                    if (fs.existsSync(path.resolve(this.app.baseDir, './app', file.filepath))) {
-                        fs.unlinkSync(path.resolve(this.app.baseDir, './app', file.filepath));
-                        // fs.unlinkSync(path.resolve(this.app.baseDir, zipPath));
-                    }
-                }
+                // for (let i = 0; i < fileInfo.length; i++) {
+                //     const file = fileInfo[i];
+                //     if (fs.existsSync(path.resolve(this.app.baseDir, './app', file.filepath))) {
+                //         fs.unlinkSync(path.resolve(this.app.baseDir, './app', file.filepath));
+                //         // fs.unlinkSync(path.resolve(this.app.baseDir, zipPath));
+                //     }
+                //     await this.ctx.app.fujianOss.delete(file.filepath);
+                // }
                 // 删除审批记录
                 await transaction.delete(this.ctx.service.advanceAudit.tableName, { vid: id, tid });
                 await transaction.commit();

+ 3 - 1
app/service/advance_file.js

@@ -27,7 +27,9 @@ module.exports = app => {
             const result = await this.db.select(this.tableName, { where: payload });
             const list = result.map(item => {
                 if (!ctx.helper.canPreview(item.fileext)) {
-                    item.filepath = `tender/${ctx.tender.id}/advance/${item.vid}/file/${item.id}/download`;
+                    item.filepath = `/tender/${ctx.tender.id}/advance/${item.vid}/file/${item.id}/download`;
+                } else {
+                    item.filepath = this.ctx.app.config.fujianOssPath + item.filepath;
                 }
                 return item;
             });

+ 8 - 6
app/service/change.js

@@ -1297,12 +1297,14 @@ module.exports = app => {
                 await this.transaction.delete(this.ctx.service.changeAudit.tableName, { cid });
                 // 再删除附件和附件文件ni zuo
                 const attList = await this.ctx.service.changeAtt.getAllDataByCondition({ where: { cid } });
-                if (attList.length !== 0) {
-                    for (const att of attList) {
-                        await fs.unlinkSync(path.join(this.app.baseDir, att.filepath));
-                    }
-                    await this.transaction.delete(this.ctx.service.changeAtt.tableName, { cid });
-                }
+                await this.ctx.helper.delFiles(attList);
+                await this.transaction.delete(this.ctx.service.changeAtt.tableName, { cid });
+                // if (attList.length !== 0) {
+                //     for (const att of attList) {
+                //         await fs.unlinkSync(path.join(this.app.baseDir, att.filepath));
+                //     }
+                //     await this.transaction.delete(this.ctx.service.changeAtt.tableName, { cid });
+                // }
                 // 最后删除变更令
                 await this.transaction.delete(this.tableName, { cid });
                 // 记录删除日志

+ 13 - 2
app/service/change_att.js

@@ -54,7 +54,16 @@ module.exports = app => {
                 '  On ca.uid = pa.id ' +
                 '  Where ca.cid = ? order by id ' + sort;
             const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, cid];
-            return await this.db.query(sql, sqlParam);
+            const result = await this.db.query(sql, sqlParam);
+            return result.map(item => {
+                item.orginpath = this.ctx.app.config.fujianOssPath + item.filepath;
+                if (!this.ctx.helper.canPreview(item.fileext)) {
+                    item.filepath = `/change/download/file/${item.id}`;
+                } else {
+                    item.filepath = this.ctx.app.config.fujianOssPath + item.filepath;
+                }
+                return item;
+            });
         }
 
         /**
@@ -65,10 +74,12 @@ module.exports = app => {
             const { ctx } = this;
             const result = await this.db.select(this.tableName, { where: { cid } });
             return result.map(item => {
+                item.orginpath = this.ctx.app.config.fujianOssPath + item.filepath;
                 if (!ctx.helper.canPreview(item.fileext)) {
                     item.filepath = `/change/download/file/${item.id}`;
                 } else {
-                    item.filepath = item.filepath.replace(/^app|\/app/, '');
+                    // item.filepath = item.filepath.replace(/^app|\/app/, '');
+                    item.filepath = this.ctx.config.ossPath + item.filepath;
                 }
                 return item;
             });

+ 8 - 3
app/service/ledger_att.js

@@ -64,7 +64,7 @@ module.exports = app => {
          * @return {void}
          */
         async getDataByTenderId(tid) {
-            const sql = 'SELECT att.id, att.lid, att.uid, att.filename, att.fileext, att.filesize, att.extra_upload, att.remark, att.in_time,' +
+            const sql = 'SELECT att.id, att.lid, att.uid, att.filepath, att.filename, att.fileext, att.filesize, att.extra_upload, att.remark, att.in_time,' +
                 ' pa.name as `username`, leg.name as `lname`, leg.code as `code`, leg.ledger_id as `ledger_id`, leg.b_code as `b_code`' +
                 ' FROM ?? AS att,?? AS pa,?? AS leg' +
                 ' WHERE leg.id = att.lid AND pa.id = att.uid AND att.tid = ? ORDER BY att.id DESC';
@@ -86,8 +86,13 @@ module.exports = app => {
                 ' WHERE leg.id = att.lid AND pa.id = att.uid AND att.id = ? ORDER BY att.in_time DESC';
             const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, this.ctx.service.ledger.tableName, id];
             const result = await this.db.queryOne(sql, sqlParam);
-            if (!ctx.helper.canPreview(result.fileext)) result.filepath = `/tender/${ctx.tender.id}/ledger/download/file/${result.id}`;
-            else result.filepath = result.filepath.replace(/^app|\/app/, '');
+            result.orginpath = this.ctx.app.config.fujianOssPath + result.filepath;
+            if (!ctx.helper.canPreview(result.fileext)) {
+                result.filepath = `/tender/${ctx.tender.id}/ledger/download/file/${result.id}`;
+            } else {
+                // result.filepath = result.filepath.replace(/^app|\/app/, '');
+                result.filepath = this.ctx.app.config.fujianOssPath + result.filepath;
+            }
             return result;
         }
 

+ 4 - 1
app/service/material_file.js

@@ -37,8 +37,11 @@ module.exports = app => {
                 orders: [['upload_time', 'desc']],
             });
             return result.map(item => {
+                item.orginpath = this.ctx.app.config.fujianOssPath + item.filepath;
                 if (!ctx.helper.canPreview(item.fileext)) {
-                    item.filepath = `tender/${ctx.tender.id}/measure/material/${item.s_order}/file/${item.id}/download`;
+                    item.filepath = `/tender/${ctx.tender.id}/measure/material/${item.s_order}/file/${item.id}/download`;
+                } else {
+                    item.filepath = this.ctx.app.config.fujianOssPath + item.filepath;
                 }
                 return item;
             });

+ 20 - 4
app/service/stage_att.js

@@ -65,12 +65,23 @@ module.exports = app => {
          * @return {void}
          */
         async getDataByTenderIdAndStageId(tid, sid) {
-            const sql = 'SELECT att.id, att.lid, att.uid, att.filename, att.fileext, att.filesize, att.extra_upload, att.remark, att.in_time,' +
+            const sql = 'SELECT att.id, att.lid, att.uid, att.filepath, att.filename, att.fileext, att.filesize, att.extra_upload, att.remark, att.in_time,' +
                 ' pa.name as `username`, leg.name as `lname`, leg.code as `code`, leg.ledger_id as `ledger_id`, leg.b_code as `b_code`' +
                 ' FROM ?? AS att,?? AS pa,?? AS leg' +
                 ' WHERE leg.id = att.lid AND pa.id = att.uid AND att.tid = ? AND att.sid = ? ORDER BY att.id DESC';
             const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, this.ctx.service.ledger.departTableName(tid), tid, sid];
-            return await this.db.query(sql, sqlParam);
+            // return await this.db.query(sql, sqlParam);
+            const result = await this.db.query(sql, sqlParam);
+            return result.map(item => {
+                item.orginpath = this.ctx.app.config.fujianOssPath + item.filepath;
+                delete item.filepath;
+                // if (!this.ctx.helper.canPreview(item.fileext)) {
+                //     item.filepath = `/tender/${this.ctx.tender.id}/measure/stage/${this.ctx.params.order}/download/file/${item.id}`;
+                // } else {
+                //     item.filepath = this.ctx.app.config.fujianOssPath + item.filepath;
+                // }
+                return item;
+            });
         }
 
         /**
@@ -87,8 +98,13 @@ module.exports = app => {
                 ' WHERE leg.id = att.lid AND pa.id = att.uid AND att.id = ? ORDER BY att.in_time DESC';
             const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, this.ctx.service.ledger.tableName, id];
             const result = await this.db.queryOne(sql, sqlParam);
-            if (!ctx.helper.canPreview(result.fileext)) result.filepath = `/tender/${ctx.tender.id}/measure/stage/${ctx.params.order}/download/file/${result.id}`;
-            else result.filepath = result.filepath.replace(/^app|\/app/, '');
+            result.orginpath = this.ctx.app.config.fujianOssPath + result.filepath;
+            if (!ctx.helper.canPreview(result.fileext)) {
+                result.filepath = `/tender/${ctx.tender.id}/measure/stage/${ctx.params.order}/download/file/${result.id}`;
+            } else {
+                // result.filepath = result.filepath.replace(/^app|\/app/, '');
+                result.filepath = this.ctx.app.config.fujianOssPath + result.filepath;
+            }
             return result;
         }
 

+ 10 - 4
app/service/stage_detail_att.js

@@ -72,7 +72,10 @@ module.exports = app => {
             const datas = data instanceof Array ? data : [data];
             for (const d of datas) {
                 for (const a of d.attachment) {
-                    if (this.ctx.helper.canPreview(a.fileext)) a.viewpath = a.filepath.replace(/^app|\/app/, '');
+                    if (this.ctx.helper.canPreview(a.fileext)){
+                        // a.viewpath = a.filepath.replace(/^app|\/app/, '');
+                        a.viewpath = this.ctx.app.config.fujianOssPath + a.filepath;
+                    }
                     delete a.filepath;
                     a.username = (await this.getUserTemp(a.uid)).name;
                 }
@@ -109,6 +112,7 @@ module.exports = app => {
                 await this.db.insert(this.tableName, insertData);
                 this._analysisDetailAtt(insertData);
                 await this._complete4Output(insertData);
+
                 return insertData;
             }
         }
@@ -126,9 +130,11 @@ module.exports = app => {
             detailAtt.attachment.splice(index, 1);
             await this.db.update(this.tableName, { id: detailAtt.id, attachment: JSON.stringify(detailAtt.attachment) });
 
-            if (fs.existsSync(path.join(this.ctx.app.baseDir, att.filepath))) {
-                await fs.unlinkSync(path.join(this.ctx.app.baseDir, att.filepath));
-            }
+            // if (fs.existsSync(path.join(this.ctx.app.baseDir, att.filepath))) {
+            //     await fs.unlinkSync(path.join(this.ctx.app.baseDir, att.filepath));
+            // }
+            await this.ctx.app.fujianOss.delete(att.filepath);
+
 
             await this._complete4Output(detailAtt);
             return detailAtt;

+ 17 - 14
app/service/stage_shoufang.js

@@ -40,8 +40,9 @@ module.exports = app => {
                     '?tid=' + this.ctx.tender.id + '&order=' + this.ctx.stage.order + '&sfid=' + result.insertId;
                 // 大小默认5,二维码周围间距默认1
                 const qr_png = await qr.image(text || '', { type: 'png', size: size || 5, margin: margin || 1 });
-                const qrcodePath = '/public/upload/' + this.ctx.tender.id + '/stage/shoufang/qrcode/' + result.insertId + '.png';
-                await this.ctx.helper.saveStreamFile(qr_png, path.resolve(this.app.baseDir, 'app/' + qrcodePath));
+                const qrcodePath = 'app/public/upload/' + this.ctx.tender.id + '/stage/shoufang/qrcode/' + result.insertId + '.png';
+                // await this.ctx.helper.saveStreamFile(qr_png, path.resolve(this.app.baseDir, 'app/' + qrcodePath));
+                await this.ctx.app.fujianOss.put(qrcodePath, qr_png);
                 await transaction.update(this.tableName, { id: result.insertId, qrcode: qrcodePath });
                 await transaction.commit();
                 return result;
@@ -57,19 +58,21 @@ module.exports = app => {
                 // 删除附件再删除收方单
                 const sfInfo = await this.getDataById(sfid);
                 const sfAttList = await this.ctx.service.stageShoufangAtt.getAllDataByCondition({ where: { sfid } });
-                if (sfAttList) {
-                    if (sfAttList.length !== 0) {
-                        for (const att of sfAttList) {
-                            if (fs.existsSync(path.join(this.app.baseDir, att.filepath))) {
-                                await fs.unlinkSync(path.join(this.app.baseDir, att.filepath));
-                            }
-                        }
-                    }
-                }
+                await this.ctx.helper.delFiles(sfAttList);
+                // if (sfAttList) {
+                //     if (sfAttList.length !== 0) {
+                //         for (const att of sfAttList) {
+                //             if (fs.existsSync(path.join(this.app.baseDir, att.filepath))) {
+                //                 await fs.unlinkSync(path.join(this.app.baseDir, att.filepath));
+                //             }
+                //         }
+                //     }
+                // }
                 // 删除二维码
-                if (fs.existsSync(path.join(this.app.baseDir, 'app/' + sfInfo.qrcode))) {
-                    await fs.unlinkSync(path.join(this.app.baseDir, 'app/' + sfInfo.qrcode));
-                }
+                // if (fs.existsSync(path.join(this.app.baseDir, 'app/' + sfInfo.qrcode))) {
+                //     await fs.unlinkSync(path.join(this.app.baseDir, 'app/' + sfInfo.qrcode));
+                // }
+                await this.ctx.app.fujianOss.delete(sfInfo.qrcode);
                 await transaction.delete(this.ctx.service.stageShoufangAtt.tableName, { sfid });
                 await transaction.delete(this.tableName, { id: sfid });
                 await transaction.commit();

+ 10 - 3
app/service/stage_shoufang_att.js

@@ -99,7 +99,10 @@ module.exports = app => {
             for (const att of result) {
                 // if (!ctx.helper.canPreview(att.fileext)) att.filepath = `/wap/shoufang/download/file/${att.id}`;
                 // else att.filepath = att.filepath.replace(/^app|\/app/, '');
-                if (ctx.helper.canPreview(att.fileext)) att.viewpath = att.filepath.replace(/^app|\/app/, '');
+                if (ctx.helper.canPreview(att.fileext)) {
+                    // att.viewpath = att.filepath.replace(/^app|\/app/, '');
+                    att.viewpath = ctx.app.config.fujianOssPath + att.filepath;
+                }
                 att.filepath = `/wap/shoufang/download/file/${att.id}`;
             }
             return result;
@@ -118,8 +121,12 @@ module.exports = app => {
                 ' WHERE att.id = ? ORDER BY att.id DESC';
             const sqlParam = [this.tableName, id];
             const result = await this.db.queryOne(sql, sqlParam);
-            if (!ctx.helper.canPreview(result.fileext)) result.filepath = `/wap/shoufang/download/file/${result.id}`;
-            else result.filepath = result.filepath.replace(/^app|\/app/, '');
+            if (!ctx.helper.canPreview(result.fileext)) {
+                result.filepath = `/wap/shoufang/download/file/${result.id}`;
+            } else {
+                // result.filepath = result.filepath.replace(/^app|\/app/, '');
+                result.filepath = ctx.app.config.fujianOssPath + result.filepath;
+            }
             return result;
         }
     }

+ 2 - 1
app/view/change/information.ejs

@@ -391,12 +391,13 @@
     const ledgeStatus = '<%- tender.ledger_status %>';
     const ledgerConsts = JSON.parse('<%- JSON.stringify(ledgerConsts) %>');
     const auditStatus = parseInt('<%- auditStatus %>');
-    const changeName = '<%- change.name %>';
+    const changeName = JSON.parse(unescape('<%- escape(JSON.stringify(change.name)) %>'));
     const touristPermission = parseInt('<%- ctx.tender.touristPermission.file %>');
     const auditList = JSON.parse(unescape('<%- escape(JSON.stringify(auditList)) %>'));
     const precision = JSON.parse('<%- JSON.stringify(precision) %>');
     const whiteList = JSON.parse('<%- JSON.stringify(whiteList) %>');
     let attData = JSON.parse(unescape('<%- escape(JSON.stringify(attList)) %>'));
+    let currPageFileData = [];
     autoFlashHeight();
     $('a[href="#sub-ap"').click(function() {
         if (parseInt(ledgeStatus) === ledgerConsts.uncheck) {

+ 1 - 0
app/view/ledger/explode.ejs

@@ -316,6 +316,7 @@
     const whiteList = JSON.parse('<%- JSON.stringify(whiteList) %>');
     const measureType = JSON.parse('<%- JSON.stringify(measureType) %>');
     let ledgerSpreadSetting = '<%- ledgerSpreadSetting %>';
+    let currPageFileData = [];
     ledgerSpreadSetting = JSON.parse(ledgerSpreadSetting);
     ledgerSpreadSetting.localCache = {
         key: 'ledger-bills',

+ 1 - 0
app/view/material/file.ejs

@@ -127,4 +127,5 @@
   const fileList = JSON.parse(unescape('<%- escape(JSON.stringify(fileList)) %>'));
   const tender = JSON.parse(unescape('<%- escape(JSON.stringify(tender)) %>'));
   const whiteList = JSON.parse('<%- JSON.stringify(whiteList) %>');
+  let currPageFileData = [];
 </script>

+ 2 - 1
app/view/measure/stage.ejs

@@ -26,6 +26,7 @@
                     <tr>
                         <th class="text-center" width="80px">计量期数</th>
                         <th class="text-center" width="70px">计量月份</th>
+                        <th class="text-center" width="70px">计量周期</th>
                         <th class="text-center" width="110px">本期合同计量</th>
                         <th class="text-center" width="110px">本期数量变更计量</th>
                         <th class="text-center" width="110px">本期完成计量</th>
@@ -47,7 +48,7 @@
                             <% } %>
                         </td>
                         <td class="text-center"><%- s.s_time %></td>
-                        <!--<td class="text-center"><%- s.period %></td>-->
+                        <td class="text-center"><%- s.period %></td>
                         <% if (ctx.tender.info.display.thousandth) { %>
                         <td class="text-right"><%- (s.contract_tp ? ctx.helper.formatNum(s.contract_tp, '#,##0.######') : '')%></td>
                         <td class="text-right"><%- (s.qc_tp ? ctx.helper.formatNum(s.qc_tp, '#,##0.######') : '')%></td>

+ 1 - 0
app/view/stage/index.ejs

@@ -520,6 +520,7 @@
     const sfAttDelPower = <%- sfAttDelPower %>;
     let sfData = JSON.parse(unescape('<%- escape(JSON.stringify(sfData)) %>'));
     const hintOver = <%- hintOver %>;
+    let currPageFileData = [];
 </script>
 <style>
 

+ 11 - 2
config/config.default.js

@@ -203,15 +203,24 @@ module.exports = appInfo => {
     config.proxy = true;
 
     config.oss = {
-        client: {
+        clients: {
+            signPdf: {
+                bucket: 'measure-sign-pdf',
+            },
+            fujian: {
+                bucket: 'jiliang-qa',
+            },
+        },
+        default: {
             accessKeyId: 'LTAIALMjBHOs9PLA',
             accessKeySecret: 'HSnULQs87wAJhcziAdyRv3GZ4EYctc',
-            bucket: 'measure-sign-pdf',
             endpoint: 'oss-cn-shenzhen.aliyuncs.com',
             timeout: '60s',
         },
     };
 
+    config.fujianOssPath = 'https://jiliang-qa.smartcost.com.cn/';
+
     config.syncUrl = 'https://sync.jl.smartcost.com.cn/';
 
     return config;

+ 9 - 3
config/web.js

@@ -136,6 +136,7 @@ const JsFiles = {
                     '/public/js/spreadjs/sheets/v11/interop/gc.spread.excelio.11.2.2.min.js',
                     '/public/js/decimal.min.js',
                     '/public/js/math.min.js',
+                    '/public/js/axios/axios.min.js', '/public/js/js-xlsx/jszip.min.js',
                     '/public/js/file-saver/FileSaver.js',
                 ],
                 mergeFiles: [
@@ -148,6 +149,7 @@ const JsFiles = {
                     '/public/js/shares/merge_peg.js',
                     '/public/js/shares/new_tag.js',
                     '/public/js/zh_calc.js',
+                    '/public/js/zip_oss.js',
                     '/public/js/path_tree.js',
                     '/public/js/ledger_tree_col.js',
                     '/public/js/std_lib.js',
@@ -303,7 +305,8 @@ const JsFiles = {
                     '/public/js/spreadjs/sheets/v11/interop/gc.spread.excelio.11.2.2.min.js',
                     '/public/js/decimal.min.js',
                     '/public/js/math.min.js',
-                    '/public/js/file-saver/FileSaver.js',
+                    // '/public/js/file-saver/FileSaver.js',
+                    '/public/js/axios/axios.min.js', '/public/js/js-xlsx/jszip.min.js', '/public/js/file-saver/FileSaver.min.js',
                 ],
                 mergeFiles: [
                     '/public/js/sub_menu.js',
@@ -317,6 +320,7 @@ const JsFiles = {
                     '/public/js/shares/new_tag.js',
                     '/public/js/zh_calc.js',
                     '/public/js/path_tree.js',
+                    '/public/js/zip_oss.js',
                     '/public/js/stage_im.js',
                     '/public/js/shares/tenders2tree.js',
                     '/public/js/shares/tender_select.js',
@@ -655,8 +659,8 @@ const JsFiles = {
                 mergeFile: 'material_list',
             },
             file: {
-                files: ['/public/js/toastr.min.js'],
-                mergeFiles: ['/public/js/sub_menu.js', '/public/js/material_file.js', '/public/js/material_audit.js'],
+                files: ['/public/js/toastr.min.js', '/public/js/axios/axios.min.js', '/public/js/js-xlsx/jszip.min.js', '/public/js/file-saver/FileSaver.min.js'],
+                mergeFiles: ['/public/js/sub_menu.js', '/public/js/zip_oss.js', '/public/js/material_file.js', '/public/js/material_audit.js'],
                 mergeFile: 'material_file',
             },
         },
@@ -831,6 +835,7 @@ const JsFiles = {
                     '/public/js/spreadjs/sheets/v11/gc.spread.sheets.all.11.2.2.min.js',
                     '/public/js/decimal.min.js',
                     '/public/js/moment/moment.min.js',
+                    '/public/js/axios/axios.min.js', '/public/js/js-xlsx/jszip.min.js', '/public/js/file-saver/FileSaver.min.js',
                 ],
                 mergeFiles: [
                     '/public/js/sub_menu.js',
@@ -841,6 +846,7 @@ const JsFiles = {
                     '/public/js/path_tree.js',
                     '/public/js/gcl_gather.js',
                     '/public/js/jquery/jquery.form.min.js',
+                    '/public/js/zip_oss.js',
                     // '/public/js/change_calculation.js',
                     '/public/js/change_information.js',
                 ],