|
@@ -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;
|