diff --git a/Application/Admin/Controller/CompanyRelationController.class.php b/Application/Admin/Controller/CompanyRelationController.class.php index 5971cea86..12461b49e 100644 --- a/Application/Admin/Controller/CompanyRelationController.class.php +++ b/Application/Admin/Controller/CompanyRelationController.class.php @@ -47,7 +47,71 @@ class CompanyRelationController extends AdminController //生效列表 public function index() { - + $params = I('get.'); + $page = $params['p'] ? intval($params['p']) : 1; + $row = $params['row'] ? intval($params['row']) : 10; + $where['_string'] = '1 = 1'; + if(isset($params['company_type'])){ + $where['_string'] .= " AND (first_company_type='{$params['company_type']}' OR second_company_type='{$params['company_type']}')"; + } + if(isset($params['company_id'])){ + $where['_string'] .= " AND (first_company_id='{$params['company_id']}' OR second_company_id='{$params['company_id']}')"; + } + if(isset($params['settlement_type'])){ + $where['settlement_type'] = $params['settlement_type']; + } + if(isset($params['invoice_type'])){ + $where['invoice_type'] = $params['invoice_type']; + } + if(isset($params['is_payment'])){ + $where['is_payment'] = $params['is_payment']; + } + + $this->checkListOrCountAuthRestMap($where);//导出权限 + $dbres = $this->DBModel->where($where)->order("id desc");; + if(isset($params['export'])){ + $dbres = $dbres->select(); + }else{ + $dbres = $dbres->page($page, $row)->select(); + } + foreach($dbres as $k=>&$v){ + $v['settlement_type'] =$this->SettlementType[$v['settlement_type']]; + $v['first_company_type'] =$this->CompanyType[$v['first_company_type']]; + $v['second_company_type'] =$this->CompanyType[$v['second_company_type']]; + $v['invoice_type'] =$this->InvoiceType[$v['invoice_type']]; + $v['is_payment'] =$this->IsPayment[$v['is_payment']]; + $v['collection'] =$this->Collection[$v['collection']]; + } + + if(isset($_REQUEST['export'])){ + $GetData = $_GET; + unset($GetData['export']); + addOperationLog(['op_type'=>3,'key'=>getNowDate(),"op_name"=>"导出",'url'=>U(CONTROLLER_NAME.'/'.ACTION_NAME,$GetData)]); + data2csv($dbres,'公司绑定生效列表',array( + "first_company_name"=>"甲方公司类型", + "first_company_type"=>"甲方公司", + "second_company_name"=>"乙方公司", + "second_company_type"=>"乙方公司类型", + "settlement_type"=>"结算周期", + "invoice_type"=>"开票类型", + "invoice_content"=>"开票内容", + "is_payment"=>"打款流程", + "collection"=>"收款方" + )); + } + + $count = $this->DBModel->field("count(id) count")->where($where)->find()['count']; + $this->assign('data', $dbres); + $page = set_pagination($count, $row); + if($page) { + $this->assign('_page', $page); + } + $this->assign('Status',$this->Status); + $this->assign('SettlementType',$this->SettlementType); + $this->assign('CompanyType',$this->CompanyType); + $this->assign('InvoiceType',$this->InvoiceType); + $this->assign('IsPayment',$this->IsPayment); + $this->display(); } //审核列表 public function lists() @@ -343,7 +407,17 @@ class CompanyRelationController extends AdminController } public function delRelation() { - + if(!isset($_REQUEST['id'])){ + $this->error('参数错误'); + } + $id = $_REQUEST['id']; + $res = $this->DBlogModel->where("id='{$id}'")->delete(); + if($res !== false){ + addOperationLog(['op_type'=>2,'key'=>$id,'op_name'=>'删除','url'=>U('lists')]); + $this->ajaxReturn(["msg"=>"删除成功","code"=>1,"url"=>U("lists")]); + }else{ + $this->error('删除错误'); + } } public function getCompanyList($type) { diff --git a/Application/Admin/View/CompanyRelation/index.html b/Application/Admin/View/CompanyRelation/index.html index b4d48f323..4b18a5d45 100644 --- a/Application/Admin/View/CompanyRelation/index.html +++ b/Application/Admin/View/CompanyRelation/index.html @@ -37,6 +37,9 @@ .butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;} .butnbox .butnlist .butn.last {background:#009900;} .butnbox .butnlist .butn~.butn {margin-left:20px;} + .butnbox a{ + cursor:pointer + } .data_list table tbody tr a.disabled,.data_list table tbody tr a.disabled:hover {color:#999;cursor:default;} .layui-layer-title { text-align: center; @@ -45,64 +48,70 @@ font-weight: 600; font-size: 18px; } + .data_list table td{ + line-height: 1.5; + }
-