Commit 3ef4d510 by lujunyi

诊断

parent eb2c7c99
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\DiagnosiRepository;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Show;
class DiagnosiController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new DiagnosiRepository(), function (Grid $grid) {
$grid->model()->orderBy('id', 'DESC');
$grid->column('id')->sortable();
$grid->column('name');
$grid->column('code');
$grid->column('content');
// 快捷搜索
$grid->quickSearch(['name', 'code', 'factcontentory'])->placeholder('请输入[诊断/诊断显示/简码]')->width(25);
$grid->filter(function (Grid\Filter $filter) {
$filter->panel(); // 更改为 panel 布局
$filter->expand(); // 默认展开搜索框
$filter->like('name')->width(3);
$filter->like('code')->width(3);
$filter->like('content')->width(3);
});
// 行按钮控制
$grid->disableDeleteButton(); // 禁用删除按钮
// 工具栏按钮控制
$grid->disableBatchDelete(); // 禁用批量删除
});
}
/**
* Make a show builder.
*
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new DiagnosiRepository(), function (Show $show) {
$show->field('id')->width(4);
$show->field('name')->width(4);
$show->field('content')->width(4);
$show->field('code')->width(4);
$show->field('created_at')->width(4);
$show->field('updated_at')->width(4);
$show->panel()->tools(function ($tools) {
$tools->disableDelete(); // 禁止删除按钮
});
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new DiagnosiRepository(), function (Form $form) {
$form->display('id')->width(4);
$form->text('name')->width(4);
$form->text('content')->width(4);
$form->text('code')->width(4);
$form->display('created_at')->width(4);
$form->display('updated_at')->width(4);
// 右上角按钮控制
$form->disableDeleteButton(); // 去掉删除按钮
});
}
}
......@@ -33,6 +33,9 @@ protected function grid()
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
// 快捷搜索
$grid->quickSearch(['name', 'code', 'factory'])->placeholder('请输入[药品名称/药品简码/生产厂家]')->width(25);
$grid->filter(function (Grid\Filter $filter) {
$filter->panel(); // 更改为 panel 布局
$filter->expand(); // 默认展开搜索框
......@@ -76,6 +79,7 @@ protected function detail($id)
$show->field('tag')->width(4);
$show->field('created_at')->width(4);
$show->field('updated_at')->width(4);
$show->panel()->tools(function ($tools) {
$tools->disableDelete(); // 禁止删除按钮
});
......
<?php
namespace App\Admin\Repositories;
use App\Models\DiagnosiModel as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class DiagnosiRepository extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
......@@ -16,6 +16,8 @@
// 药品
$router->resource('drug', 'DrugController');
// 诊断
$router->resource('diagnosi', 'DiagnosiController');
// 导入日志
$router->resource('/import-log', 'Common\ImportLogController')->names('import-log');
......
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class DiagnosiModel extends Model
{
use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'diagnosis';
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDiagnosisTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('diagnosis', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name')->comment('诊断');
$table->string('content')->comment('显示内容');
$table->string('code')->comment('诊断编码');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('diagnosis');
}
}
......@@ -41,6 +41,16 @@
* @property Grid\Column|Collection avatar
* @property Grid\Column|Collection remember_token
* @property Grid\Column|Collection is_block
* @property Grid\Column|Collection code
* @property Grid\Column|Collection unit
* @property Grid\Column|Collection spec
* @property Grid\Column|Collection dosage_form
* @property Grid\Column|Collection factory
* @property Grid\Column|Collection approval_no
* @property Grid\Column|Collection limit_buy_7
* @property Grid\Column|Collection is_rx
* @property Grid\Column|Collection tag
* @property Grid\Column|Collection deleted_at
* @property Grid\Column|Collection uuid
* @property Grid\Column|Collection connection
* @property Grid\Column|Collection queue
......@@ -86,6 +96,16 @@
* @method Grid\Column|Collection avatar(string $label = null)
* @method Grid\Column|Collection remember_token(string $label = null)
* @method Grid\Column|Collection is_block(string $label = null)
* @method Grid\Column|Collection code(string $label = null)
* @method Grid\Column|Collection unit(string $label = null)
* @method Grid\Column|Collection spec(string $label = null)
* @method Grid\Column|Collection dosage_form(string $label = null)
* @method Grid\Column|Collection factory(string $label = null)
* @method Grid\Column|Collection approval_no(string $label = null)
* @method Grid\Column|Collection limit_buy_7(string $label = null)
* @method Grid\Column|Collection is_rx(string $label = null)
* @method Grid\Column|Collection tag(string $label = null)
* @method Grid\Column|Collection deleted_at(string $label = null)
* @method Grid\Column|Collection uuid(string $label = null)
* @method Grid\Column|Collection connection(string $label = null)
* @method Grid\Column|Collection queue(string $label = null)
......@@ -136,6 +156,16 @@ class MiniGrid extends Grid {}
* @property Show\Field|Collection avatar
* @property Show\Field|Collection remember_token
* @property Show\Field|Collection is_block
* @property Show\Field|Collection code
* @property Show\Field|Collection unit
* @property Show\Field|Collection spec
* @property Show\Field|Collection dosage_form
* @property Show\Field|Collection factory
* @property Show\Field|Collection approval_no
* @property Show\Field|Collection limit_buy_7
* @property Show\Field|Collection is_rx
* @property Show\Field|Collection tag
* @property Show\Field|Collection deleted_at
* @property Show\Field|Collection uuid
* @property Show\Field|Collection connection
* @property Show\Field|Collection queue
......@@ -181,6 +211,16 @@ class MiniGrid extends Grid {}
* @method Show\Field|Collection avatar(string $label = null)
* @method Show\Field|Collection remember_token(string $label = null)
* @method Show\Field|Collection is_block(string $label = null)
* @method Show\Field|Collection code(string $label = null)
* @method Show\Field|Collection unit(string $label = null)
* @method Show\Field|Collection spec(string $label = null)
* @method Show\Field|Collection dosage_form(string $label = null)
* @method Show\Field|Collection factory(string $label = null)
* @method Show\Field|Collection approval_no(string $label = null)
* @method Show\Field|Collection limit_buy_7(string $label = null)
* @method Show\Field|Collection is_rx(string $label = null)
* @method Show\Field|Collection tag(string $label = null)
* @method Show\Field|Collection deleted_at(string $label = null)
* @method Show\Field|Collection uuid(string $label = null)
* @method Show\Field|Collection connection(string $label = null)
* @method Show\Field|Collection queue(string $label = null)
......
<?php
return [
'labels' => [
'Diagnosi' => '诊断',
'diagnosi' => '诊断',
],
'fields' => [
'name' => '诊断',
'content' => '显示内容',
'code' => '诊断简码',
],
'options' => [
],
];
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