header('中医知识库'); $content->description('列表'); $content->body($this->grid()); }); } public function create() { return Admin::content(function (Content $content) { $content->header('中医知识库'); $content->description('新增'); $content->body($this->form()); }); } public function edit($id) { return Admin::content(function (Content $content) use ($id) { $content->header('Test'); $content->description(); $content->body($this->form($id)->edit($id)); }); } protected function show($id) { $zyzsk = new Test(); $show = new Show($zyzsk->findOrFail($id)); $show->field('name' , '名称'); $label = $zyzsk->getlabel($id); switch ($label) { case 'SickNess': $show->field('department' , '科室'); $show->field('apparatus' , '器官'); $show->field('tongueCondition' , '舌象'); $show->field('symptom' , '症状'); $show->field('therapeuticMethod' , '治法'); $show->field('source' , '来源'); $show->field('pulseCondition' , '脉象'); $show->field('dietTherapy' , '食物治疗'); $show->field('acupuncturePoints' , '穴位'); break; case 'Thing': $show->field('composition' , '成分'); break; case 'CnMedicinalCrop': $show->field('toxicity' , '毒性'); $show->field('indications' , '适应症'); $show->field('source' , '来源'); //$show->field('pageRankScore'); $show->field('pharmacology' , '药理'); break; case 'CnPatentMedicine': $show->field('pageRankScore'); break; case 'Constitution': $show->field('overallFeature' , '整体特征'); $show->field('notEat' , '忌口'); $show->field('tendency' , '流行病学'); $show->field('exercise' , '锻炼'); $show->field('dietTherapy' , '饮食疗法'); $show->field('psychologicalFeature' , '心理特征'); $show->field('commonPerformance' , '共同表现'); $show->field('meridianHealth' , '经络健康'); $show->field('medicineRegimen', '药方'); break; case 'Prescription': $show->field('composition' , '成分'); //$show->field('pageRankScore'); break; case 'TonicDiet': $show->field('composition' , '成分'); //$show->field('pageRankScore'); break; } $show->field('dateModified' , '日期'); return $show; } protected function form($id = '',$label) { echo $$label;die; $this->hidden('type')->value(3); if(isset($id)) { if(!$id){ $url = Request::path(); $arr = explode('/' , $url); $id = $arr[2]; } $test = new test(); $label = $test->getlabel($id); // 编辑 switch ($label) { case 'SickNess': return Admin::form(Test::class, function (Form $form) { $form->display('id' , 'Id'); $form->text('name' , '名称'); $form->text('department' , '科室'); $form->text('apparatus' , '器官'); $form->text('tongueCondition' , '舌象'); $form->text('symptom' , '症状'); $form->text('therapeuticMethod' , '治法'); $form->text('source' , '来源'); $form->text('pulseCondition' , '脉象'); $form->text('dietTherapy' , '食物治疗'); $form->text('acupuncturePoints' , '穴位'); $form->text('pageRankScore'); }); break; case 'Thing'; return Admin::form(Test::class, function (Form $form) { $form->text('name'); $form->text('composition'); $form->text('pageRankScore'); }); break; case 'CnMedicinalCrop'; return Admin::form(Test::class, function (Form $form) { $form->text('name'); $form->text('toxicity'); $form->text('indications'); $form->text('source'); $form->text('pageRankScore'); $form->text('pharmacology'); }); break; case 'CnPatentMedicine'; return Admin::form(Test::class, function (Form $form) { $form->text('name'); $form->text('pageRankScore'); }); break; case 'Constitution'; return Admin::form(Test::class, function (Form $form) { $form->text('name'); $form->text('overallFeature'); $form->text('notEat'); $form->text('tendency'); $form->text('exercise'); $form->text('dietTherapy'); $form->text('pageRankScore'); $form->text('psychologicalFeature'); $form->text('commonPerformance'); $form->text('meridianHealth'); $form->text('medicineRegimen'); }); break; case 'Prescription'; return Admin::form(Test::class, function (Form $form) { $form->text('name'); $form->text('composition'); $form->text('pageRankScore'); }); break; case 'TonicDiet'; return Admin::form(Test::class, function (Form $form) { $form->text('name'); $form->text('composition'); $form->text('pageRankScore'); }); break; case 'ChannelCollateral': return Admin::form(Test::class, function (Form $form) { $form->text('name' , '名称'); $form->text('indications' , '主治'); $form->text('channelSymptom' , '经脉循行及其病候'); $form->text('collateralSymptom' , '络脉循行及其病候'); $form->text('divergentMeridian' , '经别循行'); $form->text('aponeuroticSystem' , '经筋循行及其病候'); $form->text('clinicalFeature' , '经络症状主要临床表现'); $form->text('mechanismAnalysis' , '经络病机分析'); $form->text('source' , '数据来源'); }); break; } } else { // 创建 return Admin::form(Test::class, function (Form $form) { $form->text('name'); }); } } // Grid protected function grid() { $lable = request('label') ?? 'SickNess'; switch ($lable){ case 'SickNess'; $aa = ZhSickNess::class; break; } return Admin::grid($aa, function (Grid $grid) use($lable) { //return Admin::grid(Test::class, function (Grid $grid) { //$label = request('label') ?? 'SickNess'; //$grid->id('Id')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->name('名称')->setAttributes(['style' => 'font-family:PMingLiU;']); switch ($lable) { case 'TonicDiet': $grid->composition('成分')->setAttributes(['style' => 'font-family:PMingLiU;']); break; case 'SickNess': $grid->department('所属科室')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->apparatus('器官')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->tongueCondition('舌象')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->symptom('症状')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->therapeuticMethod('治法')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->source('来源')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->pulseCondition('脉象')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->dietTherapy('食物治疗')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->acupuncturePoints('穴位')->setAttributes(['style' => 'font-family:PMingLiU;']); //$grid->pageRankScore()->setAttributes(['style' => 'font-family:PMingLiU;']); break; case 'CnMedicinalCrop': $grid->toxicity('毒性')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->indications('适应症')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->source('来源')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->pageRankScore()->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->pharmacology('药理')->setAttributes(['style' => 'font-family:PMingLiU;']); break; case 'CnPatentMedicine': break; case 'Thing': $grid->composition('成分')->setAttributes(['style' => 'font-family:PMingLiU;']); break; case 'Constitution': $grid->overallFeature('整体特征')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->notEat('忌口')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->tendency('流行病学')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->exercise('锻炼')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->dietTherapy('饮食疗法')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->psychologicalFeature('心理特征')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->commonPerformance('共同表现')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->meridianHealth('经络健康')->setAttributes(['style' => 'font-family:PMingLiU;']); $grid->medicineRegimen('药方')->setAttributes(['style' => 'font-family:PMingLiU;']); break; case 'Prescription': $grid->composition('成分')->setAttributes(['style' => 'font-family:PMingLiU;']); break; case 'ChannelCollateral': $grid->indications('主治'); $grid->channelSymptom('经脉循行及其病候'); $grid->collateralSymptom('络脉循行及其病候'); $grid->divergentMeridian('经别循行'); $grid->aponeuroticSystem('经筋循行及其病候'); $grid->clinicalFeature('经络症状主要临床表现'); $grid->mechanismAnalysis('经络病机分析'); $grid->source('数据来源'); break; } $grid->dateModified('日期')->setAttributes(['style' => 'font-family:PMingLiU;']); //$grid->classification(); $grid->paginate(20); // 禁用导出数据按钮 $grid->actions(function ($actions) { // $actions->disableView(); // $actions->disableEdit(); $actions->disableDelete(); //$actions->add(new Update()); //dd($actions->row); }); $grid->disableCreateButton(); //$grid->disableCreateButton(); $grid->disableExport(); $grid->filter(function ($filter) { $filter->disableIdFilter(); $filter->like('name' , '输入搜索名称'); }); }); } }