Commit 5e446ea2 by 宁成龙

增加转让,分配按钮

parent cb231d4d
<?php
namespace App\Admin\Actions\User;
use App\Models\Order as OrderModel;
use App\Models\User;
use Dcat\Admin\Grid\BatchAction;
use Dcat\Admin\Grid\Tools\AbstractTool;
use Illuminate\Http\Request;
use Dcat\Admin\Grid\RowAction;
class UserAssignAction extends BatchAction
{
protected $action;
// 注意action的构造方法参数一定要给默认值
public function __construct($title = null, $action = 1)
{
$this->title = $title;
$this->action = $action;
}
// 确认弹窗信息
public function confirm()
{
return '您确定要发布已选中的文章吗?';
}
public function html()
{
$class = $this->getElementClass();
$this->setHtmlAttribute([
"class" => "{$class} btn btn-primary btn-sm btn-mini",
]);
return parent::html(); // TODO: Change the autogenerated stub
}
// 处理请求
public function handle(Request $request)
{
// 获取选中的文章ID数组
$keys = $this->getKey();
// 获取请求参数
$action = $request->get('action');
foreach (Post::find($keys) as $post) {
$post->released = $action;
$post->save();
}
$message = $action ? '文章发布成功' : '文章下线成功';
return $this->response()->success($message)->refresh();
}
// 设置请求参数
public function parameters()
{
return [
'action' => $this->action,
];
}
}
<?php
namespace App\Admin\Actions\User;
use App\Models\Order as OrderModel;
use App\Models\User;
use Dcat\Admin\Grid\BatchAction;
use Dcat\Admin\Grid\Tools\AbstractTool;
use Illuminate\Http\Request;
use Dcat\Admin\Grid\RowAction;
class UserTransferAction extends BatchAction
{
protected $action;
// 注意action的构造方法参数一定要给默认值
public function __construct($title = null, $action = 1)
{
$this->title = $title;
$this->action = $action;
}
// 确认弹窗信息
public function confirm()
{
return '您确定要发布已选中的文章吗?';
}
public function html()
{
$class = $this->getElementClass();
$this->setHtmlAttribute([
"class" => "{$class} btn btn-primary btn-sm btn-mini",
]);
return parent::html(); // TODO: Change the autogenerated stub
}
// 处理请求
public function handle(Request $request)
{
// 获取选中的文章ID数组
$keys = $this->getKey();
// 获取请求参数
$action = $request->get('action');
foreach (Post::find($keys) as $post) {
$post->released = $action;
$post->save();
}
$message = $action ? '文章发布成功' : '文章下线成功';
return $this->response()->success($message)->refresh();
}
// 设置请求参数
public function parameters()
{
return [
'action' => $this->action,
];
}
}
......@@ -22,11 +22,12 @@ class UserController extends AdminController
$grid->showFilter();
$grid->disableFilterButton();
$grid->disableRefreshButton();
$grid->disableCreateButton();
UserService::userListFilter($grid);
$grid->disableBatchDelete();
// $grid->disableCreateButton();
UserService::userListListField($grid);
UserService::userListTool($grid);
UserService::userListActions($grid);
UserService::userListFilter($grid);
});
}
......
......@@ -4,7 +4,9 @@ namespace App\Admin\Service;
use App\Admin\Actions\OrderAuditAction;
use App\Admin\Actions\OrderReverseAuditAction;
use App\Admin\Actions\User\UserAssignAction;
use App\Admin\Actions\User\UserStatusAction;
use App\Admin\Actions\User\UserTransferAction;
use App\Models\Cms\CmsUser;
use Dcat\Admin\Grid;
......@@ -25,7 +27,7 @@ class UserService
$filter->startWith('name')->width(2);
$filter->equal('status')->select(admin_trans('user.options.status'))->width(2);
$filter->equal('sales_id',trans('inquiry.fields.sales_name'))->select(CmsUser::pluck('name', 'userId')->toArray())->width(3);
$filter->equal('status')->select(admin_trans('user.options.status'))->width(2);
$filter->equal('reg_source')->select(admin_trans('user.options.reg_source'))->width(2);
});
}
......@@ -49,8 +51,8 @@ class UserService
public static function userListTool(Grid $grid){
$grid->tools([
new OrderAuditAction(),
new OrderReverseAuditAction(),
new UserAssignAction("分配销售"),
new UserTransferAction("转移销售"),
]);
}
......
......@@ -22,11 +22,16 @@ return [
'last_name' => '姓氏',
'created_time' => '创建时间',
'update_time' => '更新时间',
'reg_source' => '注册来源',
],
'options' => [
"status"=>[
"1"=>"正常",
"-1"=>"禁用"
]
],
"reg_source"=>[
"1"=>"网站",
"2"=>"人工新增"
],
],
];
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 sign in to comment