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

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