|
@@ -85,19 +85,9 @@ class CostCompany extends BaseController
|
|
|
}
|
|
|
$where3 = array();
|
|
|
if (!empty($param['project_status'])) {
|
|
|
- if($param['project_status'] == 100){
|
|
|
- $where3[] = ['project_status', '=', 0];
|
|
|
- $where3[] = ['proprietor_status', '=', 0];
|
|
|
- }else if($param['project_status'] == 101){
|
|
|
- $where3[] = ['project_status', '=', 0];
|
|
|
- $where3[] = ['proprietor_status', '=', 1];
|
|
|
- }else if($param['project_status'] == 102){
|
|
|
- $where3[] = ['project_status', '=', 0];
|
|
|
- $where3[] = ['proprietor_status', '=', 2];
|
|
|
- }else{
|
|
|
- $where3[] = ['project_status', '=', $param['project_status']];
|
|
|
- }
|
|
|
+ $where3[] = ['project_status', '=', $param['project_status']];
|
|
|
}
|
|
|
+
|
|
|
if (!empty($param['province'])) {
|
|
|
$where3[] = ['province', '=', $param['province']];
|
|
|
}
|
|
@@ -150,7 +140,7 @@ class CostCompany extends BaseController
|
|
|
->order($order)->paginate($rows, false, ['query' => $param])
|
|
|
->each(function ($item) {
|
|
|
$item->creator = Db::name("admin")->where("id",$item->creator)->value("nickname");
|
|
|
-
|
|
|
+
|
|
|
|
|
|
$red = Db::name("new_msg")->where([["project_id", "=", $item->id], ["uid", "=", $this->uid]])->find();
|
|
|
if ($red) {
|
|
@@ -160,7 +150,7 @@ class CostCompany extends BaseController
|
|
|
} else {
|
|
|
$item->red = 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$entrust_head_id = Db::name('department')->where(['id' => $item->entrust_unit])->value('leader_id');
|
|
|
if (!($item->entrust_head_phone)) {
|
|
|
$item->entrust_head_phone = Db::name('admin')->where("id", $entrust_head_id)->value("mobile");
|
|
@@ -189,7 +179,7 @@ class CostCompany extends BaseController
|
|
|
$item->operate_team_names = $operate_team_names;
|
|
|
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
}elseif ($see_auth==0){
|
|
|
$list = $this->model
|
|
|
->where($where)->whereIn("id", $inarr)->where($where3)
|
|
@@ -240,7 +230,7 @@ class CostCompany extends BaseController
|
|
|
->order($order)->paginate($rows, false, ['query' => $param])
|
|
|
->each(function ($item) {
|
|
|
$item->creator = Db::name("admin")->where("id",$item->creator)->value("nickname");
|
|
|
-
|
|
|
+
|
|
|
$red = Db::name("new_msg")->where([["project_id", "=", $item->id], ["uid", "=", $this->uid]])->find();
|
|
|
if ($red) {
|
|
|
if ($red["detail"] || $red["comment"] || $red["report"] || $red["record"] || $red["user"] || $red["contact"]) {
|
|
@@ -265,7 +255,7 @@ class CostCompany extends BaseController
|
|
|
//只有一个人会报错
|
|
|
// dump($item->operate_team);
|
|
|
$aaa = isset($item->operate_team) ? $item->operate_team : "0";
|
|
|
-
|
|
|
+
|
|
|
// dump($aaa);
|
|
|
// $aaa = isset($param['id']) ? $param['id'] : 0;
|
|
|
$operate_team_names_ids = explode(",", $aaa);
|
|
@@ -294,11 +284,102 @@ class CostCompany extends BaseController
|
|
|
}
|
|
|
}
|
|
|
// halt( json_encode($fields));
|
|
|
- View::assign('field', $fields);
|
|
|
+ View::assign('field', $fields);
|
|
|
return view();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public function followProject()
|
|
|
+ {
|
|
|
+
|
|
|
+ if (request()->isAjax()) {
|
|
|
+ $param = get_params();
|
|
|
+ if (isset($param["project_start_time"])) {
|
|
|
+ $param["project_start_time"] = $param["project_start_time"] ? strtotime($param["project_start_time"]) : 0;
|
|
|
+ }
|
|
|
+ if (isset($param["project_end_time"])) {
|
|
|
+ $param["project_end_time"] = $param["project_end_time"] ? strtotime($param["project_end_time"]) : 0;
|
|
|
+ }
|
|
|
+ $where3 = array();
|
|
|
+ if (!empty($param['project_status'])) {
|
|
|
+ $where3[] = ['project_status', '=', $param['project_status']];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($param['province'])) {
|
|
|
+ $where3[] = ['province', '=', $param['province']];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($param['city'])) {
|
|
|
+ $where3[] = ['city', '=', $param['city']];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($param['area'])) {
|
|
|
+ $where3[] = ['area', '=', $param['area']];
|
|
|
+ }
|
|
|
+ if (!empty($param['project_end_time'])) {
|
|
|
+ $where3[] = ['project_end_time', '<', $param['project_end_time']];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($param['project_start_time'])) {
|
|
|
+ $where3[] = ['project_start_time', '>', $param['project_start_time']];
|
|
|
+ }
|
|
|
+ if (!empty($param['entrust_unit_name'])) {
|
|
|
+ $where3[] = ['entrust_unit_name', 'like', '%' . $param['entrust_unit_name']. '%'];
|
|
|
+ }
|
|
|
+ if (!empty($param['sent_review_unit_name'])) {
|
|
|
+ $where3[] = ['sent_review_unit_name', 'like', '%' . $param['sent_review_unit_name']. '%'];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($param['keyword'])) {
|
|
|
+ $keyword = $param['keyword'];
|
|
|
+ $where3[] = ['project_num|project_name|entrust_maker_name', 'like', '%' . $keyword . '%'];
|
|
|
+ }
|
|
|
+ $where = [
|
|
|
+ ["cp_cost_project.delete_time", "=", 0],
|
|
|
+ ["project_status", ">", 3],
|
|
|
+ ];
|
|
|
+ if($this->isPay==0){
|
|
|
+ $where[] = ["project_status","<",8];
|
|
|
+ }
|
|
|
+ $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
|
|
|
+ $order = empty($param['order']) ? 'project_receive_time desc,id desc' : $param['order'];
|
|
|
+ $openid = get_login_admin('openid');
|
|
|
+ $follow_project_id = Db::name('follow_project')->where('openid',$openid)->find();
|
|
|
+ $list = $this->model
|
|
|
+ ->where('id','in',$follow_project_id)
|
|
|
+ ->where($where)->where($where3)
|
|
|
+ ->order($order)->paginate($rows, false, ['query' => $param])
|
|
|
+ ->each(function ($item) {
|
|
|
+ $item->creator = Db::name("admin")->where("id",$item->creator)->value("nickname");
|
|
|
+
|
|
|
+ $entrust_head_id = Db::name('department')->where(['id' => $item->entrust_unit])->value('leader_id');
|
|
|
+ if (!($item->entrust_head_phone)) {
|
|
|
+ $item->entrust_head_phone = Db::name('admin')->where("id", $entrust_head_id)->value("mobile");
|
|
|
+ }
|
|
|
+ if ( ($item->province&&$item->city&&$item->area)) {
|
|
|
+ $item->project_region = $item->province . '-' . $item->city . '-' . $item->area;
|
|
|
+ }
|
|
|
+ $item->self_id = $this->see_auth;
|
|
|
+ //作业人
|
|
|
+ $item->operate_name = Db::name("admin")->where("id", $item->operate_head)->value("nickname");
|
|
|
+ $operate_team_names = null;
|
|
|
+
|
|
|
+ $aaa = isset($item->operate_team) ? $item->operate_team : "0";
|
|
|
+
|
|
|
+ $operate_team_names_ids = explode(",", $aaa);
|
|
|
+ for ($i = 0; $i < count($operate_team_names_ids); $i++) {
|
|
|
+ $name = Db::name("admin")->where("id", $operate_team_names_ids[$i])->value("nickname");
|
|
|
+ if (!($i == 0)) {
|
|
|
+ $name = "," . $name;
|
|
|
+ }
|
|
|
+ $operate_team_names = $operate_team_names . $name;
|
|
|
+ }
|
|
|
+ $item->operate_team_names = $operate_team_names;
|
|
|
+ });
|
|
|
+
|
|
|
+ return table_assign(0, '', $list);
|
|
|
+ }
|
|
|
+ }
|
|
|
/**
|
|
|
* 首页临期数据列表
|
|
|
*/
|
|
@@ -467,7 +548,7 @@ class CostCompany extends BaseController
|
|
|
|
|
|
$param = get_params();
|
|
|
$param["type"] = isset($param["type"]) ? $param["type"] : 0;
|
|
|
-
|
|
|
+
|
|
|
if (request()->isAjax()) {
|
|
|
// 检验完整性
|
|
|
// try {
|
|
@@ -488,47 +569,47 @@ class CostCompany extends BaseController
|
|
|
$project_status = $this->model->where("id", $id)->value("project_status");
|
|
|
//判断当前状态是否是可编辑状态
|
|
|
|
|
|
-
|
|
|
- $detail = $this->model->getCostProjectById($id);
|
|
|
- $file_array = Db::name('ProjectFile')
|
|
|
- ->field('mf.id,mf.topic_id,mf.admin_id,f.name,f.filesize,f.filepath,f.fileext,f.create_time,f.admin_id,a.nickname as admin_name')
|
|
|
- ->alias('mf')
|
|
|
- ->join('File f', 'mf.file_id = f.id', 'LEFT')
|
|
|
- ->join('Admin a', 'mf.admin_id = a.id', 'LEFT')
|
|
|
- ->order('mf.create_time desc')
|
|
|
- ->where(array('mf.topic_id' => $id, 'mf.module' => 'project'))
|
|
|
- ->select()->toArray();
|
|
|
- $comment_type = isset($param["comment_type"])?$param['comment_type'] : 0;
|
|
|
- $comment = Db::name("project_comment")->where("type",$comment_type)
|
|
|
- ->where("project_id", $id)->order('create_time', 'asc')->select();
|
|
|
- $project_log = self::project_log($id);
|
|
|
- // halt($project_log);
|
|
|
- View::assign('project_log', $project_log);
|
|
|
-
|
|
|
- $field = $this->Field->get_field_rules_new($this->uid);
|
|
|
- $field_edit = $this->Field->get_field_rules_edit_new($this->uid);
|
|
|
- //剩余时间
|
|
|
- $c = $detail['project_end_time']-time();
|
|
|
- if($c>0){
|
|
|
- $advent_time = floor($c / 86400)."天";
|
|
|
- }else{
|
|
|
- $c = -$c;
|
|
|
- $advent_time = floor($c / 86400)."天";
|
|
|
- }
|
|
|
|
|
|
- if (!empty($detail)) {
|
|
|
- View::assign('advent_time', $advent_time);
|
|
|
- View::assign('detail', $detail);
|
|
|
- View::assign('file_array', $file_array);
|
|
|
- View::assign('comment', $comment);
|
|
|
- View::assign('field', $field);
|
|
|
- View::assign('field_edit', $field_edit);
|
|
|
- View::assign('project_five', self::getProjectFive());
|
|
|
- return view();
|
|
|
- } else {
|
|
|
- throw new \think\exception\HttpException(404, '找不到页面');
|
|
|
- }
|
|
|
-
|
|
|
+ $detail = $this->model->getCostProjectById($id);
|
|
|
+ $file_array = Db::name('ProjectFile')
|
|
|
+ ->field('mf.id,mf.topic_id,mf.admin_id,f.name,f.filesize,f.filepath,f.fileext,f.create_time,f.admin_id,a.nickname as admin_name')
|
|
|
+ ->alias('mf')
|
|
|
+ ->join('File f', 'mf.file_id = f.id', 'LEFT')
|
|
|
+ ->join('Admin a', 'mf.admin_id = a.id', 'LEFT')
|
|
|
+ ->order('mf.create_time desc')
|
|
|
+ ->where(array('mf.topic_id' => $id, 'mf.module' => 'project'))
|
|
|
+ ->select()->toArray();
|
|
|
+ $comment_type = isset($param["comment_type"])?$param['comment_type'] : 0;
|
|
|
+ $comment = Db::name("project_comment")->where("type",$comment_type)
|
|
|
+ ->where("project_id", $id)->order('create_time', 'asc')->select();
|
|
|
+ $project_log = self::project_log($id);
|
|
|
+ // halt($project_log);
|
|
|
+ View::assign('project_log', $project_log);
|
|
|
+
|
|
|
+ $field = $this->Field->get_field_rules_new($this->uid);
|
|
|
+ $field_edit = $this->Field->get_field_rules_edit_new($this->uid);
|
|
|
+ //剩余时间
|
|
|
+ $c = $detail['project_end_time']-time();
|
|
|
+ if($c>0){
|
|
|
+ $advent_time = floor($c / 86400)."天";
|
|
|
+ }else{
|
|
|
+ $c = -$c;
|
|
|
+ $advent_time = floor($c / 86400)."天";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($detail)) {
|
|
|
+ View::assign('advent_time', $advent_time);
|
|
|
+ View::assign('detail', $detail);
|
|
|
+ View::assign('file_array', $file_array);
|
|
|
+ View::assign('comment', $comment);
|
|
|
+ View::assign('field', $field);
|
|
|
+ View::assign('field_edit', $field_edit);
|
|
|
+ View::assign('project_five', self::getProjectFive());
|
|
|
+ return view();
|
|
|
+ } else {
|
|
|
+ throw new \think\exception\HttpException(404, '找不到页面');
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
$field_name = array_keys($this->field_name);
|
|
|
$ab= $this->model->where("id",$param["id"])->field($field_name)->find()->toArray();
|
|
@@ -544,7 +625,7 @@ class CostCompany extends BaseController
|
|
|
$ab[$key] = !empty($ab[$key])?$ab[$key]:"无";
|
|
|
|
|
|
$value = !empty($value)?$value:"无";
|
|
|
-
|
|
|
+
|
|
|
|
|
|
$content = $content . $this->field_name[$key]."从".$ab[$key]."修改为".$value.",";
|
|
|
|
|
@@ -583,7 +664,7 @@ class CostCompany extends BaseController
|
|
|
->select()->toArray();
|
|
|
$comment_type = isset($param["comment_type"])?$param['comment_type'] : 0;
|
|
|
$comment = Db::name("project_comment")->where("type",$comment_type)
|
|
|
- ->where("project_id", $id)->order('create_time', 'asc')->select();
|
|
|
+ ->where("project_id", $id)->order('create_time', 'asc')->select();
|
|
|
$project_log = self::project_log($id);
|
|
|
// halt($file_array);
|
|
|
View::assign('project_log', $project_log);
|
|
@@ -748,7 +829,7 @@ class CostCompany extends BaseController
|
|
|
|
|
|
// dump($field);
|
|
|
if (!empty($detail)) {
|
|
|
-
|
|
|
+
|
|
|
View::assign('advent_time', $advent_time);
|
|
|
View::assign('detail', $detail);
|
|
|
View::assign('project_id', $id);
|
|
@@ -835,9 +916,9 @@ class CostCompany extends BaseController
|
|
|
}
|
|
|
// dump($where);
|
|
|
$project_log = Db::name('ProjectLog')->where($where)
|
|
|
- ->where('project_id', $project_id)
|
|
|
- ->order('create_time', 'desc')
|
|
|
- ->select()->toArray();
|
|
|
+ ->where('project_id', $project_id)
|
|
|
+ ->order('create_time', 'desc')
|
|
|
+ ->select()->toArray();
|
|
|
|
|
|
// foreach ($project_log as $key => $value) {
|
|
|
// $project_log[$key]['create_time'] = date("Y-m-d H:i:s", $value['create_time']);
|
|
@@ -1344,7 +1425,7 @@ class CostCompany extends BaseController
|
|
|
"entrust_unit_name" => Db::name("department")->where("id",$selfData["unit_name"])->value("title")
|
|
|
];
|
|
|
try{
|
|
|
- $this->model->update($data);
|
|
|
+ $this->model->update($data);
|
|
|
} catch (\Exception $e) {
|
|
|
return to_assign(1, '操作失败,原因:' . $e->getMessage());
|
|
|
}
|
|
@@ -1360,34 +1441,34 @@ class CostCompany extends BaseController
|
|
|
$param = $handle['param'];
|
|
|
if (request()->isAjax()) {
|
|
|
|
|
|
- $a = $this->model->where("id", $param["project_id"])->find();
|
|
|
+ $a = $this->model->where("id", $param["project_id"])->find();
|
|
|
|
|
|
- if($a["sent_review_head"]){
|
|
|
- return to_assign(1, '送审单位负责人已经存在,请移除后再添加');
|
|
|
- }
|
|
|
+ if($a["sent_review_head"]){
|
|
|
+ return to_assign(1, '送审单位负责人已经存在,请移除后再添加');
|
|
|
+ }
|
|
|
|
|
|
- $user = Db::name("admin")->where("id",$param["id"])->find();
|
|
|
- $department = Db::name("department")->where("id",$user["unit_name"])->find();
|
|
|
- $this->model->where("id",
|
|
|
- $param["project_id"])
|
|
|
- ->update(
|
|
|
- [
|
|
|
- "sent_review_head" => $param["id"],
|
|
|
- "sent_review_head_name"=>$user['nickname'],
|
|
|
- "sent_review_phone"=> $user["mobile"],
|
|
|
- "sent_review_unit_name"=>$department["title"],
|
|
|
- "sent_review_unit"=> $department["id"]
|
|
|
- ]
|
|
|
+ $user = Db::name("admin")->where("id",$param["id"])->find();
|
|
|
+ $department = Db::name("department")->where("id",$user["unit_name"])->find();
|
|
|
+ $this->model->where("id",
|
|
|
+ $param["project_id"])
|
|
|
+ ->update(
|
|
|
+ [
|
|
|
+ "sent_review_head" => $param["id"],
|
|
|
+ "sent_review_head_name"=>$user['nickname'],
|
|
|
+ "sent_review_phone"=> $user["mobile"],
|
|
|
+ "sent_review_unit_name"=>$department["title"],
|
|
|
+ "sent_review_unit"=> $department["id"]
|
|
|
+ ]
|
|
|
|
|
|
- );
|
|
|
+ );
|
|
|
|
|
|
- $content = get_login_admin("nickname") . "新增了送审单位负责人". $user['nickname'];
|
|
|
+ $content = get_login_admin("nickname") . "新增了送审单位负责人". $user['nickname'];
|
|
|
|
|
|
- add_project_log("新增项目成员",$param["project_id"],$content,5);
|
|
|
+ add_project_log("新增项目成员",$param["project_id"],$content,5);
|
|
|
|
|
|
- add_user($param["id"],$param["project_id"]);
|
|
|
+ add_user($param["id"],$param["project_id"]);
|
|
|
|
|
|
- return to_assign(0, '操作成功');
|
|
|
+ return to_assign(0, '操作成功');
|
|
|
|
|
|
} else {
|
|
|
$param = get_params();
|
|
@@ -1653,21 +1734,16 @@ class CostCompany extends BaseController
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return $rules_id;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function ceshi($id)
|
|
|
{
|
|
|
View::assign('detailId', $id);
|
|
|
return view();
|
|
|
}
|
|
|
|
|
|
- public function concern_datalist()
|
|
|
- {
|
|
|
- return view();
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|