Bläddra i källkod

列表筛选,优化供应商负责人

wufeng 2 år sedan
förälder
incheckning
8e099b1ecf

+ 6 - 0
app/admin/controller/After.php

@@ -3001,6 +3001,12 @@ class After extends Base
                 $condition[] = ["a.person_id", "in", $hand];
                 $condition[] = ["a.apply_id", "in", $arr];
                 $condition[] = ["a.cgderid", "in", $hand];
+
+                $code = Db::connect('mysql_sys')
+                    ->name('supplier')
+                    ->where(['is_del' => 0, 'personid' => $this->uid])
+                    ->column('code');
+                if($code) $condition[] = ["a.supplierNo", "in", $code];
             }
         }
 

+ 8 - 1
app/admin/controller/Goodup.php

@@ -160,7 +160,14 @@ class Goodup extends Base
             $hand = resign_hand_user($this->uid, 0);
             if (!empty($role[DataGroupModel::$type_全部])) {
                 $arr = array_unique(array_merge($hand, $role[DataGroupModel::$type_全部]));
-                $where[] = ['gb.chargerid|gb.createrid', 'in', $arr];
+//                $where[] = ['gb.chargerid|gb.createrid', 'in', $arr];
+
+                $supplierNos = Db::connect('mysql_sys')
+                    ->name('supplier')
+                    ->where(['is_del' => 0, 'personid' => $arr])
+                    ->column('code');
+
+                $where[] = ['gb.supplierNo', 'in', $supplierNos];
             }
         }
 

+ 7 - 0
app/admin/controller/Orderback.php

@@ -101,6 +101,13 @@ class Orderback extends Base
                 $arr = array_unique(array_merge($hand, $role[DataGroupModel::$type_全部]));
                 $condition[] = ['a.apply_id', 'in', $arr];
                 $condition[] = ['a.cgderid', 'in', $hand];
+
+                $supplierNos = Db::connect('mysql_sys')
+                    ->name('supplier')
+                    ->where(['is_del' => 0, 'personid' => $arr])
+                    ->column('code');
+
+                $where[] = ['a.supplierNo', 'in', $supplierNos];
             }
         }
 

+ 1 - 2
app/admin/controller/Purchin.php

@@ -103,9 +103,8 @@ class Purchin extends Base
                 if($arr){
                     $sys_supplier = Db::connect('mysql_sys')
                         ->name('supplier')
-                        ->field('code')
                         ->where(['is_del'=>0,'personid'=>$arr])
-                        ->buildSql();
+                        ->column('code');
                     $condition[] = ["b.supplierNo", "in", $sys_supplier];
                 }
 

+ 10 - 14
app/admin/controller/Reorder.php

@@ -472,27 +472,18 @@ class Reorder extends Base
         //3.业务公司账号-供应商负责人,只查看自己负责人的供应商的;
         //4,业务公司账号-数据共享接受人,共享给自己的数据;
         if ($this->level == 2) {
-
-            //判断是否是供应商负责人
-            $is_person = Db::connect('mysql_sys')
+            $code = Db::connect('mysql_sys')
                 ->name('supplier')
-                ->field('id')
                 ->where(['is_del' => 0, 'personid' => $this->uid])
-                ->findOrEmpty();
+                ->column('code');
 
-            if (empty($is_person)) {
+            if (empty($code)) {
                 //考虑数据权限
                 $role = $this->checkDataShare();
                 $hand = resign_hand_user($this->uid, 0);
                 $where[] = ['sr.apply_id', 'in', array_unique(array_merge($role[DataGroupModel::$type_全部], $hand))];
-            } else {
-                //考虑负责的供应商
-                $code = Db::connect('mysql_sys')
-                    ->name('supplier')
-                    ->where(['is_del' => 0, 'personid' => $this->uid])
-                    ->column('code');
-                $where[] = ['sr.supplierNo', 'in', $code];
-            }
+            } else $where[] = ['sr.supplierNo', 'in', $code];
+
 //            $role = $this->checkDataShare();
 //            $hand = resign_hand_user($this->uid, 0);
 //            if (!empty($role[DataGroupModel::$type_全部])) {
@@ -1838,6 +1829,11 @@ class Reorder extends Base
                 $condition[] = ["sr.apply_id", "in", $arr];
                 $condition[] = ["sr.cgderid", "in", $hand];
                 $condition[] = ["sr.person_id", "in", $hand];
+                $code = Db::connect('mysql_sys')
+                    ->name('supplier')
+                    ->where(['is_del' => 0, 'personid' => $this->uid])
+                    ->column('code');
+                if($code) $condition[]=['sr.supplierNo','in',$code];
             }
         }
 

+ 31 - 2
app/admin/controller/SupplierClient.php

@@ -290,9 +290,8 @@ class SupplierClient extends Base {
                 if($arr){
                     $sys_supplier = Db::connect('mysql_sys')
                         ->name('supplier')
-                        ->field('code')
                         ->where(['is_del'=>0,'personid'=>$arr])
-                        ->buildSql();
+                        ->column('code');
                     $condition[] = ["b.supplierNo", "in", $sys_supplier];
                 }
 
@@ -441,6 +440,12 @@ class SupplierClient extends Base {
             if (!empty($role[DataGroupModel::$type_全部])) {
                 $arr = array_unique(array_merge($hand, $role[DataGroupModel::$type_全部]));
                 $where[] = ['a.apply_id', 'in', $arr];
+                $code = Db::connect('mysql_sys')
+                    ->name('supplier')
+                    ->where(['is_del'=>0,'personid'=>$arr])
+                    ->column('code');
+                $condition[] = ["b.supplierNo", "in", $code];
+
             }
              if($relaComNo!='') $where[]=['b.companyNo','=', $relaComNo];
         }
@@ -530,6 +535,11 @@ class SupplierClient extends Base {
             if (!empty($role[DataGroupModel::$type_全部])) {
                 $arr = array_unique(array_merge($hand, $role[DataGroupModel::$type_全部]));
                 $where[] = ['a.apply_id', 'in', $arr];
+                $code = Db::connect('mysql_sys')
+                    ->name('supplier')
+                    ->where(['is_del'=>0,'personid'=>$arr])
+                    ->column('code');
+                $condition[] = ["a.supplierNo", "in", $code];
             }
              if($relaComNo!='') $where[]=['c.companyNo','=', $relaComNo];
         }
@@ -811,6 +821,13 @@ class SupplierClient extends Base {
                 $condition[] = ["a.person_id", "in", $hand];
                 $condition[] = ["a.apply_id", "in", $arr];
                 $condition[] = ["a.cgderid", "in", $hand];
+
+                $code = Db::connect('mysql_sys')
+                    ->name('supplier')
+                    ->where(['is_del' => 0, 'personid' => $arr])
+                    ->column('code');
+
+                $where[] = ['a.supplierNo', 'in', $code];
             }
 //            if ($param['relaComNo'] !== '') $where[] = ['c.supplierNo', "=", $param['relaComNo']];
         }
@@ -932,6 +949,12 @@ class SupplierClient extends Base {
                 $arr = array_unique(array_merge($hand, $role[DataGroupModel::$type_全部]));
                 $condition[] = ['a.apply_id', 'in', $arr];
                 $condition[] = ['a.cgderid', 'in', $hand];
+                $code = Db::connect('mysql_sys')
+                    ->name('supplier')
+                    ->where(['is_del' => 0, 'personid' => $arr])
+                    ->column('code');
+
+                $where[] = ['a.supplierNo', 'in', $code];
             }
 //            if ($relaComNo != "") $where[] = ['b.supplierNo', '=', $relaComNo];
         }
@@ -1058,6 +1081,12 @@ class SupplierClient extends Base {
                 $condition[] = ["sr.apply_id", "in", $arr];
                 $condition[] = ["sr.cgderid", "in", $hand];
                 $condition[] = ["sr.person_id", "in", $hand];
+
+                $code = Db::connect('mysql_sys')
+                    ->name('supplier')
+                    ->where(['is_del' => 0, 'personid' => $arr])
+                    ->column('code');
+                $where[] = ['sr.supplierNo', 'in', $code];
             }
 //             if ($relaComNo != "") $where[] = ['sr.companyNo', '=', $relaComNo];
         }