wugg vor 9 Monaten
Ursprung
Commit
e2f867a279
1 geänderte Dateien mit 6 neuen und 4 gelöschten Zeilen
  1. 6 4
      app/bug/controller/WorkRole.php

+ 6 - 4
app/bug/controller/WorkRole.php

@@ -57,6 +57,8 @@ class WorkRole extends Base{
         if($template->isEmpty()) return error('岗位模板不存在');
         if($template->status==0)return error('岗位模板已禁用');
         if(empty(array_diff($param['action'],$template->action))==false)return error('选择权限超出模板权限范围');
+        $user = WorkUser::where(['role_id'=>$param['id'],"status"=>[1,2]])->findOrEmpty();
+        if($user->isEmpty()==false)return error('岗位角色有账户正在使用中无法修改');
         $info->role_name= $param['role_name'];
         $info->companyNo= $param['companyNo'];
         $info->work_id= $param['work_id'];
@@ -83,7 +85,7 @@ class WorkRole extends Base{
 		if($info->isEmpty())return error('岗位角色信息不存在');
 		$info->status=$param['status'];
 		$add = $info->save();
-		$messg= WorkRole::$statusCn[$param['status']];
+		$messg= \app\bug\model\WorkRole::$statusCn[$param['status']];
 		return $add ? success("岗位角色{$messg}成功"):error("岗位角色{$messg}失败");
 	}
 	public function  delete(){
@@ -187,9 +189,9 @@ class WorkRole extends Base{
 	    $param = $this->request->param(['role_name'=>'','companyNo'=>'','belong'=>'','account_id'=>'','page'=>1,
 	    'size'=>15],'post','trim');
 		$where=[];
-		if($param['companyNo']!='')$where[]=['companyNo','=',$param['companyNo']];
-		if($param['belong']!='')$where[]=['belong','=',$param['belong']];
-		if($param['role_name']!='')$where[]=['role_name','like',"%{$param['role_name']}%"];
+		if($param['companyNo']!='')$where[]=['workRole.companyNo','=',$param['companyNo']];
+		if($param['belong']!='')$where[]=['workRole.belong','=',$param['belong']];
+		if($param['role_name']!='')$where[]=['workRole.role_name','like',"%{$param['role_name']}%"];
 		if($param['work_id']!='')$where[]=['work_id','=',$param['work_id']];
 		$list =WorkUser::with(["account"])->withJoin(["workRole"],"left")->where($where)->order('workUser.id desc')
 		->paginate(['list_rows'=>$param['size'],'page'=>$param['page']]);