|
@@ -783,15 +783,26 @@ class Purch extends Base
|
|
|
if($apply_name!==""){
|
|
|
$where[]=['a.apply_name',"like","%$apply_name%"];
|
|
|
}
|
|
|
+ $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
|
|
|
+ if ($company_name !== "") $where[] = ["a.apply_id", 'in', get_company_item_user_by_name($company_name)];
|
|
|
+
|
|
|
$count = Db::name('purchease_diff')->alias('a')->join("good b","b.spuCode=a.good_code","left")
|
|
|
->where($where)->count();
|
|
|
$total = ceil($count/$size);
|
|
|
$page = $page >= $total ? $total : $page;
|
|
|
- $list = Db::name('purchease_diff')->alias('a')->join("good b","b.spuCode=a.good_code","left")
|
|
|
- ->where($where)->page($page,$size)->order("a.addtime desc")->field("a.*,b.cat_id")->select();
|
|
|
+ $list = Db::name('purchease_diff')
|
|
|
+ ->alias('a')
|
|
|
+ ->join("good b","b.spuCode=a.good_code","left")
|
|
|
+ ->leftJoin("depart_user u", "u.uid=a.apply_id AND u.is_del=0")
|
|
|
+ ->where($where)
|
|
|
+ ->page($page,$size)
|
|
|
+ ->order("a.addtime desc")
|
|
|
+ ->field("a.*,b.cat_id,u.itemid")
|
|
|
+ ->cursor();
|
|
|
$data=[];
|
|
|
foreach ($list as $value){
|
|
|
$value['can']= isset($value['cat_id']) && $value['cat_id'] !=0 ? made($value['cat_id']):[];
|
|
|
+ $value['company_name'] = implode('/', array_column(GetPart($value['itemid']), 'name'));
|
|
|
$data[]=$value;
|
|
|
}
|
|
|
return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);
|