Commit add69948 by lujunyi

优化医师纠错

parent 13b1b812
......@@ -2,7 +2,8 @@
namespace App\Admin\Controllers;
use App\Admin\Repositories\DoctorCorrection;
use App\Admin\Repositories\DoctorCorrectionRepository;
use App\Models\DoctorCorrectionModel;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\AdminController;
......@@ -18,29 +19,31 @@ class DoctorCorrectionController extends AdminController
*/
protected function grid()
{
return Grid::make(new DoctorCorrection(), function (Grid $grid) {
return Grid::make(new DoctorCorrectionRepository(), function (Grid $grid) {
$grid->model()->orderBy('id', 'DESC');
$grid->column('id')->sortable();
$grid->column('doctor_id');
$grid->column('id');
$grid->column('is_handle')->switch();
// $grid->column('doctor_id');
$grid->column('doctor_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('doctor_name')->width(3);
$filter->like('doctor_name')->width(3);
$filter->in('is_handle')->checkbox(DoctorCorrectionModel::IS_HANDLE_MAP)->width(3);
});
// 行按钮控制
$grid->disableDeleteButton(); // 禁用删除按钮
$grid->disableActions(); // 禁用按钮
// 工具栏按钮控制
$grid->disableBatchDelete(); // 禁用批量删除
$grid->disableCreateButton(); // 禁用创建按钮
$grid->disableBatchActions(); // 禁用批量操作
});
}
......@@ -52,7 +55,7 @@ protected function grid()
*/
protected function detail($id)
{
return Show::make($id, new DoctorCorrection(), function (Show $show) {
return Show::make($id, new DoctorCorrectionRepository(), function (Show $show) {
$show->field('id');
$show->field('doctor_id');
$show->field('doctor_name');
......@@ -74,15 +77,15 @@ protected function detail($id)
*/
protected function form()
{
return Form::make(new DoctorCorrection(), function (Form $form) {
$form->display('id');
$form->text('doctor_id');
$form->text('doctor_name');
$form->text('is_handle');
$form->text('content');
return Form::make(new DoctorCorrectionRepository(), function (Form $form) {
$form->display('id')->width(4);
// $form->text('doctor_id')->readonly()->width(4);
$form->text('doctor_name')->readonly()->width(4);
$form->textarea('content')->readonly()->width(4);
$form->switch('is_handle')->width(4);
$form->display('created_at');
$form->display('updated_at');
$form->display('created_at')->width(4);
$form->display('updated_at')->width(4);
// 右上角按钮控制
$form->disableDeleteButton(); // 去掉删除按钮
......
......@@ -26,15 +26,12 @@ protected function grid()
$grid->column('question');
$grid->column('is_common')->using(InquiryModel::INQUIRY_COMMON_MAP);
// 快捷搜索
$grid->quickSearch(['question'])->placeholder('请输入[诊断问题]')->width(25);
$grid->filter(function (Grid\Filter $filter) {
$filter->panel(); // 更改为 panel 布局
$filter->expand(); // 默认展开搜索框
// $grid->filter(function (Grid\Filter $filter) {
// $filter->panel(); // 更改为 panel 布局
// $filter->expand(); // 默认展开搜索框
// $filter->like('question')->width(3);
// });
$filter->like('question')->width(3);
});
// 行按钮控制
$grid->disableDeleteButton(); // 禁用删除按钮
......
<?php
namespace App\Admin\Repositories;
use App\Models\DoctorCorrection as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class DoctorCorrection extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class DoctorCorrection extends Model
{
use HasDateTimeFormatter;
protected $table = 'doctor_correction';
}
......@@ -16,10 +16,10 @@ public function up()
Schema::create('doctor_correction', function (Blueprint $table) {
$table->comment('医师');
$table->bigIncrements('id');
$table->integer('doctor_id')->comment('医师编号');
$table->string('doctor_name')->default('')->comment('医师姓名');
$table->tinyInteger('is_handle')->comment('是否处理 0 待处理 1 已处理');
$table->longText('content')->comment('纠错内容');
$table->integer('doctor_id')->comment('医师表ID');
$table->string('doctor_name')->comment('医师姓名');
$table->tinyInteger('is_handle')->comment('是否处理[0=待处理,1=已处理]');
$table->text('content')->comment('纠错内容');
$table->timestamps();
$table->softDeletes();
});
......
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