Browse Source

报表,审批人选择,新增一期时,拷贝上一期选择结果

MaiXinRong 5 years ago
parent
commit
b0b3e6a825

+ 0 - 1
app/service/report_memory.js

@@ -671,7 +671,6 @@ module.exports = app => {
                 }
                 const changeBills = await this.ctx.service.changeAuditList.getChangeAuditBills(tid);
                 for (const d of changeBills) {
-                    //const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, d.unit);
                     d.o_qty = d.oamount;
                     d.o_tp = this.ctx.helper.mul(d.o_qty, d.unit_price, decimal.tp);
                     d.c_qty = d.camount;

+ 19 - 0
app/service/rpt_custom_define.js

@@ -28,6 +28,25 @@ module.exports = app => {
             }
             return data;
         }
+
+        async addInitialStageData(stage, preStage, transaction) {
+            if (!stage || !preStage) {
+                throw '标段数据有误';
+            }
+            const preDatas = await this.getAllDataByCondition({
+                where: {sid: preStage.id}
+            });
+            if (preDatas.length > 0) {
+                for (const pd of preDatas) {
+                    delete pd.id;
+                    pd.sid = stage.id;
+                }
+                const result = await transaction.insert(this.tableName, preDatas);
+                return result.affectedRows === preDatas.length;
+            } else {
+                return true;
+            }
+        }
     }
 
     return RptCustomDefine;

+ 4 - 0
app/service/stage.js

@@ -275,6 +275,10 @@ module.exports = app => {
                     const otherResult = await this.ctx.service.stageOther.addInitialStageData(newStage, preStage, transaction);
                     if (!otherResult) throw '初始化其他台账数据失败';
                 }
+                // 新增期拷贝报表相关配置
+                if (preStage) {
+                    const rptResult = await this.ctx.service.rptCustomDefine.addInitialStageData(newStage, preStage, transaction);
+                }
 
                 await transaction.commit();
                 return newStage;

+ 0 - 1
app/service/stage_jgcl.js

@@ -227,7 +227,6 @@ module.exports = app => {
             } else {
                 return true;
             }
-
         }
     }