|
@@ -27,6 +27,8 @@ class Customer extends BaseController
|
|
|
$page= isset($this->post['page']) && $this->post['page']!==""? intval($this->post['page']):"1";
|
|
|
$size = isset($this->post['size']) && $this->post['size'] != "" ? intval($this->post['size']) : 10;
|
|
|
$pid = isset($this->post['pid']) &&$this->post['pid']!=="" ?intval($this->post['pid']): 0;
|
|
|
+ $where =[];
|
|
|
+ $where []= ['is_del',"=",0];
|
|
|
$condition[] = ['is_del',"=",0];
|
|
|
if($pid!==""){
|
|
|
$condition[]=["pid","=",$pid];
|
|
@@ -35,10 +37,28 @@ class Customer extends BaseController
|
|
|
if($name!=""){
|
|
|
$condition[]=["name","like","%{$this->post['name']}%"];
|
|
|
}
|
|
|
- $count = Db::name('customer_org1')->where($condition)->count();
|
|
|
- $page>=ceil($count/$size) ? $page=ceil($count/$size) :"";
|
|
|
+// $count = Db::name('customer_org1')->where($condition)->count();
|
|
|
+// $page>=ceil($count/$size) ? $page=ceil($count/$size) :"";
|
|
|
+ $pidlist = Db::name("customer_org1")->where($condition)->column("pid");
|
|
|
+ if(!empty($pidlist)){
|
|
|
+ $where[]=[["itemid","in",$pidlist]];
|
|
|
+
|
|
|
+ }else{
|
|
|
+ if($pid===""){
|
|
|
+ $where[]=['itemid','=',0];
|
|
|
+ }else{
|
|
|
+ $where[]=['itemid','=',$pid];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $itm = Db::name('customer_info')->where($where)->select();
|
|
|
$list = Db::name('customer_org1')->where($condition)->page($page,$size)->column("id,pid,name,level,depart_link");
|
|
|
- return app_show(0,"获取成功",['list'=>$list,'count'=>$count]);
|
|
|
+// $data=[];
|
|
|
+// foreach ($list as $item) {
|
|
|
+// $cuost = Db::name('customer_info')->where(['itemid'=>$item['id'],'is_del'=>0])->find();
|
|
|
+// $item['name']=$cuost['companyName'];
|
|
|
+// $data[]=$item;
|
|
|
+// }
|
|
|
+ return app_show(0,"获取成功",['list'=>$list,'itm'=>$itm]);
|
|
|
}
|
|
|
/*新建*/
|
|
|
public function create()
|