Commit ca7e8853 by lujunyi

优化药店纠错

parent add69948
......@@ -2,7 +2,8 @@
namespace App\Admin\Controllers;
use App\Admin\Repositories\PharmacyCorrection;
use App\Admin\Repositories\PharmacyCorrectionRepository;
use App\Models\PharmacyCorrectionModel;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\AdminController;
......@@ -18,28 +19,31 @@ class PharmacyCorrectionController extends AdminController
*/
protected function grid()
{
return Grid::make(new PharmacyCorrection(), function (Grid $grid) {
return Grid::make(new PharmacyCorrectionRepository(), function (Grid $grid) {
$grid->model()->orderBy('id', 'DESC');
$grid->column('id')->sortable();
$grid->column('pharmacy_id');
// $grid->column('pharmacy_id');
$grid->column('pharmacy_name');
$grid->column('is_handle');
$grid->column('content');
$grid->column('created_at');
$grid->column('updated_at')->sortable();
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid->filter(function (Grid\Filter $filter) {
$filter->panel(); // 更改为 panel 布局
$filter->expand(); // 默认展开搜索框
$filter->like('pharmacy_name')->width(3);
$filter->in('is_handle')->checkbox(PharmacyCorrectionModel::IS_HANDLE_MAP)->width(3);
});
// 行按钮控制
$grid->disableDeleteButton(); // 禁用删除按钮
$grid->disableActions(); // 禁用按钮
// 工具栏按钮控制
$grid->disableBatchDelete(); // 禁用批量删除
$grid->disableCreateButton(); // 禁用创建按钮
$grid->disableBatchActions(); // 禁用批量操作
});
}
......@@ -51,7 +55,7 @@ protected function grid()
*/
protected function detail($id)
{
return Show::make($id, new PharmacyCorrection(), function (Show $show) {
return Show::make($id, new PharmacyCorrectionRepository(), function (Show $show) {
$show->field('id');
$show->field('pharmacy_id');
$show->field('pharmacy_name');
......@@ -73,12 +77,12 @@ protected function detail($id)
*/
protected function form()
{
return Form::make(new PharmacyCorrection(), function (Form $form) {
return Form::make(new PharmacyCorrectionRepository(), function (Form $form) {
$form->display('id')->width(4);
$form->text('pharmacy_id')->width(4);
$form->text('pharmacy_name')->width(4);
$form->text('is_handle')->width(4);
$form->text('content')->width(4);
// $form->text('pharmacy_id')->width(4);
$form->text('pharmacy_name')->readonly()->width(4);
$form->text('content')->readonly()->width(4);
$form->switch('is_handle')->width(4);
$form->display('created_at')->width(4);
$form->display('updated_at')->width(4);
......
......@@ -2,10 +2,10 @@
namespace App\Admin\Repositories;
use App\Models\PharmacyCorrection as Model;
use App\Models\DoctorCorrectionModel as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class PharmacyCorrection extends EloquentRepository
class DoctorCorrectionRepository extends EloquentRepository
{
/**
* Model.
......
<?php
namespace App\Admin\Repositories;
use App\Models\PharmacyCorrectionModel as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class PharmacyCorrectionRepository extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class DoctorCorrectionModel extends Model
{
use HasDateTimeFormatter;
protected $table = 'doctor_correction';
// 是否处理[0=待处理,1=已处理]
const IS_HANDLE_FALSE = 0;
const IS_HANDLE_TRUE = 1;
// 是否处理-文字映射
const IS_HANDLE_MAP = [
self::IS_HANDLE_FALSE => '待处理',
self::IS_HANDLE_TRUE => '已处理',
];
}
......@@ -5,9 +5,20 @@
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class PharmacyCorrection extends Model
class PharmacyCorrectionModel extends Model
{
use HasDateTimeFormatter;
protected $table = 'pharmacy_correction';
// 是否处理[0=待处理,1=已处理]
const IS_HANDLE_FALSE = 0;
const IS_HANDLE_TRUE = 1;
// 是否处理-文字映射
const IS_HANDLE_MAP = [
self::IS_HANDLE_FALSE => '待处理',
self::IS_HANDLE_TRUE => '已处理',
];
}
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