Commit f90682b5 by 汪伟伟

找不到

parent a841ad99
......@@ -3,7 +3,10 @@
namespace App\Admin\Controllers;
use App\Admin\Extensions\Tools\BackAction;
use App\Admin\Extensions\Tools\CreateSettlementOrder;
use App\Admin\Extensions\Tools\NotFindAction;
use App\Admin\Extensions\Tools\OrderDetailAction;
use App\Admin\Extensions\Tools\PassAction;
use App\Admin\Repositories\TasksReceive;
use App\Models\TasksApprove;
use App\Models\TasksOrder;
......@@ -11,14 +14,17 @@ 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\Repositories\EloquentRepository;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Widgets\Tab;
use Illuminate\Http\Request;
class TaskReceiveController extends AdminController
{
protected $title = ' ';
/**
* @return Tab
*/
......@@ -28,13 +34,13 @@ class TaskReceiveController extends AdminController
// $tab->add('选项卡1', view('...'));
$user = Admin::user();
if ($user->is_admin){
$tab->add('全部任务', $this->getData(-1),true,'1');
if ($user->is_admin) {
$tab->add('全部任务', $this->getData(-1), true, '1');
}
$tab->add('待完成任务', $this->getData(0),true,'2');
$tab->add('已完成任务', $this->getData(1),true,'3');
$tab->add('待完成任务', $this->getData(0), true, '2');
$tab->add('已完成任务', $this->getData(1), true, '3');
if ($user->is_admin == 0) {//用户
$tab->add('已经结算任务', $this->getOrderData(),true,'4');
$tab->add('已经结算任务', $this->getOrderData(), true, '4');
}
return $tab;
}
......@@ -43,7 +49,7 @@ class TaskReceiveController extends AdminController
{
return Grid::make(TasksOrder::query(), function (Grid $grid) {
$user = Admin::user();
$grid->model()->where('user_id',$user->id);
$grid->model()->where('user_id', $user->id);
// 在 display 回调中使用
$grid->column('序号')->display(function () {
......@@ -51,10 +57,10 @@ class TaskReceiveController extends AdminController
});
// $grid->column('id')->sortable();
$grid->column('time','结算时间');
$grid->column('num','数量');
$grid->column('amount','金额');
$grid->column('pay_img','转账截图');
$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];
});
......@@ -78,11 +84,11 @@ class TaskReceiveController extends AdminController
protected function getData($status)
{
return Grid::make(TasksReceive::with(['task','collects','user']), function (Grid $grid) use ($status) {
return Grid::make(TasksReceive::with(['task', 'collects', 'user']), function (Grid $grid) use ($status) {
$user = Admin::user();
$user->is_admin == 0 && $grid->model()->where('user_id', $user->id);
if ($status == 0) $grid->model()->where('status', 0);
if ($status == 1) $grid->model()->where('status','>',0);
if ($status == 1) $grid->model()->where('status', '>', 0);
// dd(trans('admin.view'));//查看
// 在 display 回调中使用
......@@ -110,8 +116,8 @@ class TaskReceiveController extends AdminController
// $grid->column('collects.net_img', '网页截图');
}
if ($status == -1 || $status == 1){
$grid->column('status', '状态')->display(function ($val){
if ($status == -1 || $status == 1) {
$grid->column('status', '状态')->display(function ($val) {
return \App\Models\TasksReceive::STATUS_DESC[$val];
});
}
......@@ -119,7 +125,7 @@ class TaskReceiveController extends AdminController
if ($user->is_admin == 0) {
if ($this->status <= 2) {
$actions->append(new BackAction());//退回按钮
}else{
} else {
$actions->disableEdit();//已经通过的任务不能编辑
}
}
......@@ -135,8 +141,6 @@ class TaskReceiveController extends AdminController
});
$grid->disableDeleteButton()->disableCreateButton();
......@@ -155,7 +159,7 @@ class TaskReceiveController 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', '地区');
$show->field('task.city_id', '地区')->unserialize();
$show->field('task.year', '时间');
$show->field('task.refer', '参考信源');
$show->field('task.level', '等级');
......@@ -178,19 +182,44 @@ class TaskReceiveController extends AdminController
});
}
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 update($id)
{
return $this->form()->update($id);
}
public function notFind($id)
{
dd(2323, $id);
}
public function edit3()
{
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
protected function form($id=123)
{
return Form::make(TasksReceive::with(['task', 'collects']), function (Form $form) {
return Form::make(TasksReceive::with(['task', 'collects']), function (Form $form) use ($id) {
$form->display('id');
$form->display('task.name');
$form->display('task.city_id');
$form->display('task.year');
$form->display('task.refer');
$form->display('task.name', '指标名称');
$form->display('task.city_id', '地区')->options('/getCity');
$form->display('task.year', '时间');
$form->display('task.refer', '参考信源');
$form->text('collects.value', '指标值')->required();
$form->url('collects.reality_refer', '实际信源')->required();
......@@ -198,6 +227,9 @@ class TaskReceiveController extends AdminController
$form->editor('collects.net_img', '网页截图')->required();
$form->text('collects.remark', '备注信息');
$form->button('<a href=/notFind/' . $id . '>找不到<a');
// $form->display('created_at');
// $form->display('updated_at');
......@@ -216,13 +248,13 @@ class TaskReceiveController extends AdminController
if ($this->status == 0) {
\App\Models\TasksReceive::query()->where('id', $this->id)->update(['status' => 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,
'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,
]);
}
});
......
......@@ -5,8 +5,14 @@ namespace App\Admin\Controllers;
use App\Admin\Extensions\Tools\NotPassAction;
use App\Admin\Extensions\Tools\PassAction;
use App\Admin\Repositories\TasksApprove;
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;
......@@ -23,14 +29,107 @@ class TasksApproveController extends AdminController
$tab = Tab::make();
// $tab->add('选项卡1', view('...'));
$tab->add('未审核', $this->getData(0),true,'a');
$tab->add('已审核', $this->getData(1),true,'b');
$tab->add('未审核', $this->getData(0), true, 'a');
$tab->add('已审核', $this->getData(1), true, 'b');
return $tab;
}
public function checkData($status)
{
$content = Content::make();
return $content->body(view('admin.check',['id'=>1]));
}
protected function getData22($status)
{
$taskIds = \App\Models\TasksApprove::query()->where('status', 0)->pluck('task_id');
$model = \App\Models\Task::query()->with(['approves'])->whereIn('id', $taskIds);
// dd($taskIds);
$header = Grid::make($model, function (Grid $grid) use ($status) {
// 在 display 回调中使用
$grid->column('序号')->display(function () {
return $this->_index + 1;
});
// $grid->column('id')->sortable();
$grid->column('name', '指标名称');
$grid->column('city_id', '地区')->distpicker();
$grid->column('year', '时间');
$grid->column('refer', '参考信源');
$grid->column('price', '单价');
$grid->disableEditButton()->disableDeleteButton()->disableCreateButton()->disableFilterButton()->disableBatchDelete();
$grid->actions(function (Grid\Displayers\Actions $actions) {
$actions->append(new PassAction());//通过按钮
$actions->append(new NotPassAction());//不通过按钮
});
});
$body = Grid::make(TasksApprove::with(['task', 'collects', 'user']), function (Grid $grid) use ($status) {
// 在 display 回调中使用
$grid->column('序号')->display(function () {
return $this->_index + 1;
});
// $grid->column('id')->sortable();
$grid->column('collects.value', '指标值');
$grid->column('collects.reality_refer', '实际信源');
$grid->column('collects.refer_level', '信源等级');
// $grid->column('collects.net_img', '截图链接');
$grid->disableEditButton()->disableDeleteButton()->disableCreateButton()->disableFilterButton()->disableBatchDelete();
$grid->actions(function (Grid\Displayers\Actions $actions) {
$actions->append(new PassAction());//通过按钮
$actions->append(new NotPassAction());//不通过按钮
});
});
$content = Content::make();
$row = new Row();
$row->column(12, function (Column $column) use ($header){
$column->row(
$header
// function (Row $row) {
// $row->column(12 / 7, '序号');
// $row->column(12 / 7, '指标名称');
// $row->column(12 / 7, '地区');
// $row->column(12 / 7, '时间');
// $row->column(12 / 7, '参考信源');
// $row->column(12 / 7, '单价');
// $row->column(12 / 7, '操作');
// }
);
$column->row(function (Row $row) {
$row->column(6, 4);
$row->column(6, 5);
});
});
return $row;
}
/**
* Make a grid builder.
*
......@@ -42,13 +141,15 @@ class TasksApproveController extends AdminController
// $model = \App\Models\Task::query()->with(['approves'])->whereIn('id',$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) use ($status) {
if ($status == 0) {
$grid->model()->where('status', 0)->orderBy('task_id', 'desc');
} else {
$grid->model()->where('status', '>', 0)->orderBy('task_id', 'desc');
}
// 在 display 回调中使用
$grid->column('序号')->display(function () {
return $this->_index + 1;
......@@ -79,8 +180,8 @@ class TasksApproveController extends AdminController
$filter->equal('id');
});
$grid->actions(function (Grid\Displayers\Actions $actions){
if ($this->status < 3){
$grid->actions(function (Grid\Displayers\Actions $actions) {
if ($this->status < 3) {
$actions->append(new PassAction());//通过按钮
$actions->append(new NotPassAction());//不通过按钮
}
......@@ -99,11 +200,11 @@ class TasksApproveController extends AdminController
*/
protected function detail($id)
{
return Show::make($id,TasksApprove::with(['task', 'collects','user']), function (Show $show) {
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){
$show->field('task.city_id', '地区')->as(function ($val) {
return DcatDistpickerHelper::getAreaName($val);
});
$show->field('task.year', '时间');
......@@ -115,7 +216,7 @@ class TasksApproveController extends AdminController
$show->field('collects.refer_level', '信源等级');
$show->field('collects.net_img', '截图链接')->unescape();
$show->field('status','状态')->as(function ($statusValue){
$show->field('status', '状态')->as(function ($statusValue) {
// 获取当前行的其他字段
// $username = $this->username;
return \App\Models\TasksApprove::APPROVE_STATUS_DESC[$statusValue];
......
<?php
namespace App\Admin\Extensions\Tools;
use App\Models\Task;
use App\Models\TasksApprove;
use App\Models\TasksCollect;
use App\Models\TasksReceive;
use Dcat\Admin\Admin;
use Dcat\Admin\Grid\RowAction;
use Illuminate\Http\Request;
class NotFindAction extends RowAction
{
public $id;
public function __construct($id,$title = null)
{
$this->id = $id;
}
/**
* 返回字段标题
*
*
* * @return string
*/
public function title()
{
return '通过&nbsp;&nbsp;&nbsp;';
}
/**
* 添加JS
*
*
* * @return string
*/
/**
* 处理请求,如果不需要接口处理,请直接删除这个方法
*
* @param Request $request
*
* @return \Dcat\Admin\Actions\Response
*/
public function handle(Request $request)
{
// 获取主键
dd(111);
// $user = Admin::user();
return $this->response()->success('Processed successfully')
->refresh();
}
public function html()
{
return parent::html();
}
}
......@@ -22,6 +22,8 @@ Route::group([
$router->get('receive/{id}', 'TaskController@receiveDetail');
$router->get('notFind/{id}', 'TaskReceiveController@notFind');
$router->resource('receives', 'TaskReceiveController');
$router->resource('approves', 'TasksApproveController');
......
<div class="tab-pane active" id="tab_a" style="margin-top: -3%;margin-left: -2%;">
<div class="row ">
<div class="col-md-12">
<div class="dcat-box">
{{-- <div class="d-block pb-0">--}}
{{-- <div class="custom-data-table-header">--}}
{{-- <div class="table-responsive">--}}
{{-- <div class="top d-block clearfix p-0">--}}
{{-- <button data-action="refresh"--}}
{{-- class="btn btn-primary grid-refresh btn-mini btn-outline"--}}
{{-- style="margin-right:3px">--}}
{{-- <i class="feather icon-refresh-cw"></i><span class="d-none d-sm-inline">&nbsp; 刷新</span>--}}
{{-- </button>--}}
{{-- <div class="pull-right" data-responsive-table-toolbar="grid-table">--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- </div>--}}
@if ($id == 1)
fsdf大师傅大师傅似的
@endif
<div class="table-responsive table-wrapper complex-container table-middle mt-1 table-collapse ">
<table class="table custom-data-table data-table" id="grid-table">
<thead>
<tr>
<th>
<div
class="vs-checkbox-con vs-checkbox-primary checkbox-grid checkbox-grid-header">
<input type="checkbox" class="select-all grid-select-all">
<span class="vs-checkbox"><span class="vs-checkbox--check"><i
class="vs-icon feather icon-check"></i></span></span>
</div>
</th>
<th>序号</th>
<th>指标名称</th>
<th>地区</th>
<th>时间</th>
<th>参考信源</th>
<th>单价</th>
<th class="grid__actions__">操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div
class="vs-checkbox-con vs-checkbox-primary checkbox-grid checkbox-grid-column">
<input type="checkbox" class="grid-row-checkbox" data-id="1"
data-label="幸福指标">
<span class="vs-checkbox"><span class="vs-checkbox--check"><i
class="vs-icon feather icon-check"></i></span></span>
</div>
</td>
<td>1</td>
<td>幸福指标</td>
<td>呼和浩特市</td>
<td>2024</td>
<td>大大多大大大大</td>
<td>0.00</td>
<td class="grid__actions__"><a style="cursor: pointer;" class="act-WSn1S7FQNM71Qdnc"
href="http://127.0.0.1:83/approves/1"><i
class=""></i> <span class="text-success">查看</span></a><a
style="cursor: pointer;" class="act-NXhzdhTBNxqtxzxX"
href="javascript:void(0)">通过&nbsp;&nbsp;&nbsp;</a><span
style="cursor: pointer" data-toggle="modal" data-target="#modal-rDTMKJf0LR"><a
href="javascript:void(0)">不通过</a></span></td>
</tr>
<tr>
<td>
<div
class="vs-checkbox-con vs-checkbox-primary checkbox-grid checkbox-grid-column">
<input type="checkbox" class="grid-row-checkbox" data-id="2"
data-label="幸福指标">
<span class="vs-checkbox"><span class="vs-checkbox--check"><i
class="vs-icon feather icon-check"></i></span></span>
</div>
</td>
<td>2</td>
<td>幸福指标</td>
<td>北京城区</td>
<td>2023</td>
<td>大大大大大</td>
<td>0.00</td>
<td class="grid__actions__"><a style="cursor: pointer;" class="act-dbtgrVKs1nsE6pTy"
href="http://127.0.0.1:83/approves/2"><i
class=""></i> <span class="text-success">查看</span></a><a
style="cursor: pointer;" class="act-dSPxAUi9boxxEzej"
href="javascript:void(0)">通过&nbsp;&nbsp;&nbsp;</a><span
style="cursor: pointer" data-toggle="modal" data-target="#modal-5LeyLqKhTX"><a
href="javascript:void(0)">不通过</a></span></td>
</tr>
<tr>
<td>
<div
class="vs-checkbox-con vs-checkbox-primary checkbox-grid checkbox-grid-column">
<input type="checkbox" class="grid-row-checkbox" data-id="6"
data-label="过年送礼指标">
<span class="vs-checkbox"><span class="vs-checkbox--check"><i
class="vs-icon feather icon-check"></i></span></span>
</div>
</td>
<td>3</td>
<td>过年送礼指标</td>
<td>杭州市</td>
<td>2024</td>
<td>http://127.0.0.1:83/</td>
<td>0.00</td>
<td class="grid__actions__"><a style="cursor: pointer;" class="act-410LqWGyD4JnGMZc"
href="http://127.0.0.1:83/approves/6"><i
class=""></i> <span class="text-success">查看</span></a><a
style="cursor: pointer;" class="act-SOPZXLLkKsKqxDkj"
href="javascript:void(0)">通过&nbsp;&nbsp;&nbsp;</a><span
style="cursor: pointer" data-toggle="modal" data-target="#modal-JBxJD6KKJA"><a
href="javascript:void(0)">不通过</a></span></td>
</tr>
</tbody>
</table>
</div>
<div class="box-footer d-block clearfix ">
<span class="d-none d-sm-inline"
style="line-height:33px;color:#7c858e"><b>1</b><b>3</b> ,总共 <b>3</b></span>
<ul class="pagination pagination-sm no-margin pull-right shadow-100"
style="border-radius: 1.5rem">
<!-- Previous Page Link -->
<li class="page-item previous disabled"><span class="page-link"></span></li>
<!-- "Three Dots" Separator -->
<!-- Array Of Links -->
<li class="page-item active"><span class="page-link">1</span></li>
<!-- Next Page Link -->
<li class="page-item next disabled"><span class="page-link"></span></li>
</ul>
<label class="pull-right d-none d-sm-inline per-pages-selector" style="margin-right: 10px">
<span class="dropup" style="display:inline-block">
<a id="" class="dropdown-toggle btn btn-sm btn-white waves-effect" style="" data-toggle="dropdown"
href="javascript:void(0)">
<stub>20</stub>
<span class="caret"></span>
</a>
<ul class="dropdown-menu"><li class="dropdown-item"><a
href="http://127.0.0.1:83/approves?per_page=10">10</a></li><li class="dropdown-item"><a
href="http://127.0.0.1:83/approves?per_page=20">20</a></li><li class="dropdown-item"><a
href="http://127.0.0.1:83/approves?per_page=30">30</a></li><li class="dropdown-item"><a
href="http://127.0.0.1:83/approves?per_page=50">50</a></li><li class="dropdown-item"><a
href="http://127.0.0.1:83/approves?per_page=100">100</a></li><li class="dropdown-item"><a
href="http://127.0.0.1:83/approves?per_page=200">200</a></li></ul>
</span>
</label>
</div>
</div>
<div class="row ">
<div class="col-md-6">4</div>
<div class="col-md-6">5</div>
</div>
</div>
</div>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment