| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?php
- namespace App\Module\Fund\AdminControllers;
- use App\Module\Fund\Services\AccountService;
- use Spatie\RouteAttributes\Attributes\Resource;
- use UCore\DcatAdmin\AdminController;
- use App\Module\Fund\AdminControllers\Helper\FilterHelper;
- use App\Module\Fund\AdminControllers\Helper\GridHelper;
- use App\Module\Fund\AdminControllers\Helper\ShowHelper;
- use App\Module\Fund\AdminControllers\Helper\FormHelper;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use App\Module\Fund\Models\FundModel;
- use App\Module\Fund\Repositorys\FundCirculationRepository as FundCirculation;
- use UCore\DcatAdmin\Metrics\Examples\Link;
- /**
- * 资金流转
- *
- *
- */
- #[Resource('fund-circulation', names: 'dcat.admin.fund-circulation')]
- class FundCirculationController extends AdminController
- {
- protected $title='资金流转';
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new FundCirculation(), function (Grid $grid) {
- // $grid->model()->with('user');
- $helper = new GridHelper($grid,$this);
- $helper->disableAll();
- $helper->columnIdDesc();
- $helper->columnUserID();
- $helper->columnUsingkv('fund_id', AccountService::getFundsDesc(),'来源账户');
- $helper->columnUsingkv('to_fund_id', AccountService::getFundsDesc(),'目标账户');
- $helper->columnc1000('total_fee','数额');
- $helper->columnAt('create_time');
- $grid->column('re_type','关联')->expand(function(){
- $url = admin_url('404');
- $title = '未知';
- $link = new Link($title,$url);
- return $link;
- });
- // $helper->columnAt('ok_time');
- // * @property string $re_type 关联类型
- // * @property int $re_id 关联类型
- // $helper-
- //
- $grid->filter(function (Grid\Filter $filter) {
- $helper= new FilterHelper($filter,$this);
- $filter->equal('id', 'ID');
- $filter->equal('user_id', '用户ID');
- $helper->equalRadio('fund_id', AccountService::getFundsDesc(), '来源账户');
- $helper->equalRadio('to_fund_id', AccountService::getFundsDesc(), '目标账户');
- $helper->betweenAmount('total_fee', '金额范围'); // 添加金额范围筛选
- $helper->betweenTimestamp('create_time', '创建时间');
- });
- $grid->disableCreateButton();
- $grid->actions(function (Grid\Displayers\Actions $actions) {
- // $actions->disableDelete();
- $actions->disableView();
- });
- });
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- *
- * @return Show
- */
- protected function detail($id)
- {
- return Show::make($id, new FundCirculation(), function (Show $show) {
- $show->field('id');
- $show->field('service_id');
- $show->field('title');
- $show->field('title_i18n');
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new FundCirculation(), function (Form $form) {
- });
- }
- }
|