|
@@ -1117,6 +1117,244 @@ class Temporary extends BaseController
|
|
|
{
|
|
|
return view();
|
|
|
}
|
|
|
+
|
|
|
+ public function kan_list()
|
|
|
+ {
|
|
|
+ //根据所登录的账号,查询跟本身有关的项目
|
|
|
+ //2是公司,0是财政局,1是业主
|
|
|
+ $param = get_params();
|
|
|
+
|
|
|
+ $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
|
|
|
+ $order = empty($param['order']) ? 'id desc' : $param['order'];
|
|
|
+ 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 = [];//搜索条件
|
|
|
+ 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['keyword'])) {
|
|
|
+ $keyword = $param['keyword'];
|
|
|
+ $where3[] = ['project_num|project_name|review_unit', 'like', '%' . $keyword . '%'];
|
|
|
+ }
|
|
|
+ if (!empty($param['review_unit_name'])) {
|
|
|
+ $where3[] = ['review_unit_name', 'like', '%' . $param['review_unit_name'] . '%'];
|
|
|
+ }
|
|
|
+ if (!empty($param['sent_review_unit_name'])) {
|
|
|
+ $where3[] = ['sent_review_unit_name', 'like', '%' . $param['sent_review_unit_name'] . '%'];
|
|
|
+ }
|
|
|
+ if (!empty($param['entrust_unit_name'])) {
|
|
|
+ $where3[] = ['entrust_unit_name', 'like', '%' . $param['entrust_unit_name'] . '%'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $unit_type = Db::name("department")->where("id", get_login_admin("unit_name"))->value("type");
|
|
|
+ $inarr = array();
|
|
|
+
|
|
|
+ if ($unit_type == 0) {
|
|
|
+ $where[] = ["delete_time", "=", 0];
|
|
|
+ $where[] = ["project_status", ">", 0];
|
|
|
+ $where[] = ["entrust_unit", "=", get_login_admin('unit_name')];
|
|
|
+ $where2[] = ["delete_time", "=", 0];
|
|
|
+ $where2[] = ["project_status", ">", 0];
|
|
|
+ $where2[] = ["entrust_unit", "=", get_login_admin('unit_name')];
|
|
|
+ //项目可见的权限
|
|
|
+ $field = $this->Field->get_field_rules_new($this->uid);
|
|
|
+ //1全部-可查看可编辑,2全部-可查看,0与我有关
|
|
|
+ $see_auth = isset($field["see_auth"]) ? $field["see_auth"] : 3;
|
|
|
+ if ($see_auth == 3) {
|
|
|
+ $where[] = ["entrust_maker", "=", $this->uid];
|
|
|
+
|
|
|
+ $where2[] = ["entrust_approver", "=", $this->uid];
|
|
|
+ $where2[] = ["project_status", ">", 1];
|
|
|
+
|
|
|
+ } elseif ($see_auth == 0) {
|
|
|
+ $where[] = ["entrust_maker", "=", $this->uid];
|
|
|
+ $where[] = ["project_status", ">", 0];
|
|
|
+ $where2[] = ["entrust_approver", "=", $this->uid];
|
|
|
+ $where2[] = ["project_status", ">", 1];
|
|
|
+ }
|
|
|
+ $list = $this->model->where($where3)
|
|
|
+ ->where(function ($query) use ($where,$where2) {
|
|
|
+ // 第一组条件(entrust_maker)
|
|
|
+ $query->where(function ($q1) use ($where) {
|
|
|
+ $q1->where($where);
|
|
|
+ });
|
|
|
+ // 使用 OR 连接第二组条件(entrust_approver)
|
|
|
+ $query->whereOr(function ($q2) use ($where2) {
|
|
|
+ $q2->where($where2);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ ->order("create_time desc")->paginate(9999, false, ['query' => $param])
|
|
|
+ ->each(function ($item) {
|
|
|
+ $red = Db::name("new_msg")->where([["project_id", "=", $item->id], ["uid", "=", $this->uid]])->find();
|
|
|
+ if ($red) {
|
|
|
+ if ($red["detail"] || $red["comment"] || $red["report"] || $red["user"] || $red["contact"]) {
|
|
|
+ $item->red = 1;
|
|
|
+ } else {
|
|
|
+
|
|
|
+ $item->red = 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $item->red = 0;
|
|
|
+ }
|
|
|
+ if (($item->province && $item->city && $item->area)) {
|
|
|
+ $item->project_region = $item->province . '-' . $item->city . '-' . $item->area;
|
|
|
+ }
|
|
|
+
|
|
|
+ })->toArray();
|
|
|
+ } elseif ($unit_type == 2) {
|
|
|
+ $order = empty($param['order']) ? 'project_receive_time desc,id desc' : $param['order'];
|
|
|
+
|
|
|
+ $where = [
|
|
|
+ ["delete_time", "=", 0],
|
|
|
+ ["project_status", ">", 3],
|
|
|
+ ["review_unit", "=", get_login_admin("unit_name")]
|
|
|
+ ];
|
|
|
+ $review_unit = $this->model->where($where)->where($where3)->field('id,review_head,operate_head,operate_team')->select()->toArray();
|
|
|
+ for ($i = 0; $i < count($review_unit); $i++) {
|
|
|
+ $a = $review_unit[$i];
|
|
|
+ $ids = $a["review_head"] . ',' . $a["operate_head"] . ',' . $a["operate_team"];
|
|
|
+ $ids = explode(",", $ids);
|
|
|
+ $c = in_array($this->uid, $ids);
|
|
|
+ if ($c) {
|
|
|
+ $inarr[] = $a["id"];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $field = $this->Field->get_field_rules_New($this->uid);
|
|
|
+ $see_auth = isset($field["see_auth"]) ? $field["see_auth"] : 3;
|
|
|
+ $this->see_auth = $see_auth;
|
|
|
+ if ($see_auth == 3) {
|
|
|
+
|
|
|
+ $list = $this->model
|
|
|
+ ->where($where)->where($where3)->whereIn("id", $inarr)
|
|
|
+ ->order($order)->paginate(9999, false, ['query' => $param])
|
|
|
+ ->each(function ($item) {
|
|
|
+
|
|
|
+ $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"]) {
|
|
|
+ $item->red = 1;
|
|
|
+ } else {
|
|
|
+ $item->red = 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $item->red = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ })->toArray();
|
|
|
+
|
|
|
+ } elseif ($see_auth == 0) {
|
|
|
+ $list = $this->model
|
|
|
+ ->where($where)->where($where3)->whereIn("id", $inarr)
|
|
|
+ ->order($order)->paginate(9999, false, ['query' => $param])
|
|
|
+ ->each(function ($item) {
|
|
|
+
|
|
|
+ $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"]) {
|
|
|
+ $item->red = 1;
|
|
|
+ } else {
|
|
|
+ $item->red = 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $item->red = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ })->toArray();
|
|
|
+ } else {
|
|
|
+ $list = $this->model
|
|
|
+ ->where($where)
|
|
|
+ ->order($order)->where($where3)->paginate(9999, false, ['query' => $param])
|
|
|
+ ->each(function ($item) {
|
|
|
+
|
|
|
+ $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"]) {
|
|
|
+ $item->red = 1;
|
|
|
+ } else {
|
|
|
+ $item->red = 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $item->red = 0;
|
|
|
+ }
|
|
|
+ })->toArray();
|
|
|
+ }
|
|
|
+
|
|
|
+ } elseif ($unit_type == 1) {
|
|
|
+ $field = $this->Field->get_field_rules_New($this->uid);
|
|
|
+ $see_auth = isset($field["see_auth"]) ? $field["see_auth"] : 3;
|
|
|
+ if ($see_auth == 0 || $see_auth == 3) {
|
|
|
+ $where = [
|
|
|
+ ["delete_time", "=", 0],
|
|
|
+ ["sent_review_unit", "=", get_login_admin("unit_name")],
|
|
|
+ ["sent_review_head", "=", $this->uid]
|
|
|
+ ];
|
|
|
+ } else {
|
|
|
+ $where = [
|
|
|
+ ["delete_time", "=", 0],
|
|
|
+ ["sent_review_unit", "=", get_login_admin("unit_name")]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ $list = $this->model
|
|
|
+ ->where($where)
|
|
|
+ ->order($order)->where($where3)->paginate(9999, false, ['query' => $param])
|
|
|
+ ->each(function ($item) {
|
|
|
+
|
|
|
+ $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"]) {
|
|
|
+ $item->red = 1;
|
|
|
+ } else {
|
|
|
+ $item->red = 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $item->red = 0;
|
|
|
+ }
|
|
|
+ })->toArray();
|
|
|
+ } else {
|
|
|
+ $list["data"] = [];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $data = $list["data"];
|
|
|
+ $real_list = array_values(array_column($data, NULL, 'id'));
|
|
|
+
|
|
|
+ $red = $this->Auditmodel->where("approver", $this->uid)->where("audit_status", 1)->count();
|
|
|
+ $red_id = Db::name("new_msg")->where("uid", "=", $this->uid)->select();
|
|
|
+ $red_kan = 0;
|
|
|
+ foreach ($red_id as $item => $value) {
|
|
|
+ if ($value["detail"] || $value["comment"] || $value["report"] || $value["user"] || $value["contact"]) {
|
|
|
+ $red_kan = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ View::assign("red_kan", $red_kan);
|
|
|
+ View::assign("detail", $real_list);
|
|
|
+ View::assign("red", $red);
|
|
|
+ View::assign("unit_type", $unit_type);
|
|
|
+ return view();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|