diff --git a/Application/Admin/Controller/CompanyRelationController.class.php b/Application/Admin/Controller/CompanyRelationController.class.php index 84355f2e8..5971cea86 100644 --- a/Application/Admin/Controller/CompanyRelationController.class.php +++ b/Application/Admin/Controller/CompanyRelationController.class.php @@ -310,11 +310,40 @@ class CompanyRelationController extends AdminController } public function editRelation() { - + if ($_POST) { + $p= I('post.'); + if(!isset($p['id'])){ + $this->error('参数错误'); + } + //查询 + $y = $this->DBlogModel->where("id='{$p['id']}'")->find(); + $p['remark'] = $p['remark'] ?? ''; + if($y['settlement_type'] != $p['settlement_type'] || $y['invoice_type'] != $p['invoice_type'] || $y['invoice_content'] != $p['invoice_content'] || $y['is_payment'] != $p['is_payment'] || $y['collection'] != $p['collection']){ + $p['status'] = 0; + $p['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]); + } + $this->DBlogModel->save($p); + addOperationLog(['op_type'=>1,'key'=>$p['id'],'op_name'=>'修改','url'=>U('lists')]); + $this->ajaxReturn(["msg"=>"修改成功","code"=>1,"url"=>U("lists")]); + } else { + $params = I('get.'); + $id = $params['id'] ?? 0; + $id = intval($id); + $map['id'] = $id; + $dbres = $this->DBlogModel->where($map)->find(); + $this->assign('first_company_info',$this->getCompanyInfo($dbres['first_company_type'],$dbres['first_company_id'])); + $this->assign('second_company_info',$this->getCompanyInfo($dbres['second_company_type'],$dbres['second_company_id'])); + + $dbres['first_company_type'] =$this->CompanyType[$dbres['first_company_type']]; + $dbres['second_company_type'] =$this->CompanyType[$dbres['second_company_type']]; + + $this->assign('data', $dbres); + $this->display(); + } } public function delRelation() { - + } public function getCompanyList($type) { @@ -347,6 +376,32 @@ class CompanyRelationController extends AdminController } $this->success($companyInfo,'',true); } + public function getCompanyInfo($type,$id) + { + $companyInfo = []; + if($type == 0){ + //己方公司 + $companyInfo = M("CompanyInfo","tab_")->field("id,partner company_name,link_man,link_phone")->where("status='1' AND id='{$id}'")->find(); + } + if($type == 1){ + //上游 + $companyInfo = M("Partner","tab_")->field("id,partner company_name,company_type,link_man,link_phone")->where("status='1' AND id='{$id}'")->find(); + } + if($type == 2){ + //下游游 + $companyInfo = M("PromoteCompany","tab_")->field("id,company_belong,company_name,company_type,settlement_contact link_man,contact_phone link_phone")->where("status='1' AND id='{$id}'")->find(); + } + if(isset($companyInfo['company_belong'])){ + $companyInfo['company_belong'] = getCompanyBlong($companyInfo['company_belong']); + } + if(isset($companyInfo['company_type'])){ + $companyInfo['company_type'] = ($companyInfo['company_type'] == 1 ? "公司" :'个人'); + } + if(isset($companyInfo['link_phone']) && $companyInfo['link_phone']==0){ + $companyInfo['link_phone'] = ''; + } + return $companyInfo; + } public function menuAuth() { $addurl = U("addRelation"); diff --git a/Application/Admin/View/CompanyRelation/addRelation.html b/Application/Admin/View/CompanyRelation/addRelation.html index 378810312..a7ffd7ce6 100644 --- a/Application/Admin/View/CompanyRelation/addRelation.html +++ b/Application/Admin/View/CompanyRelation/addRelation.html @@ -205,10 +205,10 @@
说明:除了备注其他项的修改将会重走审批流程,若不需要修改请点击返回
-说明:除了备注,其他项的修改将会重走审批流程,若不需要修改请点击返回
+