|
@@ -319,52 +319,61 @@ class Project extends Base
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function list(){
|
|
|
- $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;
|
|
|
- $where=[["p.is_del","=",0]];
|
|
|
- $khNo = isset($this->post['khNo']) &&$this->post['khNo']!==""? trim($this->post['khNo']):"";
|
|
|
- if($khNo!==""){
|
|
|
- $where[]=["p.khNo","=",$khNo];
|
|
|
- }
|
|
|
- $project_name = isset($this->post['project_name']) &&$this->post['project_name']!==""? trim($this->post['project_name']):"";
|
|
|
- if($project_name!==""){
|
|
|
- $where[]=["p.project_name","like","%$project_name%"];
|
|
|
- }
|
|
|
- $status = isset($this->post['status']) &&$this->post['status']!==""? intval($this->post['status']):"";
|
|
|
- if($status!==""){
|
|
|
- $where[]=["p.status","=",$status];
|
|
|
- }
|
|
|
- $start = isset($this->post['start'])&&$this->post['start']!=="" ? $this->post['start']:"";
|
|
|
- if($start!==''){
|
|
|
- $where[]=["p.addtime",">=",$start];
|
|
|
- }
|
|
|
- $end = isset($this->post['end'])&&$this->post['end']!=="" ? $this->post['end']:"";
|
|
|
- if($end!==''){
|
|
|
- $where[]=["p.addtime","<=",$end];
|
|
|
- }
|
|
|
- $low = isset($this->post['low'])&&$this->post['low']!=="" ? floatval($this->post['low']):"";
|
|
|
- if($low!==''){
|
|
|
- $where[]=["p.budget_total",">=",$low];
|
|
|
- }
|
|
|
- $up = isset($this->post['up'])&&$this->post['up']!=="" ? floatval($this->post['up']):"";
|
|
|
- if($up!==''){
|
|
|
- $where[]=["p.budget_total","<=",$up];
|
|
|
- }
|
|
|
- $companyNo = isset($this->post['companyNo'])&&$this->post['companyNo']!=="" ? trim($this->post['companyNo']):"";
|
|
|
- if($companyNo!==''){
|
|
|
- $where[]=["p.companyNo","like","%$companyNo%"];
|
|
|
- }
|
|
|
+ public function list()
|
|
|
+ {
|
|
|
|
|
|
- $relaComNo = isset($this->post['relaComNo']) && $this->post['relaComNo'] !== "" ? trim($this->post['relaComNo']) : "";
|
|
|
- if ($relaComNo != '') $where[] = ["p.companyNo", "=", $relaComNo];
|
|
|
+ $param = $this->request->only([
|
|
|
+ 'page' => 1,
|
|
|
+ 'size' => 10,
|
|
|
+ 'khNo' => '',
|
|
|
+ 'project_name' => '',
|
|
|
+ 'status' => '',
|
|
|
+ 'start' => '',
|
|
|
+ 'end' => '',
|
|
|
+ 'low' => '',
|
|
|
+ 'up' => '',
|
|
|
+ 'companyNo' => '',
|
|
|
+ 'relaComNo' => '',
|
|
|
+ 'platform_id' => '',
|
|
|
+ 'company_name' => '',
|
|
|
+ ], 'post', 'trim');
|
|
|
|
|
|
- $platform_id = isset($this->post['platform_id'])&&$this->post['platform_id']!=="" ? intval($this->post['platform_id']):"";
|
|
|
- if($platform_id!==''){
|
|
|
- $where[]=["p.platform_id","=",$platform_id];
|
|
|
- }
|
|
|
- $company_name = isset($this->post['company_name'])&&$this->post['company_name']!=="" ? trim($this->post['company_name']):"";
|
|
|
- if($company_name!=='') $where[] = ["p.createrid", 'in', get_company_item_user_by_name($company_name)];
|
|
|
+// $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;
|
|
|
+ $where = [["p.is_del", "=", 0]];
|
|
|
+// $khNo = isset($this->post['khNo']) &&$this->post['khNo']!==""? trim($this->post['khNo']):"";
|
|
|
+ if ($param['khNo'] !== "") $where[] = ["p.khNo", "=", $param['khNo']];
|
|
|
+
|
|
|
+// $project_name = isset($this->post['project_name']) &&$this->post['project_name']!==""? trim($this->post['project_name']):"";
|
|
|
+ if ($param['project_name'] !== "") $where[] = ["p.project_name", "like", '%' . $param['project_name'] . '%'];
|
|
|
+
|
|
|
+// $status = isset($this->post['status']) &&$this->post['status']!==""? intval($this->post['status']):"";
|
|
|
+ if ($param['status'] !== "") $where[] = ["p.status", "=", $param['status']];
|
|
|
+
|
|
|
+// $start = isset($this->post['start'])&&$this->post['start']!=="" ? $this->post['start']:"";
|
|
|
+ if ($param['start'] !== '') $where[] = ["p.addtime", ">=", $param['start']];
|
|
|
+
|
|
|
+// $end = isset($this->post['end'])&&$this->post['end']!=="" ? $this->post['end']:"";
|
|
|
+ if ($param['end'] !== '') $where[] = ["p.addtime", "<=", $param['end']];
|
|
|
+
|
|
|
+// $low = isset($this->post['low'])&&$this->post['low']!=="" ? floatval($this->post['low']):"";
|
|
|
+ if ($param['low'] !== '') $where[] = ["p.budget_total", ">=", $param['low']];
|
|
|
+
|
|
|
+// $up = isset($this->post['up'])&&$this->post['up']!=="" ? floatval($this->post['up']):"";
|
|
|
+ if ($param['up'] !== '') $where[] = ["p.budget_total", "<=", $param['up']];
|
|
|
+
|
|
|
+// $companyNo = isset($this->post['companyNo'])&&$this->post['companyNo']!=="" ? trim($this->post['companyNo']):"";
|
|
|
+ if ($param['companyNo'] !== '') $where[] = ["p.companyNo", "like", '%' . $param['companyNo'] . '%'];
|
|
|
+
|
|
|
+
|
|
|
+// $relaComNo = isset($this->post['relaComNo']) && $this->post['relaComNo'] !== "" ? trim($this->post['relaComNo']) : "";
|
|
|
+ if ($param['relaComNo'] != '') $where[] = ["p.companyNo", "=", $param['relaComNo']];
|
|
|
+
|
|
|
+// $platform_id = isset($this->post['platform_id'])&&$this->post['platform_id']!=="" ? intval($this->post['platform_id']):"";
|
|
|
+ if ($param['platform_id'] !== '') $where[] = ["p.platform_id", "=", $param['platform_id']];
|
|
|
+
|
|
|
+// $company_name = isset($this->post['company_name'])&&$this->post['company_name']!=="" ? trim($this->post['company_name']):"";
|
|
|
+ if ($param['company_name'] !== '') $where[] = ["p.createrid", 'in', get_company_item_user_by_name($param['company_name'])];
|
|
|
|
|
|
// $role=$this->checkRole();
|
|
|
// if(!empty($role['write'])){
|
|
@@ -373,43 +382,55 @@ class Project extends Base
|
|
|
// $role = $this->checkDataShare();
|
|
|
// if (!empty($role[DataGroupModel::$type_全部])) $where[] = ['p.createrid', 'in', $role[DataGroupModel::$type_全部]];
|
|
|
$role = $this->checkDataShare();
|
|
|
- $hand = resign_hand_user($this->uid,0);
|
|
|
+ $hand = resign_hand_user($this->uid, 0);
|
|
|
if (!empty($role[DataGroupModel::$type_全部])) {
|
|
|
- $arr= array_unique(array_merge($hand,$role[DataGroupModel::$type_全部]));
|
|
|
- $where[] = ['p.createrid', 'in',$arr];
|
|
|
+ $arr = array_unique(array_merge($hand, $role[DataGroupModel::$type_全部]));
|
|
|
+ $where[] = ['p.createrid', 'in', $arr];
|
|
|
}
|
|
|
// if(!empty($role['platform'])){
|
|
|
// $where[]=["p.platform_id","in",$role['platform']];
|
|
|
// }
|
|
|
- $count = Db::name('project') ->alias('p')->where($where)->count();
|
|
|
- $total = ceil($count / $size);
|
|
|
- $page = $page >= $total ? $total : $page;
|
|
|
+ $count = Db::name('project')
|
|
|
+ ->alias('p')
|
|
|
+ ->where($where)
|
|
|
+ ->count();
|
|
|
+
|
|
|
$list = Db::name('project')
|
|
|
->alias('p')
|
|
|
- ->field('p.*,u.itemid')
|
|
|
- ->leftJoin('depart_user u', 'u.uid=p.createrid AND u.is_del=0')
|
|
|
+ ->field('p.*,b.platform_name,b.platform_code')
|
|
|
+ ->leftJoin('platform b', 'b.id=p.platform_id')
|
|
|
->where($where)
|
|
|
- ->page($page,$size)
|
|
|
+ ->page($param['page'], $param['size'])
|
|
|
->order("p.addtime desc")
|
|
|
- ->cursor();
|
|
|
- $data=[];
|
|
|
- foreach ($list as $value){
|
|
|
- $info = Db::name("platform")->where(['id'=>$value['platform_id']])->find();
|
|
|
- $value['platform_name']=isset($info['platform_name'])?$info['platform_name']:"";
|
|
|
- $value['platform_code']=isset($info['platform_code'])?$info['platform_code']:"";
|
|
|
- $khinfo = Db::name("customer_info")->where(["companyNo"=>$value['khNo']])->find();
|
|
|
- $value['khName'] = isset($khinfo['companyName'])?$khinfo['companyName']:"";
|
|
|
- $company = Db::name("business")->where(["companyNo"=>$value['companyNo']])->find();
|
|
|
- $value['company'] = isset($company['company'])?$company['company']:"";
|
|
|
- $value['company_name'] = implode('/', array_column(GetPart($value['itemid']), 'name'));
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+
|
|
|
+ //所有创建人及所属部门
|
|
|
+ $all_createrid = array_column($list, 'createrid');
|
|
|
+ $item = get_company_name_by_uid($all_createrid);
|
|
|
+
|
|
|
+ //所有公司编码
|
|
|
+ $all_code = array_merge(array_column($list, 'khNo'), array_column($list, 'companyNo'));
|
|
|
+ $headquarters = get_headquarters_code_and_name($all_code);
|
|
|
+
|
|
|
+ $data = [];
|
|
|
+ foreach ($list as $value) {
|
|
|
+// $info = Db::name("platform")->where(['id'=>$value['platform_id']])->find();
|
|
|
+// $value['platform_name']=isset($info['platform_name'])?$info['platform_name']:"";
|
|
|
+// $value['platform_code']=isset($info['platform_code'])?$info['platform_code']:"";
|
|
|
+// $khinfo = Db::name("customer_info")->where(["companyNo"=>$value['khNo']])->find();
|
|
|
+ $value['khName'] = $headquarters[$value['khNo']] ?? '';//isset($khinfo['companyName'])?$khinfo['companyName']:"";
|
|
|
+// $company = Db::name("business")->where(["companyNo"=>$value['companyNo']])->find();
|
|
|
+ $value['company'] = $headquarters[$value['companyNo']] ?? '';//isset($company['company'])?$company['company']:"";
|
|
|
+ $value['company_name'] = $item[$value['createrid']];//implode('/', array_column(GetPart($value['itemid']), 'name'));
|
|
|
|
|
|
//是否具有编辑权限
|
|
|
$value['is_allow_update'] = 0;
|
|
|
if (in_array($this->roleid, [1, 33]) || in_array($value['createrid'], $role[DataGroupModel::$type_可编辑])) $value['is_allow_update'] = 1;
|
|
|
|
|
|
- $data[]=$value;
|
|
|
+ $data[] = $value;
|
|
|
}
|
|
|
- return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);
|
|
|
+ return app_show(0, "获取成功", ['list' => $data, 'count' => $count]);
|
|
|
}
|
|
|
|
|
|
public function feedlist(){
|