Pārlūkot izejas kodu

修复调差管理员修改流程bug

ellisran 8 mēneši atpakaļ
vecāks
revīzija
dd75b54106
1 mainītis faili ar 14 papildinājumiem un 0 dzēšanām
  1. 14 0
      app/service/material_audit.js

+ 14 - 0
app/service/material_audit.js

@@ -69,6 +69,20 @@ module.exports = app => {
             return result;
         }
 
+        async getLastestAuditors(materialId, times, status) {
+            const sql =
+                'SELECT la.`aid`, pa.`name`, pa.`company`, pa.`role`, pa.`mobile`, pa.`telephone`, la.audit_type, la.audit_order,' +
+                '    la.`times`, la.`order`, la.`status`, la.`opinion`, la.`begin_time`, la.`end_time` ' +
+                '    FROM ' + this.tableName + ' AS la' +
+                '    Left Join ' + this.ctx.service.projectAccount.tableName + ' AS pa ON la.`aid` = pa.`id`' +
+                '  WHERE la.`mid` = ? and la.`status` = ? and la.`times` = ?' +
+                '  ORDER BY `order` DESC';
+            const sqlParam = [materialId, status, times ? times: 1];
+            const result = await this.db.query(sql, sqlParam);
+            if (result.length === 0) return [];
+            return result.filter(x => { return x.order === result[0].order });
+        }
+
         async getFinalAuditGroup(materialId, times = 1) {
             const sql =
                 'SELECT la.`aid`, pa.`name`, pa.`company`, pa.`role`, pa.`mobile`, pa.`telephone`, pa.`sign_path`, la.`times`, la.`mid`, la.`audit_order`, la.`audit_type`, Max(la.`order`) as max_order, GROUP_CONCAT(la.tp_data) as tp_data ' +