Blame view

application/admin/controller/antis/examine/Examine.php 5.54 KB
2db47680   hexiaodong   chore: 初始提交 php 遗...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
  <?php
  
  namespace app\admin\controller\antis\examine;
  use addons\antis\model\Staff;
  use app\admin\controller\antis\Base;
  use app\common\controller\Backend;
  use addons\antis\model\ExamineRecord;
  use addons\antis\model\FormApproval;
  use think\DB;
  
  /**
   * 审核信息
   */
  class Examine extends Base {
      public function _initialize() {
          parent::_initialize();
          $this->model = new ExamineRecord();
      }
  
      /**
       * 审核合同
       */
      public function index() {
          $this->request->filter(['strip_tags']);
  
          if ($this->request->isAjax()) {
              $this->relationSearch = true;
              list($where, $sort, $order, $offset, $limit) = $this->buildparams();
              $status = input('status',0);
              $wheres['check_staff_id'] = $this->_staff->id;
              $wheres['relation_type'] = 'contract';
              if($status == 1){
                  $wheres['status'] = array('in','1,2');
              }else{
                  $wheres['status']=0;
              }
              $list   = $this->model->where($where)->where($wheres)->with([
                  'checkStaff',
                  'contract' => ['ownerStaff']
              ])->order($sort, $order)->paginate($limit);
              $row    = $list->items();
  
              $result = array("total" => $list->total(), "rows" => $row);
  
              return json($result);
          }
  
          return $this->view->fetch();
      }
  
      /**
       * 审核费用
       */
      public function consume() {
          $this->request->filter(['strip_tags']);
          if ($this->request->isAjax()) {
              $this->relationSearch = true;
              list($where, $sort, $order, $offset, $limit) = $this->buildparams();
              $status = input('status',0);
              $wheres['check_staff_id'] = $this->_staff->id;
              $wheres['relation_type'] = 'consume';
              if($status == 1){
                  $wheres['status'] = array('in','1,2');
              }else{
                  $wheres['status']=0;
              }
  
              $list   = $this->model->where($where)->where($wheres)->with(['checkStaff','consume'=>['staff']])->order($sort, $order)->paginate($limit);
              $row    = $list->items();
              $result = array("total" => $list->total(), "rows" => $row);
  
              return json($result);
          }
  
          return $this->view->fetch();
      }
  
      /**
       * 审核回款
       */
      public function receivables() {
          $this->request->filter(['strip_tags']);
          $receivables_id = input('receivables_id','','trim');
          if ($this->request->isAjax()) {
              $this->relationSearch = true;
              $status = input('status',0);
              list($where, $sort, $order, $offset, $limit) = $this->buildparams();
              $wheres['check_staff_id'] = $this->_staff->id;
              $wheres['relation_type'] = 'receivables';
              if($status == 1){
                  $wheres['status'] = array('in','1,2');
              }else{
                  $wheres['status']=0;
              }
              if(isset($receivables_id) && $receivables_id){
                  $wheres['relation_id'] = $receivables_id;
                  $wheres['status'] = array('neq',0);
              }
              $list   = $this->model->where($where)->where($wheres)
                  ->with(['checkStaff','receivables'=>['createStaff']])->order($sort, $order)->paginate($limit);
              $row    = $list->items();
              $result = array("total" => $list->total(), "rows" => $row);
  
              return json($result);
          }
  
          return $this->view->fetch();
      }
      /**
       * 审核业绩目标
       */
      public function achievement() {
          $this->request->filter(['strip_tags']);
          if ($this->request->isAjax()) {
              $this->relationSearch = true;
              $status = input('status',0);
              list($where, $sort, $order, $offset, $limit) = $this->buildparams();
              $wheres['check_staff_id'] = $this->_staff->id;
              $wheres['relation_type'] = ExamineRecord::ACHIEVEMENT_TYPE;
              if($status == 1){
                  $wheres['status'] = array('in','1,2');
              }else{
                  $wheres['status']=0;
              }
              $list   = $this->model->where($where)->where($wheres)->with(['checkStaff','achievement'=>['createStaff']])->order($sort, $order)->paginate($limit);
              $row    = $list->items();
              $result = array("total" => $list->total(), "rows" => $row);
  
              return json($result);
          }
  
          return $this->view->fetch();
      }
      /**
       * 审核办公审批
       */
      public function work() {
          $this->request->filter(['strip_tags']);
          if ($this->request->isAjax()) {
              $this->relationSearch = true;
              $status = input('status',0);
              list($where, $sort, $order, $offset, $limit) = $this->buildparams();
              $wheres['check_staff_id'] = $this->_staff->id;
              $wheres['relation_type'] = 'approval';
              if($status == 1){
                  $wheres['status'] = array('in','1,2');
              }else{
                  $wheres['status']=0;
              }
  
              $list   = $this->model->where($where)->where($wheres)
                  ->with(['checkStaff','approval'=>['createStaff']])->order($sort, $order)->paginate($limit);
              foreach($list as $k=>$v){
                  $list[$k]['approval_name'] = FormApproval::where(array('id'=>$v['approval']['formapproval_id']))->value('name');
              }
              $row    = $list->items();
              $result = array("total" => $list->total(), "rows" => $row);
  
              return json($result);
          }
  
          return $this->view->fetch();
      }
  
  }