Просмотр исходного кода

清单表,sid传值为-1时,不check期数据

MaiXinRong 6 месяцев назад
Родитель
Сommit
cebad91341
1 измененных файлов с 8 добавлено и 7 удалено
  1. 8 7
      app/service/report_memory.js

+ 8 - 7
app/service/report_memory.js

@@ -539,17 +539,18 @@ module.exports = app => {
         }
 
         async getStageBillsData(tid, sid, fields, showLevel) {
+            sid = undefined;
             try {
                 await this.ctx.service.tender.checkTender(tid);
-                if (sid) {
+                if (sid && sid !== -1) {
                     await this.ctx.service.stage.checkStage(sid);
                 }
 
-                const billsData = this.ctx.stage.ledgerHis
+                const billsData = this.ctx.stage && this.ctx.stage.ledgerHis
                     ? await this.ctx.helper.loadLedgerDataFromOss(this.ctx.stage.ledgerHis.bills_file)
                     : await this.ctx.service.ledger.getData(this.ctx.tender.id);
                 const extraData = await this.ctx.service.ledgerExtra.getData(this.ctx.tender.id, ['is_tp', 'gxby_status', 'gxby_limit', 'dagl_status', 'dagl_limit', 'calc_template']);
-                const memoData = this.ctx.stage.ledgerHis ? await this.ctx.service.ledger.getAllDataByCondition({ columns: ['id', 'memo'], where: { tender_id: this.ctx.tender.id } }) : [];
+                const memoData = this.ctx.stage && this.ctx.stage.ledgerHis ? await this.ctx.service.ledger.getAllDataByCondition({ columns: ['id', 'memo'], where: { tender_id: this.ctx.tender.id } }) : [];
                 if (this._checkFieldsExist(fields, billsFields.stageDgn)) {
                     const dgnData = await this.ctx.service.stageBillsDgn.getDgnData(this.ctx.tender.id);
                     for (const d of dgnData) {
@@ -569,8 +570,8 @@ module.exports = app => {
                 if (this._checkFieldsExist(fields, billsFields.stageEnd)) {
                     preStage = this.ctx.stage.preCheckedStage ? await this.ctx.service.stageBillsFinal.getFinalData(this.ctx.tender, this.ctx.stage.preCheckedStage.order) : [];
                 }
-                const bpcStage = await this.ctx.service.stageBillsPc.getAllDataByCondition({ where: { sid: this.ctx.stage.id } });
-                const endBpcStage = await this.ctx.service.stageBillsPc.getEndStageData(this.ctx.stage);
+                const bpcStage = this.ctx.stage ? await this.ctx.service.stageBillsPc.getAllDataByCondition({ where: { sid: this.ctx.stage.id } }) : [];
+                const endBpcStage = this.ctx.stage ? await this.ctx.service.stageBillsPc.getEndStageData(this.ctx.stage) : [];
                 const yearStage = this._checkFieldsExistReg(fields, 'year_') && this.ctx.stage.s_time
                     ? await this._loadStageBillsYear(this.ctx.tender, this.ctx.stage.s_time.split('-')[0])
                     : [];
@@ -578,7 +579,7 @@ module.exports = app => {
                     ? await this.ctx.service.changeAuditList.getBillsSum(this.ctx.tender.id)
                     : [];
                 this.ctx.helper.assignRelaData(billsData, [
-                    { data: extraData, field: ['is_tp', 'gxby_status', 'gxby_limit', 'dagl_status', 'dagl_limit', 'calc_template'], prefix: '', relaId: 'id' },
+                    { data: extraData, fields: ['is_tp', 'gxby_status', 'gxby_limit', 'dagl_status', 'dagl_limit', 'calc_template'], prefix: '', relaId: 'id' },
                     { data: memoData, fields: ['memo'], prefix: '', relaId: 'id' },
                     { data: curStage, fields: ['contract_qty', 'contract_tp', 'contract_expr', 'qc_qty', 'qc_tp', 'qc_minus_qty', 'postil'], prefix: '', relaId: 'lid' },
                     { data: preStage, fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'qc_minus_qty'], prefix: 'pre_', relaId: 'lid' },
@@ -656,7 +657,7 @@ module.exports = app => {
         async getStagePosData(tid, sid, fields) {
             try {
                 await this.ctx.service.tender.checkTender(tid);
-                if (sid) {
+                if (sid && sid !== -1) {
                     await this.ctx.service.stage.checkStage(sid);
                 }