Browse Source

报表数据源,添加参建单位数据

MaiXinRong 10 months ago
parent
commit
c4eb5e1929
2 changed files with 13 additions and 0 deletions
  1. 9 0
      app/service/construction_unit.js
  2. 4 0
      app/service/report.js

+ 9 - 0
app/service/construction_unit.js

@@ -5,6 +5,7 @@
  */
 
 const BaseService = require('../base/base_service');
+const accountGroup = require('../const/account_group');
 
 module.exports = app => {
 
@@ -116,6 +117,14 @@ module.exports = app => {
             // 删除单位
             return await this.db.delete(this.tableName, { id });
         }
+
+        async getReportData(pid) {
+            const data = this.getAllDataByCondition({ where: { pid } });
+            data.forEach(x => {
+                x.type_str = accountGroup.group[x.type];
+            });
+            return data;
+        }
     }
     return ConstructionUnit;
 };

+ 4 - 0
app/service/report.js

@@ -435,6 +435,10 @@ module.exports = app => {
                                 customDefine.gather_select, customSelect ? customSelect.gather_select : null));
                             runnableKey.push(filter);
                             break;
+                        case 'construction_unit':
+                            runnableRst.push(service.constructionUnit.getReportData(this.ctx.session.sessionProject.id));
+                            runnableKey.push(filter);
+                            break;
                         default:
                             break;
                     }