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
26a96a24
authored
Nov 07, 2022
by
宁成龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
完善用户列表
parent
46abd3ee
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
29 deletions
app/Admin/Controllers/UserController.php
app/Admin/Service/UserService.php
app/Admin/routes.php
resources/lang/en/user.php
resources/lang/zh_CN/user.php
app/Admin/Controllers/UserController.php
View file @
26a96a24
...
...
@@ -3,6 +3,7 @@
namespace
App\Admin\Controllers
;
use
App\Admin\Repositories\User
;
use
App\Admin\Service\UserService
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Show
;
...
...
@@ -18,30 +19,13 @@ class UserController extends AdminController
protected
function
grid
()
{
return
Grid
::
make
(
new
User
(),
function
(
Grid
$grid
)
{
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'user_sn'
);
$grid
->
column
(
'name'
);
$grid
->
column
(
'email'
);
$grid
->
column
(
'email_verified_at'
);
$grid
->
column
(
'password'
);
$grid
->
column
(
'phone'
);
$grid
->
column
(
'remember_token'
);
$grid
->
column
(
'account_properties'
);
$grid
->
column
(
'status'
);
$grid
->
column
(
'company_name'
);
$grid
->
column
(
'first_name'
);
$grid
->
column
(
'sale_id'
);
$grid
->
column
(
'sale_name'
);
$grid
->
column
(
'last_name'
);
$grid
->
column
(
'created_time'
);
$grid
->
column
(
'update_time'
);
$grid
->
column
(
'created_at'
);
$grid
->
column
(
'updated_at'
)
->
sortable
();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
equal
(
'id'
);
});
$grid
->
showFilter
();
$grid
->
disableActions
();
$grid
->
disableFilterButton
();
$grid
->
disableRefreshButton
();
$grid
->
disableCreateButton
();
UserService
::
userListFilter
(
$grid
);
UserService
::
userListListField
(
$grid
);
});
}
...
...
@@ -102,7 +86,7 @@ class UserController extends AdminController
$form
->
text
(
'last_name'
);
$form
->
text
(
'created_time'
);
$form
->
text
(
'update_time'
);
$form
->
display
(
'created_at'
);
$form
->
display
(
'updated_at'
);
});
...
...
app/Admin/Service/UserService.php
0 → 100644
View file @
26a96a24
<?php
namespace
App\Admin\Service
;
use
App\Models\Cms\CmsUser
;
use
Dcat\Admin\Grid
;
class
UserService
{
public
static
function
userListFilter
(
Grid
$grid
){
$grid
->
filter
(
function
(
$filter
)
{
$filter
->
expand
(
true
);
$filter
->
whereBetween
(
'create_time'
,
function
(
$q
)
{
$start
=
strtotime
(
$this
->
input
[
'start'
]
??
null
);
$end
=
strtotime
(
$this
->
input
[
'end'
]
??
null
);
$q
->
whereBetween
(
'create_time'
,
[
$start
,
$end
]);
})
->
datetime
()
->
width
(
3
);
$filter
->
startWith
(
'company_name'
)
->
width
(
2
);
$filter
->
startWith
(
'user_sn'
)
->
width
(
2
);
$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
);
});
}
public
static
function
userListListField
(
Grid
$grid
){
$grid
->
column
(
'company_name'
);
$grid
->
column
(
'user_sn'
);
$grid
->
column
(
'name'
);
$grid
->
column
(
'phone'
);
$grid
->
column
(
'email'
);
$grid
->
column
(
'sale_name'
);
$grid
->
column
(
'status'
)
->
using
(
admin_trans
(
'user.options.status'
));
$grid
->
column
(
'created_time'
)
->
display
(
function
(
$time
)
{
return
$time
?
date
(
'Y-m-d H:i:s'
,
$time
)
:
''
;
})
->
sortable
();;
$grid
->
column
(
'update_time'
)
->
display
(
function
(
$time
)
{
return
$time
?
date
(
'Y-m-d H:i:s'
,
$time
)
:
''
;
})
->
sortable
();;
}
}
app/Admin/routes.php
View file @
26a96a24
...
...
@@ -17,5 +17,5 @@ Route::group([
$router
->
resource
(
'inquiry'
,
'InquiryController'
);
$router
->
resource
(
'order'
,
'OrderController'
);
$router
->
resource
(
'test'
,
'TestController'
);
$router
->
resource
(
'users'
,
'UserController'
);
});
resources/lang/en/user.php
View file @
26a96a24
<?php
<?php
return
[
'labels'
=>
[
'User'
=>
'User'
,
...
...
@@ -12,8 +12,8 @@ return [
'password'
=>
'密码'
,
'phone'
=>
'手机号码'
,
'remember_token'
=>
'记住登陆token'
,
'account_properties'
=>
'账号属性
,1是个人,2是企业
'
,
'status'
=>
'状态
,1是正常,-1是禁用
'
,
'account_properties'
=>
'账号属性'
,
'status'
=>
'状态'
,
'company_name'
=>
'公司名称'
,
'first_name'
=>
'名字'
,
'sale_id'
=>
'业务员'
,
...
...
@@ -23,5 +23,9 @@ return [
'update_time'
=>
'更新时间'
,
],
'options'
=>
[
"status"
=>
[
"1"
=>
"正常"
,
"-1"
=>
"禁用"
]
],
];
resources/lang/zh_CN/user.php
0 → 100755
View file @
26a96a24
<?php
return
[
'labels'
=>
[
'User'
=>
'User'
,
'user'
=>
'User'
,
],
'fields'
=>
[
'user_sn'
=>
'客户编码'
,
'name'
=>
'用户名'
,
'email'
=>
'邮箱'
,
'email_verified_at'
=>
'邮箱校验时间'
,
'password'
=>
'密码'
,
'phone'
=>
'手机号码'
,
'remember_token'
=>
'记住登陆token'
,
'account_properties'
=>
'账号属性'
,
'status'
=>
'状态'
,
'company_name'
=>
'公司名称'
,
'first_name'
=>
'名字'
,
'sale_id'
=>
'业务员'
,
'sale_name'
=>
'业务员名字'
,
'last_name'
=>
'姓氏'
,
'created_time'
=>
'创建时间'
,
'update_time'
=>
'更新时间'
,
],
'options'
=>
[
"status"
=>
[
"1"
=>
"正常"
,
"-1"
=>
"禁用"
]
],
];
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