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
5a1e0464
Commit
5a1e0464
authored
Jan 18, 2024
by
汪伟伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jiesuan
parent
fd2b97a7
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
243 additions
and
103 deletions
+243
-103
app/Admin/Controllers/AlreadyApproveController.php
+148
-0
app/Admin/Controllers/CreateOrderController.php
+86
-0
app/Admin/Controllers/TaskController.php
+2
-1
app/Admin/Controllers/TasksApproveController.php
+4
-27
app/Admin/Controllers/TasksOrderController.php
+1
-75
app/Admin/routes.php
+2
-0
No files found.
app/Admin/Controllers/AlreadyApproveController.php
0 → 100644
View file @
5a1e0464
<?php
namespace
App\Admin\Controllers
;
use
App\Admin\Extensions\Tools\NotPassAction
;
use
App\Admin\Extensions\Tools\PassAction
;
use
App\Admin\Repositories\TasksApprove
;
use
App\Admin\Services\CityAreaService
;
use
App\Models\Task
;
use
Dcat\Admin\Actions\Action
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Http\Controllers\Dashboard
;
use
Dcat\Admin\Layout\Column
;
use
Dcat\Admin\Layout\Content
;
use
Dcat\Admin\Layout\Row
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Dcat\Admin\Widgets\Tab
;
use
SuperEggs\DcatDistpicker\DcatDistpickerHelper
;
class
AlreadyApproveController
extends
AdminController
{
protected
$title
=
'已审核'
;
/**
* Make a grid builder.
*
* @return Grid
*/
protected
function
grid
()
{
return
Grid
::
make
(
TasksApprove
::
with
([
'task'
,
'collects'
,
'user'
]),
function
(
Grid
$grid
)
{
$grid
->
model
()
->
where
(
'status'
,
'>'
,
0
)
->
orderBy
(
'task_id'
,
'desc'
);
// 在 display 回调中使用
$grid
->
column
(
'序号'
)
->
display
(
function
()
{
return
$this
->
_index
+
1
;
});
$grid
->
column
(
'user.name'
,
'用户'
);
// $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.price'
,
'单价'
);
$grid
->
column
(
'collects.value'
,
'指标值'
);
$grid
->
column
(
'collects.reality_refer'
,
'实际信源'
);
$grid
->
column
(
'collects.refer_level'
,
'信源等级'
);
// $grid->column('collects.net_img', '截图链接');
$grid
->
column
(
'status'
,
'状态'
)
->
display
(
function
(
$statusValue
)
{
//是当前字段的值
return
\App\Models\TasksApprove
::
APPROVE_STATUS_DESC
[
$statusValue
];
});
// $grid->tools('<a class="btn btn-primary disable-outline">测试按钮</a>');
$grid
->
disableEditButton
()
->
disableDeleteButton
()
->
disableCreateButton
()
->
disableFilterButton
()
->
disableBatchDelete
();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
equal
(
'id'
);
});
$grid
->
actions
(
function
(
Grid\Displayers\Actions
$actions
)
{
if
(
$this
->
status
<
3
)
{
$actions
->
append
(
new
PassAction
());
//通过按钮
$actions
->
append
(
new
NotPassAction
());
//不通过按钮
}
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected
function
detail
(
$id
)
{
return
Show
::
make
(
$id
,
TasksApprove
::
with
([
'task'
,
'collects'
,
'user'
]),
function
(
Show
$show
)
{
$show
->
field
(
'user.name'
,
'用户'
);
$show
->
field
(
'task.name'
,
'指标名称'
);
$show
->
field
(
'task.city_id'
,
'地区'
)
->
as
(
function
(
$val
)
{
return
CityAreaService
::
getAreaName
(
$val
);
});
$show
->
field
(
'task.year'
,
'时间'
);
$show
->
field
(
'task.refer'
,
'参考信源'
);
$show
->
field
(
'task.price'
,
'单价'
);
$show
->
field
(
'collects.value'
,
'指标值'
);
$show
->
field
(
'collects.reality_refer'
,
'实际信源'
);
$show
->
field
(
'collects.refer_level'
,
'信源等级'
);
$show
->
field
(
'collects.net_img'
,
'截图链接'
)
->
unescape
();
$show
->
field
(
'status'
,
'状态'
)
->
as
(
function
(
$statusValue
)
{
// 获取当前行的其他字段
// $username = $this->username;
return
\App\Models\TasksApprove
::
APPROVE_STATUS_DESC
[
$statusValue
];
});
$show
->
field
(
'msg'
,
'未通过原因'
);
// $show->field('created_at');
// $show->field('updated_at');
$show
->
disableDeleteButton
()
->
disableEditButton
();
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected
function
form
()
{
return
Form
::
make
(
new
TasksApprove
(),
function
(
Form
$form
)
{
// $form->display('id');
// $form->text('task_id');
// $form->text('user_id');
// $form->text('receive_id');
// $form->text('status');
$form
->
text
(
'msg'
);
// $form->display('created_at');
// $form->display('updated_at');
});
}
// public function edit($id, Content $content)
// {
//// dd($id);
// return $content
// ->translation($this->translation())
// ->title($this->title())
// ->description($this->description()['edit'] ?? trans('admin.edit'))
// ->body($this->form());
// }
}
app/Admin/Controllers/CreateOrderController.php
0 → 100644
View file @
5a1e0464
<?php
namespace
App\Admin\Controllers
;
use
App\Admin\Extensions\Tools\CreateSettlementOrder
;
use
App\Admin\Extensions\Tools\ReturnBack
;
use
App\Admin\Extensions\Tools\UserConfirmOrder
;
use
App\Admin\Repositories\TasksReceive
;
use
App\Models\AdminUser
;
use
App\Models\TasksOrder
;
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\Tab
;
class
CreateOrderController
extends
AdminController
{
protected
$title
=
'数据'
;
protected
function
grid
()
{
return
Grid
::
make
(
TasksReceive
::
with
([
'task'
,
'collects'
,
'user'
]),
function
(
Grid
$grid
)
{
$grid
->
model
()
->
where
(
'status'
,
3
);
//3:审核通过但未结算的任务
$grid
->
disablePagination
();
// 在 display 回调中使用
$grid
->
column
(
'序号'
)
->
display
(
function
()
{
return
$this
->
_index
+
1
;
});
$grid
->
column
(
'user.name'
,
'用户'
);
// $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.price'
,
'单价'
);
$grid
->
column
(
'collects.value'
,
'指标值'
);
$grid
->
column
(
'collects.reality_refer'
,
'实际信源'
);
$grid
->
column
(
'status'
,
'状态'
)
->
display
(
function
(
$val
)
{
return
\App\Models\TasksReceive
::
STATUS_DESC
[
$val
];
});
$grid
->
tools
(
new
CreateSettlementOrder
(
'<button class="btn btn-primary ">生成结算单</button>'
));
// $grid->actions([new PassAction()]);//通过按钮
// $grid->actions([new NotPassAction()]);//不通过按钮
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
expand
();
//展开过滤器
// 更改为 panel 布局
$filter
->
panel
();
// 注意切换为panel布局方式时需要重新调整表单字段的宽度
$filter
->
equal
(
'user.id'
,
'用户'
)
->
width
(
2
)
->
select
(
function
()
{
$userIds
=
\App\Models\TasksReceive
::
query
()
->
where
(
'status'
,
3
)
->
pluck
(
'user_id'
)
->
toArray
();
$userArr
=
AdminUser
::
query
()
->
whereIn
(
'id'
,
$userIds
)
->
get
()
->
toArray
();
return
array_column
(
$userArr
,
'name'
,
'id'
);
});
$filter
->
equal
(
'status'
,
'状态'
)
->
width
(
2
)
->
select
([
'3'
=>
'未结算'
])
->
default
(
3
);
});
$grid
->
disableFilterButton
();
$grid
->
disableDeleteButton
()
->
disableCreateButton
()
->
disableEditButton
()
->
disableViewButton
()
->
disableActions
()
->
disableBatchDelete
();
});
}
}
app/Admin/Controllers/TaskController.php
View file @
5a1e0464
...
@@ -29,7 +29,7 @@ class TaskController extends AdminController
...
@@ -29,7 +29,7 @@ class TaskController extends AdminController
{
{
return
$content
return
$content
// ->translation($this->translation())
// ->translation($this->translation())
// ->title($this->title()
)
->
title
(
'待领取任务列表'
)
// ->description($this->description()['index'] ?? trans('admin.list'))
// ->description($this->description()['index'] ?? trans('admin.list'))
->
body
(
$this
->
getData
());
->
body
(
$this
->
getData
());
}
}
...
@@ -43,6 +43,7 @@ class TaskController extends AdminController
...
@@ -43,6 +43,7 @@ class TaskController extends AdminController
// $model = \App\Models\Task::query()->whereNotIn('id',$exists)
// $model = \App\Models\Task::query()->whereNotIn('id',$exists)
return
Grid
::
make
(
new
Task
(),
function
(
Grid
$grid
)
use
(
$user
,
$exists
)
{
return
Grid
::
make
(
new
Task
(),
function
(
Grid
$grid
)
use
(
$user
,
$exists
)
{
// $grid->title('dasd');
$grid
->
model
()
->
whereNotIn
(
'id'
,
$exists
);
$grid
->
model
()
->
whereNotIn
(
'id'
,
$exists
);
// dd(Admin::user()->is_admin);
// dd(Admin::user()->is_admin);
// dd(trans('admin.view'));//查看
// dd(trans('admin.view'));//查看
...
...
app/Admin/Controllers/TasksApproveController.php
View file @
5a1e0464
...
@@ -22,21 +22,8 @@ use SuperEggs\DcatDistpicker\DcatDistpickerHelper;
...
@@ -22,21 +22,8 @@ use SuperEggs\DcatDistpicker\DcatDistpickerHelper;
class
TasksApproveController
extends
AdminController
class
TasksApproveController
extends
AdminController
{
{
/**
protected
$title
=
'未审核'
;
* @return Tab
*/
protected
function
grid
()
{
$tab
=
Tab
::
make
();
// $tab->add('选项卡1', view('...'));
$tab
->
add
(
'未审核'
,
$this
->
getData
(
0
),
false
,
'a'
);
$tab
->
add
(
'已审核'
,
$this
->
getData
(
1
),
false
,
'b'
);
return
$tab
;
}
public
function
checkData
(
$status
)
public
function
checkData
(
$status
)
{
{
...
@@ -136,20 +123,14 @@ class TasksApproveController extends AdminController
...
@@ -136,20 +123,14 @@ class TasksApproveController extends AdminController
*
*
* @return Grid
* @return Grid
*/
*/
protected
function
g
etData
(
$status
)
protected
function
g
rid
(
)
{
{
// $taskIds = TasksReceive::query()->where('status',1)->pluck('task_id');
// $taskIds = TasksReceive::query()->where('status',1)->pluck('task_id');
// $model = \App\Models\Task::query()->with(['approves'])->whereIn('id',$taskIds);
// $model = \App\Models\Task::query()->with(['approves'])->whereIn('id',$taskIds);
// dd($taskIds);
// dd($taskIds);
return
Grid
::
make
(
TasksApprove
::
with
([
'task'
,
'collects'
,
'user'
]),
function
(
Grid
$grid
)
use
(
$status
)
{
return
Grid
::
make
(
TasksApprove
::
with
([
'task'
,
'collects'
,
'user'
]),
function
(
Grid
$grid
)
{
if
(
$status
==
0
)
{
$grid
->
model
()
->
where
(
'status'
,
0
)
->
orderBy
(
'task_id'
,
'desc'
);
$grid
->
model
()
->
where
(
'status'
,
0
)
->
orderBy
(
'task_id'
,
'desc'
);
}
else
{
$grid
->
model
()
->
where
(
'status'
,
'>'
,
0
)
->
orderBy
(
'task_id'
,
'desc'
);
}
// 在 display 回调中使用
// 在 display 回调中使用
$grid
->
column
(
'序号'
)
->
display
(
function
()
{
$grid
->
column
(
'序号'
)
->
display
(
function
()
{
...
@@ -168,11 +149,7 @@ class TasksApproveController extends AdminController
...
@@ -168,11 +149,7 @@ class TasksApproveController extends AdminController
$grid
->
column
(
'collects.reality_refer'
,
'实际信源'
);
$grid
->
column
(
'collects.reality_refer'
,
'实际信源'
);
$grid
->
column
(
'collects.refer_level'
,
'信源等级'
);
$grid
->
column
(
'collects.refer_level'
,
'信源等级'
);
// $grid->column('collects.net_img', '截图链接');
// $grid->column('collects.net_img', '截图链接');
if
(
$status
)
{
$grid
->
column
(
'status'
,
'状态'
)
->
display
(
function
(
$statusValue
)
{
//是当前字段的值
return
\App\Models\TasksApprove
::
APPROVE_STATUS_DESC
[
$statusValue
];
});
}
// $grid->tools('<a class="btn btn-primary disable-outline">测试按钮</a>');
// $grid->tools('<a class="btn btn-primary disable-outline">测试按钮</a>');
...
...
app/Admin/Controllers/TasksOrderController.php
View file @
5a1e0464
...
@@ -116,87 +116,13 @@ class TasksOrderController extends AdminController
...
@@ -116,87 +116,13 @@ class TasksOrderController extends AdminController
});
});
}
}
/**
* @return Tab
*/
protected
function
grid
()
{
$tab
=
Tab
::
make
();
// $tab->add('选项卡1', view('...'));
// $user = Admin::user();
$tab
->
add
(
'结算列表'
,
$this
->
getData
(),
true
,
'11111'
);
$tab
->
add
(
'生成结算单'
,
$this
->
getReceiveData
(),
true
,
'22222'
);
return
$tab
;
}
protected
function
getReceiveData
()
{
return
Grid
::
make
(
TasksReceive
::
with
([
'task'
,
'collects'
,
'user'
]),
function
(
Grid
$grid
)
{
$grid
->
model
()
->
where
(
'status'
,
3
);
//3:审核通过但未结算的任务
// 在 display 回调中使用
$grid
->
column
(
'序号'
)
->
display
(
function
()
{
return
$this
->
_index
+
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.price'
,
'单价'
);
$grid
->
column
(
'collects.value'
,
'指标值'
);
$grid
->
column
(
'collects.reality_refer'
,
'实际信源'
);
$grid
->
column
(
'status'
,
'状态'
)
->
display
(
function
(
$val
)
{
return
\App\Models\TasksReceive
::
STATUS_DESC
[
$val
];
});
$grid
->
tools
(
new
CreateSettlementOrder
(
'<button class="btn btn-primary ">生成结算单</button>'
));
// $grid->actions([new PassAction()]);//通过按钮
// $grid->actions([new NotPassAction()]);//不通过按钮
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
expand
();
//展开过滤器
// 更改为 panel 布局
$filter
->
panel
();
// 注意切换为panel布局方式时需要重新调整表单字段的宽度
$filter
->
equal
(
'user.id'
,
'用户'
)
->
width
(
2
)
->
select
(
function
()
{
$userIds
=
\App\Models\TasksReceive
::
query
()
->
where
(
'status'
,
3
)
->
pluck
(
'user_id'
)
->
toArray
();
$userArr
=
AdminUser
::
query
()
->
whereIn
(
'id'
,
$userIds
)
->
get
()
->
toArray
();
return
array_column
(
$userArr
,
'name'
,
'id'
);
});
$filter
->
equal
(
'status'
,
'状态'
)
->
width
(
2
)
->
select
([
'3'
=>
'未结算'
])
->
default
(
3
);
});
$grid
->
disableFilterButton
();
$grid
->
disableDeleteButton
()
->
disableCreateButton
()
->
disableEditButton
()
->
disableViewButton
()
->
disableActions
()
->
disableBatchDelete
();
});
}
/**
/**
* Make a grid builder.
* Make a grid builder.
*
*
* @return Grid
* @return Grid
*/
*/
protected
function
g
etData
()
protected
function
g
rid
()
{
{
return
Grid
::
make
(
TasksOrder
::
with
([
'user'
]),
function
(
Grid
$grid
)
{
return
Grid
::
make
(
TasksOrder
::
with
([
'user'
]),
function
(
Grid
$grid
)
{
// 在 display 回调中使用
// 在 display 回调中使用
...
...
app/Admin/routes.php
View file @
5a1e0464
...
@@ -33,7 +33,9 @@ Route::group([
...
@@ -33,7 +33,9 @@ Route::group([
$router
->
resource
(
'approves'
,
'TasksApproveController'
);
$router
->
resource
(
'approves'
,
'TasksApproveController'
);
$router
->
resource
(
'alreadyApprove'
,
'AlreadyApproveController'
);
$router
->
resource
(
'orders'
,
'TasksOrderController'
);
$router
->
resource
(
'orders'
,
'TasksOrderController'
);
$router
->
resource
(
'createOrder'
,
'CreateOrderController'
);
$router
->
get
(
'orderReceive/{id}'
,
'TasksOrderController@orderReceive'
);
$router
->
get
(
'orderReceive/{id}'
,
'TasksOrderController@orderReceive'
);
...
...
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