Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
data-collect
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
汪伟伟
data-collect
Commits
74eee49d
Commit
74eee49d
authored
Feb 01, 2024
by
汪伟伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理员查看任务包方式查看
parent
bc8f9154
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
437 additions
and
79 deletions
+437
-79
app/Admin/Controllers/AlreadyApproveController.php
+3
-6
app/Admin/Controllers/AlreadyDoneTaskController.php
+133
-3
app/Admin/Controllers/AlreadySettlementController.php
+1
-1
app/Admin/Controllers/CreateOrderController.php
+2
-4
app/Admin/Controllers/NoDoneTaskController.php
+127
-4
app/Admin/Controllers/TasController.php
+92
-35
app/Admin/Controllers/TaskController.php
+23
-5
app/Admin/Controllers/TasksApproveController.php
+12
-8
app/Admin/Controllers/TasksCollectController.php
+1
-1
app/Admin/Controllers/TasksOrderController.php
+3
-5
app/Admin/bootstrap.php
+2
-1
app/Models/Tas.php
+11
-2
app/Models/Task.php
+1
-0
resources/lang/zh_CN/tas.php
+2
-2
resources/lang/zh_CN/task.php
+1
-1
resources/views/admin/check.blade.php
+23
-1
No files found.
app/Admin/Controllers/AlreadyApproveController.php
View file @
74eee49d
...
...
@@ -24,6 +24,7 @@ class AlreadyApproveController extends AdminController
protected
function
grid
()
{
return
Grid
::
make
(
TasksApprove
::
with
([
'task'
,
'collects'
,
'user'
]),
function
(
Grid
$grid
)
{
$grid
->
withBorder
();
$grid
->
addTableClass
([
'table-text-center'
]);
//设置表格文字居中
$grid
->
model
()
->
where
(
'status'
,
'>'
,
0
)
...
...
@@ -40,9 +41,7 @@ class AlreadyApproveController extends AdminController
// $grid->column('id')->sortable();
$grid
->
column
(
'task.name'
,
'指标名称'
);
$grid
->
column
(
'task.city_id'
,
'地区'
)
->
display
(
function
(
$v
){
return
CityAreaService
::
getAreaName
(
$v
);
});
$grid
->
column
(
'task.city_id'
,
'地区'
);
$grid
->
column
(
'task.year'
,
'时间'
);
$grid
->
column
(
'task.refer'
,
'参考信源'
)
->
display
(
function
(
$val
)
{
if
(
filter_var
(
$val
,
FILTER_VALIDATE_URL
)
!==
false
)
{
//是链接
...
...
@@ -115,9 +114,7 @@ class AlreadyApproveController extends AdminController
$show
->
field
(
'user.name'
,
'用户'
);
$show
->
field
(
'task.name'
,
'指标名称'
);
$show
->
field
(
'task.city_id'
,
'地区'
)
->
as
(
function
(
$val
)
{
return
CityAreaService
::
getAreaName
(
$val
);
});
$show
->
field
(
'task.city_id'
,
'地区'
);
$show
->
field
(
'task.year'
,
'时间'
);
$show
->
field
(
'task.refer'
,
'参考信源'
);
$show
->
field
(
'task.price'
,
'单价'
);
...
...
app/Admin/Controllers/AlreadyDoneTaskController.php
View file @
74eee49d
...
...
@@ -5,6 +5,7 @@ namespace App\Admin\Controllers;
use
App\Admin\Extensions\Tools\BackAction
;
use
App\Admin\Repositories\TasksReceive
;
use
App\Admin\Services\CityAreaService
;
use
App\Models\Task
;
use
App\Models\TasksCollect
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Form
;
...
...
@@ -12,6 +13,7 @@ use Dcat\Admin\Grid;
use
Dcat\Admin\Layout\Content
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Dcat\Admin\Widgets\Table
;
use
Dcat\Admin\Widgets\Tooltip
;
use
Illuminate\Support\Facades\Storage
;
...
...
@@ -26,7 +28,13 @@ class AlreadyDoneTaskController extends AdminController
*/
protected
function
grid
()
{
$user
=
Admin
::
user
();
if
(
$user
->
is_admin
==
1
){
return
$this
->
adminAlreadyGrid
();
}
return
Grid
::
make
(
TasksReceive
::
with
([
'task'
,
'collects'
,
'user'
,
'approve'
]),
function
(
Grid
$grid
){
$grid
->
withBorder
();
$user
=
Admin
::
user
();
$user
->
is_admin
==
0
&&
$grid
->
model
()
->
where
(
'user_id'
,
$user
->
id
);
$grid
->
addTableClass
([
'table-text-center'
]);
//设置表格文字居中
...
...
@@ -47,9 +55,10 @@ class AlreadyDoneTaskController extends AdminController
// $grid->column('id')->sortable();
$grid
->
column
(
'task.name'
,
'指标名称'
);
$grid
->
column
(
'task.
city_id'
,
'地区'
)
->
display
(
function
(
$v
){
return
CityAreaService
::
getAreaName
(
$v
)
;
$grid
->
column
(
'task.
sort'
,
'优先级'
)
->
display
(
function
(
$val
){
return
\App\Models\Tas
::
SORT_DESC
[
$val
]
;
});
$grid
->
column
(
'task.city_id'
,
'地区'
);
$grid
->
column
(
'task.year'
,
'时间'
);
$grid
->
column
(
'task.refer'
,
'参考信源'
)
->
display
(
function
(
$val
)
{
if
(
filter_var
(
$val
,
FILTER_VALIDATE_URL
)
!==
false
)
{
//是链接
...
...
@@ -112,6 +121,124 @@ class AlreadyDoneTaskController extends AdminController
});
}
public
function
adminAlreadyGrid
()
{
$param
=
request
()
->
input
();
return
Grid
::
make
(
\App\Models\Tas
::
with
([
'receives'
=>
fn
(
$q
)
=>
$q
->
where
(
'status'
,
'>'
,
0
)
,
'receives.task'
=>
fn
(
$q
)
=>
$q
->
where
(
function
(
$que
)
use
(
$param
){
if
(
!
empty
(
$param
[
'receives'
][
'task'
][
'name'
])){
$que
->
where
(
'name'
,
'like'
,
"%
{
$param
[
'receives'
][
'task'
][
'name'
]
}
%"
);
}
if
(
!
empty
(
$param
[
'receives'
][
'task'
][
'city_id'
])){
$que
->
where
(
'city_id'
,
'like'
,
"%
{
$param
[
'receives'
][
'task'
][
'city_id'
]
}
%"
);
}
if
(
!
empty
(
$param
[
'receives'
][
'task'
][
'year'
])){
$que
->
where
(
'year'
,
'like'
,
"%
{
$param
[
'receives'
][
'task'
][
'year'
]
}
%"
);
}
})
,
'receives.user'
,
'receives.collects'
,
'receives.approve'
])
->
whereHas
(
'receives'
,
function
(
$query
){
return
$query
->
where
(
'status'
,
'>'
,
0
);
})
,
function
(
Grid
$grid
)
{
// $grid->withBorder();
$grid
->
tableCollapse
(
false
);
$grid
->
number
(
'序号'
);
$grid
->
model
()
->
orderBy
(
'created_at'
,
'desc'
);
// $grid->column('id')->sortable();
$grid
->
column
(
'name'
)
->
expand
(
function
()
use
(
$grid
)
{
//这里要让哪个字段显示下拉,就写哪个字段,没什么要求
$comments
=
$this
->
receives
->
map
(
function
(
$itm
,
$key
)
{
$referVal
=
$itm
->
task
->
refer
??
''
;
$realityReferVal
=
$itm
->
collects
->
reality_refer
??
''
;
$html
=
\App\Models\TasksReceive
::
STATUS_DESC
[
$itm
->
status
];
return
[
'key'
=>
$key
+
1
,
'username'
=>
$itm
->
user
->
name
??
''
,
'name'
=>
$itm
->
task
->
name
??
''
,
'level'
=>
$itm
->
task
->
level
??
''
,
'city_id'
=>
$itm
->
task
->
city_id
??
''
,
'year'
=>
$itm
->
task
->
year
??
''
,
'refer'
=>
filter_var
(
$referVal
,
FILTER_VALIDATE_URL
)
!==
false
?
"<a href=
{
$referVal
}
target='_blank' style='color: #00b44e'>点击查看</a>"
:
$referVal
,
'price'
=>
$itm
->
task
->
price
??
''
,
'value'
=>
$itm
->
collects
->
value
??
''
,
'reality_refer'
=>
filter_var
(
$realityReferVal
,
FILTER_VALIDATE_URL
)
!==
false
?
"<a href=
{
$realityReferVal
}
target='_blank' style='color: #00b44e'>点击查看</a>"
:
$realityReferVal
,
'status'
=>
$html
,
'time'
=>
$itm
->
created_at
->
format
(
'Y-m-d H:i:s'
)
??
''
,
'action'
=>
'<a style="" href="/already/'
.
$itm
->
id
.
'?type=1"><i class=""></i> <span class="text-success">查看 </span></a>'
];
// return $itm->only(['id', 'task.name','task.level', 'task.city_id', 'task.year', 'task.refer', 'task.price']);
})
->
toArray
();
return
new
Table
([
'序号'
,
'用户'
,
'指标名称'
,
'等级'
,
'地区'
,
'时间'
,
'信源'
,
'单价'
,
'指标值'
,
'实际信源'
,
'状态'
,
'领取时间'
,
'操作'
],
$comments
,[
'table custom-data-table data-table table-text-center table-bordered complex-headers'
]);
});
$grid
->
column
(
'sort'
,
'优先级'
)
->
display
(
function
(
$val
){
return
\App\Models\Tas
::
SORT_DESC
[
$val
];
});
$grid
->
column
(
'level'
,
'难度等级'
);
$grid
->
column
(
'city_id'
,
'地区'
);
// $grid->column('province_id');
$grid
->
column
(
'year'
,
'时间'
);
$grid
->
column
(
'refer'
,
'信源'
)
->
display
(
function
(
$val
)
{
if
(
filter_var
(
$val
,
FILTER_VALIDATE_URL
)
!==
false
)
{
//是链接
return
"<a href=
{
$val
}
target='_blank' style='color: #00b44e'>点击查看</a>"
;
}
else
{
return
$val
;
}
});
// $grid->column('guide');
$grid
->
column
(
'price'
,
'单价'
);
$grid
->
column
(
'done'
,
'完成情况'
)
->
display
(
function
(){
$mu
=
Task
::
CAN_RECEIVE_NUM
*
Task
::
query
()
->
where
(
'tas_id'
,
$this
->
id
)
->
count
();
$zi
=
\App\Models\TasksReceive
::
query
()
->
where
(
'tas_id'
,
$this
->
id
)
->
where
(
'status'
,
'>'
,
0
)
->
count
();
return
$zi
.
'/'
.
$mu
;
});
// $grid->column('status');
// $grid->column('num');
// $grid->column('images');
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid
->
disableRowSelector
()
->
disableEditButton
()
->
disableDeleteButton
()
->
disableViewButton
()
->
disableCreateButton
();
$grid
->
actions
(
function
(
Grid\Displayers\Actions
$actions
)
{
$actions
->
append
(
'<a style="" href="/tas/'
.
$this
->
id
.
'?type=2"><i class=""></i> <span class="text-success">查看 </span></a>'
);
//查看按钮
});
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
like
(
'receives.task.name'
,
'指标名称'
);
$filter
->
like
(
'receives.task.year'
,
'时间'
);
$filter
->
like
(
'receives.task.city_id'
,
'地区'
);
// $filter->like('receives.user.name','用户');
// $filter->where('name', function ($query) {
// $name = explode(',',str_replace(',',',',$this->input));
//
// $query->whereHas('tasks', function ($query)use ($name) {
// $query->whereIn('name',$name);
// });
//
// }, '指标名称')->placeholder('搜索多个请用逗号隔开,如:指标1,指标2');
});
});
}
/**
* Make a show builder.
...
...
@@ -125,7 +252,10 @@ class AlreadyDoneTaskController extends AdminController
return
Show
::
make
(
$id
,
TasksReceive
::
with
([
'task'
,
'collects'
]),
function
(
Show
$show
)
use
(
$id
)
{
$show
->
field
(
'id'
);
$show
->
field
(
'task.name'
,
'指标名称'
);
$show
->
field
(
'task.city_id'
,
'地区'
)
->
unserialize
();
$show
->
field
(
'task.sort'
,
'优先级'
)
->
as
(
function
(
$val
){
return
\App\Models\Tas
::
SORT_DESC
[
$val
];
});
$show
->
field
(
'task.city_id'
,
'地区'
);
$show
->
field
(
'task.year'
,
'时间'
);
$show
->
field
(
'task.refer'
,
'参考信源'
);
$show
->
field
(
'task.level'
,
'等级'
);
...
...
app/Admin/Controllers/AlreadySettlementController.php
View file @
74eee49d
...
...
@@ -21,7 +21,7 @@ class AlreadySettlementController extends AdminController
}
else
{
return
Grid
::
make
(
TasksOrder
::
query
(),
function
(
Grid
$grid
)
use
(
$user
)
{
$grid
->
addTableClass
([
'table-text-center'
]);
//设置表格文字居中
$grid
->
withBorder
();
$grid
->
model
()
->
where
(
'user_id'
,
$user
->
id
);
// 在 display 回调中使用
...
...
app/Admin/Controllers/CreateOrderController.php
View file @
74eee49d
...
...
@@ -18,7 +18,7 @@ class CreateOrderController extends AdminController
{
return
Grid
::
make
(
TasksReceive
::
with
([
'task'
,
'collects'
,
'user'
]),
function
(
Grid
$grid
)
{
$grid
->
addTableClass
([
'table-text-center'
]);
//设置表格文字居中
$grid
->
withBorder
();
$grid
->
model
()
->
where
(
'status'
,
3
);
//3:审核通过但未结算的任务
$grid
->
disablePagination
();
...
...
@@ -31,9 +31,7 @@ class CreateOrderController extends AdminController
// $grid->column('id')->sortable();
$grid
->
column
(
'task.name'
,
'指标名称'
);
$grid
->
column
(
'task.city_id'
,
'地区'
)
->
display
(
function
(
$v
){
return
CityAreaService
::
getAreaName
(
$v
);
});
$grid
->
column
(
'task.city_id'
,
'地区'
);
$grid
->
column
(
'task.year'
,
'时间'
);
$grid
->
column
(
'task.refer'
,
'参考信源'
)
->
display
(
function
(
$val
)
{
if
(
filter_var
(
$val
,
FILTER_VALIDATE_URL
)
!==
false
)
{
//是链接
...
...
app/Admin/Controllers/NoDoneTaskController.php
View file @
74eee49d
...
...
@@ -3,16 +3,19 @@
namespace
App\Admin\Controllers
;
use
App\Admin\Extensions\Tools\BackAction
;
use
App\Admin\Repositories\Tas
;
use
App\Admin\Repositories\TasksReceive
;
use
App\Admin\Services\CityAreaService
;
use
App\Models\TasksApprove
;
use
App\Models\TasksCollect
;
use
Dcat\Admin\Actions\Action
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Layout\Content
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Dcat\Admin\Widgets\Table
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Storage
;
...
...
@@ -28,11 +31,16 @@ class NoDoneTaskController extends AdminController
*/
protected
function
grid
()
{
$user
=
Admin
::
user
();
if
(
$user
->
is_admin
==
1
){
return
$this
->
adminGrid
();
}
return
Grid
::
make
(
TasksReceive
::
with
([
'task'
,
'collects'
,
'user'
]),
function
(
Grid
$grid
)
{
$user
=
Admin
::
user
();
$user
->
is_admin
==
0
&&
$grid
->
model
()
->
where
(
'user_id'
,
$user
->
id
);
$grid
->
addTableClass
([
'table-text-center'
]);
//设置表格文字居中
$grid
->
withBorder
();
$grid
->
model
()
->
where
(
'status'
,
0
);
// dd(trans('admin.view'));//查看
...
...
@@ -49,9 +57,10 @@ class NoDoneTaskController extends AdminController
// $grid->column('id')->sortable();
$grid
->
column
(
'task.name'
,
'指标名称'
);
$grid
->
column
(
'task.
city_id'
,
'地区'
)
->
display
(
function
(
$v
)
{
return
CityAreaService
::
getAreaName
(
$v
)
;
$grid
->
column
(
'task.
sort'
,
'优先级'
)
->
display
(
function
(
$val
)
{
return
\App\Models\Tas
::
SORT_DESC
[
$val
]
;
});
$grid
->
column
(
'task.city_id'
,
'地区'
);
$grid
->
column
(
'task.year'
,
'时间'
);
$grid
->
column
(
'task.refer'
,
'参考信源'
)
->
display
(
function
(
$val
)
{
if
(
filter_var
(
$val
,
FILTER_VALIDATE_URL
)
!==
false
)
{
//是链接
...
...
@@ -92,6 +101,116 @@ class NoDoneTaskController extends AdminController
});
}
public
function
adminGrid
()
{
$param
=
request
()
->
input
();
return
Grid
::
make
(
\App\Models\Tas
::
with
([
'receives'
=>
fn
(
$q
)
=>
$q
->
where
(
'status'
,
0
)
,
'receives.task'
=>
fn
(
$q
)
=>
$q
->
where
(
function
(
$que
)
use
(
$param
){
if
(
!
empty
(
$param
[
'receives'
][
'task'
][
'name'
])){
$que
->
where
(
'name'
,
'like'
,
"%
{
$param
[
'receives'
][
'task'
][
'name'
]
}
%"
);
}
if
(
!
empty
(
$param
[
'receives'
][
'task'
][
'city_id'
])){
$que
->
where
(
'city_id'
,
'like'
,
"%
{
$param
[
'receives'
][
'task'
][
'city_id'
]
}
%"
);
}
if
(
!
empty
(
$param
[
'receives'
][
'task'
][
'year'
])){
$que
->
where
(
'year'
,
'like'
,
"%
{
$param
[
'receives'
][
'task'
][
'year'
]
}
%"
);
}
})
,
'receives.user'
// =>fn($q)=>$q->where(function ($query)use($param){
// if (!empty($param['receives']['user']['name'])){
// $query->where('name','like',"%{$param['receives']['user']['name']}%");
// }
// })
])
->
whereHas
(
'receives'
,
function
(
$query
){
return
$query
->
where
(
'status'
,
0
);
})
,
function
(
Grid
$grid
)
{
// $grid->withBorder();
$grid
->
tableCollapse
(
false
);
$grid
->
number
(
'序号'
);
$grid
->
model
()
->
orderBy
(
'created_at'
,
'desc'
);
// $grid->column('id')->sortable();
$grid
->
column
(
'name'
)
->
expand
(
function
()
use
(
$grid
)
{
//这里要让哪个字段显示下拉,就写哪个字段,没什么要求
$comments
=
$this
->
receives
->
map
(
function
(
$itm
,
$key
)
{
$referVal
=
$itm
->
task
->
refer
??
''
;
return
[
'key'
=>
$key
+
1
,
'username'
=>
$itm
->
user
->
name
??
''
,
'name'
=>
$itm
->
task
->
name
??
''
,
'level'
=>
$itm
->
task
->
level
??
''
,
'city_id'
=>
$itm
->
task
->
city_id
??
''
,
'year'
=>
$itm
->
task
->
year
??
''
,
'refer'
=>
filter_var
(
$referVal
,
FILTER_VALIDATE_URL
)
!==
false
?
"<a href=
{
$referVal
}
target='_blank' style='color: #00b44e'>点击查看</a>"
:
$referVal
,
'price'
=>
$itm
->
task
->
price
??
''
,
'time'
=>
$itm
->
created_at
->
format
(
'Y-m-d H:i:s'
)
??
''
,
'action'
=>
'<a style="" href="/noDone/'
.
$itm
->
id
.
'?type=1"><i class=""></i> <span class="text-success">查看 </span></a>'
];
// return $itm->only(['id', 'task.name','task.level', 'task.city_id', 'task.year', 'task.refer', 'task.price']);
})
->
toArray
();
return
new
Table
([
'序号'
,
'用户'
,
'指标名称'
,
'等级'
,
'地区'
,
'时间'
,
'信源'
,
'单价'
,
'领取时间'
,
'操作'
],
$comments
,[
'table custom-data-table data-table table-text-center table-bordered complex-headers'
]);
});
$grid
->
column
(
'sort'
,
'优先级'
)
->
display
(
function
(
$val
){
return
\App\Models\Tas
::
SORT_DESC
[
$val
];
});
$grid
->
column
(
'level'
,
'难度等级'
);
$grid
->
column
(
'city_id'
,
'地区'
);
// $grid->column('province_id');
$grid
->
column
(
'year'
,
'时间'
);
$grid
->
column
(
'refer'
,
'信源'
)
->
display
(
function
(
$val
)
{
if
(
filter_var
(
$val
,
FILTER_VALIDATE_URL
)
!==
false
)
{
//是链接
return
"<a href=
{
$val
}
target='_blank' style='color: #00b44e'>点击查看</a>"
;
}
else
{
return
$val
;
}
});
// $grid->column('guide');
$grid
->
column
(
'price'
,
'单价'
);
// $grid->column('status');
// $grid->column('num');
// $grid->column('images');
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid
->
disableRowSelector
()
->
disableEditButton
()
->
disableDeleteButton
()
->
disableViewButton
()
->
disableCreateButton
();
$grid
->
actions
(
function
(
Grid\Displayers\Actions
$actions
)
{
$actions
->
append
(
'<a style="" href="/tas/'
.
$this
->
id
.
'?type=1"><i class=""></i> <span class="text-success">查看 </span></a>'
);
//查看按钮
});
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
like
(
'receives.task.name'
,
'指标名称'
);
$filter
->
like
(
'receives.task.year'
,
'时间'
);
$filter
->
like
(
'receives.task.city_id'
,
'地区'
);
// $filter->like('receives.user.name','用户');
// $filter->where('name', function ($query) {
// $name = explode(',',str_replace(',',',',$this->input));
//
// $query->whereHas('tasks', function ($query)use ($name) {
// $query->whereIn('name',$name);
// });
//
// }, '指标名称')->placeholder('搜索多个请用逗号隔开,如:指标1,指标2');
});
});
}
/**
* Make a show builder.
*
...
...
@@ -104,7 +223,10 @@ class NoDoneTaskController extends AdminController
return
Show
::
make
(
$id
,
TasksReceive
::
with
([
'task'
,
'collects'
]),
function
(
Show
$show
)
use
(
$id
)
{
$show
->
field
(
'id'
);
$show
->
field
(
'task.name'
,
'指标名称'
);
$show
->
field
(
'task.city_id'
,
'地区'
)
->
unserialize
();
$show
->
field
(
'task.sort'
,
'优先级'
)
->
as
(
function
(
$val
){
return
\App\Models\Tas
::
SORT_DESC
[
$val
];
});
$show
->
field
(
'task.city_id'
,
'地区'
);
$show
->
field
(
'task.year'
,
'时间'
);
$show
->
field
(
'task.refer'
,
'参考信源'
);
$show
->
field
(
'task.level'
,
'等级'
);
...
...
@@ -195,6 +317,7 @@ class NoDoneTaskController extends AdminController
return
Form
::
make
(
\App\Models\TasksReceive
::
with
([
'task'
,
'collects'
]),
function
(
Form
$form
)
use
(
$id
)
{
$form
->
display
(
'id'
);
$form
->
display
(
'task.name'
,
'指标名称'
);
// $form->select('task.sort','优先级')->options([3 => '高', 2 => '中', 1 => '低']);
$form
->
display
(
'area'
,
'地区'
);
// $form->distpicker(['city_id'=>'市']);
$form
->
display
(
'task.year'
,
'时间'
);
...
...
app/Admin/Controllers/TasController.php
View file @
74eee49d
...
...
@@ -26,55 +26,76 @@ class TasController extends AdminController
*
* @return Grid
*/
p
rotected
function
grid
()
p
ublic
function
grid
()
{
$param
=
request
()
->
input
();
return
Grid
::
make
(
Tas
::
with
([
'tasks'
=>
fn
(
$q
)
=>
$q
->
where
(
function
(
$que
)
use
(
$param
)
{
return
Grid
::
make
(
Tas
::
with
([
'tasks'
=>
fn
(
$q
)
=>
$q
->
where
(
function
(
$que
)
use
(
$param
)
{
// var_dump($param);
if
(
!
empty
(
$param
[
'tasks'
][
'name'
])){
$que
->
where
(
'name'
,
'like'
,
"
{
$param
[
'tasks'
][
'name'
]
}
"
);
if
(
!
empty
(
$param
[
'tasks'
][
'name'
]))
{
$que
->
where
(
'name'
,
'like'
,
"%
{
$param
[
'tasks'
][
'name'
]
}
%
"
);
}
if
(
!
empty
(
$param
[
'tasks'
][
'city_id'
])){
$que
->
where
(
'city_id'
,
'like'
,
"
{
$param
[
'tasks'
][
'city_id'
]
}
"
);
if
(
!
empty
(
$param
[
'tasks'
][
'city_id'
]))
{
$que
->
where
(
'city_id'
,
'like'
,
"%
{
$param
[
'tasks'
][
'city_id'
]
}
%
"
);
}
if
(
!
empty
(
$param
[
'tasks'
][
'year'
])){
$que
->
where
(
'year'
,
'like'
,
"
{
$param
[
'tasks'
][
'year'
]
}
"
);
if
(
!
empty
(
$param
[
'tasks'
][
'year'
]))
{
$que
->
where
(
'year'
,
'like'
,
"%
{
$param
[
'tasks'
][
'year'
]
}
%
"
);
}
})]),
function
(
Grid
$grid
)
{
// $grid->tableCollapse(false);
// $grid->withBorder();
$grid
->
tableCollapse
(
false
);
$grid
->
column
(
'序号'
)
->
display
(
function
()
{
return
$this
->
_index
+
1
;
});
$grid
->
model
()
->
orderBy
(
'created_at'
,
'desc'
);
$grid
->
model
()
->
orderBy
(
'sort'
,
'desc'
)
->
orderBy
(
'created_at'
,
'desc'
);
// $grid->column('id')->sortable();
$grid
->
column
(
'name'
)
->
expand
(
function
()
use
(
$grid
)
{
//这里要让哪个字段显示下拉,就写哪个字段,没什么要求
$comments
=
$this
->
tasks
->
map
(
function
(
$itm
)
{
return
$itm
->
only
([
'id'
,
'name'
,
'level'
,
'city_id'
,
'year'
,
'refer'
,
'price'
]);
return
$itm
->
only
([
'id'
,
'name'
,
'sort'
,
'level'
,
'city_id'
,
'year'
,
'refer'
,
'price'
]);
})
->
toArray
();
// dd($comments);
// dd(empty( $this->receives->user));
$taskIds
=
array_column
(
$comments
,
'id'
);
// var_dump($comments,$taskIds);
$receive
=
TasksReceive
::
query
()
->
with
(
'user'
)
->
whereIn
(
'task_id'
,
$taskIds
)
->
get
()
->
toArray
();
foreach
(
$comments
as
$key
=>
&
$com
)
{
$com
[
'sort'
]
=
\App\Models\Tas
::
SORT_DESC
[
$com
[
'sort'
]];
$username
=
''
;
foreach
(
$receive
as
$rec
)
{
if
(
$rec
[
'task_id'
]
==
$com
[
'id'
])
{
$username
.=
$rec
[
'user'
][
'name'
]
.
','
;
}
}
$com
[
'user'
]
=
$username
;
array_unshift
(
$com
,
$key
+
1
);
$com
[
'action'
]
=
'<a style="margin-right:
2%" href="/tasks/'
.
$com
[
'id'
]
.
'?type=1"><i class=""></i> <span class="text-success">查看 </span></a>
<a style="margin-right:
2%" href="/tasks/'
.
$com
[
'id'
]
.
'/edit?type=1"><i class=""></i> <span class="text-custom">编辑 </span></a>
$com
[
'action'
]
=
'<a style="margin-right:2%" href="/tasks/'
.
$com
[
'id'
]
.
'?type=1"><i class=""></i> <span class="text-success">查看 </span></a>
<a style="margin-right:2%" href="/tasks/'
.
$com
[
'id'
]
.
'/edit?type=1"><i class=""></i> <span class="text-custom">编辑 </span></a>
<a data-url="/tas/'
.
$this
->
id
.
'?task_id='
.
$com
[
'id'
]
.
'" data-message="ID - '
.
$com
[
'id'
]
.
'" data-action="delete" data-redirect="/tas" style="cursor: pointer;" class="act-'
.
$com
[
'id'
]
.
'" href="javascript:void(0)"><i class=""></i> <span class="text-danger">删除</span> </a>'
;
unset
(
$com
[
'id'
]);
}
return
new
Table
([
'序号'
,
'指标名称'
,
'难度等级'
,
'地区'
,
'时间'
,
'信源'
,
'单价'
,
'操作'
],
$comments
);
'序号'
,
'指标名称'
,
'优先级'
,
'难度等级'
,
'地区'
,
'时间'
,
'信源'
,
'单价'
,
'领取用户'
,
'操作'
],
$comments
,
[
'table custom-data-table data-table table-text-center table-bordered complex-headers'
]);
});
$grid
->
column
(
'sort'
,
'优先级'
)
->
display
(
function
(
$val
){
return
\App\Models\Tas
::
SORT_DESC
[
$val
];
});
$grid
->
column
(
'level'
);
$grid
->
column
(
'city_id'
,
'地区'
);
// $grid->column('province_id');
$grid
->
column
(
'year'
,
'时间'
);
$grid
->
column
(
'refer'
,
'信源'
)
->
display
(
function
(
$val
)
{
if
(
filter_var
(
$val
,
FILTER_VALIDATE_URL
)
!==
false
)
{
//是链接
return
"<a href=
{
$val
}
target='_blank' style='color: #00b44e'>点击查看</a>"
;
...
...
@@ -84,6 +105,11 @@ class TasController extends AdminController
});
// $grid->column('guide');
$grid
->
column
(
'price'
);
$grid
->
column
(
'done'
,
'完成情况'
)
->
display
(
function
(){
$mu
=
Task
::
CAN_RECEIVE_NUM
*
Task
::
query
()
->
where
(
'tas_id'
,
$this
->
id
)
->
count
();
$zi
=
\App\Models\TasksReceive
::
query
()
->
where
(
'tas_id'
,
$this
->
id
)
->
where
(
'status'
,
'>'
,
0
)
->
count
();
return
$zi
.
'/'
.
$mu
;
});
// $grid->column('status');
// $grid->column('num');
// $grid->column('images');
...
...
@@ -105,9 +131,9 @@ class TasController extends AdminController
$grid
->
disableRowSelector
();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
like
(
'tasks.name'
,
'指标名称'
);
$filter
->
like
(
'tasks.year'
,
'时间'
);
$filter
->
like
(
'tasks.city_id'
,
'地区'
);
$filter
->
like
(
'tasks.name'
,
'指标名称'
);
$filter
->
like
(
'tasks.year'
,
'时间'
);
$filter
->
like
(
'tasks.city_id'
,
'地区'
);
// $filter->where('name', function ($query) {
// $name = explode(',',str_replace(',',',',$this->input));
...
...
@@ -130,9 +156,13 @@ class TasController extends AdminController
*/
protected
function
detail
(
$id
)
{
return
Show
::
make
(
$id
,
new
Tas
(),
function
(
Show
$show
)
use
(
$id
){
$type
=
request
()
->
input
(
'type'
,
0
);
return
Show
::
make
(
$id
,
new
Tas
(),
function
(
Show
$show
)
use
(
$id
,
$type
)
{
$show
->
field
(
'id'
);
$show
->
field
(
'name'
);
$show
->
field
(
'sort'
,
'优先级'
)
->
as
(
function
(
$val
){
return
\App\Models\Tas
::
SORT_DESC
[
$val
];
});
$show
->
field
(
'level'
);
$show
->
field
(
'city_id'
);
$show
->
field
(
'year'
);
...
...
@@ -146,6 +176,29 @@ class TasController extends AdminController
}
// $show->field('created_at');
// $show->field('updated_at');
if
(
$type
==
1
)
{
//管理员查看 未完成任务
$show
->
disableDeleteButton
()
->
disableEditButton
()
->
disableListButton
();
$show
->
tools
(
function
(
Show\Tools
$tools
)
{
$tools
->
append
(
'<div class="btn-group pull-right btn-mini" style="margin-right: 5px">
<a href="/noDone" class="btn btn-sm btn-primary ">
<i class="feather icon-list"></i><span class="d-none d-sm-inline"> 列表</span>
</a>
</div>'
);
});
}
if
(
$type
==
2
)
{
//管理员查看 已完成任务
$show
->
disableDeleteButton
()
->
disableEditButton
()
->
disableListButton
();
$show
->
tools
(
function
(
Show\Tools
$tools
)
{
$tools
->
append
(
'<div class="btn-group pull-right btn-mini" style="margin-right: 5px">
<a href="/already" class="btn btn-sm btn-primary ">
<i class="feather icon-list"></i><span class="d-none d-sm-inline"> 列表</span>
</a>
</div>'
);
});
}
});
}
...
...
@@ -159,12 +212,14 @@ class TasController extends AdminController
return
Form
::
make
(
new
Tas
(),
function
(
Form
$form
)
{
$form
->
display
(
'id'
);
if
(
$form
->
isEditing
())
{
$form
->
text
(
'name'
,
'任务包名称'
)
->
disable
();
$form
->
text
(
'name'
,
'任务包名称'
)
->
disable
();
$form
->
select
(
'sort'
,
'优先级'
)
->
options
([
3
=>
'高'
,
2
=>
'中'
,
1
=>
'低'
]);
$form
->
select
(
'level'
)
->
options
([
1
=>
1
,
2
=>
2
,
3
=>
3
,
4
=>
4
,
5
=>
5
]);
$form
->
text
(
'city_id'
,
'设置地区'
)
->
disable
();
$form
->
text
(
'year'
,
'设置时间'
)
->
disable
();
}
else
{
$form
->
text
(
'name'
,
'任务包名称'
)
->
placeholder
(
'设置多个请用逗号隔开,如:指标1,指标2'
)
->
required
();
$form
->
text
(
'name'
,
'任务包名称'
)
->
placeholder
(
'设置多个请用逗号隔开,如:指标1,指标2'
)
->
required
();
$form
->
select
(
'sort'
,
'优先级'
)
->
options
([
3
=>
'高'
,
2
=>
'中'
,
1
=>
'低'
])
->
default
(
3
)
->
required
();
$form
->
select
(
'level'
)
->
options
([
1
=>
1
,
2
=>
2
,
3
=>
3
,
4
=>
4
,
5
=>
5
])
->
default
(
1
)
->
required
();
$form
->
text
(
'city_id'
,
'设置地区'
)
->
placeholder
(
'设置多个请用逗号隔开,如:深圳,上海'
)
->
required
();
$form
->
text
(
'year'
,
'设置时间'
)
->
placeholder
(
'设置多个请用逗号隔开,如:2024,2023'
)
->
required
();
...
...
@@ -211,13 +266,14 @@ class TasController extends AdminController
//保存后回调
$form
->
saved
(
function
(
Form
$form
)
{
$tas
=
\App\Models\Tas
::
query
()
->
find
(
$this
->
id
)
->
toArray
();
Task
::
query
()
->
where
(
'tas_id'
,
$this
->
id
)
Task
::
query
()
->
where
(
'tas_id'
,
$this
->
id
)
->
update
([
'level'
=>
$tas
[
'level'
],
'price'
=>
$tas
[
'price'
],
'refer'
=>
$tas
[
'refer'
],
'guide'
=>
$tas
[
'guide'
],
'images'
=>
$tas
[
'images'
],
'level'
=>
$tas
[
'level'
],
'price'
=>
$tas
[
'price'
],
'refer'
=>
$tas
[
'refer'
],
'guide'
=>
$tas
[
'guide'
],
'images'
=>
$tas
[
'images'
],
'sort'
=>
$tas
[
'sort'
],
]);
});
...
...
@@ -227,8 +283,6 @@ class TasController extends AdminController
}
public
function
store
()
{
DB
::
beginTransaction
();
...
...
@@ -285,6 +339,8 @@ class TasController extends AdminController
'guide'
=>
$param
[
'guide'
],
'price'
=>
$param
[
'price'
]
??
0
,
'images'
=>
$images
,
'sort'
=>
$param
[
'sort'
],
'num'
=>
Task
::
CAN_RECEIVE_NUM
];
}
}
...
...
@@ -298,6 +354,7 @@ class TasController extends AdminController
'refer'
=>
$param
[
'refer'
],
'guide'
=>
$param
[
'guide'
],
'price'
=>
$param
[
'price'
]
??
0
,
'sort'
=>
$param
[
'sort'
],
'images'
=>
$images
,
];
$tas
=
\App\Models\Tas
::
query
()
->
create
(
$tasData
);
...
...
@@ -317,22 +374,22 @@ class TasController extends AdminController
{
$taskId
=
request
()
->
input
(
'task_id'
);
// $idArr = explode(',', $id);
if
(
$taskId
){
if
(
$taskId
)
{
if
(
TasksReceive
::
query
()
->
where
(
'task_id'
,
$taskId
)
->
exists
())
{
$task
=
\App\Models\Task
::
query
()
->
find
(
$taskId
);
return
$this
->
form
()
->
response
()
->
error
(
'已经有用户领取了任务,不允许删除,任务名称:'
.
$task
->
name
.
' '
.
$task
->
city_id
.
' '
.
$task
->
year
);
}
Task
::
query
()
->
where
(
'id'
,
$taskId
)
->
delete
();
Task
::
query
()
->
where
(
'id'
,
$taskId
)
->
delete
();
return
$this
->
form
()
->
response
()
->
refresh
();
}
else
{
}
else
{
if
(
TasksReceive
::
query
()
->
where
(
'tas_id'
,
$id
)
->
exists
())
{
// $tas = \App\Models\Tas::query()->find($id);
return
$this
->
form
()
->
response
()
->
error
(
'该任务包已经有用户领取了任务,不允许删除'
);
}
}
Task
::
query
()
->
where
(
'tas_id'
,
$id
)
->
delete
();
Task
::
query
()
->
where
(
'tas_id'
,
$id
)
->
delete
();
return
$this
->
form
()
->
destroy
(
$id
);
}
}
app/Admin/Controllers/TaskController.php
View file @
74eee49d
...
...
@@ -44,9 +44,11 @@ class TaskController extends AdminController
// $model = \App\Models\Task::query()->whereNotIn('id',$exists)
return
Grid
::
make
(
new
Task
(),
function
(
Grid
$grid
)
use
(
$user
,
$exists
)
{
$grid
->
addTableClass
([
'table-text-center'
]);
//设置表格文字居中
$grid
->
withBorder
();
// $grid->title('dasd');
$grid
->
model
()
->
whereNotIn
(
'id'
,
$exists
)
->
orderBy
(
'created_at'
,
'desc'
);
$grid
->
model
()
->
whereNotIn
(
'id'
,
$exists
)
->
orderBy
(
'sort'
,
'desc'
)
->
orderBy
(
'created_at'
,
'desc'
);
// dd(Admin::user()->is_admin);
// dd(trans('admin.view'));//查看
...
...
@@ -57,6 +59,9 @@ class TaskController extends AdminController
// $grid->column('id')->sortable();
$grid
->
column
(
'name'
);
$grid
->
column
(
'sort'
,
'优先级'
)
->
display
(
function
(
$val
){
return
\App\Models\Tas
::
SORT_DESC
[
$val
];
});
$grid
->
column
(
'level'
);
$grid
->
column
(
'city_id'
);
$grid
->
column
(
'year'
);
...
...
@@ -109,8 +114,11 @@ class TaskController extends AdminController
return
Show
::
make
(
$id
,
new
Task
(),
function
(
Show
$show
)
use
(
$id
)
{
$show
->
field
(
'id'
);
$show
->
field
(
'name'
);
$show
->
field
(
'sort'
,
'优先级'
)
->
as
(
function
(
$val
){
return
\App\Models\Tas
::
SORT_DESC
[
$val
];
});
$show
->
field
(
'level'
);
$show
->
city_id
()
->
unserialize
()
;
$show
->
city_id
();
$show
->
field
(
'year'
);
$show
->
field
(
'refer'
);
...
...
@@ -138,7 +146,7 @@ class TaskController extends AdminController
{
return
Grid
::
make
(
new
Task
(),
function
(
Grid
$grid
)
{
$grid
->
addTableClass
([
'table-text-center'
]);
//设置表格文字居中
$grid
->
withBorder
();
$grid
->
model
()
->
orderBy
(
'created_at'
,
'desc'
);
// dd(trans('admin.view'));//查看
...
...
@@ -149,6 +157,9 @@ class TaskController extends AdminController
// $grid->column('id')->sortable();
$grid
->
column
(
'name'
);
$grid
->
column
(
'sort'
,
'优先级'
)
->
display
(
function
(
$val
){
return
\App\Models\Tas
::
SORT_DESC
[
$val
];
});
$grid
->
column
(
'level'
);
// $grid->column('city_id')->distpicker();
$grid
->
column
(
'city_id'
)
->
display
(
function
(
$v
)
{
...
...
@@ -193,8 +204,11 @@ class TaskController extends AdminController
return
Show
::
make
(
$id
,
new
Task
(),
function
(
Show
$show
)
use
(
$id
)
{
$show
->
field
(
'id'
);
$show
->
field
(
'name'
);
$show
->
field
(
'sort'
,
'优先级'
)
->
as
(
function
(
$val
){
return
\App\Models\Tas
::
SORT_DESC
[
$val
];
});
$show
->
field
(
'level'
);
$show
->
city_id
()
->
unserialize
()
;
$show
->
city_id
();
$show
->
field
(
'year'
);
$show
->
field
(
'refer'
);
...
...
@@ -274,6 +288,8 @@ class TaskController extends AdminController
return
Form
::
make
(
new
Task
(),
function
(
Form
$form
)
use
(
$type
)
{
$form
->
display
(
'id'
);
$form
->
text
(
'name'
)
->
required
();
$form
->
select
(
'sort'
,
'优先级'
)
->
options
([
3
=>
'高'
,
2
=>
'中'
,
1
=>
'低'
])
->
required
();
$form
->
select
(
'level'
)
->
options
([
1
=>
1
,
2
=>
2
,
3
=>
3
,
4
=>
4
,
5
=>
5
])
->
required
();
// $form->multipleSelect('city_id', '选择地区')->options('/getCity')->required()->saving(function ($v) {
...
...
@@ -415,6 +431,8 @@ class TaskController extends AdminController
'guide'
=>
$param
[
'guide'
],
'price'
=>
$param
[
'price'
]
??
0
,
'images'
=>
$images
,
'num'
=>
\App\Models\Task
::
CAN_RECEIVE_NUM
];
\App\Models\Task
::
query
()
->
create
(
$insertData
);
}
...
...
app/Admin/Controllers/TasksApproveController.php
View file @
74eee49d
...
...
@@ -33,11 +33,19 @@ class TasksApproveController extends AdminController
$pageSize
=
$request
->
input
(
'per_page'
,
10
);
$userId
=
$request
->
input
(
'user_id'
);
$taskName
=
$request
->
input
(
'task_name'
);
$taskYear
=
$request
->
input
(
'task_year'
);
$taskCity
=
$request
->
input
(
'task_city_id'
);
// var_dump($request->input());
$taskQuery
=
Task
::
query
();
if
(
!
empty
(
$taskName
))
{
$taskQuery
->
where
(
'name'
,
'like'
,
"%
{
$taskName
}
%"
);
}
if
(
!
empty
(
$taskYear
))
{
$taskQuery
->
where
(
'year'
,
'like'
,
"%
{
$taskYear
}
%"
);
}
if
(
!
empty
(
$taskCity
))
{
$taskQuery
->
where
(
'city_id'
,
'like'
,
"%
{
$taskCity
}
%"
);
}
$data
=
$taskQuery
->
whereHas
(
'receives'
,
function
(
$query
)
use
(
$userId
)
{
if
(
!
empty
(
$userId
))
{
...
...
@@ -78,7 +86,7 @@ class TasksApproveController extends AdminController
$content
=
Content
::
make
();
return
$content
->
title
(
'未审核列表'
)
->
body
(
view
(
'admin.check'
,
[
'data'
=>
$data
,
'users'
=>
$users
,
'userId'
=>
$userId
,
'taskName'
=>
$taskName
]));
->
body
(
view
(
'admin.check'
,
[
'data'
=>
$data
,
'users'
=>
$users
,
'userId'
=>
$userId
,
'taskName'
=>
$taskName
,
'taskYear'
=>
$taskYear
,
'taskCityId'
=>
$taskCity
]));
}
...
...
@@ -97,7 +105,7 @@ class TasksApproveController extends AdminController
$model
=
TasksApprove
::
with
([
'task'
,
'collects'
,
'user'
]);
return
Grid
::
make
(
$model
,
function
(
Grid
$grid
)
{
$grid
->
addTableClass
([
'table-text-center'
]);
//设置表格文字居中
$grid
->
withBorder
();
$grid
->
model
()
->
where
(
'status'
,
0
)
->
orderBy
(
'task_id'
,
'desc'
);
// 在 display 回调中使用
...
...
@@ -122,9 +130,7 @@ class TasksApproveController extends AdminController
// $grid->column('id')->sortable();
$grid
->
column
(
'task.name'
,
'指标名称'
);
$grid
->
column
(
'task.city_id'
,
'地区'
)
->
display
(
function
(
$v
)
{
return
CityAreaService
::
getAreaName
(
$v
);
});
$grid
->
column
(
'task.city_id'
,
'地区'
);
$grid
->
column
(
'task.year'
,
'时间'
);
$grid
->
column
(
'task.refer'
,
'参考信源'
)
->
display
(
function
(
$val
)
{
if
(
filter_var
(
$val
,
FILTER_VALIDATE_URL
)
!==
false
)
{
//是链接
...
...
@@ -195,9 +201,7 @@ class TasksApproveController extends AdminController
$show
->
field
(
'user.name'
,
'用户'
);
$show
->
field
(
'task.name'
,
'指标名称'
);
$show
->
field
(
'task.city_id'
,
'地区'
)
->
as
(
function
(
$val
)
{
return
CityAreaService
::
getAreaName
(
$val
);
});
$show
->
field
(
'task.city_id'
,
'地区'
);
$show
->
field
(
'task.year'
,
'时间'
);
$show
->
field
(
'task.refer'
,
'参考信源'
);
$show
->
field
(
'task.price'
,
'单价'
);
...
...
app/Admin/Controllers/TasksCollectController.php
View file @
74eee49d
...
...
@@ -19,7 +19,7 @@ class TasksCollectController extends AdminController
{
return
Grid
::
make
(
new
TasksCollect
(),
function
(
Grid
$grid
)
{
$grid
->
addTableClass
([
'table-text-center'
]);
//设置表格文字居中
$grid
->
withBorder
();
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'task_id'
);
$grid
->
column
(
'user_id'
);
...
...
app/Admin/Controllers/TasksOrderController.php
View file @
74eee49d
...
...
@@ -36,7 +36,7 @@ class TasksOrderController extends AdminController
$user
=
Admin
::
user
();
// dd(trans('admin.view'));//查看
$grid
->
addTableClass
([
'table-text-center'
]);
//设置表格文字居中
$grid
->
withBorder
();
$grid
->
title
(
'结算单详情'
);
$grid
->
header
(
function
(
$collection
)
use
(
$grid
,
$id
)
{
...
...
@@ -64,9 +64,7 @@ class TasksOrderController extends AdminController
// $grid->column('id')->sortable();
$grid
->
column
(
'task.name'
,
'指标名称'
);
if
(
$user
->
is_admin
==
1
)
$grid
->
column
(
'user.name'
,
'用户'
);
$grid
->
column
(
'task.city_id'
,
'地区'
)
->
display
(
function
(
$v
){
return
CityAreaService
::
getAreaName
(
$v
);
});
$grid
->
column
(
'task.city_id'
,
'地区'
);
$grid
->
column
(
'task.year'
,
'时间'
);
$grid
->
column
(
'task.refer'
,
'参考信源'
)
->
display
(
function
(
$val
)
{
if
(
filter_var
(
$val
,
FILTER_VALIDATE_URL
)
!==
false
)
{
//是链接
...
...
@@ -139,7 +137,7 @@ class TasksOrderController extends AdminController
{
return
Grid
::
make
(
TasksOrder
::
with
([
'user'
]),
function
(
Grid
$grid
)
{
$grid
->
addTableClass
([
'table-text-center'
]);
//设置表格文字居中
$grid
->
withBorder
();
// 在 display 回调中使用
$grid
->
column
(
'序号'
)
->
display
(
function
()
{
return
$this
->
_index
+
1
;
...
...
app/Admin/bootstrap.php
View file @
74eee49d
...
...
@@ -24,9 +24,10 @@ use Dcat\Admin\Show\Field;
Field
::
extend
(
'unserialize'
,
\App\Admin\Extensions\UnSerialize
::
class
);
\Dcat\Admin\Grid
::
resolving
(
function
(
\Dcat\Admin\Grid
$grid
)
{
$grid
->
tableCollapse
(
false
);
$grid
->
withBorder
();
//
// $grid->tableCollapse(false);
$grid
->
addTableClass
([
'table-text-center'
]);
//设置表格文字居中
...
...
app/Models/Tas.php
View file @
74eee49d
...
...
@@ -16,6 +16,12 @@ class Tas extends Model
protected
$table
=
'tas'
;
const
SORT_DESC
=
[
3
=>
'高'
,
2
=>
'中'
,
1
=>
'低'
,
];
/**
* The attributes that are mass assignable.
*
...
...
@@ -31,7 +37,7 @@ class Tas extends Model
'guide'
,
'price'
,
'status'
,
'
num
'
,
'
sort
'
,
'images'
,
'created_at'
,
'updated_at'
,
...
...
@@ -66,5 +72,8 @@ class Tas extends Model
return
$this
->
hasMany
(
Task
::
class
);
}
public
function
receives
()
{
return
$this
->
hasMany
(
TasksReceive
::
class
,
'tas_id'
);
}
}
app/Models/Task.php
View file @
74eee49d
...
...
@@ -35,6 +35,7 @@ class Task extends Model
'status'
,
'num'
,
'images'
,
'sort'
,
'created_at'
,
'updated_at'
,
];
...
...
resources/lang/zh_CN/tas.php
View file @
74eee49d
<?php
<?php
return
[
'labels'
=>
[
'Tas'
=>
'
Tas
'
,
'Tas'
=>
'
任务包
'
,
'tas'
=>
'Tas'
,
],
'fields'
=>
[
...
...
resources/lang/zh_CN/task.php
View file @
74eee49d
<?php
return
[
'labels'
=>
[
'Task'
=>
'
创建指标任务
'
,
'Task'
=>
'
'
,
'task'
=>
'Task'
,
],
'fields'
=>
[
...
...
resources/views/admin/check.blade.php
View file @
74eee49d
...
...
@@ -123,6 +123,28 @@
</div>
</div>
</div>
<div class="
filter
-
input
col
-
sm
-
2
" style="">
<div class="
form
-
group
">
<div class="
input
-
group
input
-
group
-
sm
">
<div class="
input
-
group
-
prepend
">
<span class="
input
-
group
-
text
bg
-
white
text
-
capitalize
"><b>时间</b></span>
</div>
<input type="
text
" class="
form
-
control
filter
-
column
-
task
-
name
"
placeholder="
时间
" name="
task_year
" value="
{{
$taskYear
??
''
}}
">
</div>
</div>
</div>
<div class="
filter
-
input
col
-
sm
-
2
" style="">
<div class="
form
-
group
">
<div class="
input
-
group
input
-
group
-
sm
">
<div class="
input
-
group
-
prepend
">
<span class="
input
-
group
-
text
bg
-
white
text
-
capitalize
"><b>地区</b></span>
</div>
<input type="
text
" class="
form
-
control
filter
-
column
-
task
-
name
"
placeholder="
地区
" name="
task_city_id
" value="
{{
$taskCityId
??
''
}}
">
</div>
</div>
</div>
<button class="
btn
btn
-
primary
btn
-
sm
btn
-
mini
submit
" style="
margin
-
left
:
12
px
">
<i class="
feather
icon
-
search
"></i><span class="
d
-
none
d
-
sm
-
inline
"> 搜索</span>
...
...
@@ -176,7 +198,7 @@
{{-- </td>--}}
<td>
{
{$key+1}
}
</td>
<td>
{
{$item['name']}
}
</td>
<td>
{
{
\App\Admin\Services\CityAreaService::getAreaName($item['city_id'])
}
}
</td>
<td>
{
{
$item['city_id']
}
}
</td>
<td>
{
{$item['year']}
}
</td>
<td>
@if(filter_var(
$item['refer']
, FILTER_VALIDATE_URL) !== false)
...
...
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