Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b1c3adf1
authored
Jul 19, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
权限查询
parent
022b576b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
3 deletions
app/Http/Controllers/Filter/SupplierExaminationFilter.php
app/Http/Services/DepartmentService.php
resources/views/web/SupplierExaminationList.blade.php
app/Http/Controllers/Filter/SupplierExaminationFilter.php
View file @
b1c3adf1
...
...
@@ -3,9 +3,12 @@
namespace
App\Http\Controllers\Filter
;
use
App\Http\Services\AdminUserService
;
use
App\Http\Services\DepartmentService
;
use
App\Model\SupplierAccountModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierExaminationModel
;
use
Illuminate\Support\Facades\DB
;
class
SupplierExaminationFilter
{
...
...
@@ -15,15 +18,25 @@ class SupplierExaminationFilter
$map
=
$request
->
all
();
$canViewAllSupplierExamination
=
checkPerm
(
'ViewAllSupplierExamination'
);
$canViewSubordinateSupplierExamination
=
checkPerm
(
'ViewSubordinateSupplierExamination'
);
$userId
=
$request
->
user
->
userId
;
$name
=
$request
->
user
->
name
;
$model
=
new
SupplierExaminationModel
();
$query
=
$model
->
orderBy
(
'id'
,
'desc'
);
if
(
$canViewAllSupplierExamination
)
{
//能查看所有的话,限制基本没有
}
else
{
$query
->
where
(
'purchase_name'
,
$name
);
//如果能看部下的,那需要判断的地方就多了不少
if
(
$canViewSubordinateSupplierExamination
)
{
$departmentService
=
new
DepartmentService
();
//下属用户(结果包括自己)
$subordinateUserNames
=
$departmentService
->
getSubordinateUserNames
(
$userId
);
$query
->
whereIn
(
'purchase_name'
,
$subordinateUserNames
);
}
else
{
$query
->
where
(
'purchase_name'
,
$name
);
}
}
if
(
!
empty
(
$map
[
'supplier_name'
]))
{
...
...
app/Http/Services/DepartmentService.php
View file @
b1c3adf1
...
...
@@ -21,6 +21,13 @@ class DepartmentService
return
array_column
(
$users
,
'userId'
);
}
public
function
getSubordinateUserNames
(
$adminId
)
{
$departmentId
=
DB
::
table
(
'user_info'
)
->
where
(
'userId'
,
$adminId
)
->
value
(
'department_id'
);
$users
=
$this
->
getUserByDepartmentId
(
$departmentId
);
return
array_column
(
$users
,
'name'
);
}
// 获取部门人员
public
function
getUserByDepartmentId
(
$departmentId
,
$status
=
''
,
$filter
=
''
)
{
...
...
resources/views/web/SupplierExaminationList.blade.php
View file @
b1c3adf1
...
...
@@ -55,7 +55,6 @@
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"delete_supplier_examination"
>
删除
</button>
@endif
</div>
<table
class=
"layui-table"
id=
"supplierExaminationList"
lay-filter=
"supplierExaminationList"
></table>
</div>
@if(request()->get('supplier_id'))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment