XyZskInspectionController.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Http\Controllers\Controller;
  4. use App\Model\XyZskInspection;
  5. use Encore\Admin\Form;
  6. use Encore\Admin\Grid;
  7. use Encore\Admin\Facades\Admin;
  8. use Encore\Admin\Layout\Content;
  9. use Encore\Admin\Controllers\ModelForm;
  10. use Encore\Admin\Show;
  11. class XyZskInspectionController extends Controller
  12. {
  13. use ModelForm;
  14. public function index()
  15. {
  16. return Admin::content(function (Content $content) {
  17. $content->header('西医检验检查');
  18. $content->description('列表');
  19. $content->body($this->grid());
  20. });
  21. }
  22. public function create()
  23. {
  24. return Admin::content(function (Content $content) {
  25. $content->header('西医检验检查');
  26. $content->description('新增');
  27. $content->body($this->form());
  28. });
  29. }
  30. public function edit($id)
  31. {
  32. return Admin::content(function (Content $content) use ($id) {
  33. $content->header('西医检验检查');
  34. $content->description();
  35. $content->body($this->form($id)->edit($id));
  36. });
  37. }
  38. protected function show($id)
  39. {
  40. $show = new Show(XyZskInspection::findOrFail($id));
  41. $show->field('name' , '名称');
  42. $show->field('department' , '科室分类');
  43. $show->field('overview' , '概述');
  44. $show->field('principle' , '原理');
  45. $show->field('reagent' , '试剂');
  46. $show->field('operation' , '操作方法');
  47. $show->field('clinicalSignificance' , '临床意义');
  48. $show->field('normalValue' , '正常值');
  49. $show->field('annotation' , '附注');
  50. $show->field('precautions' , '注意事项');
  51. $show->field('donghua_name' , '东华name');
  52. $show->field('zhonglian_name' , '中联name');
  53. $show->field('process' , '检查过程');
  54. $show->field('related_symptoms' , '相关症状');
  55. $show->field('related_diseases' , '相关疾病');
  56. $show->field('haoze_name' , '昊泽name');
  57. $show->field('sex' , '性别');
  58. return $show;
  59. }
  60. protected function form($id='')
  61. {
  62. return Admin::form(XyZskInspection::class, function (Form $form) {
  63. $form->text('name' , '名称');
  64. $form->text('department' , '科室分类');
  65. $form->textarea('overview' , '概述');
  66. $form->textarea('principle' , '原理');
  67. $form->textarea('reagent' , '试剂');
  68. $form->textarea('operation' , '操作方法');
  69. $form->textarea('clinicalSignificance' , '临床意义');
  70. $form->textarea('normalValue' , '正常值');
  71. $form->textarea('annotation' , '附注');
  72. $form->textarea('precautions' , '注意事项');
  73. $form->textarea('donghua_name' , '东华name');
  74. $form->textarea('zhonglian_name' , '中联name');
  75. $form->textarea('process' , '检查过程');
  76. $form->textarea('related_symptoms' , '相关症状');
  77. $form->textarea('related_diseases' , '相关疾病');
  78. $form->textarea('haoze_name' , '昊泽name');
  79. $form->text('sex' , '性别');
  80. });
  81. }
  82. protected function grid()
  83. {
  84. return Admin::grid(XyZskInspection::class, function (Grid $grid) {
  85. $grid->id('序号')->sortable();
  86. //$grid->model()->orderBy('id','desc');
  87. $grid->name('检查名称');
  88. $grid->department('科室分类');
  89. $grid->operation('操作方法');
  90. $grid->normalValue('正常值');
  91. $grid->annotation('附注');
  92. // $grid->created_at('创建时间');
  93. // $grid->updated_at('更新时间');
  94. $grid->paginate(20);
  95. //$grid->disableCreateButton();
  96. $grid->disableExport();
  97. // 禁用导出数据按钮
  98. $grid->actions(function ($actions) {
  99. $actions->disableView();
  100. //$actions->disableEdit();
  101. });
  102. // 条件过滤
  103. $grid->filter(function ($filter) {
  104. $filter->disableIdFilter();
  105. $filter->like('name' , '输入检查名称搜索');
  106. });
  107. });
  108. }
  109. }