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
5e446ea2
authored
Nov 09, 2022
by
宁成龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
增加转让,分配按钮
parent
cb231d4d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
150 additions
and
6 deletions
app/Admin/Actions/User/UserAssignAction.php
app/Admin/Actions/User/UserTransferAction.php
app/Admin/Controllers/UserController.php
app/Admin/Service/UserService.php
resources/lang/en/user.php
app/Admin/Actions/User/UserAssignAction.php
0 → 100644
View file @
5e446ea2
<?php
namespace
App\Admin\Actions\User
;
use
App\Models\Order
as
OrderModel
;
use
App\Models\User
;
use
Dcat\Admin\Grid\BatchAction
;
use
Dcat\Admin\Grid\Tools\AbstractTool
;
use
Illuminate\Http\Request
;
use
Dcat\Admin\Grid\RowAction
;
class
UserAssignAction
extends
BatchAction
{
protected
$action
;
// 注意action的构造方法参数一定要给默认值
public
function
__construct
(
$title
=
null
,
$action
=
1
)
{
$this
->
title
=
$title
;
$this
->
action
=
$action
;
}
// 确认弹窗信息
public
function
confirm
()
{
return
'您确定要发布已选中的文章吗?'
;
}
public
function
html
()
{
$class
=
$this
->
getElementClass
();
$this
->
setHtmlAttribute
([
"class"
=>
"
{
$class
}
btn btn-primary btn-sm btn-mini"
,
]);
return
parent
::
html
();
// TODO: Change the autogenerated stub
}
// 处理请求
public
function
handle
(
Request
$request
)
{
// 获取选中的文章ID数组
$keys
=
$this
->
getKey
();
// 获取请求参数
$action
=
$request
->
get
(
'action'
);
foreach
(
Post
::
find
(
$keys
)
as
$post
)
{
$post
->
released
=
$action
;
$post
->
save
();
}
$message
=
$action
?
'文章发布成功'
:
'文章下线成功'
;
return
$this
->
response
()
->
success
(
$message
)
->
refresh
();
}
// 设置请求参数
public
function
parameters
()
{
return
[
'action'
=>
$this
->
action
,
];
}
}
app/Admin/Actions/User/UserTransferAction.php
0 → 100644
View file @
5e446ea2
<?php
namespace
App\Admin\Actions\User
;
use
App\Models\Order
as
OrderModel
;
use
App\Models\User
;
use
Dcat\Admin\Grid\BatchAction
;
use
Dcat\Admin\Grid\Tools\AbstractTool
;
use
Illuminate\Http\Request
;
use
Dcat\Admin\Grid\RowAction
;
class
UserTransferAction
extends
BatchAction
{
protected
$action
;
// 注意action的构造方法参数一定要给默认值
public
function
__construct
(
$title
=
null
,
$action
=
1
)
{
$this
->
title
=
$title
;
$this
->
action
=
$action
;
}
// 确认弹窗信息
public
function
confirm
()
{
return
'您确定要发布已选中的文章吗?'
;
}
public
function
html
()
{
$class
=
$this
->
getElementClass
();
$this
->
setHtmlAttribute
([
"class"
=>
"
{
$class
}
btn btn-primary btn-sm btn-mini"
,
]);
return
parent
::
html
();
// TODO: Change the autogenerated stub
}
// 处理请求
public
function
handle
(
Request
$request
)
{
// 获取选中的文章ID数组
$keys
=
$this
->
getKey
();
// 获取请求参数
$action
=
$request
->
get
(
'action'
);
foreach
(
Post
::
find
(
$keys
)
as
$post
)
{
$post
->
released
=
$action
;
$post
->
save
();
}
$message
=
$action
?
'文章发布成功'
:
'文章下线成功'
;
return
$this
->
response
()
->
success
(
$message
)
->
refresh
();
}
// 设置请求参数
public
function
parameters
()
{
return
[
'action'
=>
$this
->
action
,
];
}
}
app/Admin/Controllers/UserController.php
View file @
5e446ea2
...
...
@@ -22,11 +22,12 @@ class UserController extends AdminController
$grid
->
showFilter
();
$grid
->
disableFilterButton
();
$grid
->
disableRefreshButton
();
$grid
->
disable
CreateButton
();
UserService
::
userListFilter
(
$grid
);
$grid
->
disable
BatchDelete
();
// $grid->disableCreateButton(
);
UserService
::
userListListField
(
$grid
);
UserService
::
userListTool
(
$grid
);
UserService
::
userListActions
(
$grid
);
UserService
::
userListFilter
(
$grid
);
});
}
...
...
app/Admin/Service/UserService.php
View file @
5e446ea2
...
...
@@ -4,7 +4,9 @@ namespace App\Admin\Service;
use
App\Admin\Actions\OrderAuditAction
;
use
App\Admin\Actions\OrderReverseAuditAction
;
use
App\Admin\Actions\User\UserAssignAction
;
use
App\Admin\Actions\User\UserStatusAction
;
use
App\Admin\Actions\User\UserTransferAction
;
use
App\Models\Cms\CmsUser
;
use
Dcat\Admin\Grid
;
...
...
@@ -25,7 +27,7 @@ class UserService
$filter
->
startWith
(
'name'
)
->
width
(
2
);
$filter
->
equal
(
'status'
)
->
select
(
admin_trans
(
'user.options.status'
))
->
width
(
2
);
$filter
->
equal
(
'sales_id'
,
trans
(
'inquiry.fields.sales_name'
))
->
select
(
CmsUser
::
pluck
(
'name'
,
'userId'
)
->
toArray
())
->
width
(
3
);
$filter
->
equal
(
'
status'
)
->
select
(
admin_trans
(
'user.options.status
'
))
->
width
(
2
);
$filter
->
equal
(
'
reg_source'
)
->
select
(
admin_trans
(
'user.options.reg_source
'
))
->
width
(
2
);
});
}
...
...
@@ -49,8 +51,8 @@ class UserService
public
static
function
userListTool
(
Grid
$grid
){
$grid
->
tools
([
new
OrderAuditAction
(
),
new
OrderReverseAuditAction
(
),
new
UserAssignAction
(
"分配销售"
),
new
UserTransferAction
(
"转移销售"
),
]);
}
...
...
resources/lang/en/user.php
View file @
5e446ea2
...
...
@@ -22,11 +22,16 @@ return [
'last_name'
=>
'姓氏'
,
'created_time'
=>
'创建时间'
,
'update_time'
=>
'更新时间'
,
'reg_source'
=>
'注册来源'
,
],
'options'
=>
[
"status"
=>
[
"1"
=>
"正常"
,
"-1"
=>
"禁用"
]
],
"reg_source"
=>
[
"1"
=>
"网站"
,
"2"
=>
"人工新增"
],
],
];
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