zgg há 1 hora atrás
pai
commit
84b0092908

+ 3 - 0
application/admin/controller/Config.php

@@ -48,6 +48,9 @@ class Config extends Auth
             if($v['type'] == 5){ // 工人
                 $list[$k]['user'] = $nuser;
                 $list[$k]['value'] = $list[$k]['value']?explode(',',$list[$k]['value']):[];
+            }elseif ($v['type'] == 8){ //角色
+                $list[$k]['roles'] = model('Roles')->getList();;
+                $list[$k]['value'] = $list[$k]['value']?explode(',',$list[$k]['value']):[];
             }
         }
         $this->assign('list',$list);

+ 11 - 0
application/admin/controller/Orders.php

@@ -2719,6 +2719,17 @@ class Orders extends Auth {
         $res?$this->success('操作成功','',['status'=>$value]):$this->error('操作失败');
     }
 
+    public function bhTodoCount()
+    {
+        $count = Db::name('todo')
+            ->where('org_id', $this->orgId)
+            ->where('del', 0)
+            ->where('work_type_mode', 3)
+            ->where('todo_mode', 4)
+            ->count() ?? 0;
+        $this->success('操作成功','',['count'=>$count]);
+    }
+
     public function print1($id){
 
         $order = Db::name('orders')->where(['id' => $id])->find();

+ 3 - 0
application/admin/view/config/org.html

@@ -66,6 +66,9 @@
                             {:widget_view('common/upimg',['name'=>$config['name'],'multi'=>0,'val'=>$config['value']?$config['value']:''])}
                             {/case}
 
+                            {case value="8"}
+                            {:widget_view('common/multiselect',['name'=>$config['name'],'lists' =>$config['roles'], 'val' =>$config['value']?$config['value']:[]])}
+                            {/case}
                             {/switch}
                         </div>
                         {/volist}

+ 11 - 0
application/admin/view/orders/convey.html

@@ -328,6 +328,7 @@
                 // clearInterval(interval);
                 $ppp = {$sxJg};
                 $("#search-btn").click();
+                bhTodoCount();
             }else{
                 $("#timermsglabel").html($ppp+"秒后自动刷新页面");
                 $ppp--;
@@ -336,6 +337,16 @@
         if(parseInt('{$refresh}') >0){
             var time1 =  setInterval(interval,1000);
         }
+
+        function bhTodoCount(){
+            $.post('{:url("bhTodoCount")}', {}, function(res) {
+                if (res.code == 1 && res.data.count > 0) {
+                    $('.bhgd').text("驳回工单(" + res.data.count + ")");
+                }
+            }).fail(function() {
+                console.log('请求失败');
+            });
+        }
         //派工
         $('.paiGong').click(function (res) {
             var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow');    //获取勾选记录的ID

+ 13 - 1
application/common/model/Todo.php

@@ -601,7 +601,7 @@ class Todo extends Base
                     }
                 }
             }
-            if($data['work_type_mode'] == 3){
+            if($info['work_type_mode'] == 3){
                 $wlps = Db::connect('db_config_jili')->name('wlps')->where('order_id',$data['order_id'])->find();
                 if($wlps){
                     Db::connect('db_config_jili')->name('wlps')->where('id',$wlps['id'])->update([
@@ -862,6 +862,18 @@ class Todo extends Base
                 return false;
             }
 
+            $bxRoles = model('Config')->getConfig('org_bh_roles',$todo['org_id']);
+            if (!empty($bxRoles)){
+                $bxRoles = explode(',', $bxRoles);
+                $userRoles = Db::name('user_roles')->where('user_id',$userId)->value('roles_id') ?? 0;
+                if (!in_array((int)$userRoles,$bxRoles)){
+                    $this->error = '当前用户角色无驳回权限';
+                    return false;
+                }
+            }else{
+                $this->error = '当前用户角色无驳回权限';
+                return false;
+            }
 
             if($todo['todo_mode']!==1){
                 $this->error = '当前状态不能驳回';