Преглед на файлове

修复协同审批待办页bug

ellisran преди 1 година
родител
ревизия
77a700c69e
променени са 1 файла, в които са добавени 9 реда и са изтрити 1 реда
  1. 9 1
      app/service/stage_audit_ass.js

+ 9 - 1
app/service/stage_audit_ass.js

@@ -43,9 +43,17 @@ module.exports = app => {
         async getAuditStageAss(ass_user_id) {
             // 找出待上报或待审批的协同字段
             const accountStageAssData = await this.getAllDataByCondition({ where: { ass_user_id } });
+            const accountStageAssDatas = [];
+            for (const as of accountStageAssData) {
+                const asaIndex = accountStageAssDatas.findIndex(x => { return x.sid === as.sid; });
+                if (asaIndex === -1 || (asaIndex >= 0 && as.times > accountStageAssDatas[asaIndex].times)) {
+                    if (asaIndex >= 0 && as.times > accountStageAssDatas[asaIndex].times) accountStageAssDatas.splice(asaIndex, 1);
+                    accountStageAssDatas.push(as);
+                }
+            }
             const result = [];
             const accountAssData = await this.ctx.service.auditAss.getAllDataByCondition({ where: { ass_user_id } });
-            for (const as of accountStageAssData) {
+            for (const as of accountStageAssDatas) {
                 const index = accountAssData.findIndex(x => { return x.tid === as.tid && x.user_id === as.user_id; });
                 if (index >= 0) {
                     accountAssData.splice(index, 1);