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
03be81b9
authored
Nov 04, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
优化前端
parent
9a212bf4
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
47 additions
and
30 deletions
app/Admin/Actions/Grid/HandleInquiry.php
app/Admin/Controllers/InquiryController.php
app/Admin/Forms/HandleInquiry.php
app/Models/Inquiry.php
public/vendor/dcat-admin/images/logo.png
public/vendor/dcat-admin/images/logo_back.png
resources/lang/en/global.php
resources/lang/en/inquiry.php
resources/lang/zh_CN/global.php
resources/lang/zh_CN/inquiry.php
app/Admin/Actions/Grid/HandleInquiry.php
View file @
03be81b9
...
...
@@ -3,14 +3,7 @@
namespace
App\Admin\Actions\Grid
;
use
App\Admin\Traits\BatchAction
;
use
Dcat\Admin\Actions\Response
;
use
Dcat\Admin\Grid\Displayers\Button
;
use
Dcat\Admin\Grid\Tools\AbstractTool
;
use
Dcat\Admin\Traits\HasPermissions
;
use
Dcat\Admin\Widgets\Modal
;
use
Illuminate\Contracts\Auth\Authenticatable
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Http\Request
;
class
HandleInquiry
extends
BatchAction
{
...
...
@@ -25,26 +18,31 @@ class HandleInquiry extends BatchAction
public
function
render
()
{
$form
=
\App\Admin\Forms\HandleInquiry
::
make
();
$buttonName
=
trans
(
'inquiry.labels.handle'
);
return
Modal
::
make
()
->
lg
()
->
title
(
$this
->
title
)
->
body
(
$form
)
->
onLoad
(
$this
->
getModalScript
())
->
button
(
'<button class="btn btn-primary">
<i class="feather icon-filter"></i><span class="d-none d-sm-inline"> Handle</span>
<span class="filter-count"></span>
<i class="feather icon-filter"></i><span class="d-none d-sm-inline" style="margin-left: 5px">'
.
$buttonName
.
'</span>
</button>'
);
}
protected
function
getModalScript
()
{
// 弹窗显示后往隐藏的id表单中写入批量选中的行ID
$warning
=
admin_trans
(
'global.labels.operate_must_single'
);
$warning
=
trans
(
'global.labels.operate_must_single'
);
$warning2
=
trans
(
'global.labels.operate_must_select_data'
);
return
<<<JS
// 获取选中的ID数组
var key = {$this->getSelectedKeysScript()}
if (key.length > 1){
Dcat.swal.error('$warning');
Dcat.reload();
Dcat.reload();
return false;
}
if (!key.length){
Dcat.swal.error('$warning2');
Dcat.reload();
}
$('#inquiry_id').val(key);
JS;
}
...
...
app/Admin/Controllers/InquiryController.php
View file @
03be81b9
...
...
@@ -7,6 +7,8 @@ use App\Admin\Renderable\BarChart;
use
App\Admin\Renderable\InquiryDetail
;
use
App\Admin\Renderable\PostTable
;
use
App\Admin\Repositories\Inquiry
;
use
App\Models\Cms\CmsUser
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Show
;
...
...
@@ -22,33 +24,31 @@ class InquiryController extends AdminController
*/
protected
function
grid
()
{
return
Grid
::
make
(
new
Inquiry
([
'user'
]),
function
(
Grid
$grid
)
{
return
Grid
::
make
(
new
Inquiry
([
'user'
,
'sales_user'
]),
function
(
Grid
$grid
)
{
$grid
->
showFilter
();
$grid
->
disableActions
();
$grid
->
filter
(
function
(
$filter
)
{
$filter
->
expand
(
true
);
$filter
->
equal
(
'inquiry_id'
)
->
width
(
3
);
$filter
->
like
(
'inquiry_sn'
)
->
width
(
3
);
$filter
->
equal
(
'status'
)
->
select
(
admin_trans
(
'inquiry.options.status'
))
->
width
(
3
);
$filter
->
equal
(
'priority'
)
->
select
(
admin_trans
(
'inquiry.options.priority'
))
->
width
(
3
);
$filter
->
like
(
'user.email'
)
->
width
(
3
);
$filter
->
like
(
'user.phone'
)
->
width
(
3
);
$filter
->
equal
(
'sales_name'
)
->
select
(
admin_trans
(
'inquiry.options.priority'
))
->
width
(
3
);
$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
->
like
(
'user.company_name'
)
->
width
(
3
);
$filter
->
like
(
'user.id'
)
->
width
(
3
);
$filter
->
equal
(
'inquiry_id'
)
->
width
(
3
);
$filter
->
like
(
'user.email'
)
->
width
(
3
);
$filter
->
like
(
'user.phone'
)
->
width
(
3
);
$filter
->
like
(
'inquiry_sn'
)
->
width
(
3
);
$filter
->
equal
(
'priority'
)
->
select
(
admin_trans
(
'inquiry.options.priority'
))
->
width
(
3
);
$filter
->
equal
(
'status'
)
->
select
(
admin_trans
(
'inquiry.options.status'
))
->
width
(
3
);
$filter
->
equal
(
'sales_name'
)
->
select
(
CmsUser
::
pluck
(
'name'
,
'userId'
)
->
toArray
())
->
width
(
3
);
});
$grid
->
tools
(
new
HandleInquiry
(
admin_trans
(
'inquiry.labels.handle'
)));
$grid
->
model
()
->
orderBy
(
'inquiry_id'
,
'desc'
);
$grid
->
column
(
'inquiry_id'
)
->
sortable
();
$grid
->
column
(
'task_type'
)
->
display
(
admin_trans
(
'inquiry.options.task_type.1'
));
$grid
->
column
(
'user.email'
);
$grid
->
column
(
'inquiry_sn'
)
->
modal
(
function
(
Grid\Displayers\Modal
$modal
)
{
$modal
->
xl
();
// 标题
...
...
@@ -57,17 +57,21 @@ class InquiryController extends AdminController
$list
=
InquiryDetail
::
inquiryItems
(
$this
->
inquiry_id
);
return
new
Card
(
$detail
)
.
new
Card
(
$list
);
});
$grid
->
column
(
'task_type'
)
->
display
(
admin_trans
(
'inquiry.options.task_type.1'
));
$grid
->
column
(
'user.phone'
);
$grid
->
column
(
'user.email'
);
$grid
->
column
(
'status'
)
->
using
(
admin_trans
(
'inquiry.options.status'
))
->
badge
([
-
1
=>
'danger'
,
0
=>
'primary'
,
1
=>
'success'
])
->
sortable
();
$grid
->
column
(
'remark'
);
$grid
->
column
(
'priority'
)
->
using
(
admin_trans
(
'inquiry.options.priority'
))
->
badge
([
1
=>
'primary'
,
2
=>
'success'
,
3
=>
'danger'
]);
$grid
->
column
(
'remark'
)
->
limit
(
10
);
$grid
->
column
(
'sales_user.name'
);
$grid
->
column
(
'user_types'
)
->
using
(
admin_trans
(
'inquiry.options.user_types'
));
$grid
->
column
(
'processing_time'
)
->
display
(
function
(
$time
)
{
return
$time
?
date
(
'Y-m-d H:i:s'
,
$time
)
:
''
;
...
...
app/Admin/Forms/HandleInquiry.php
View file @
03be81b9
...
...
@@ -4,6 +4,7 @@ namespace App\Admin\Forms;
use
App\Models\Inquiry
;
use
Dcat\Admin\Models\Administrator
;
use
Dcat\Admin\Widgets\Alert
;
use
Dcat\Admin\Widgets\Form
;
use
Dcat\Admin\Traits\LazyWidget
;
use
Dcat\Admin\Contracts\LazyRenderable
;
...
...
@@ -21,6 +22,13 @@ class HandleInquiry extends Form implements LazyRenderable
*/
public
function
handle
(
array
$input
)
{
$status
=
Inquiry
::
where
(
'inquiry_id'
,
$input
[
'inquiry_id'
])
->
value
(
'status'
);
if
(
$status
!==
Inquiry
::
STATUS_PENDING
)
{
return
$this
->
response
()
->
error
(
trans
(
'inquiry.labels.inquiry_handle_status_wrong'
))
->
refresh
();
}
Inquiry
::
where
(
'inquiry_id'
,
$input
[
'inquiry_id'
])
->
update
([
'status'
=>
$input
[
'status'
],
'processing_result'
=>
$input
[
'handle_result'
]
...
...
@@ -49,8 +57,7 @@ class HandleInquiry extends Form implements LazyRenderable
public
function
default
()
{
return
[
'name'
=>
'John Doe'
,
'email'
=>
'John.Doe@gmail.com'
,
];
}
}
app/Models/Inquiry.php
View file @
03be81b9
...
...
@@ -18,6 +18,10 @@ class Inquiry extends Model
public
$timestamps
=
false
;
const
STATUS_PROCESSED
=
1
;
const
STATUS_PENDING
=
0
;
const
STATUS_CLOSED
=
-
1
;
public
function
user
()
{
return
$this
->
belongsTo
(
User
::
class
,
'user_id'
,
'id'
);
...
...
public/vendor/dcat-admin/images/logo.png
View file @
03be81b9
7.76 KB
|
W:
|
H:
7.39 KB
|
W:
|
H:
2-up
Swipe
Onion skin
public/vendor/dcat-admin/images/logo_back.png
0 → 100644
View file @
03be81b9
7.76 KB
resources/lang/en/global.php
View file @
03be81b9
...
...
@@ -32,7 +32,8 @@ return [
'create'
=>
'create'
,
'root'
=>
'root'
,
'scaffold'
=>
'scaffold'
,
'operate_must_single'
=>
'This operation can only be a single option'
,
'operate_must_single'
=>
'This operation can be performed only in one option'
,
'operate_must_select_data'
=>
'Please select your operation item'
,
'handle_status'
=>
'Handle Status'
,
'handle_result'
=>
'Handle Result'
,
],
...
...
resources/lang/en/inquiry.php
View file @
03be81b9
...
...
@@ -4,7 +4,8 @@ return [
'Inquiry'
=>
'Inquiry'
,
'inquiry'
=>
'Inquiry'
,
'inquiry_detail'
=>
'Inquiry Detail'
,
'handle'
=>
'Handle'
'handle'
=>
'Handle'
,
'inquiry_handle_status_wrong'
=>
'Only pending inquiry can be handle'
,
],
'fields'
=>
[
'inquiry_id'
=>
'Id'
,
...
...
resources/lang/zh_CN/global.php
View file @
03be81b9
...
...
@@ -39,6 +39,7 @@ return [
'scaffold'
=>
'代码生成器'
,
'UserAddress'
=>
'用户地址管理'
,
'operate_must_single'
=>
'该操作只能单选'
,
'operate_must_select_data'
=>
'请选择要操作的数据'
,
'handle_status'
=>
'处理状态'
,
'handle_result'
=>
'处理结果'
,
],
...
...
resources/lang/zh_CN/inquiry.php
View file @
03be81b9
...
...
@@ -4,7 +4,8 @@ return [
'Inquiry'
=>
'Inquiry'
,
'inquiry'
=>
'Inquiry'
,
'inquiry_detail'
=>
'询价详情'
,
'handle'
=>
'处理'
'handle'
=>
'处理'
,
'inquiry_handle_status_wrong'
=>
'只有待处理的询价才能被处理'
,
],
'fields'
=>
[
'inquiry_id'
=>
'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