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
d147cd23
Commit
d147cd23
authored
Jan 18, 2024
by
汪伟伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
我的任务
parent
3854c0d1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
481 additions
and
13 deletions
+481
-13
app/Admin/Controllers/AlreadyDoneTaskController.php
+184
-0
app/Admin/Controllers/AlreadySettlementController.php
+51
-0
app/Admin/Controllers/NoDoneTaskController.php
+238
-0
app/Admin/Controllers/TaskReceiveController.php
+2
-9
app/Admin/Extensions/Tools/BackAction.php
+1
-1
app/Admin/Extensions/Tools/ReturnBack.php
+1
-1
app/Admin/routes.php
+4
-2
No files found.
app/Admin/Controllers/AlreadyDoneTaskController.php
0 → 100644
View file @
d147cd23
<?php
namespace
App\Admin\Controllers
;
use
App\Admin\Extensions\Tools\BackAction
;
use
App\Admin\Repositories\TasksReceive
;
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
;
class
AlreadyDoneTaskController
extends
AdminController
{
public
$title
=
'已完成任务'
;
/**
* Make a grid builder.
*
* @return Grid
*/
protected
function
grid
()
{
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
->
model
()
->
where
(
'status'
,
'>'
,
0
);
// dd(trans('admin.view'));//查看
$grid
->
model
()
->
orderBy
(
'created_at'
,
'desc'
);
// 在 display 回调中使用
$grid
->
column
(
'序号'
)
->
display
(
function
()
{
return
$this
->
_index
+
1
;
});
if
(
$user
->
is_admin
==
1
)
{
$grid
->
column
(
'user.name'
,
'用户'
);
$grid
->
disableEditButton
();
}
// $grid->column('id')->sortable();
$grid
->
column
(
'task.name'
,
'指标名称'
);
$grid
->
column
(
'task.city_id'
,
'地区'
)
->
distpicker
();
$grid
->
column
(
'task.year'
,
'时间'
);
$grid
->
column
(
'task.refer'
,
'参考信源'
);
$grid
->
column
(
'task.level'
,
'等级'
);
$grid
->
column
(
'task.price'
,
'单价'
);
$grid
->
column
(
'collects.value'
,
'指标值'
);
$grid
->
column
(
'collects.reality_refer'
,
'实际信源'
);
// $grid->column('collects.net_img', '网页截图');
$grid
->
column
(
'status'
,
'状态'
)
->
display
(
function
(
$val
)
{
return
\App\Models\TasksReceive
::
STATUS_DESC
[
$val
];
});
$grid
->
column
(
'created_at'
,
'领取任务时间'
);
$grid
->
actions
(
function
(
Grid\Displayers\Actions
$actions
)
use
(
$user
)
{
if
(
$user
->
is_admin
==
0
)
{
if
(
$this
->
status
<=
2
)
{
$actions
->
append
(
new
BackAction
());
//退回按钮
}
else
{
$actions
->
disableEdit
();
//已经通过的任务不能编辑
}
}
});
$grid
->
disableBatchDelete
();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
// $filter->equal('id');
$filter
->
like
(
'task.name'
,
'指标名称'
);
});
$grid
->
disableDeleteButton
()
->
disableCreateButton
();
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected
function
detail
(
$id
)
{
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.year'
,
'时间'
);
$show
->
field
(
'task.refer'
,
'参考信源'
);
$show
->
field
(
'task.level'
,
'等级'
);
// $show->field('task.guide','参考指南')->unescape();//不 转义html内容
$show
->
field
(
'task.price'
,
'单价'
);
if
(
$show
->
model
()
->
status
>
0
)
{
$show
->
field
(
'collects.value'
,
'指标值'
);
$show
->
field
(
'collects.reality_refer'
,
'实际信源'
);
$show
->
field
(
'collects.refer_level'
,
'信源等级'
);
$show
->
field
(
'collects.net_img'
,
'网页截图'
)
->
unescape
();
$show
->
field
(
'collects.remark'
,
'备注信息'
);
}
// $show->field('created_at');
// $show->field('updated_at');
$show
->
disableDeleteButton
()
->
disableEditButton
();
});
}
public
function
edit
(
$id
,
Content
$content
)
{
return
$content
->
translation
(
$this
->
translation
())
->
title
(
$this
->
title
())
->
description
(
$this
->
description
()[
'edit'
]
??
trans
(
'admin.edit'
))
->
body
(
$this
->
form
(
$id
)
->
edit
(
$id
));
}
/**
* Make a form builder.
*
* @return Form
*/
protected
function
form
(
$id
=
''
)
{
// $model = \App\Models\TasksReceive::query()
// ->leftJoin('tasks as a','task_id','=','a.id')
// ->select(['a.name','a.city_id','a.year','a.refer','tasks_receives.*'])
// ->with(['collects']);
return
Form
::
make
(
\App\Models\TasksReceive
::
with
([
'task'
,
'collects'
]),
function
(
Form
$form
)
use
(
$id
)
{
$form
->
display
(
'id'
);
$form
->
display
(
'task.name'
,
'指标名称'
);
$form
->
display
(
'area'
,
'地区'
);
// $form->distpicker(['city_id'=>'市']);
$form
->
display
(
'task.year'
,
'时间'
);
$form
->
display
(
'task.refer'
,
'参考信源'
);
$form
->
text
(
'collects.value'
,
'指标值'
)
->
required
();
$form
->
text
(
'collects.reality_refer'
,
'实际信源'
)
->
required
();
$form
->
select
(
'collects.refer_level'
,
'信源等级'
)
->
options
([
1
=>
1
,
2
=>
2
,
3
=>
3
,
4
=>
4
,
5
=>
5
])
->
required
();
$form
->
editor
(
'collects.net_img'
,
'网页截图'
)
->
required
();
$form
->
text
(
'collects.remark'
,
'备注信息'
)
->
placeholder
(
'如果找不到请填写备注信息'
)
->
attribute
([
'id'
=>
'remark-zbd'
]);
// $form->ignore(['task.city_id']);//忽略掉不需要保存的字段 (ignore)
// $form->display('created_at');
// $form->display('updated_at');
// // 在表单提交前调用
// $form->submitted(function (Form $form) {
// //...
// });
// //保存前回调
// $form->saving(function (Form $form) {
//
//
// });
//保存后回调
// $form->saved(function (Form $form) {
// });
$form
->
disableDeleteButton
();
});
}
}
app/Admin/Controllers/AlreadySettlementController.php
0 → 100644
View file @
d147cd23
<?php
namespace
App\Admin\Controllers
;
use
App\Admin\Extensions\Tools\OrderDetailAction
;
use
App\Models\TasksOrder
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Http\Controllers\AdminController
;
class
AlreadySettlementController
extends
AdminController
{
protected
$title
=
'已经结算任务'
;
protected
function
grid
()
{
return
Grid
::
make
(
TasksOrder
::
query
(),
function
(
Grid
$grid
)
{
$user
=
Admin
::
user
();
$grid
->
model
()
->
where
(
'user_id'
,
$user
->
id
);
// 在 display 回调中使用
$grid
->
column
(
'序号'
)
->
display
(
function
()
{
return
$this
->
_index
+
1
;
});
// $grid->column('id')->sortable();
$grid
->
column
(
'time'
,
'结算时间'
);
$grid
->
column
(
'num'
,
'数量'
);
$grid
->
column
(
'amount'
,
'金额'
);
$grid
->
column
(
'pay_img'
,
'转账截图'
);
$grid
->
column
(
'status'
,
'状态'
)
->
display
(
function
(
$val
)
{
return
TasksOrder
::
ORDER_STATUS_DESC
[
$val
];
});
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid
->
actions
(
function
(
Grid\Displayers\Actions
$actions
)
use
(
$user
)
{
$actions
->
append
(
new
OrderDetailAction
());
//
});
$grid
->
disableCreateButton
()
->
disableDeleteButton
()
->
disableEditButton
()
->
disableViewButton
();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
// $filter->equal('id');
});
});
}
}
app/Admin/Controllers/NoDoneTaskController.php
0 → 100644
View file @
d147cd23
<?php
namespace
App\Admin\Controllers
;
use
App\Admin\Extensions\Tools\BackAction
;
use
App\Admin\Repositories\TasksReceive
;
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
Illuminate\Http\Request
;
class
NoDoneTaskController
extends
AdminController
{
public
$title
=
'未完成任务'
;
/**
* Make a grid builder.
*
* @return Grid
*/
protected
function
grid
()
{
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
->
model
()
->
where
(
'status'
,
0
);
// dd(trans('admin.view'));//查看
$grid
->
model
()
->
orderBy
(
'created_at'
,
'desc'
);
// 在 display 回调中使用
$grid
->
column
(
'序号'
)
->
display
(
function
()
{
return
$this
->
_index
+
1
;
});
if
(
$user
->
is_admin
==
1
)
{
$grid
->
column
(
'user.name'
,
'用户'
);
$grid
->
disableEditButton
();
}
// $grid->column('id')->sortable();
$grid
->
column
(
'task.name'
,
'指标名称'
);
$grid
->
column
(
'task.city_id'
,
'地区'
)
->
distpicker
();
$grid
->
column
(
'task.year'
,
'时间'
);
$grid
->
column
(
'task.refer'
,
'参考信源'
);
$grid
->
column
(
'task.level'
,
'等级'
);
$grid
->
column
(
'created_at'
,
'领取任务时间'
);
$grid
->
actions
(
function
(
Grid\Displayers\Actions
$actions
)
use
(
$user
)
{
if
(
$user
->
is_admin
==
0
)
{
if
(
$this
->
status
<=
2
)
{
$actions
->
append
(
new
BackAction
());
//退回按钮
}
else
{
$actions
->
disableEdit
();
//已经通过的任务不能编辑
}
}
});
$grid
->
disableBatchDelete
();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
// $filter->equal('id');
$filter
->
like
(
'task.name'
,
'指标名称'
);
});
$grid
->
disableDeleteButton
()
->
disableCreateButton
();
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected
function
detail
(
$id
)
{
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.year'
,
'时间'
);
$show
->
field
(
'task.refer'
,
'参考信源'
);
$show
->
field
(
'task.level'
,
'等级'
);
// $show->field('task.guide','参考指南')->unescape();//不 转义html内容
$show
->
field
(
'task.price'
,
'单价'
);
if
(
$show
->
model
()
->
status
>
0
)
{
$show
->
field
(
'collects.value'
,
'指标值'
);
$show
->
field
(
'collects.reality_refer'
,
'实际信源'
);
$show
->
field
(
'collects.refer_level'
,
'信源等级'
);
$show
->
field
(
'collects.net_img'
,
'网页截图'
)
->
unescape
();
$show
->
field
(
'collects.remark'
,
'备注信息'
);
}
// $show->field('created_at');
// $show->field('updated_at');
$show
->
disableDeleteButton
()
->
disableEditButton
();
});
}
public
function
edit
(
$id
,
Content
$content
)
{
return
$content
->
translation
(
$this
->
translation
())
->
title
(
$this
->
title
())
->
description
(
$this
->
description
()[
'edit'
]
??
trans
(
'admin.edit'
))
->
body
(
$this
->
form
(
$id
)
->
edit
(
$id
));
}
public
function
notFind
(
$id
,
Request
$request
)
{
$remark
=
$request
->
get
(
'remark'
);
$receive
=
\App\Models\TasksReceive
::
query
()
->
find
(
$id
);
if
(
$receive
){
$receive
->
status
=
1
;
TasksCollect
::
query
()
->
where
(
'receive_id'
,
$id
)
->
update
([
'is_find'
=>
0
,
'remark'
=>
$remark
]);
$receive
->
save
();
}
$no
=
\App\Models\TasksReceive
::
query
()
->
where
(
'id'
,
'!='
,
$id
)
->
where
(
'status'
,
0
)
->
orderBy
(
'created_at'
)
->
first
();
if
(
$no
){
$url
=
'/noDone/'
.
$no
->
id
.
'/edit'
;
}
else
{
$url
=
'/already'
;
}
return
response
()
->
redirectTo
(
$url
);
//自动跳转下一个
}
/**
* Make a form builder.
*
* @return Form
*/
protected
function
form
(
$id
=
''
)
{
// $model = \App\Models\TasksReceive::query()
// ->leftJoin('tasks as a','task_id','=','a.id')
// ->select(['a.name','a.city_id','a.year','a.refer','tasks_receives.*'])
// ->with(['collects']);
return
Form
::
make
(
\App\Models\TasksReceive
::
with
([
'task'
,
'collects'
]),
function
(
Form
$form
)
use
(
$id
)
{
$form
->
display
(
'id'
);
$form
->
display
(
'task.name'
,
'指标名称'
);
$form
->
display
(
'area'
,
'地区'
);
// $form->distpicker(['city_id'=>'市']);
$form
->
display
(
'task.year'
,
'时间'
);
$form
->
display
(
'task.refer'
,
'参考信源'
);
$form
->
text
(
'collects.value'
,
'指标值'
)
->
required
();
$form
->
text
(
'collects.reality_refer'
,
'实际信源'
)
->
required
();
$form
->
select
(
'collects.refer_level'
,
'信源等级'
)
->
options
([
1
=>
1
,
2
=>
2
,
3
=>
3
,
4
=>
4
,
5
=>
5
])
->
required
();
$form
->
editor
(
'collects.net_img'
,
'网页截图'
)
->
required
();
$form
->
text
(
'collects.remark'
,
'备注信息'
)
->
placeholder
(
'如果找不到请填写备注信息'
)
->
attribute
([
'id'
=>
'remark-zbd'
]);
// $form->button('<a style="color: white;" href=/notFind/' . $id . '?remark='.'>找不到<a>');
$form
->
footer
(
function
(
$footer
)
use
(
$id
)
{
$receive
=
\App\Models\TasksReceive
::
query
()
->
find
(
$id
);
if
(
$receive
&&
$receive
->
status
==
0
){
$footer
->
view
(
'admin.button'
,
[
'id'
=>
$id
]);
}
});
// $form->ignore(['task.city_id']);//忽略掉不需要保存的字段 (ignore)
// $form->display('created_at');
// $form->display('updated_at');
// // 在表单提交前调用
// $form->submitted(function (Form $form) {
// //...
// });
// //保存前回调
// $form->saving(function (Form $form) {
//
//
// });
//保存后回调
$form
->
saved
(
function
(
Form
$form
)
{
if
(
$this
->
status
==
0
)
{
// dd($this->id);
\App\Models\TasksReceive
::
query
()
->
where
(
'id'
,
$this
->
id
)
->
update
([
'status'
=>
1
]);
//状态更新成已完成
TasksCollect
::
query
()
->
where
(
'receive_id'
,
$this
->
id
)
->
update
([
'is_find'
=>
1
]);
//可以找到
TasksApprove
::
query
()
->
updateOrCreate
([
//审核表里新增一条记录
'task_id'
=>
$this
->
task_id
,
'user_id'
=>
$this
->
user_id
,
'receive_id'
=>
$this
->
id
,
],
[
'task_id'
=>
$this
->
task_id
,
'user_id'
=>
$this
->
user_id
,
'receive_id'
=>
$this
->
id
,
]);
$no
=
\App\Models\TasksReceive
::
query
()
->
where
(
'id'
,
'!='
,
$this
->
id
)
->
where
(
'status'
,
0
)
->
orderBy
(
'created_at'
,
'desc'
)
->
first
();
if
(
$no
){
$url
=
'/noDone/'
.
$no
->
id
.
'/edit'
;
}
else
{
$url
=
'/already'
;
}
// var_dump($url);
return
$form
->
response
()
->
success
(
'保存成功'
)
->
redirect
(
$url
);
}
});
$form
->
disableDeleteButton
();
});
}
}
app/Admin/Controllers/TaskReceiveController.php
View file @
d147cd23
...
...
@@ -19,16 +19,9 @@ use Illuminate\Http\Request;
class
TaskReceiveController
extends
AdminController
{
protected
$title
=
' '
;
protected
$title
=
''
;
public
function
noDone
(
Content
$content
)
{
return
$content
->
translation
(
$this
->
translation
())
->
title
(
$this
->
title
())
->
description
(
$this
->
description
()[
'index'
]
??
trans
(
'admin.list'
))
->
body
(
$this
->
getData
(
0
));
}
/**
* @return Tab
*/
...
...
app/Admin/Extensions/Tools/BackAction.php
View file @
d147cd23
...
...
@@ -60,7 +60,7 @@ class BackAction extends RowAction
// dd($id,$user->id);
return
$this
->
response
()
->
success
(
'退回成功'
)
->
redirect
(
'
receives
'
);
->
redirect
(
'
noDone
'
);
}
public
function
html
()
...
...
app/Admin/Extensions/Tools/ReturnBack.php
View file @
d147cd23
...
...
@@ -30,7 +30,7 @@ class ReturnBack extends Action
$type
=
$request
->
get
(
'type'
);
if
(
$type
==
1
){
$url
=
'/
receives
'
;
$url
=
'/
settle
'
;
}
if
(
$type
==
2
){
...
...
app/Admin/routes.php
View file @
d147cd23
...
...
@@ -22,12 +22,14 @@ Route::group([
$router
->
get
(
'receive/{id}'
,
'TaskController@receiveDetail'
);
$router
->
get
(
'notFind/{id}'
,
'
TaskReceive
Controller@notFind'
);
$router
->
get
(
'notFind/{id}'
,
'
NoDoneTask
Controller@notFind'
);
$router
->
resource
(
'receives'
,
'TaskReceiveController'
);
$router
->
get
(
'noDone'
,
'TaskReceiveController@noDone'
);
$router
->
resource
(
'noDone'
,
'NoDoneTaskController'
);
$router
->
resource
(
'already'
,
'AlreadyDoneTaskController'
);
$router
->
resource
(
'settle'
,
'AlreadySettlementController'
);
$router
->
resource
(
'approves'
,
'TasksApproveController'
);
...
...
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