MaiXinRong преди 2 години
родител
ревизия
4c4362ed97
променени са 3 файла, в които са добавени 6 реда и са изтрити 13 реда
  1. 2 10
      app/controller/stage_controller.js
  2. 1 1
      app/public/js/stage.js
  3. 3 2
      app/service/cooperation_confirm.js

+ 2 - 10
app/controller/stage_controller.js

@@ -377,16 +377,8 @@ module.exports = app => {
                             responseData.data.tags = await ctx.service.ledgerTag.getDatas(ctx.tender.id, ctx.stage.id);
                             break;
                         case 'cooperation':
-                            const uid = ctx.stage.curAuditor ?
-                                ctx.stage.curAuditor.aid :
-                                (ctx.stage.status === auditConst.status.uncheck ||
-                                (ctx.stage.status === auditConst.status.checkNo && ctx.stage.user_id === ctx.session.sessionUser.accountId) ?
-                                    ctx.stage.user_id : (ctx.stage.status === auditConst.status.checkNo && ctx.stage.user_id !== ctx.session.sessionUser.accountId) ?
-                                        ctx.session.sessionUser.accountId : null);
-                            responseData.data.cooperation = uid !== null ? await ctx.service.ledgerCooperation.getValidData(
-                                ctx.tender.id, uid) : [];
-                            const stageTimes = (ctx.stage.status === auditConst.status.checkNo && ctx.stage.user_id !== ctx.session.sessionUser.accountId) ? ctx.stage.times - 1 : ctx.stage.times;
-                            responseData.data.cooperationConfirm = uid !== null ? await ctx.service.cooperationConfirm.getValidData(ctx.tender.id, ctx.stage.id, stageTimes, uid) : [];
+                            responseData.data.cooperation = await ctx.service.ledgerCooperation.getValidData(ctx.tender.id, ctx.session.sessionUser.accountId);
+                            responseData.data.cooperationConfirm = await ctx.service.cooperationConfirm.getValidData(ctx.tender.id, ctx.stage.id, ctx.stage.times, ctx.session.sessionUser.accountId);
                             responseData.data.locked = await ctx.service.cooperationConfirm.getLockedId(ctx.tender, ctx.stage);
                             break;
                         case 'spec':

+ 1 - 1
app/public/js/stage.js

@@ -389,7 +389,7 @@ $(document).ready(() => {
                 const lockedInfo = stageTree.getLockedInfo(p.node);
                 if (lockedInfo.length > 0) {
                     const lockedUser = lockedInfo.map(x => { return  x.name; });
-                    html.push('<td>', `审批人 ${lockedInfo.join(',')} 确认通过`, '</td>');
+                    html.push('<td>', `审批人 ${lockedUser.join(',')} 确认通过`, '</td>');
                 } else {
                     html.push('<td>', '</td>');
                 }

+ 3 - 2
app/service/cooperation_confirm.js

@@ -95,6 +95,7 @@ module.exports = app => {
             lockConfirm.forEach(x => {
                 delete x.id;
                 x.locked = 1;
+                x.times = x.times + 1;
                 insertData.push(x);
             });
             // 审批人前所有角色,与锁定数据相关确认状态保留
@@ -111,6 +112,7 @@ module.exports = app => {
                 if (exist) {
                     delete kc.id;
                     kc.locked = 0;
+                    kc.times = kc.times + 1;
                     insertData.push(kc);
                 }
             }
@@ -122,11 +124,10 @@ module.exports = app => {
         }
 
         async getLockedId(tender, stage) {
-            // const lockedCoop = await this.getAllDataByCondition({ where: { sid: stage.id, times: stage.curTimes, locked: 1 } });
             const sql = `SELECT cc.ledger_id, cc.uid, pa.name FROM ${this.tableName} cc` +
                     `  LEFT JOIN ${this.ctx.service.projectAccount.tableName} pa ON cc.uid = pa.id` +
                     '  WHERE cc.sid = ? AND cc.times = ? AND cc.locked = 1';
-            return await this.db.query(sql, [stage.id, stage.curTimes]);
+            return await this.db.query(sql, [stage.id, stage.times]);
         }
     }