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

82 lines
2.6 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. if ($this->user_id){
  39. $name = AdminUsers::find($this->user_id)->name;
  40. }else{
  41. $name = '<span style="color: #ff0000">数据错误</span>';
  42. }
  43. }
  44. return $name;
  45. })->style('danger');
  46. $grid->money('金额');
  47. $grid->desc('说明');
  48. $grid->created_at('创建时间')->display(function ($time) {
  49. return date('Y-m-d H:i', $time);
  50. });
  51. $grid->filter(function (Grid\Filter $filter) use ($adu,$type) {
  52. $filter->equal('id');
  53. if (!$adu->isRole('lanzu_cs')&&$type==4) {
  54. $filter->equal('user_id', '社区站点')->select(LanzuCsInfo::selectCsInfo());
  55. }
  56. });
  57. $grid->disableViewButton();
  58. $grid->disableCreateButton();
  59. $grid->disableEditButton();
  60. $grid->disableDeleteButton();
  61. });
  62. }
  63. protected function form()
  64. {
  65. return Form::make(new FinancialRecord0(), function (Form $form) {
  66. $form->datetime('created_at');
  67. });
  68. }
  69. }