Crazy 7 months ago
parent
commit
f271fa8f4f

+ 5 - 6
app/admin/controller/project/Audit.php

@@ -999,7 +999,7 @@ class Audit extends BaseController
             } catch (\Exception $e) {
             } catch (\Exception $e) {
                 return to_assign(1, '操作失败,原因:' . $e->getMessage());
                 return to_assign(1, '操作失败,原因:' . $e->getMessage());
             }
             }
-
+            //找有没有二审
             $where = [
             $where = [
                 ["project_id", "=", $param["project_id"]],
                 ["project_id", "=", $param["project_id"]],
                 ["else_id", "=", $param["else_id"]],
                 ["else_id", "=", $param["else_id"]],
@@ -1007,15 +1007,15 @@ class Audit extends BaseController
                 ["audit_type", "=", 5]
                 ["audit_type", "=", 5]
             ];
             ];
             $next = $this->Auditmodel->where($where)->count();
             $next = $this->Auditmodel->where($where)->count();
-            if ($next == 0) {
+            if ($next == 0) {//没有二审,给财评新增报告审核
                 $where = [
                 $where = [
                     ["project_id", "=", $param["project_id"]],
                     ["project_id", "=", $param["project_id"]],
-                    ["else_id", "=", $param["else_id"]],
+                    ["else_id", "=", $param["else_id"]],//项目报告id
                     ["audit_type", "=", 4]
                     ["audit_type", "=", 4]
                 ];
                 ];
                 $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
                 $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
                 $auditData = $this->Auditmodel->where($where)->find()->toArray();
                 $auditData = $this->Auditmodel->where($where)->find()->toArray();
-                $auditData["audit_name"] = "报告审核";
+                $auditData["audit_name"] = "财评报告审核";
                 $auditData["audit_status"] = 1;
                 $auditData["audit_status"] = 1;
                 $auditData["audit_type"] = 2;
                 $auditData["audit_type"] = 2;
                 $auditData["approver"] = $detail["entrust_maker"];
                 $auditData["approver"] = $detail["entrust_maker"];
@@ -1032,7 +1032,6 @@ class Audit extends BaseController
                     return to_assign(1, '操作失败,原因:' . $e->getMessage());
                     return to_assign(1, '操作失败,原因:' . $e->getMessage());
                 }
                 }
 
 
-
                 //内部审核通过了,通知公司的发起人,通知财政局的审批人
                 //内部审核通过了,通知公司的发起人,通知财政局的审批人
                 $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
                 $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
                 if (empty($handle['company'])) {
                 if (empty($handle['company'])) {
@@ -1048,7 +1047,7 @@ class Audit extends BaseController
                 add_project_log("新增项目报告", $param["project_id"], $else_name, 4);
                 add_project_log("新增项目报告", $param["project_id"], $else_name, 4);
                 Db::name("cost_project")->where("id", $param["project_id"])->update(["report_time" => time()]);
                 Db::name("cost_project")->where("id", $param["project_id"])->update(["report_time" => time()]);
 
 
-            } else {
+            } else {//公司内部有第二审批
                 $where = [
                 $where = [
                     ["project_id", "=", $param["project_id"]],
                     ["project_id", "=", $param["project_id"]],
                     ["else_id", "=", $param["else_id"]],
                     ["else_id", "=", $param["else_id"]],

+ 68 - 29
app/admin/controller/project/Report.php

@@ -126,7 +126,7 @@ class Report extends BaseController
 
 
 
 
     /**
     /**
-     * 添加-公司
+     * 添加报告-公司
      */
      */
     public function add_company()
     public function add_company()
     {
     {
@@ -267,14 +267,16 @@ class Report extends BaseController
 
 
             return to_assign(0, '操作成功');
             return to_assign(0, '操作成功');
         } else {
         } else {
+            //dump($param);=>project_id
             $project_id = isset($param['project_id']) ? $param['project_id'] : 0;
             $project_id = isset($param['project_id']) ? $param['project_id'] : 0;
-
+                                                                                            //委托单位的id(财政局),评审单位id(公司),操作负责人id(作业部长),操作成员id(工人)
             $ids = Db::name('CostProject')->where("id", $project_id)->field("entrust_maker,review_head,operate_head,operate_team")->find();
             $ids = Db::name('CostProject')->where("id", $project_id)->field("entrust_maker,review_head,operate_head,operate_team")->find();
-            // halt($ids);
+             //halt($ids);
             $idarr = $ids["operate_team"] . ',' . $ids["operate_head"] . ',' . $ids["review_head"];
             $idarr = $ids["operate_team"] . ',' . $ids["operate_head"] . ',' . $ids["review_head"];
             $idarr = explode(",", $idarr);
             $idarr = explode(",", $idarr);
 
 
             $people = Db::name("admin")->whereIn('id', $idarr)->field('id,nickname')->select();
             $people = Db::name("admin")->whereIn('id', $idarr)->field('id,nickname')->select();
+            //dump($people);
             //富文本类型
             //富文本类型
             View::assign('editor', get_system_config('other', 'editor'));
             View::assign('editor', get_system_config('other', 'editor'));
             //关联项目id
             //关联项目id
@@ -441,48 +443,86 @@ class Report extends BaseController
         $param = get_params();
         $param = get_params();
         $handle = $this->Pushmessage->handleParam($param);
         $handle = $this->Pushmessage->handleParam($param);
         $param = $handle['param'];
         $param = $handle['param'];
+        //return json($param);
+        //dump($param);
         
         
         $type = isset($param['type']) ? $param['type'] : 0;
         $type = isset($param['type']) ? $param['type'] : 0;
-        dump($type);
+        //dump($type);
         if (!isset($param["type"])) {
         if (!isset($param["type"])) {
             $id = isset($param['id']) ? $param['id'] : 0;
             $id = isset($param['id']) ? $param['id'] : 0;
-            $this->model->where("id", $id)->update(["status" => 1]);//已通过
-            $detail = $this->model->where("id", $id)->find();
-            $num = $this->model->where([
-                ["project_id", "=", $detail["project_id"],
-                    ["type", ">", $detail["type"]]],
-                ["status", ">", 1],//已通过
-                ["status", "<>", 2],//不等于
-                ["status", "<", 4]//小于删除通过
-            ])->count();//找到删除待审核的
+            $this->model->where("id", $id)->update(["status" => 1]);//财评已通过
+            $detail = $this->model->where("id", $id)->find();//在Project_report里
+            //更新报告时间
+//            $num = $this->model->where([
+//                ["project_id", "=", $detail["project_id"],
+//                    ["type", ">", $detail["type"]]],
+//                ["status", ">", 1],//已通过
+//                ["status", "<>", 2],//不等于
+//                ["status", "<", 4]//小于删除通过
+//            ])->count();//找到status=3删除待审核的
             //type,0初审,1对数,2审定
             //type,0初审,1对数,2审定
-            $report_status = $detail["type"] + 1;
-            if ($num == 0) {
-                $data = ['report_time' => time(), "report_status" => $report_status];
-            } else {
-                $data = ['report_time' => time()];
-            }
-
-            try {
-                Db::name("cost_project")->where("id", $detail["project_id"])->update($data);
-            } catch (DbException $e) {
-                return to_assign(1, '操作失败,原因:' . $e->getMessage());
-            }
+            //$report_status = $detail["type"] + 1;//更新到对数
+//            if ($num == 0) {
+//                $data = ['report_time' => time(), "report_status" => $report_status];
+//            } else {
+//                $data = ['report_time' => time()];
+//            }
+
+//            try {
+//                Db::name("cost_project")->where("id", $detail["project_id"])->update($data);//
+//            } catch (DbException $e) {
+//                return to_assign(1, '操作失败,原因:' . $e->getMessage());
+//            }
 
 
             try {
             try {
-                Db::name("project_audit")->where([["else_id", "=", $id]])->update(["audit_status" => 2, "audit_time" => time()]);
+                Db::name("project_audit")->where([["else_id", "=", $id]])->update(["audit_status" => 2, "audit_time" => time()]);//更新通过
             } catch (DbException $e) {
             } catch (DbException $e) {
                 return to_assign(1, '操作失败,原因:' . $e->getMessage());
                 return to_assign(1, '操作失败,原因:' . $e->getMessage());
             }
             }
+            //给业主新增报告审核
+                $where = [
+                    ["project_id", "=", $param["project_id"]],
+                    ["else_id", "=", $param["else_id"]],//项目报告id
+                    ["audit_type", "=", 4]
+                ];
+                $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("sent_review_head,sent_review_head_name")->find();
+                $auditData = $this->Auditmodel->where($where)->find()->toArray();
+                $auditData["audit_name"] = "业主报告审核";
+                $auditData["audit_status"] = 1;
+                $auditData["audit_type"] = 2;
+                $auditData["approver"] = $detail["sent_review_head"];
+                $auditData["approver_name"] = $detail["sent_review_head_name"];
+                $auditData["create_time"] = time();
+                $auditData["audit_time"] = null;
+                $auditData["remark"] = null;
+                $auditData["audit_remark"] = null;
+                unset($auditData["id"]);
+                try {
+                    Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 1]);
+                    $this->Auditmodel->save($auditData);
+                } catch (\Exception $e) {
+                    return to_assign(1, '操作失败,原因:' . $e->getMessage());
+                }
 
 
+            //发给公司
             $people = $this->model->where('id', $id)->value("maker_id");
             $people = $this->model->where('id', $id)->value("maker_id");
+            //发送信息给业主审核
+            $proprietor =Db::name("costProject")->where("id",$detail["project_id"])->value("sent_review_head");
+
             if (empty($handle['company'])) {
             if (empty($handle['company'])) {
                 $handle['company'] = (array)$people;
                 $handle['company'] = (array)$people;
             } else {
             } else {
                 $handle['company'] = array_merge($handle['company'], (array)$people);
                 $handle['company'] = array_merge($handle['company'], (array)$people);
             }
             }
+            if (empty($handle['proprietor'])) {
+                $handle['proprietor'] = (array)$proprietor;
+            } else {
+                $handle['proprietor'] = array_merge($handle['proprietor'], (array)$proprietor);
+            }
           
           
-            $this->Pushmessage->pushMessage($detail["project_id"], $handle['financial'], $handle['company']);
+            $this->Pushmessage->pushMessage($detail["project_id"], $handle['financial'], $handle['company'], $handle['proprietor']);
+            add_project_log('审批通过', $param['project_id'], "财政局报告审批通过");
+
 
 
 
 
         } else {
         } else {
@@ -526,7 +566,6 @@ class Report extends BaseController
             add_project_log('审批通过', $param['project_id'], "报告审批通过");
             add_project_log('审批通过', $param['project_id'], "报告审批通过");
         }
         }
 
 
-
         return to_assign(0, "操作成功");
         return to_assign(0, "操作成功");
     }
     }
 
 
@@ -542,7 +581,7 @@ class Report extends BaseController
         $type = isset($param['type']) ? $param['type'] : 0;
         $type = isset($param['type']) ? $param['type'] : 0;
         if (!isset($param["type"])) {
         if (!isset($param["type"])) {
             $id = isset($param['id']) ? $param['id'] : 0;
             $id = isset($param['id']) ? $param['id'] : 0;
-            $this->model->where("id", $id)->update(["status" => 1]);
+            $this->model->where("id", $id)->update(["status" => 8]);
             $detail = $this->model->where("id", $id)->find();
             $detail = $this->model->where("id", $id)->find();
             $num = $this->model->where([
             $num = $this->model->where([
                 ["project_id", "=", $detail["project_id"],
                 ["project_id", "=", $detail["project_id"],

+ 11 - 3
app/admin/view/project/cost/edit_report.html

@@ -74,15 +74,23 @@
                         if (d.status == 0) {
                         if (d.status == 0) {
                             abc = "<span>未审核(新建)</span>";
                             abc = "<span>未审核(新建)</span>";
                         } else if (d.status == 1) {
                         } else if (d.status == 1) {
-                            abc = "<span>已通过(新建)</span>";
+                            abc = "<span>财政局已通过,待业主审核(新建)</span>";
                         } else if (d.status == 2) {
                         } else if (d.status == 2) {
-                            abc = "<span>已拒绝(新建)</span>";
+                            abc = "<span>财政局已拒绝(新建)</span>";
                         } else if (d.status == 3) {
                         } else if (d.status == 3) {
                             abc = "<span>未审核(删除)</span>";
                             abc = "<span>未审核(删除)</span>";
                         } else if (d.status == 4) {
                         } else if (d.status == 4) {
-                            abc = "<span>已通过(删除)</span>";
+                            abc = "<span>财政局已通过,待业主审核(删除)</span>";
                         } else if (d.status == 5) {
                         } else if (d.status == 5) {
                             abc = "<span>已拒绝(删除)</span>";
                             abc = "<span>已拒绝(删除)</span>";
+                        }else if (d.status ==8){
+                            abc = "<span>业主已通过(新建)</span>";
+                        }else if (d.status ==9){
+                            abc = "<span>业主拒绝(新建)</span>";
+                        }else if (d.status == 10) {
+                            abc = "<span>业主已通过(删除)</span>";
+                        } else if (d.status == 11) {
+                            abc = "<span>业主已拒绝(删除)</span>";
                         }
                         }
                         return abc;
                         return abc;
                     }
                     }

+ 10 - 2
app/admin/view/project/cost_company/edit_report.html

@@ -71,19 +71,27 @@
                         if(d.status==0){
                         if(d.status==0){
                             abc = "<span>未审核(新建)</span>";
                             abc = "<span>未审核(新建)</span>";
                         }else if(d.status==1){
                         }else if(d.status==1){
-                            abc = "<span>已通过(新建)</span>";
+                            abc = "<span>财政局已通过,待业主审核(新建)</span>";
                         }else if(d.status==2){
                         }else if(d.status==2){
                             abc = "<span>已拒绝(新建)</span>";
                             abc = "<span>已拒绝(新建)</span>";
                         }else if(d.status==3){
                         }else if(d.status==3){
                             abc = "<span>未审核(删除)</span>";
                             abc = "<span>未审核(删除)</span>";
                         }else if(d.status==4){
                         }else if(d.status==4){
-                            abc = "<span>已通过(删除)</span>";
+                            abc = "<span>财政局已通过,待业主审核(删除)</span>";
                         }else if(d.status==5){
                         }else if(d.status==5){
                             abc = "<span>已拒绝(删除)</span>";
                             abc = "<span>已拒绝(删除)</span>";
                         }else if(d.status==6){
                         }else if(d.status==6){
                             abc = "<span>未审核(内部)</span>";
                             abc = "<span>未审核(内部)</span>";
                         }else if(d.status==7){
                         }else if(d.status==7){
                             abc = "<span>已拒绝(内部)</span>";
                             abc = "<span>已拒绝(内部)</span>";
+                        }else if (d.status ==8){
+                            abc = "<span>业主已通过(新建)</span>";
+                        }else if (d.status ==9){
+                            abc = "<span>业主拒绝(新建)</span>";
+                        }else if (d.status == 10) {
+                            abc = "<span>业主已通过(删除)</span>";
+                        } else if (d.status == 11) {
+                            abc = "<span>业主已拒绝(删除)</span>";
                         }
                         }
                         return abc;
                         return abc;
                     }
                     }

+ 3 - 3
app/admin/view/project/cost_proprietor/edit_contact.html

@@ -28,7 +28,7 @@
                     data: res.data // 当前页数据
                     data: res.data // 当前页数据
                 };
                 };
             },
             },
-            url: "/admin/project.contact/conlist_company",
+            url: "/admin/project.contact/conlist_proprietor",
             where: {'project_id': project_id},
             where: {'project_id': project_id},
             page: true, //开启分页
             page: true, //开启分页
             limit: 20,
             limit: 20,
@@ -105,7 +105,7 @@
                         },2000)
                         },2000)
 
 
                     }
                     }
-                    parent.layui.tool.side('/admin/project.contact/add_proprietor?project_id=' + project_id,callback);  // 项目id
+                    parent.layui.tool.side('/admin/project.contact/add?project_id=' + project_id,callback);  // 项目id
                     break;
                     break;
             }
             }
         });
         });
@@ -114,7 +114,7 @@
             var data = obj.data; //获得当前行数据
             var data = obj.data; //获得当前行数据
             console.log(data.status);
             console.log(data.status);
             if (obj.event === 'detail') { //查看
             if (obj.event === 'detail') { //查看
-                let url = '/admin/project.contact/view_proprietor?id=' + data.id;// 项目id
+                let url = '/admin/project.contact/view?id=' + data.id;// 项目id
                 parent.layui.tool.side(url);
                 parent.layui.tool.side(url);
             }
             }
             if (obj.event === 'del') {
             if (obj.event === 'del') {

+ 1 - 1
app/admin/view/project/cost_proprietor/edit_main.html

@@ -458,7 +458,7 @@
 
 
         {if $project_five.project_user == 1}
         {if $project_five.project_user == 1}
         <div class="layui-tab-item">
         <div class="layui-tab-item">
-            {include file="/project/cost_proprietor/edit_user" /}
+            {include file="/project/cost_proprietor/project_user" /}
         </div>
         </div>
         {/if}
         {/if}
 
 

+ 11 - 3
app/admin/view/project/cost_proprietor/edit_report.html

@@ -74,15 +74,23 @@
                         if (d.status == 0) {
                         if (d.status == 0) {
                             abc = "<span>未审核(新建)</span>";
                             abc = "<span>未审核(新建)</span>";
                         } else if (d.status == 1) {
                         } else if (d.status == 1) {
-                            abc = "<span>已通过(新建)</span>";
+                            abc = "<span>财政局已通过,待业主审核(新建)</span>";
                         } else if (d.status == 2) {
                         } else if (d.status == 2) {
-                            abc = "<span>已拒绝(新建)</span>";
+                            abc = "<span>财政局已拒绝(新建)</span>";
                         } else if (d.status == 3) {
                         } else if (d.status == 3) {
                             abc = "<span>未审核(删除)</span>";
                             abc = "<span>未审核(删除)</span>";
                         } else if (d.status == 4) {
                         } else if (d.status == 4) {
-                            abc = "<span>已通过(删除)</span>";
+                            abc = "<span>财政局已通过,待业主审核(删除)</span>";
                         } else if (d.status == 5) {
                         } else if (d.status == 5) {
                             abc = "<span>已拒绝(删除)</span>";
                             abc = "<span>已拒绝(删除)</span>";
+                        }else if (d.status ==8){
+                            abc = "<span>业主已通过(新建)</span>";
+                        }else if (d.status ==9){
+                            abc = "<span>业主拒绝(新建)</span>";
+                        }else if (d.status == 10) {
+                            abc = "<span>业主已通过(删除)</span>";
+                        } else if (d.status == 11) {
+                            abc = "<span>业主已拒绝(删除)</span>";
                         }
                         }
                         return abc;
                         return abc;
                     }
                     }

+ 1 - 1
app/admin/view/project/cost_proprietor/project_user.html

@@ -4,7 +4,7 @@
 <script type="text/html" id="toolbaruser">
 <script type="text/html" id="toolbaruser">
     <div class="layui-btn-container">
     <div class="layui-btn-container">
         <button class="layui-btn layui-btn-sm" lay-event="add">+ 新增送审单位成员</button>
         <button class="layui-btn layui-btn-sm" lay-event="add">+ 新增送审单位成员</button>
-        <button class="layui-btn layui-btn-sm" lay-event="adda">+ 新增施工单位成员</button>
+<!--        <button class="layui-btn layui-btn-sm" lay-event="adda">+ 新增施工单位成员</button>-->
 
 
     </div>
     </div>
 </script>
 </script>

+ 1 - 1
app/admin/view/project/report/add.html

@@ -131,7 +131,7 @@
             <th class="layui-th-gray">四级审核人</th>
             <th class="layui-th-gray">四级审核人</th>
             <th colspan="2">
             <th colspan="2">
                 <select name="fourth" lay-reqText="请选择审批人">
                 <select name="fourth" lay-reqText="请选择审批人">
-                    <option value="">请选择审核人</option>
+                    <option value="">请选择审核人,可空</option>
                     {volist name='people' id='vo'}
                     {volist name='people' id='vo'}
                     <option value="{$vo.id}">{$vo.nickname}</option>
                     <option value="{$vo.id}">{$vo.nickname}</option>
                     {/volist}
                     {/volist}