|
@@ -156,23 +156,18 @@ public function __construct(App $app)
|
|
|
$value['status_name'] = $var['status_name'];
|
|
|
|
|
|
//根据角色筛选
|
|
|
- $uids_role = Db::name('user_role')
|
|
|
- ->where([['is_del', '=', 0], ['roleid', 'in', $value['roleid']]])
|
|
|
- ->column('uid');
|
|
|
-
|
|
|
- //根据数据权限筛选
|
|
|
- $uids_group_share = $this->getUidsByGroupAndShare($value['order_type']);
|
|
|
-
|
|
|
- $uids = array_merge($uids_role, $uids_group_share, $value['wait_id'] ?? []);
|
|
|
- $uids = array_unique($uids);
|
|
|
-
|
|
|
- sort($uids);
|
|
|
+ $users=Db::name('user_role')
|
|
|
+ ->alias('a')
|
|
|
+ ->where([
|
|
|
+ ['a.is_del','=',0],
|
|
|
+ ['a.roleid','in',$value['roleid']],
|
|
|
+ ['b.nickname','<>',''],
|
|
|
+ ['b.is_del', '=', 0],
|
|
|
+ ])->leftJoin('depart_user b','b.uid=a.uid')
|
|
|
+ ->column('b.nickname');
|
|
|
|
|
|
//当前操作人
|
|
|
- $value['handle_user_list'] = Db::name('depart_user')
|
|
|
- ->where(['is_del' => 0, 'status' => 1])
|
|
|
- ->whereIn('uid', $uids)
|
|
|
- ->column('nickname');
|
|
|
+ $value['handle_user_list'] = $value['wait_name'] ? array_merge($users, [$value['wait_name']]) : $users;
|
|
|
|
|
|
$data[] = $value;
|
|
|
}
|
|
@@ -200,68 +195,4 @@ public function all(){
|
|
|
return app_show(0,"获取成功",$list);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- //根据流程对应菜单,查找我能看到哪些人的数据
|
|
|
- private function getUidsByGroupAndShare(string $order_type = '')
|
|
|
- {
|
|
|
- //流程与菜单id的对应关系,22-09-22 16:35:00添加,以后要时不时的查看有无新的流程添加,及时维护,后续新版用户组和数据共享上线之后就可以不用这个方法了
|
|
|
- $process_menu_id = [
|
|
|
- 'CGD' => 42,//采购单流程
|
|
|
- 'RKD' => 70,//采购单入库流程
|
|
|
- 'BHD' => 148,//备货申请单流程
|
|
|
- 'XSQRD' => 46,//销售订单流程
|
|
|
- 'CKD' => 98,//发货申请单流程
|
|
|
- 'SHD' => 48,//售后申请单流程
|
|
|
- 'CKTHD' => 50,//售后退货单流程
|
|
|
- 'XSTHD' => 75,//销售退货单流程
|
|
|
- 'CGGCD' => 68,//采购工差单流程
|
|
|
- 'XSGCD' => 151,//销售工差单流程
|
|
|
- 'DBD' => 21,//调拨单流程
|
|
|
- 'PDD' => 22,//盘点单流程
|
|
|
- 'YJD' => 146,//议价单流程
|
|
|
- 'PRO' => 142,//项目单流程
|
|
|
- 'SPCB' => 115,//商品成本流程
|
|
|
- 'SPSX' => 116,//商品上线流程
|
|
|
- 'HD' => 127,//活动流程
|
|
|
- 'YZSX' => 183,//有赞商品上架流程
|
|
|
- 'YZQRD' => 190,//有赞订单审核流程
|
|
|
- 'LZJJ' => 14,//离职交接流程
|
|
|
- 'CGTHD' => 96,//采购单退货流程
|
|
|
- 'ZXD' => 144,//竞价单流程
|
|
|
- 'GOL' => 173,//商品下线流程
|
|
|
- ];
|
|
|
-
|
|
|
- //先确定自己所属的用户组
|
|
|
- $group_ids = Db::name('role_group')
|
|
|
- ->where([
|
|
|
- 'is_del' => 0, 'status' => 1
|
|
|
- ])->whereFindInSet('group_user', $this->uid)
|
|
|
- ->column('id');
|
|
|
-
|
|
|
- $tmp = Db::name('role_group')
|
|
|
- ->field('group_user')
|
|
|
- ->where([
|
|
|
- 'is_del' => 0, 'status' => 1
|
|
|
- ])->whereIn('id', $group_ids)
|
|
|
- ->cursor();
|
|
|
- $uids = [];
|
|
|
- foreach ($tmp as $uid) {
|
|
|
- $uids = array_merge($uids, explode(',', $uid['group_user']));
|
|
|
- }
|
|
|
-
|
|
|
- //查找共享数据
|
|
|
- $share = Db::name('role_share')
|
|
|
- ->where(['is_del' => 0, 'status' => 1])
|
|
|
- ->whereFindInSet('action_collect', isset($process_menu_id[$order_type]) ? $process_menu_id[$order_type] : 0)
|
|
|
- ->where(function ($query) use ($group_ids) {
|
|
|
- return $query->where('to_user', $this->uid)->whereOr('to_group', 'in', $group_ids);
|
|
|
- })->column('share_user');
|
|
|
-
|
|
|
- if ($share) $uids = array_merge($uids, $share);
|
|
|
-
|
|
|
- return $uids;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
}
|