瀏覽代碼

修复一些测试bug

ellisran 10 月之前
父節點
當前提交
d29e0c54ed
共有 3 個文件被更改,包括 18 次插入5 次删除
  1. 15 2
      app/service/ledger_audit.js
  2. 3 2
      app/service/shenpi_audit.js
  3. 0 1
      app/view/tender/shenpi.ejs

+ 15 - 2
app/service/ledger_audit.js

@@ -606,12 +606,25 @@ module.exports = app => {
          * @return {Promise<Array>} 查询结果集
          */
         async getAuditGroupByList(tender_id, times = 1, transaction = null) {
+            // const sql =
+            //     'SELECT la.`audit_id`, la.`status`, pa.`name`, pa.`company`, pa.`role`, la.`times`, la.`tender_id`, la.`audit_order` ' +
+            //     '  FROM ?? AS la Left Join ?? AS pa On la.`audit_id` = pa.`id`' +
+            //     '  WHERE la.`tender_id` = ? and la.`times` = ? GROUP BY la.`audit_id` ORDER BY la.`audit_order`';
+            // const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, tender_id, times];
+            // return transaction ? await transaction.query(sql, sqlParam) : await this.db.query(sql, sqlParam);
             const sql =
                 'SELECT la.`audit_id`, la.`status`, pa.`name`, pa.`company`, pa.`role`, la.`times`, la.`tender_id`, la.`audit_order` ' +
                 '  FROM ?? AS la Left Join ?? AS pa On la.`audit_id` = pa.`id`' +
-                '  WHERE la.`tender_id` = ? and la.`times` = ? GROUP BY la.`audit_id` ORDER BY la.`audit_order`';
+                '  WHERE la.`tender_id` = ? and la.`times` = ? ORDER BY la.`audit_order` DESC';
             const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, tender_id, times];
-            return transaction ? await transaction.query(sql, sqlParam) : await this.db.query(sql, sqlParam);
+            const result = transaction ? await transaction.query(sql, sqlParam) : await this.db.query(sql, sqlParam);
+            const audits = [];
+            for (const r of result) {
+                if (audits.findIndex(a => a.audit_id === r.audit_id) === -1) {
+                    audits.push(r);
+                }
+            }
+            return audits.reverse();
         }
 
         /**

+ 3 - 2
app/service/shenpi_audit.js

@@ -26,7 +26,8 @@ module.exports = app => {
         }
 
         async getShenpi(tid, info) {
-            for (const sp of shenpiConst.sp_lc) {
+            const spConst = this._.cloneDeep(shenpiConst);
+            for (const sp of spConst.sp_lc) {
                 sp.status = info.shenpi ? info.shenpi[sp.code] : shenpiConst.sp_status.sqspr;
                 if (sp.status === shenpiConst.sp_status.gdspl) {
                     sp.groupList = await this.ctx.service.shenpiGroup.getGroupList(tid, sp.type) || [];
@@ -43,7 +44,7 @@ module.exports = app => {
                     sp.audit = await this.getAudit(tid, sp.type, sp.status);
                 }
             }
-            return shenpiConst;
+            return spConst;
         }
 
         async getAudit(tid, type, status) {

+ 0 - 1
app/view/tender/shenpi.ejs

@@ -32,7 +32,6 @@
                                             <% } %>
                                         </div>
                                     </div>
-                                    <% if (!shenpi.sp_status_list[sp.status]) console.log(sp) %>
                                     <div class="alert alert-warning"><%- shenpi.sp_status_list[sp.status].name %>:<%- shenpi.sp_status_list[sp.status].msg %></div>
                                     <div class="lc-show">
                                     <% if (sp.status === shenpi.sp_status.gdspl) { %>