链街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.

77 lines
2.4 KiB

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