瀏覽代碼

修改审批流程问题

MaiXinRong 1 年之前
父節點
當前提交
a33a072922
共有 4 個文件被更改,包括 18 次插入3 次删除
  1. 1 1
      app/controller/stage_controller.js
  2. 1 1
      app/public/js/stage_audit.js
  3. 15 0
      app/service/stage_audit.js
  4. 1 1
      app/service/sub_proj_info.js

+ 1 - 1
app/controller/stage_controller.js

@@ -1411,7 +1411,7 @@ module.exports = app => {
                 const data = JSON.parse(ctx.request.body.data);
                 await ctx.service.stageAudit.saveAudit(ctx.stage.id, ctx.stage.times, data);
 
-                const auditors = await ctx.service.stageAudit.getUserGroup(ctx.stage.id, ctx.stage.times);
+                const auditors = await ctx.service.stageAudit.getUniqUserGroup(ctx.stage.id, ctx.stage.times);
                 ctx.body = { err: 0, msg: '', data: auditors };
             } catch (err) {
                 this.log(err);

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

@@ -315,7 +315,7 @@ $(document).ready(function () {
                     if (j === group.length - 1) {
                         html.push('<span class="dropdown mr-2">',
                             `<a href="javascript: void(0)" class="add-audit" id="${auditor.aid}_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">增加</a>`,
-                            makeSelectAudit(auditor.id+'_add', auditor.id, 'add'),'</div>', '</span>');
+                            makeSelectAudit(auditor.aid+'_add', auditor.aid, 'add'),'</div>', '</span>');
                         if (auditor.audit_type !== auditType.key.common) {
                             html.push('<span class="dropdown mr-2">',
                                 '<a href="javascript: void(0)" class="add-audit" id="<%- auditor.aid %>_add_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">平级</a>',

+ 15 - 0
app/service/stage_audit.js

@@ -2036,6 +2036,21 @@ module.exports = app => {
             return group;
         }
 
+        async getUniqUserGroup(stageId, times) {
+            const group = await this.getAuditorGroup(stageId, times);
+            const sql =
+                'SELECT pa.`id` As aid, pa.`name`, pa.`company`, pa.`role`, ? As times, ? As sid, 0 As `order`, 1 As audit_type, 0 As audit_order' +
+                '  FROM ' + this.ctx.service.stage.tableName + ' As s' +
+                '  LEFT JOIN ' + this.ctx.service.projectAccount.tableName + ' As pa' +
+                '  ON s.user_id = pa.id' +
+                '  WHERE s.id = ?';
+            const sqlParam = [times, stageId, stageId];
+            const user = await this.db.queryOne(sql, sqlParam);
+            user.audit_order = 0;
+            group.unshift([ user ]);
+            return this.ctx.helper.groupAuditorsUniq(group);
+        }
+
         async getAuditorHistory(stageId, times, reverse = false) {
             const history = [];
             if (times >= 1) {

+ 1 - 1
app/service/sub_proj_info.js

@@ -35,7 +35,7 @@ const defaultInfo = {
         { id: 6, pid: 2, full_path: '2-6', level: 2, is_leaf: 1, order: 4, name: '水泥', unit: '吨', dgn_qty: 0, final_qty: 0, },
         { id: 7, pid: 2, full_path: '2-7', level: 2, is_leaf: 1, order: 5, name: '碎石、砂', unit: 'm3', dgn_qty: 0, final_qty: 0, },
         { id: 8, pid: 2, full_path: '2-8', level: 2, is_leaf: 1, order: 6, name: '电', unit: 'km.h', dgn_qty: 0, final_qty: 0, },
-        { id: 9, pid: 2, full_path: '2-9', level: 2, is_leaf: 1, order: 7, name: '主要机械消耗', unit: '台班', dgn_qty: 0, final_qty: 0, },
+        { id: 9, pid: -1, full_path: '9', level: 1, is_leaf: 1, order: 3, name: '主要机械消耗', unit: '台班', dgn_qty: 0, final_qty: 0, },
     ],
 };