FundCirculationController.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. namespace App\Module\Fund\AdminControllers;
  3. use App\Module\Fund\Services\AccountService;
  4. use Spatie\RouteAttributes\Attributes\Resource;
  5. use UCore\DcatAdmin\AdminController;
  6. use UCore\DcatAdmin\FilterHelper;
  7. use UCore\DcatAdmin\GridHelper;
  8. use Dcat\Admin\Form;
  9. use Dcat\Admin\Grid;
  10. use Dcat\Admin\Show;
  11. use App\Module\Fund\Models\FundModel;
  12. use App\Module\Fund\Repositorys\FundCirculationRepository as FundCirculation;
  13. use UCore\DcatAdmin\Metrics\Examples\Link;
  14. /**
  15. * 资金流转
  16. *
  17. *
  18. */
  19. #[Resource('fund_circulation', names: 'dcat.admin.fund_circulation')]
  20. class FundCirculationController 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 FundCirculation(), function (Grid $grid) {
  31. // $grid->model()->with('user');
  32. $helper = new GridHelper($grid,$this);
  33. $helper->disableAll();
  34. $helper->columnIdDesc();
  35. $helper->columnUserID();
  36. $helper->columnUsingkv('fund_id', AccountService::getFundsDesc(),'来源账户');
  37. $helper->columnUsingkv('to_fund_id', AccountService::getFundsDesc(),'目标账户');
  38. $helper->columnc1000('total_fee','数额');
  39. $helper->columnAt('create_time');
  40. $grid->column('re_type','关联')->expand(function(){
  41. $url = admin_url('404');
  42. $title = '未知';
  43. $link = new Link($title,$url);
  44. return $link;
  45. });
  46. // $helper->columnAt('ok_time');
  47. // * @property string $re_type 关联类型
  48. // * @property int $re_id 关联类型
  49. // $helper-
  50. //
  51. $grid->filter(function (Grid\Filter $filter) {
  52. $helper= new FilterHelper($filter,$this);
  53. $filter->equal('user_id');
  54. $filter->equal('id',"ID");
  55. $helper->equalRadio('fund_id',AccountService::getFundsDesc(),"来源账户");
  56. $helper->equalRadio('to_fund_id',AccountService::getFundsDesc(),"目标账户");
  57. $filter->expand();
  58. $filter->panel();
  59. });
  60. $grid->disableCreateButton();
  61. $grid->actions(function (Grid\Displayers\Actions $actions) {
  62. // $actions->disableDelete();
  63. $actions->disableView();
  64. });
  65. });
  66. }
  67. /**
  68. * Make a show builder.
  69. *
  70. * @param mixed $id
  71. *
  72. * @return Show
  73. */
  74. protected function detail($id)
  75. {
  76. return Show::make($id, new FundCirculation(), function (Show $show) {
  77. $show->field('id');
  78. $show->field('service_id');
  79. $show->field('title');
  80. $show->field('title_i18n');
  81. });
  82. }
  83. /**
  84. * Make a form builder.
  85. *
  86. * @return Form
  87. */
  88. protected function form()
  89. {
  90. return Form::make(new FundCirculation(), function (Form $form) {
  91. });
  92. }
  93. }