laiguoran 5 years ago
parent
commit
7daecf723f

+ 5 - 2
app/controller/tender_controller.js

@@ -88,16 +88,19 @@ module.exports = app => {
                         if (t.lastStage.status === auditConst.stage.status.uncheck) {
                         if (t.lastStage.status === auditConst.stage.status.uncheck) {
                             const status_name = await this.ctx.service.projectAccount.getAccountInfoById(t.lastStage.user_id);
                             const status_name = await this.ctx.service.projectAccount.getAccountInfoById(t.lastStage.user_id);
                             t.status_users = status_name ? status_name.name : '';
                             t.status_users = status_name ? status_name.name : '';
+                            // const status_name = await this.ctx.service.stageAudit.getStatusName(t.lastStage.id, t.lastStage.times - 1);
+                            // t.status_users = status_name ? status_name.name : '';
                         } else {
                         } else {
-                            const status_name = await this.ctx.service.stageAudit.getStatusName(t.lastStage.id);
+                            const status_name = await this.ctx.service.stageAudit.getStatusName(t.lastStage.id, t.lastStage.times);
                             t.status_users = status_name ? status_name.name : '';
                             t.status_users = status_name ? status_name.name : '';
                         }
                         }
                     } else {
                     } else {
                         if (t.ledger_status !== auditConst.ledger.status.uncheck) {
                         if (t.ledger_status !== auditConst.ledger.status.uncheck) {
-                            const status_name = await this.ctx.service.ledgerAudit.getStatusName(t.id);
+                            const status_name = await this.ctx.service.ledgerAudit.getStatusName(t.id, t.ledger_times);
                             t.status_users = status_name ? status_name.name : '';
                             t.status_users = status_name ? status_name.name : '';
                         }
                         }
                     }
                     }
+                    console.log(t.status_users);
                 }
                 }
                 renderData.categoryData = await this.ctx.service.category.getAllCategory(this.ctx.session.sessionProject.id);
                 renderData.categoryData = await this.ctx.service.category.getAllCategory(this.ctx.session.sessionProject.id);
                 renderData.valuations = await this.ctx.service.valuation.getProjectValidValuation(this.ctx.session.sessionProject.id);
                 renderData.valuations = await this.ctx.service.valuation.getProjectValidValuation(this.ctx.session.sessionProject.id);

+ 2 - 2
app/service/ledger_audit.js

@@ -50,11 +50,11 @@ module.exports = app => {
          * @param {Number} times - 第几次审批
          * @param {Number} times - 第几次审批
          * @returns {Promise<*>}
          * @returns {Promise<*>}
          */
          */
-        async getStatusName(tenderId) {
+        async getStatusName(tenderId, times) {
             const sql = 'SELECT pa.`name` ' +
             const sql = 'SELECT pa.`name` ' +
                 'FROM ?? AS la, ?? AS pa ' +
                 'FROM ?? AS la, ?? AS pa ' +
                 'WHERE la.`tender_id` = ?' +
                 'WHERE la.`tender_id` = ?' +
-                '    and la.`audit_id` = pa.`id` and la.`status` != ? ORDER BY la.`audit_order` DESC';
+                '    and la.`audit_id` = pa.`id` and la.`status` != ? ORDER BY la.`times` DESC, la.`audit_order` DESC';
             const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, tenderId, auditConst.status.uncheck];
             const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, tenderId, auditConst.status.uncheck];
             return await this.db.queryOne(sql, sqlParam);
             return await this.db.queryOne(sql, sqlParam);
         }
         }

+ 1 - 1
app/service/stage_audit.js

@@ -85,7 +85,7 @@ module.exports = app => {
             const sql = 'SELECT pa.`name` ' +
             const sql = 'SELECT pa.`name` ' +
                 'FROM ?? AS sa, ?? AS pa ' +
                 'FROM ?? AS sa, ?? AS pa ' +
                 'WHERE sa.`sid` = ?' +
                 'WHERE sa.`sid` = ?' +
-                '    and sa.`aid` = pa.`id` and sa.`status` != ? ORDER BY sa.`order` DESC';
+                '    and sa.`aid` = pa.`id` and sa.`status` != ? ORDER BY sa.`times` DESC, sa.`order` DESC';
             const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, stageId, auditConst.status.uncheck];
             const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, stageId, auditConst.status.uncheck];
             return await this.db.queryOne(sql, sqlParam);
             return await this.db.queryOne(sql, sqlParam);
         }
         }