wugg 8 months ago
parent
commit
0a0a774ae2

+ 1 - 0
app/admin/controller/Base.php

@@ -14,6 +14,7 @@ class Base extends BaseController
    protected $roleid=0;
    protected $level="0";
    protected $token="";
+   protected $model=null;
    public function __construct(App $app) {
    	parent::__construct($app);
    	$this->token = $this->request->param('token','','trim');

+ 14 - 1
app/admin/controller/Menu.php

@@ -8,9 +8,22 @@ use think\App;
 class Menu extends Base{
 	public function __construct(App $app) {
 		parent::__construct($app);
+		$this->model=new \app\admin\model\Menu();
 	}
 	
 	public function list(){
-		return error(100);
+	    $param = $this->request->param(["relaComNo"=>"","level"=>""],"post","trim");
+	    $condition = [
+	        ['status','=',1],
+	        ['is_display','=',1]
+        ];
+        $action = \app\admin\model\UserRole::getAllAction($this->uid,$param['relaComNo'],$this->level);
+        if(isset($param['level']) && $param['level'] !== '') $condition[] = ['level','in',[0,$param['level']]];
+        else {
+            if($this->level == 1) $condition[] = ['level','in',[0,1,2]];
+            else $condition[] = ['level','in',[0,$this->level]];
+        }
+        $list=$this->model->getMenu($action,$condition);
+
 	}
 }

+ 1 - 1
app/admin/model/RoleAction.php

@@ -16,7 +16,7 @@ class RoleAction extends Base
         'updatetime'       =>'datetime',//
 
     ];
-        protected $updateTime='updatetime';
+    protected $updateTime='updatetime';
     protected $createTime='addtime';
      public function GetActionConllectAttr($v){
         return json_decode($v,true);

+ 30 - 0
app/admin/model/UserRole.php

@@ -20,4 +20,34 @@ class UserRole extends Model
 	        'is_del' => 0])
 	        ->value('role_id','');
     }
+
+    public function RoleInfo(){
+	  return  $this->belongsTo(RoleAction::class,"roleid","role_id")->bind(['action_conllect']);
+    }
+
+    public static function getAllAction($uid=0,$companyNo='',$level=0){
+	    switch ($level){
+	        case 1:
+	            $action = Action::where(['is_del' => 0, 'status' => 1]) ->column('id');
+	            break;
+	        case 2:
+	            $role = self::where([
+	                'uid' => $uid,
+	                'companyNo' => $companyNo,
+	                'is_del' => 0])->with('RoleInfo')
+	               ->findOrEmpty();
+	            $action = $role->action_conllect??[];
+	           break;
+	       case 3:
+	          $role = self::where([
+	          	                'uid' => $uid,
+	          	                'is_del' => 0])->with('RoleInfo')
+	          	               ->findOrEmpty();
+	           $action = $role->action_conllect??[];
+	         break;
+	         default:
+	             $action = [];
+	    }
+	    return $action;
+    }
 }

+ 3 - 3
app/bug/controller/WorkRole.php

@@ -258,9 +258,9 @@ class WorkRole extends Base{
 		}
 		
 	
-		$list =AccountCompany::with(["accountInfo"=>["userInfo","accountItem"=>["itemName"]]])
-		->withJoin(["account_info"],"left")
-		->where($where)->order('id asc')
+		$list =Account::with(["userInfo","accountItem"=>["itemName"]])
+		->leftJoin("account_company a","a.account_id= account.id")
+		->where($where)->order('account.id desc')
 		->paginate(['list_rows'=>$param['size'],'page'=>$param['page']]);
 
 		foreach ($list->items() as &$item){

+ 3 - 1
app/bug/model/WorkUser.php

@@ -1,7 +1,8 @@
 <?php
 namespace app\bug\model;
 
-use app\user\model\Account;use think\model\concern\SoftDelete;
+use app\user\model\Account;
+use think\model\concern\SoftDelete;
 class WorkUser extends Base
 {
 //设置字段信息
@@ -10,6 +11,7 @@ class WorkUser extends Base
         'id'  =>'int',//
         'account_id'  =>'int',//账户id
         'role_id'  =>'int',//岗位角色id
+        'companyNo'  =>'varchar',//岗位角色id
         'status'  =>'tinyint',//状态 0未启用1启用 2推送到系统3推送失败4已废弃
         'apply_name'  =>'varchar',//
         'apply_id'  =>'int',//