gogs 1 jaar geleden
bovenliggende
commit
90ed959dac
2 gewijzigde bestanden met toevoegingen van 18 en 16 verwijderingen
  1. 3 1
      app/Service/ConstructionService.php
  2. 15 15
      app/Service/OaService.php

+ 3 - 1
app/Service/ConstructionService.php

@@ -879,9 +879,11 @@ class ConstructionService extends Service
         if(empty($model)) return [false,'数据不存在!'];
         $employee_key_list = Employee::pluck('emp_name','id')->toArray();
         $detail = $model->toArray();
+
         $detail['install_man_title'] = $employee_key_list[$detail['install_man']] ?? "";
         $detail['sale_man_title'] = $employee_key_list[$detail['sale_man']] ?? "";
-
+        $img_list = ConstructionFile::where('order_number',$detail['order_number'])->select('file','name','mark')->get()->toArray();
+        $detail['file'] = $img_list;
         return [true,$detail];
     }
 

+ 15 - 15
app/Service/OaService.php

@@ -49,7 +49,7 @@ class OaService extends Service
             ->leftjoin('sys_menu as s', 's.id', 'o.menu_id')
             ->select('o.id', 'o.menu_id', 'o.crt_time', 's.title')
             ->where('o.del_time', 0)
-            ->where('o.channel', $this->user[0]['depart_id']);
+            ->where('o.channel', $this->user['depart_top'][0]['depart_id']);
 
         $list = $this->limit($list, '', $data);
 
@@ -63,7 +63,7 @@ class OaService extends Service
     {
 
         $id = $data['id'];
-        $oa = Oa::where('id', $id)->where('channel',$this->user[0]['depart_id'])->first();
+        $oa = Oa::where('id', $id)->where('channel',$this->user['depart_top'][0]['depart_id'])->first();
         $list = OaSub::where('oa_id', $id)->where('del_time', 0)->get()->toArray();
         $oa_sub_ids = [];
         foreach ($list as $v) {
@@ -79,7 +79,7 @@ class OaService extends Service
             $oaRuleKey[$v['oa_sub_id']][] = [
                 'value' => $v['value'],
                 'key' => $v['key'],
-                'opera' => $v['formula'] == '==' ? '=' : $v['formula'],
+                'opera' => $v['formula'] == '==' ? '==' : $v['formula'],
             ];
         }
         $employee_key_list = Employee::pluck('emp_name', 'id')->toArray();
@@ -196,7 +196,7 @@ class OaService extends Service
             $oa->menu_id = $data['menu_id'];
             $oa->type = $data['type'];
             $oa->title = $data['title'] ?? '';
-            $oa->channel = $this->user[0]['depart_id'];
+            $oa->channel = $this->user['depart_top'][0]['depart_id'];
             $oa->save();
             $id = $oa->id;
             $insert = [];
@@ -231,7 +231,7 @@ class OaService extends Service
     {
 
 
-        $first = Oa::where('del_time', 0)->where('channel',$this->user[0]['depart_id'])->where('menu_id', $data['menu_id']);
+        $first = Oa::where('del_time', 0)->where('channel',$this->user['depart_top'][0]['depart_id'])->where('menu_id', $data['menu_id']);
         if (isset($data['id'])) $first = $first->where('id', '<>', $data['id']);
         if (isset($data['type'])) $first = $first->where('type', $data['type']);
         $first = $first->first();
@@ -247,7 +247,7 @@ class OaService extends Service
             $oa->crt_employee_id = $user['id'];
             $oa->type = $data['type'] ?? 0;
             $oa->title = $data['title'] ?? '';
-            $oa->channel = $this->user[0]['depart_id'];
+            $oa->channel = $this->user['depart_top'][0]['depart_id'];
             $oa->save();
             $id = $oa->id;
             $insert = [];
@@ -407,7 +407,7 @@ class OaService extends Service
             ->leftJoin('oa_sub as os', 'os.oa_id', 'o.id')
             ->select('os.sort', 'os.type', 'os.sub_id')
             ->where('o.del_time', 0)
-            ->where('o.channel', $this->user[0]['depart_id'])
+            ->where('o.channel', $this->user['depart_top'][0]['depart_id'])
             ->where('o.menu_id', $menu_id);
         if (!empty($type)) $list = $list->where('os.sort', 1);
         $list = $list->orderBy('os.sort')
@@ -429,7 +429,7 @@ class OaService extends Service
             $order->menu_id = $menu_id;
             $order->order_no = $order_no;
             $order->opt_case = $type;
-            $order->channel = $this->user[0]['depart_id'];
+            $order->channel = $this->user['depart_top'][0]['depart_id'];
             $order->save();
             $id = $order->id;
 
@@ -473,7 +473,7 @@ class OaService extends Service
         if (!isset($all['order_number'])) $request->merge($param);
 //        $request->merge($param);
         $detail = $this->oaGetData($menu_id, $request);
-        $oa_id = Oa::where('menu_id', $menu_id)->where('channel',$this->user[0]['depart_id'])->where('del_time', 0)->value('id');
+        $oa_id = Oa::where('menu_id', $menu_id)->where('channel',$this->user['depart_top'][0]['depart_id'])->where('del_time', 0)->value('id');
         $parent_ids = [$parent_id, 0];
 //        var_dump($parent_ids);
         if ($sort > 2) {
@@ -629,7 +629,7 @@ class OaService extends Service
             $report->order_no = $oaOrder->order_no;
             $report->opt_case = $oaOrder->opt_case;
             $report->user_id = $user_id;
-            $report->channel = $this->user[0]['depart_id'];
+            $report->channel = $this->user['depart_top'][0]['depart_id'];
             $report->save();
             foreach ($oa_sub_report_employee as $v) {
                 $list[] = [
@@ -684,7 +684,7 @@ class OaService extends Service
     {
         $order_no = $data['order_no'];
         $menu_id = $data['menu_id'];
-        $oa = OaOrder::where('order_no', $order_no)->where('channel',$this->user[0]['depart_id'])->where('menu_id', $menu_id)->first();
+        $oa = OaOrder::where('order_no', $order_no)->where('channel',$this->user['depart_top'][0]['depart_id'])->where('menu_id', $menu_id)->first();
         if (empty($oa)) return [false, '审核不存在'];
         $list = OaOrderSub::where('oa_order_id', $oa->id)->orderBy('sort', 'asc')->select('*')->get()->toArray();
         return [true, $list];
@@ -696,7 +696,7 @@ class OaService extends Service
         $user_id = $user->id;
         $order_no = $data['order_no'];
         $menu_id = $data['menu_id'];
-        $detail = OaOrder::where('order_no', $order_no)->where('channel',$this->user[0]['depart_id'])->orderBy('id', 'desc')->where('menu_id', $menu_id)->first();
+        $detail = OaOrder::where('order_no', $order_no)->where('channel',$this->user['depart_top'][0]['depart_id'])->orderBy('id', 'desc')->where('menu_id', $menu_id)->first();
         if (empty($detail)) return [false, '审核不存在'];
         if ($detail->state == 2) return [true, ['state' => 0]];
         $oa_detail = OaOrderSubEmployee::where('employee_id', $user_id)->where('oa_order_id', $detail->id)->pluck('oa_order_sub_id')->toArray();
@@ -800,7 +800,7 @@ class OaService extends Service
     public function oaSubRemark($data)
     {
         $order_no = $data['order_no'];
-        $first = OaOrder::where('del_time', 0)->where('channel',$this->user[0]['depart_id'])->where('order_no', $order_no)->orderBy('id', 'desc')->first();
+        $first = OaOrder::where('del_time', 0)->where('channel',$this->user['depart_top'][0]['depart_id'])->where('order_no', $order_no)->orderBy('id', 'desc')->first();
         if (empty($first)) return [true, []];
         $oa_order_id = $first->id;
         $remark = OaOrderSub::where('oa_order_id', $oa_order_id)->orderBy('sort', 'desc')->value('remark');
@@ -818,7 +818,7 @@ class OaService extends Service
             ->leftJoin('oa_order as oo','oo.order_no','o.order_no')
             ->leftJoin('employee as ee','ee.id','o.user_id')
             ->where('e.employee_id',$id)
-            ->where('o.channel',$this->user[0]['depart_id'])
+            ->where('o.channel',$this->user['depart_top'][0]['depart_id'])
             ->groupBy('oo.id')->orderBy('oo.id','desc')
             ->select('oo.*','o.id as sid','o.check','o.user_id','ee.emp_name');
         $list = $this->limit($list,'',$data);
@@ -830,7 +830,7 @@ class OaService extends Service
 
     public function reportCheck($data){
         $id = $data['sid'];
-        OaReportOrder::wherein('id',$id)->where('channel',$this->user[0]['depart_id'])->update([
+        OaReportOrder::wherein('id',$id)->where('channel',$this->user['depart_top'][0]['depart_id'])->update([
             'check' => 1
         ]);
         return [true,''];