FundController.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. namespace App\Module\Fund\AdminControllers;
  3. use App\Module\Fund\Admin\Actions\Circulation;
  4. use App\Module\Fund\Admin\Actions\FundAdminAction;
  5. use App\Module\Fund\Services\AccountService;
  6. use Spatie\RouteAttributes\Attributes\Resource;
  7. use UCore\DcatAdmin\AdminController;
  8. use UCore\DcatAdmin\FilterHelper;
  9. use UCore\DcatAdmin\GridHelper;
  10. use Dcat\Admin\Form;
  11. use Dcat\Admin\Grid;
  12. use Dcat\Admin\Layout\Content;
  13. use Dcat\Admin\Show;
  14. use App\Module\Fund\Models\FundModel;
  15. use App\Module\Fund\Repositorys\FundRepository as Fund;
  16. /**
  17. * 资金账户
  18. */
  19. #[Resource('fund', names: 'dcat.admin.fund')]
  20. class FundController extends AdminController
  21. {
  22. protected $title='资金账户';
  23. /**
  24. * Make a grid builder.
  25. *
  26. * @return Grid
  27. */
  28. protected function grid()
  29. {
  30. return Grid::make(new Fund(['user']), function (Grid $grid) {
  31. $helper = new GridHelper($grid, $this);
  32. $helper->columnIdDesc();
  33. $helper->columnUserIDInfo();
  34. $grid->column('fund_id', '账户')->using(AccountService::getFundsDesc());
  35. $helper->columnc1000('balance')->sortable();
  36. $helper->columnAt('create_time');
  37. $helper->columnAt('update_time');
  38. $helper->disableAll();
  39. $grid->filter(function (Grid\Filter $filter) {
  40. $helper= new FilterHelper($filter,$this);
  41. $filter->equal('user_id');
  42. $helper->equalRadio('fund_id',AccountService::getFundsDesc(),'账户');
  43. $helper->gtas('user_idgt','user_id','最小');
  44. $filter->expand();
  45. $filter->panel();
  46. });
  47. $grid->actions(function (Grid\Displayers\Actions $actions) {
  48. // $actions->disableDelete();
  49. // $actions->disableView();
  50. $actions->append(new FundAdminAction());
  51. $actions->append(new Circulation());
  52. });
  53. });
  54. }
  55. /**
  56. * Make a show builder.
  57. *
  58. * @param mixed $id
  59. *
  60. * @return Show
  61. */
  62. protected function detail($id)
  63. {
  64. return Show::make($id, new Fund(), function (Show $show) {
  65. $show->field('id');
  66. $show->field('service_id');
  67. $show->field('title');
  68. $show->field('title_i18n');
  69. });
  70. }
  71. /**
  72. * Make a form builder.
  73. *
  74. * @return Form
  75. */
  76. protected function form()
  77. {
  78. return Form::make(new Fund(), function (Form $form) {
  79. });
  80. }
  81. public function circulation(Content $content)
  82. {
  83. return $content
  84. ->title('流转')
  85. ->body(new CirculationForm());
  86. }
  87. }