Browse Source

采购单管理,列表增加采购员所属部门的筛选条件

wufeng 2 years ago
parent
commit
78cd65348f
1 changed files with 7 additions and 3 deletions
  1. 7 3
      app/admin/controller/Purch.php

+ 7 - 3
app/admin/controller/Purch.php

@@ -116,6 +116,9 @@ class Purch extends Base
         if(!empty($role['write'])){
             $where[]=["po.cgder_id","in",$role['write']];
         }
+        $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
+        if ($company_name !== "") $where[] = ["po.cgder_id", 'in', get_company_item_user_by_name($company_name)];
+
 //        if(!empty($role['platform']) ){
 //            $where[]=["po.platform_id","in",$role['platform']];
 //        }
@@ -125,12 +128,12 @@ class Purch extends Base
         $list = Db::name("purchease_order")
             ->alias('po')
             ->leftJoin('order_num on','on.cgdNo=po.cgdNo')
-            ->field('po.*,on.orderCode')
+            ->leftJoin("depart_user u", "u.uid=po.cgder_id AND u.is_del=0")
+            ->field('po.*,on.orderCode,u.itemid')
             ->where($where)
             ->page($page,$size)
             ->order("po.addtime desc")
-            ->select()
-            ->toArray();
+            ->cursor();
 //        $all_orderCodes = Db::name('order_num')
 //            ->whereIn('cgdNo',array_column($list,'cgdNo'))
 //            ->column('orderCode','cgdNo');
@@ -178,6 +181,7 @@ class Purch extends Base
             $value['total_fee'] =round($value['total_fee']-$value['th_fee'],2);
             //补充orderCode
 //            $value['orderCode']=isset($all_orderCodes[$value['cgdNo']])?$all_orderCodes[$value['cgdNo']]:'';
+            $value['company_name'] = implode('/', array_column(GetPart($value['itemid']), 'name'));
             $data[]=$value;
         }
         return app_show(0,"获取成功",["list"=>$data ,"count"=>$count]);