瀏覽代碼

报表数据源,从业人员相关

MaiXinRong 9 月之前
父節點
當前提交
6aabd1965c
共有 3 個文件被更改,包括 46 次插入0 次删除
  1. 9 0
      app/service/report.js
  2. 19 0
      app/service/rpt_gather_memory.js
  3. 18 0
      app/service/tender_cert.js

+ 9 - 0
app/service/report.js

@@ -426,6 +426,15 @@ module.exports = app => {
                             runnableRst.push(service.schedule.getDataByCondition({ tid: params.tender_id }));
                             runnableKey.push(filter);
                             break;
+                        case 'mem_tender_cert':
+                            runnableRst.push(service.tenderCert.getAllCert(params.tender_id));
+                            runnableKey.push(filter);
+                            break;
+                        case 'mem_gather_tender_cert':
+                            runnableRst.push(service.rptGatherMemory.getGatherTenderCert(memFieldKeys[filter],
+                                customDefine.gather_select, customSelect ? customSelect.gather_select : null));
+                            runnableKey.push(filter);
+                            break;
                         default:
                             break;
                     }

+ 19 - 0
app/service/rpt_gather_memory.js

@@ -1271,6 +1271,25 @@ module.exports = app => {
             return this.resultDealBills;
         }
 
+
+        /**
+         * 从业人员
+         */
+        async _gatherCommonTenderCert(sTender) {
+            const tenderCert = await this.ctx.service.tenderCert.getAllCert(sTender.tid);
+            this.resultTenderCert.push(...tenderCert);
+        }
+        async getGatherTenderCert(memFieldKeys, gsDefine, gsCustom) {
+            if (!gsDefine || !gsDefine.enable) return [];
+            if (!gsCustom || !gsCustom.tenders || gsCustom.tenders.length === 0) return [];
+
+            this.resultTenderCert = [];
+            for (const tender of gsCustom.tenders) {
+                await this._gatherCommonTenderCert(tender);
+            }
+            return this.resultTenderCert;
+        }
+
         _getChangeConstName(define, value) {
             for (const prop in define) {
                 if (define[prop].value === value) {

+ 18 - 0
app/service/tender_cert.js

@@ -106,6 +106,24 @@ module.exports = app => {
                 throw err;
             }
         }
+
+        async getAllCert(tenderId) {
+            const sql = 'SELECT tc.uid, tc.cert_id, tc.department, tc.job_time, tc.remark,' +
+                '    ac.type, ac.name as ac_name, ac.code, ac.reg_unit, ac.job_title, ac.file_name, ac.file_path, ac.edu_json,' +
+                '    pa.account, pa.name, pa.role, pa.company' +
+                `  FROM ${this.tableName} tc LEFT JOIN ${this.ctx.service.accountCert.tableName} ac ON tc.cert_id = ac.id` +
+                `  LEFT JOIN ${this.ctx.service.projectAccount.tableName} pa ON tc.uid = pa.id` +
+                '  WHERE tc.tid = ?';
+            const result = await this.db.query(sql, [tenderId]);
+            result.forEach(x => {
+                x.edu_json = x.edu_json ? JSON.parse(x.edu_json) : [];
+                const eduInfo = x.edu_json.length > 0 ? x.edu_json[x.edu_json.length - 1] : null;
+                for (const prop in eduInfo) {
+                   x['edu_info_' + prop] = eduInfo[prop];
+                }
+            });
+            return result;
+        }
     }
 
     return TenderCert;