Browse Source

多审表相关

MaiXinRong 1 năm trước cách đây
mục cha
commit
ed0a4ddf7a
2 tập tin đã thay đổi với 12 bổ sung10 xóa
  1. 2 2
      app/public/report/js/rpt_custom.js
  2. 10 8
      app/service/report_memory.js

+ 2 - 2
app/public/report/js/rpt_custom.js

@@ -224,7 +224,7 @@ const rptCustomObj = (function () {
             const flow = sf.audit_order
                 ? ( sf.audit_order === maxOrder ? '终审' : transFormToChinese(sf.audit_order) + '审')
                 : '原报';
-            html.push(`<option ${sf.visible ? '' : 'style="display: none"'}>${sf.name}-${sf.role}(${flow})</option>`);
+            html.push(`<option ${sf.visible ? '' : 'style="display: none"'} value="${sf.audit_order}">${sf.name}-${sf.role}(${flow})</option>`);
         }
         html.push('</select>');
         return html.join('');
@@ -528,7 +528,7 @@ const rptCustomObj = (function () {
                 $('#audit-select-hint').html('未选择' + s.attributes['sf-title'].value).show();
                 return;
             }
-            data.audit_select.push({...sf, sort: s.selectedIndex});
+            data.audit_select.push({...sf, sort: sf.audit_order});
         }
         $('#audit-select-hint').hide();
         postData('/report/cDefine', data, function (result) {

+ 10 - 8
app/service/report_memory.js

@@ -604,19 +604,21 @@ module.exports = app => {
             if (this.stageValidRole && this.stageValidRole.length > 0) return;
 
             const result = [{dataOrder: 0, flowOrder: 0, uid: this.ctx.stage.user_id}];
-            for (const auditor of this.ctx.stage.auditors) {
-                if (auditor.status === audit.stage.status.checked ||
-                    (auditor.status === audit.stage.status.checking && !this.ctx.stage.readOnly)) {
+            for (const auditorGroup of this.ctx.stage.auditorGroups) {
+                const hasChecked = auditorGroup.find(x => { return x.status === audit.stage.status.checked });
+                const hasOtherStatus = auditorGroup.find(x => { return x.status === audit.stage.status.checkNo || x.status === audit.stage.status.checkNoPre || x.status === audit.stage.status.checkAgain || x.status === audit.stage.status.checkCancel });
+                const isCur = auditorGroup.find(x => { return x.status === audit.stage.status.checking}) && (!this.ctx.stage.readOnly || this.ctx.stage.canCheck);
+                if ((hasChecked && !hasOtherStatus) || isCur) {
                     const role = result.find(function (r) {
-                        return r.uid === auditor.aid;
+                        return r.uid === auditorGroup.map(x => { return x.aid }).join(',');
                     });
                     if (role) {
-                        role.dataOrder = auditor.order;
+                        role.dataOrder = auditorGroup[0].order;
                     } else {
                         result.push({
-                            dataOrder: auditor.order,
-                            flowOrder: result.length,
-                            uid: auditor.aid
+                            dataOrder: auditorGroup[0].order,
+                            flowOrder: auditorGroup[0].audit_order,
+                            uid: auditorGroup.map(x => { return x.aid }).join(',')
                         })
                     }
                 }