Преглед изворни кода

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

MaiXinRong пре 3 година
родитељ
комит
25b54244ed
3 измењених фајлова са 39 додато и 16 уклоњено
  1. 31 12
      app/service/stage.js
  2. 2 2
      app/service/stage_shoufang.js
  3. 6 2
      app/view/report/rpt_individual.ejs

+ 31 - 12
app/service/stage.js

@@ -512,18 +512,18 @@ module.exports = app => {
             try {
                 const stageInfo = await this.getDataById(id);
                 // 通知发送 - 第三方更新
-                if (this.ctx.session.sessionProject.custom && syncApiConst.notice_type.indexOf(this.ctx.session.sessionProject.customType) !== -1) {
-                    const base_data = {
-                        tid: this.ctx.tender.id,
-                        sid: id,
-                        op: 'delete',
-                    };
-                    await this.ctx.helper.syncNoticeSend(this.ctx.session.sessionProject.customType, JSON.stringify(base_data));
-                    // 是否还存在其他期
-                    base_data.op = stageInfo.order === 1 ? 'delete' : 'update';
-                    base_data.sid = -1;
-                    await this.ctx.helper.syncNoticeSend(this.ctx.session.sessionProject.customType, JSON.stringify(base_data));
-                }
+                // if (this.ctx.session.sessionProject.custom && syncApiConst.notice_type.indexOf(this.ctx.session.sessionProject.customType) !== -1) {
+                //     const base_data = {
+                //         tid: this.ctx.tender.id,
+                //         sid: id,
+                //         op: 'delete',
+                //     };
+                //     await this.ctx.helper.syncNoticeSend(this.ctx.session.sessionProject.customType, JSON.stringify(base_data));
+                //     // 是否还存在其他期
+                //     base_data.op = stageInfo.order === 1 ? 'delete' : 'update';
+                //     base_data.sid = -1;
+                //     await this.ctx.helper.syncNoticeSend(this.ctx.session.sessionProject.customType, JSON.stringify(base_data));
+                // }
                 await transaction.delete(this.tableName, { id });
                 await transaction.delete(this.ctx.service.pos.tableName, { add_stage: id });
                 await transaction.delete(this.ctx.service.stageAudit.tableName, { sid: id });
@@ -580,6 +580,25 @@ module.exports = app => {
                 await transaction.delete(this.ctx.service.scheduleStage.tableName, { tid: stageInfo.tid, order: stageInfo.order });
                 // 重算进度计量总金额
                 await this.ctx.service.scheduleStage.calcStageSjTp(transaction, stageInfo.tid);
+                // 删除收方单及附件
+                const shoufangAttList = await this.ctx.service.stageShoufangAtt.getAllDataByCondition({ where: { sid: id } });
+                if (shoufangAttList.length !== 0) {
+                    for (const att of shoufangAttList) {
+                        if (fs.existsSync(path.join(this.app.baseDir, att.filepath))) {
+                            await fs.unlinkSync(path.join(this.app.baseDir, att.filepath));
+                        }
+                    }
+                }
+                await transaction.delete(this.ctx.service.stageShoufangAtt.tableName, { sid: id });
+                const shoufangList = await this.ctx.service.stageShoufang.getAllDataByCondition({ where: { sid: id } });
+                if (shoufangList.length !== 0) {
+                    for (const att of shoufangList) {
+                        if (fs.existsSync(path.join(this.app.baseDir, 'app/' + att.qrcode))) {
+                            await fs.unlinkSync(path.join(this.app.baseDir, 'app/' + att.qrcode));
+                        }
+                    }
+                }
+                await transaction.delete(this.ctx.service.stageShoufang.tableName, { sid: id });
                 // 记录删除日志
                 await this.ctx.service.projectLog.addProjectLog(transaction, projectLogConst.type.stage, projectLogConst.status.delete, '第' + stageInfo.order + '期');
                 await transaction.commit();

+ 2 - 2
app/service/stage_shoufang.js

@@ -65,8 +65,8 @@ module.exports = app => {
                     }
                 }
                 // 删除二维码
-                if (fs.existsSync(path.join(this.app.baseDir, sfInfo.qrcode))) {
-                    await fs.unlinkSync(path.join(this.app.baseDir, 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 transaction.delete(this.ctx.service.stageShoufangAtt.tableName, { sfid });
                 await transaction.delete(this.tableName, { id: sfid });

+ 6 - 2
app/view/report/rpt_individual.ejs

@@ -230,8 +230,12 @@
     function exportPDF() {
         //导出PDF
         if (currentPageRst) {
-            dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-normal.js', 'normal', _getPdfFontCallback);
-            dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-bold.js', 'bold', _getPdfFontCallback);
+            if (pdfFont['SmartSimsun'].length === 2) {
+                JpcJsPDFHelper.outputAsPdf(currentPageRst, PAGE_SIZE, currentReportName, [], []);
+            } else {
+                dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-normal.js', 'normal', _getPdfFontCallback);
+                dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-bold.js', 'bold', _getPdfFontCallback);
+            }
         }
     }