链街Dcat后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.1 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Models\AdminUsers;
  4. use App\Models\FinancialRecord;
  5. use App\Models\FinancialRecord0;
  6. use App\Models\ImsCjdcUser;
  7. use App\Models\LanzuCsInfo;
  8. use App\Models\LanzuMpInfo;
  9. use app\Request;
  10. use Dcat\Admin\Admin;
  11. use Dcat\Admin\Controllers\AdminController;
  12. use Dcat\Admin\Form;
  13. use Dcat\Admin\Grid;
  14. class LanzuFinancialRecord extends AdminController
  15. {
  16. protected function grid()
  17. {
  18. $adu = Admin::user();
  19. $builder = new FinancialRecord0();
  20. if ($adu->isRole('lanzu_cs')){
  21. $fr = FinancialRecord::getFinancialRecordModel($adu->id);
  22. $builder = $fr;
  23. }else{
  24. $param = \Request::get('user_id');
  25. if ($param){
  26. $fr = FinancialRecord::getFinancialRecordModel($param);
  27. $builder = $fr;
  28. }
  29. }
  30. return Grid::make($builder,function (Grid $grid) use ($adu){
  31. $grid->id;
  32. $grid->user_id('用户')->display(function (){
  33. if ($this->user_type==1){
  34. $name = ImsCjdcUser::find($this->user_id)->name;
  35. }else{
  36. $name = AdminUsers::find($this->user_id)->name;
  37. }
  38. return $name;
  39. });
  40. $grid->money('金额');
  41. $grid->desc('说明');
  42. $grid->created_at('创建时间')->display(function ($time){
  43. return date('Y-m-d H:i',$time);
  44. });
  45. $grid->filter(function (Grid\Filter $filter) use ($adu){
  46. $filter->equal('id');
  47. if (!$adu->isRole('lanzu_cs')){
  48. $filter->equal('user_id','社区站点')->select(LanzuCsInfo::selectCsInfo());
  49. }
  50. });
  51. $grid->disableViewButton();
  52. $grid->disableCreateButton();
  53. $grid->disableEditButton();
  54. $grid->disableDeleteButton();
  55. });
  56. }
  57. protected function form()
  58. {
  59. return Form::make(new FinancialRecord0(),function (Form $form){
  60. $form->datetime('created_at');
  61. });
  62. }
  63. }