瀏覽代碼

标段数据源,合同管理指标数据

MaiXinRong 3 月之前
父節點
當前提交
f036dbdcd7
共有 2 個文件被更改,包括 95 次插入0 次删除
  1. 48 0
      app/service/report.js
  2. 47 0
      app/service/report_memory.js

+ 48 - 0
app/service/report.js

@@ -439,6 +439,54 @@ module.exports = app => {
                             runnableRst.push(service.constructionUnit.getReportData(this.ctx.session.sessionProject.id));
                             runnableKey.push(filter);
                             break;
+                        case 'contract_tree_1':
+                            runnableRst.push(service.reportMemory.getContractTree(params.tender_id, 1));
+                            runnableKey.push(filter);
+                            break;
+                        case 'contract_1':
+                            runnableRst.push(service.reportMemory.getContract(params.tender_id, 1));
+                            runnableKey.push(filter);
+                            break;
+                        case 'contract_pay_1':
+                            runnableRst.push(service.reportMemory.getContractPay(params.tender_id, 1));
+                            runnableKey.push(filter);
+                            break;
+                        case 'contract_tree_2':
+                            runnableRst.push(service.reportMemory.getContractTree(params.tender_id, 2));
+                            runnableKey.push(filter);
+                            break;
+                        case 'contract_2':
+                            runnableRst.push(service.reportMemory.getContract(params.tender_id, 2));
+                            runnableKey.push(filter);
+                            break;
+                        case 'contract_pay_2':
+                            runnableRst.push(service.reportMemory.getContractPay(params.tender_id, 2));
+                            runnableKey.push(filter);
+                            break;
+                        case 'sp_contract_tree_1':
+                            runnableRst.push(service.reportMemory.getSpContractTree(params.tender_id, 1));
+                            runnableKey.push(filter);
+                            break;
+                        case 'sp_contract_1':
+                            runnableRst.push(service.reportMemory.getSpContract(params.tender_id, 1));
+                            runnableKey.push(filter);
+                            break;
+                        case 'sp_contract_pay_1':
+                            runnableRst.push(service.reportMemory.getSpContractPay(params.tender_id, 1));
+                            runnableKey.push(filter);
+                            break;
+                        case 'sp_contract_tree_2':
+                            runnableRst.push(service.reportMemory.getSpContractTree(params.tender_id, 2));
+                            runnableKey.push(filter);
+                            break;
+                        case 'sp_contract_2':
+                            runnableRst.push(service.reportMemory.getSpContract(params.tender_id, 2));
+                            runnableKey.push(filter);
+                            break;
+                        case 'sp_contract_pay_2':
+                            runnableRst.push(service.reportMemory.getSpContractPay(params.tender_id, 2));
+                            runnableKey.push(filter);
+                            break;
                         default:
                             break;
                     }

+ 47 - 0
app/service/report_memory.js

@@ -1689,6 +1689,53 @@ module.exports = app => {
             });
             return result;
         }
+
+        async _getContractTree(condition) {
+            const data = await this.ctx.service.contractTree.getAllDataByCondition({ where: condition });
+            const contract_data = await this.ctx.service.contract.getAllDataByCondition({ where: condition });
+            const tree = new Ledger.billsTree(this.ctx, {
+                id: 'contract_id',
+                pid: 'contract_pid',
+                order: 'order',
+                level: 'level',
+                rootId: -1,
+                calcFields: [ 'total_price', 'pay_price', 'debit_price', 'yf_price', 'sf_price'],
+                calc: function (node, helper, decimal) {},
+            });
+            tree.loadDatas([...data, ...contract_data]);
+            return tree.getDefaultDatas();
+        }
+        async _getContract(condition) {
+            const data = await this.ctx.service.contract.getAllDataByCondition({ where: condition });
+            return data;
+        }
+        async _getContractPay(condition) {
+            const data = await this.ctx.service.contractPay.getAllDataByCondition({ where: condition, orders: [['cid', 'asc'], ['create_time', 'asc']] });
+            return data;
+        }
+
+        async getContractTree(tid, contract_type) {
+            return await this._getContractTree({ tid, contract_type });
+        }
+        async getContract(tid, contract_type) {
+            return await this.getContract({ tid, contract_type });
+        }
+        async getContractPay(tid, contract_type) {
+            return await this._getContractPay({ tid, contract_type });
+        }
+
+        async getSpContractTree(tid, contract_type) {
+            await this.ctx.service.tender.checkTender(tid);
+            await this._getContractTree({ spid: this.ctx.tender.data.spid, contract_type });
+        }
+        async getSpContract(tid, contract_type) {
+            await this.ctx.service.tender.checkTender(tid);
+            return await this._getContract({ spid: this.ctx.tender.data.spid, contract_type });
+        }
+        async getSpContractPay(tid, contract_type) {
+            await this.ctx.service.tender.checkTender(tid);
+            return await this._getContractPay({ spid: this.ctx.tender.data.spid, contract_type });
+        }
     }
 
     return ReportMemory;