Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_admin
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
fa1595cd
authored
Dec 06, 2022
by
宁成龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复权限
parent
ac4c8093
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
6 deletions
app/Admin/Actions/User/UserAssignAction.php
app/Admin/Forms/User/AssignUserHandle.php
app/Admin/Forms/User/TransferUserHandle.php
app/Admin/Actions/User/UserAssignAction.php
View file @
fa1595cd
...
@@ -19,16 +19,16 @@ class UserAssignAction extends BatchAction
...
@@ -19,16 +19,16 @@ class UserAssignAction extends BatchAction
protected
$action
;
protected
$action
;
protected
$htmlClasses
=
[
'btn btn-primary btn-sm btn-mini'
];
protected
$htmlClasses
=
[
'btn btn-primary btn-sm btn-mini'
];
// 注意action的构造方法参数一定要给默认值
// 注意action的构造方法参数一定要给默认值
1指派,2转让
public
function
__construct
()
public
function
__construct
(
$action
=
1
)
{
{
$this
->
title
=
""
;
$this
->
title
=
""
;
$this
->
action
=
1
;
$this
->
action
=
$action
;
}
}
public
function
render
()
public
function
render
()
{
{
$form
=
AssignUserHandle
::
make
();
$form
=
AssignUserHandle
::
make
(
[
'action'
=>
$this
->
action
]
);
$buttonName
=
trans
(
'user.labels.assign'
);
$buttonName
=
trans
(
'user.labels.assign'
);
return
Modal
::
make
()
->
lg
()
->
title
(
$this
->
title
)
->
body
(
$form
->
payload
([]))
->
onLoad
(
$this
->
getModalScript
())
->
button
(
'<button class="btn btn-primary">
return
Modal
::
make
()
->
lg
()
->
title
(
$this
->
title
)
->
body
(
$form
->
payload
([]))
->
onLoad
(
$this
->
getModalScript
())
->
button
(
'<button class="btn btn-primary">
<i class="feather icon-check-circle"></i><span class="d-none d-sm-inline" style="margin-left: 5px">'
.
$buttonName
.
'</span>
<i class="feather icon-check-circle"></i><span class="d-none d-sm-inline" style="margin-left: 5px">'
.
$buttonName
.
'</span>
...
...
app/Admin/Forms/User/AssignUserHandle.php
View file @
fa1595cd
...
@@ -43,7 +43,7 @@ class AssignUserHandle extends Form implements LazyRenderable
...
@@ -43,7 +43,7 @@ class AssignUserHandle extends Form implements LazyRenderable
{
{
$this
->
disableResetButton
();
$this
->
disableResetButton
();
$this
->
hidden
(
'id'
)
->
attribute
(
'id'
,
'id'
);
$this
->
hidden
(
'id'
)
->
attribute
(
'id'
,
'id'
);
$this
->
select
(
'sale_id'
)
->
options
(
CmsUser
::
pluck
(
'name'
,
'userId'
)
->
toArray
())
->
default
(
0
)
->
required
();
$this
->
select
(
'sale_id'
)
->
options
(
CmsUser
::
getUserList
())
->
default
(
0
)
->
required
();
}
}
/**
/**
...
...
app/Admin/Forms/User/TransferUserHandle.php
View file @
fa1595cd
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
App\Admin\Forms\User
;
namespace
App\Admin\Forms\User
;
use
App\Admin\Service\PermService
;
use
App\Admin\Service\UserService
;
use
App\Admin\Service\UserService
;
use
App\Models\Cms\CmsUser
;
use
App\Models\Cms\CmsUser
;
use
App\Models\Inquiry
;
use
App\Models\Inquiry
;
...
@@ -36,6 +37,43 @@ class TransferUserHandle extends Form implements LazyRenderable
...
@@ -36,6 +37,43 @@ class TransferUserHandle extends Form implements LazyRenderable
}
}
}
}
public
function
getCmsUserList
()
{
CmsUser
::
getUserList
();
$where
=
[];
$where
[]
=
[
function
(
$query
)
{
$viewList
=
User
::
$ruleViewList
;
$adminUser
=
"userId"
;
$nowSaleId
=
getAdminUserId
();
if
(
$nowSaleId
==
1000
)
{
return
$query
;
}
//查看所有
if
(
checkPerm
(
$viewList
[
0
]))
{
return
$query
;
}
//查看下级
if
(
checkPerm
(
$viewList
[
1
]))
{
//查看下级的权限//获取用户部门下的所有用户
$userIds
=
PermService
::
getSubUserId
(
$nowSaleId
);
if
(
!
empty
(
$userIds
))
{
return
$query
->
whereIn
(
$adminUser
,
$userIds
);
}
}
//查看同组
$user_info
=
CmsUser
::
getInfoByUserId
(
$nowSaleId
);
if
(
empty
(
$user_info
)
||
!
$user_info
[
'department_id'
])
{
return
$query
->
where
(
$adminUser
,
$nowSaleId
);
}
// 获取下级部门的人员
$sub_user_ids
=
CmsUser
::
getUserIdsByDepartmentIds
([
$user_info
[
'department_id'
]]);
return
$query
->
whereIn
(
$adminUser
,
$sub_user_ids
);
}
];
return
CmsUser
::
where
(
$where
)
->
pluck
(
'name'
,
'userId'
)
->
toArray
();
}
/**
/**
* Build a form here.
* Build a form here.
*/
*/
...
@@ -43,7 +81,7 @@ class TransferUserHandle extends Form implements LazyRenderable
...
@@ -43,7 +81,7 @@ class TransferUserHandle extends Form implements LazyRenderable
{
{
$this
->
disableResetButton
();
$this
->
disableResetButton
();
$this
->
hidden
(
'id'
)
->
attribute
(
'id'
,
'id'
);
$this
->
hidden
(
'id'
)
->
attribute
(
'id'
,
'id'
);
$this
->
select
(
'sale_id'
)
->
options
(
CmsUser
::
get
UserList
())
->
default
(
0
)
->
required
();
$this
->
select
(
'sale_id'
)
->
options
(
$this
->
getCms
UserList
())
->
default
(
0
)
->
required
();
}
}
/**
/**
...
...
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