<template>
  <div class="app-container enterprise_contatiner">
	<div class="title_wrap">
		<div class="enterprise_title">
			查城投平台
		</div>
	</div>
	  <div class="content">
	  	<div class="content_item">
	  	   <div class="content_right item_ckquery_list">
	  	       <el-input class="ename_input" placeholder="请输入企业名称关键字" clearable v-model="keys" >
	  	   		<div slot="append" class="btn-search" @click="search()">搜索</div>
	  	   	</el-input>
	  	      
	  	   </div>
	  	</div>
		
		<div class="content_item">
		    <div class="label">企业地区</div>
		    <div class="content_right item_ckquery_list">
		       <div class="select-popper" >
		         <span :class="{color_text:jskBidQueryDto.provinceIds.length ||jskBidQueryDto.cityIds.length ||jskBidQueryDto.areaIds.length,}">
					 注册地区{{jskBidQueryDto.provinceIds.length ||jskBidQueryDto.cityIds.length ||jskBidQueryDto.areaIds.length? jskBidQueryDto.provinceIds.length + jskBidQueryDto.cityIds.length +jskBidQueryDto.areaIds.length +"项": ""}}
		           <i class="el-icon-caret-bottom"></i>
		         </span>
		         <el-cascader
		           ref="address"
		           class="cascader-region"
		           v-model="addressType"
		           :options="addressList"
		           :props="props"
		           @change="domicileChange"
		           collapse-tags
		           clearable
		         ></el-cascader>
		       </div>
			   <div class="checkbox">
				   <div class="checkbox-titel">行政等级</div>
				   <div class="checkbox-content">
					   <div class="checkbox-content-qx">
						    <el-checkbox  v-model="checkuipExecutive" @change="checkuipExecutivebtn">全部</el-checkbox>
					   </div>
						<el-checkbox-group v-model="uipExecutiveText" @change="uipExecutiveLevelbtn">
						    <el-checkbox v-for="item in uipExecutiveLevel" :label="item" :key="item">{{item}}</el-checkbox>
						</el-checkbox-group>
				   </div>
			   </div>
			   
		    </div>
		</div>
		<div class="content_item">
		    <div class="label" style="margin-right: 28px;">城投业务类型</div>
		    <div class="content_right ">
			   <div class="checkbox">
				   <div class="checkbox-content">
					   <div class="checkbox-content-qx">
						    <el-checkbox  v-model="checkuipBusiness" @change="checkuipBusinessbtn">全部</el-checkbox>
					   </div>
						<el-checkbox-group v-model="uipBusinessText" @change="uipBusinessTypebtn">
						    <el-checkbox v-for="item in uipBusinessType" :label="item" :key="item">{{item}}</el-checkbox>
						</el-checkbox-group>
				   </div>
			   </div>
		    </div>
		</div>
		<div class="content_item">
		    <div class="label" >主体评级</div>
		    <div class="content_right ">
			   <div class="checkbox">
				   <div class="checkbox-content">
					   <div class="checkbox-content-qx">
						    <el-checkbox  v-model="checkbratingSubject" @change="checkbratingSubjectbtn">全部</el-checkbox>
					   </div>
						<el-checkbox-group v-model="bratingSubjectText" @change="bratingSubjectLevelbtn">
						    <el-checkbox v-for="item in bratingSubjectLevel" :label="item" :key="item">{{item}}</el-checkbox>
						</el-checkbox-group>
				   </div>
			   </div>
		    </div>
		</div>
		<div class="content_item">
		    <div class="label" >股东背景</div>
		    <div class="content_right ">
			   <div class="checkbox">
				   <div class="checkbox-content">
					   <div class="checkbox-content-qx">
						    <el-checkbox  v-model="checkshareholder" @change="checkshareholderbtn">全部</el-checkbox>
					   </div>
						<el-checkbox-group v-model="shareholderText" @change="shareholderBgbtn">
						    <el-checkbox v-for="item in shareholderBg" :label="item" :key="item">{{item}}</el-checkbox>
						</el-checkbox-group>
				   </div>
			   </div>
		    </div>
		</div>
		<div class="content_item">
		    <div class="label" >股权关系</div>
		    <div class="content_right ">
			   <div class="checkbox">
				   <div class="checkbox-content">
					   <div class="checkbox-content-qx">
						    <el-checkbox  v-model="checkequityRelationship" @change="checkequityRelationshipbtn">全部</el-checkbox>
					   </div>
						<el-checkbox-group v-model="equityRelationshipText" @change="equityRelationshipbtn">
						    <el-checkbox v-for="item in equityRelationship" :label="item" :key="item">{{item}}</el-checkbox>
						</el-checkbox-group>
				   </div>
			   </div>
		    </div>
		</div>
		<div class="content_item">
		</div>
	  </div>
	  <div class="bottomlist">
	  	<div class="bottomlist-title">
			<div class="bottomlist-title-left" >
				<p class="title-left">
					查询结果列表
				</p>
				<el-popover v-model="fieldshow" placement="bottom-start" trigger="click"
					popper-class="viewlist-el-popover">
					<ul class="pup_list">
						<li v-for="(itme,i) in fieldOptions" :class="itme.status?'active':''"
							@click="handsequencingList(i)" :key="i">
							{{itme.value}}
						</li>
					</ul>
					<span slot="reference" class="toolbar-right-download" >
						{{fieldText}}<i class="el-icon-arrow-down"
							:style="{transform:fieldshow?'rotate(180deg)':''}"></i>
					</span>
				</el-popover>
			</div>
	  		
			
	  		<div class="title-right">
	  			<p>共有{{total}}条</p>
	  			<p>
	  				<img src="@/assets/images/EXCEL.png" alt="">
	  				<span class="excel" @click="$message({message: '功能正在开发中',type: 'warning'})">导出EXCEL</span>
	  			</p>
	  		</div>
	  		  
	  	</div>
		<div class="table-item-jf table-item-jf1" v-if="tableData.length==0&& !isSkeleton">
			<img class="item-jf-img" src="@/assets/images/kong.png" alt="">
			<div class="item-jf-titel">抱歉，没找到相关数据！</div>
			<div class="item-jf-text">建议调整关键词或筛选条件，重新搜索！</div>
		</div>
		<skeleton style="margin-left:16px;" v-if="isSkeleton"></skeleton>

	  	<div class=" table-item-jf" v-if="!isSkeleton&&tableData.length>0">
	  	  <el-table  :data="tableData" :header-cell-style="{ background:'#f0f3fa',color: 'rgba(35,35,35,0.8)'}" max-height="640"  class="table-item1 fixed-table"  border  highlight-current-row>
	  			<el-table-column type="index" label="序号" fixed width="60">
	  			 <template slot-scope="scope">
	  			 	<span>{{(pageNum - 1) *20 + scope.$index + 1}}</span>
	  			 </template>
	  			</el-table-column>
	  			<el-table-column  label="公司名称" fixed width="380" >
	  						 <template slot-scope="scope">
								 <div class="renling">
									 <router-link  :to="`/enterprise/${encodeStr(scope.row.companyId)}`" tag="a" class="list-titel-a" v-html="scope.row.companyName" ></router-link>
									 <div class="renling-btn" @click="claimbtn(scope.row)" >
										 <p  v-if="scope.row.claimStatus==0"  class="renling-img-true">
											 
										 </p>
										 <p v-else   class="renling-img-false">
										 											 
										 </p>
									 	<span v-if="scope.row.claimStatus==0" @click="cancelClaim(scope.row.companyName,scope.$index)" class="renling-hui">
											已认领
										</span>	
										<span v-else class="renling-hei">
											认领
										</span>
									 </div>
								 </div>
								 
							</template>
								 
	  			 </el-table-column>
	  			<el-table-column label="区域"   width="160">
	  					<template slot-scope="scope">
							   {{scope.row.province}}
							   <template v-if="scope.row.city">
							   	-
							   </template>
							   {{scope.row.city}}
							   <template v-if="scope.row.area">
							   	-
							   </template>
							   {{scope.row.area}}
	  					</template>
	  						  
	  			</el-table-column>
	  			<el-table-column  label="招标数量" width="72" >
	  						  <template slot-scope="scope">
	  							 {{scope.row.biddingCount||"--"}}
	  							</template>
	  							
	  			</el-table-column>
	  			<el-table-column  label="城投拿地" width="72" >
	  						<template slot-scope="scope">
	  							  	{{scope.row.landInfoCount||"--"}}
	  						</template>
	  			 </el-table-column>
				 
				 <el-table-column  label="供应商" width="72" >
				 			<template slot-scope="scope">
				 				  	{{scope.row.supplierCount||"--"}}
				 			</template>
				  </el-table-column>
				  <el-table-column  label="主体评级" width="72" >
				  			<template slot-scope="scope">
				  				  	{{scope.row.bratingSubjectLevel||"--"}}
				  			</template>
				   </el-table-column>
				   <el-table-column  label="债券余额（亿元）" width="124" >
				   			<template slot-scope="scope">
				   				  	{{scope.row.bondBalance||"--"}}
				   			</template>
				    </el-table-column>
					<el-table-column  label="行政级别" width="72" >
								<template slot-scope="scope">
									  	{{scope.row.uipExecutiveLevel||"--"}}
								</template>
					 </el-table-column>
					 <el-table-column  label="股东背景" width="84" >
					 			<template slot-scope="scope">
					 				  	{{scope.row.shareholderBg||"--"}}
					 			</template>
					  </el-table-column>
					  <el-table-column  label="股权关系" width="84" >
					  			<template slot-scope="scope">
					  				  	{{scope.row.equityRelationship||"--"}}
					  			</template>
					   </el-table-column>
					   <el-table-column  label="平台重要性" width="84" >
					   			<template slot-scope="scope">
					   				  	{{scope.row.platformImportance||"--"}}
					   			</template>
					    </el-table-column>
						<el-table-column  label="城投业务类型" width="94" >
									<template slot-scope="scope">
										  	{{scope.row.uipBusinessType||"--"}}
									</template>
						 </el-table-column>
						 <el-table-column  label="实控人" width="290" >
						 			<template slot-scope="scope">
										<!-- <router-link v-if="scope.row.actualController"  :to="'/radar/bxprozbgg/details/'+ 1" tag="a" class="list-titel-a"  >
												{{scope.row.actualController}}
										</router-link> -->
						 				  <template >
											  {{scope.row.actualController||"--"}}
										  </template>
						 			</template>
						  </el-table-column>
						  <el-table-column  label="最新报告期" width="92" >
						  			<template slot-scope="scope">
						  				  	{{scope.row.latestReportPeriod||"--"}}
						  			</template>
						   </el-table-column>
						   <el-table-column  label="总资产（亿元）" width="112" >
						   			<template slot-scope="scope">
						   				  	{{scope.row.totalAssets||"--"}}
						   			</template>
						    </el-table-column>
							<el-table-column  label="归母净资产（亿元）" width="132" >
									<template slot-scope="scope">
										{{scope.row.belongNetAssets||"--"}}
									</template>
							 </el-table-column>
							 <el-table-column  label="货币资金（亿元）" width="120" >
								<template slot-scope="scope">
									{{scope.row.monetaryFunds||"--"}}
								</template>
							  </el-table-column>
							  <el-table-column  label="土地资产（亿元）" width="120" >
								<template slot-scope="scope">
									{{scope.row.landAssets||"--"}}
								</template>
							   </el-table-column>
							   <el-table-column  label="受限资产（亿元）" width="120" >
								<template slot-scope="scope">
									{{scope.row.restrictedAssets||"--"}}
								</template>
							    </el-table-column>
								<el-table-column  label="应收账款（亿元）" width="120" >
									<template slot-scope="scope">
										{{scope.row.accountsReceivable||"--"}}
									</template>
								 </el-table-column>
								 <el-table-column  label="其他应收款（亿元）" width="132" >
									<template slot-scope="scope">
										{{scope.row.otherReceivable||"--"}}
									</template>
								  </el-table-column>
								 <el-table-column  label="公益性&准公益性主营占比（%）" width="188" >
									<template slot-scope="scope">
										{{scope.row.econData_001||"--"}}
									</template>
								  </el-table-column>
								  <el-table-column  label="政府补助（亿元）" width="120" >
									<template slot-scope="scope">
										{{scope.row.govSubsidy||"--"}}
									</template>
								   </el-table-column>
								   <el-table-column  label="专项应付款（亿元）" width="132" >
										<template slot-scope="scope">
											{{scope.row.specialPayable||"--"}}
										</template>
								    </el-table-column>
									<el-table-column  label="营业收入（亿元）" width="120" >
										<template slot-scope="scope">
											{{scope.row.operatingIncome||"--"}}
										</template>
									 </el-table-column>
									 <el-table-column  label="归母净利润（亿元）" width="132" >
										<template slot-scope="scope">
											{{scope.row.belongNetProfit||"--"}}
										</template>
									  </el-table-column>
									  <el-table-column  label="净资产收益率（%）" width="136" >
										<template slot-scope="scope">
											{{scope.row.roe||"--"}}
										</template>
									   </el-table-column>
									   <el-table-column  label="经营现金流量净额（亿元）" width="168" >
											<template slot-scope="scope">
												{{scope.row.netOperatingCashFlow||"--"}}
											</template>
									    </el-table-column>
										<el-table-column  label="筹资现金流量净额（亿元）" width="168" >
											<template slot-scope="scope">
												{{scope.row.netFinancingCashFlow||"--"}}
											</template>
										 </el-table-column>
										 <el-table-column  label="投资现金流量净额（亿元）" width="168" >
											<template slot-scope="scope">
												{{scope.row.netInvestmentCashFlow||"--"}}
											</template>
										  </el-table-column>
										<el-table-column  label="总负债 （亿元）" width="112" >
											<template slot-scope="scope">
												{{scope.row.totalLiabilities||"--"}}
											</template>
										 </el-table-column>
										 <el-table-column  label="有息债务 （亿元）" width="124" >
											<template slot-scope="scope">
												{{scope.row.uipInterestBearingDebt||"--"}}
											</template>
										  </el-table-column>
										  <el-table-column  label="有息债务/总负债（%）" width="134" >
											<template slot-scope="scope">
												{{scope.row.econData_002||"--"}}
											</template>
										   </el-table-column>
										   <el-table-column  label="综合融资成本（%）" width="116" >
												<template slot-scope="scope">
													{{scope.row.ofcb||"--"}}
												</template>
										    </el-table-column>
										<el-table-column  label="现金比率（%）" width="92" >
											<template slot-scope="scope">
												{{scope.row.cashRatio||"--"}}
											</template>
										</el-table-column>
										<el-table-column  label="现金流量比率（%）" width="116" >
											<template slot-scope="scope">
												{{scope.row.cashFlowRatio||"--"}}
											</template>
										</el-table-column>
										<el-table-column  label="现金到期债务比（%）" width="132" >
											<template slot-scope="scope">
												{{scope.row.cashDebtRatio||"--"}}
											</template>
										</el-table-column>
										<el-table-column  label="授信余额（亿元）" width="124" >
											<template slot-scope="scope">
												{{scope.row.creditBalance||"--"}}
											</template>
										</el-table-column>
										<el-table-column  label="授信余额/全部债务（%）" width="146" >
											<template slot-scope="scope">
												{{scope.row.econData_003||"--"}}
											</template>
										</el-table-column>
										<el-table-column  label="EBITDA保障倍数" width="116" >
													<template slot-scope="scope">
														  	{{scope.row.ebitdaIcr||"--"}}
													</template>
										</el-table-column>
										<el-table-column  label="私募债余额占比（%）" width="128" >
											<template slot-scope="scope">
												{{scope.row.ppnBalanceProp||"--"}}
											</template>
										</el-table-column>
										<el-table-column  label="一年内到期债权占比（%）" width="152" >
											<template slot-scope="scope">
												{{scope.row.econData_004||"--"}}
											</template>
										</el-table-column>
										<el-table-column  label="债券余额/有息债务（%）" width="152" >
											<template slot-scope="scope">
												{{scope.row.econData_005||"--"}}
											</template>
										</el-table-column>
										<el-table-column  label="借款余额（亿元）" width="124" >
											<template slot-scope="scope">
												{{scope.row.loan||"--"}}
											</template>
										</el-table-column>
										<el-table-column  label="借款/有息债务（%）" width="122" >
											<template slot-scope="scope">
												{{scope.row.econData_006||"--"}}
											</template>
										</el-table-column>
										<el-table-column  label="非标余额（亿元）" width="124" >
											<template slot-scope="scope">
												{{scope.row.nonStandardBalance||"--"}}
											</template>
										</el-table-column>
										<el-table-column  label="非标余额/有息债务（%）" width="152" >
											<template slot-scope="scope">
												{{scope.row.nonStandardRatio||"--"}}
											</template>
										</el-table-column>
										<el-table-column  label="对外担保金额（亿元）" width="144" >
											<template slot-scope="scope">
												{{scope.row.guaranteeAmount||"--"}}
											</template>
										</el-table-column>
										<el-table-column  label="对外担保比例（%）" width="116" >
											<template slot-scope="scope">
												{{scope.row.guaranteeRatio||"--"}}
											</template>
										</el-table-column>
										<el-table-column  label="所属开发区" width="84" >
													<template slot-scope="scope">
														  	{{scope.row.developmentZone||"--"}}
													</template>
										</el-table-column>
										
	  	  </el-table>
	  	</div>
	  	<div class="pagination clearfix"  v-show="total>0">
	  		  <el-pagination
	  		    background
	  		    :page-size="pageSize"
	  		    :current-page="pageNum"
	  		    @current-change="handleCurrentChange"
	  		    layout="prev, pager, next"
	  		    :total="total">
	  		  </el-pagination>
	  	</div>
	  	
	  </div>
	  <el-dialog
	    title=""
	    :visible.sync="dialogVisible"
		:modal="false"
		custom-class='dialog-renlin'
		:show-close="false"
	    width="244px">
	    <span>认领成功，是否完善客户信息？</span>
	    <div slot="footer" class="dialog-footer">
		  <span class="dialog-footer-btn1" type="primary" @click="claimopen(companyId,customerId)" >
			   立即完善
		  </span>
	      <span class="dialog-footer-btn2" @click="search(pageNum, pageSize)">稍后</span>
	    </div>
	  </el-dialog>
	  <el-dialog
	    title="取消认领"
	    :visible.sync="dialogVisible1"
		:modal="false"
		custom-class='dialog-renlin'
		:show-close="false"
	    width="344px">
	    <span>是否取消认领客户？客户信息将放入“历史客户”。</span>
	    <div slot="footer" class="dialog-footer">
		  <span class="dialog-footer-btn1" type="primary" @click="confirm()" >
			   确认
		  </span>
	      <span class="dialog-footer-btn2" @click="dialogVisible1 = false">关闭</span>
	    </div>
	  </el-dialog>
	  <el-dialog :visible.sync="dialogVisible2" custom-class='dialog-renlin' title="重新认领" width="260px" :show-close="false">
		<div>再次认领将会恢复客户数据</div>
		<div slot="footer" class="dialog-footer">
			<span class="dialog-footer-btn1" type="primary" @click="handleHistoryClaim()">确认</span>
			<span class="dialog-footer-btn2" @click="dialogVisible2 = false">关闭</span>
		</div>
		</el-dialog>
  </div>
</template>

<script>
import {encodeStr} from "@/assets/js/common.js"
import jsk_data from '../../../../../public/jsk.json';
import skeleton from '@/views/project/projectList/component/skeleton'
import api from '@/api/enterpriseData/enterpriseData.js';
import "@/assets/styles/public.css";
export default {
  name: 'Owner',
  components:{skeleton},
  data() {
    return {
	  encodeStr,
	  isSkeleton:true,
	  keys:'',
      addressList: [],
      addressType: [],
      props: {
        multiple: true,
        expandTrigger: "hover",
        value: "id",
      },
      pageSize: 20,
	  dialogVisible2:false,
      jskBidQueryDto: {
        provinceIds: [],
        cityIds: [],
        areaIds: []
      },
      domicile: [],
	  // 行政等级
	  uipExecutiveLevel:[],
	  uipExecutiveText:[],
	  checkuipExecutive:true,
	  // 城投业务类型
	  uipBusinessType:[],
	  uipBusinessText:[],
	  checkuipBusiness:true,
	  // 主体信用等级
	  bratingSubjectLevel:[],
	  bratingSubjectText:[],
	  checkbratingSubject:true,
	  // 股东背景
	  shareholderBg:[],
	  shareholderText:[],
	  checkshareholder:true,
	  // 股权关系
	  equityRelationship:[],
	  equityRelationshipText:[],
	  checkequityRelationship:true,
	  
      pageFlag: true,
	  conditionsArr: [],
	  
	  fieldshow: false,
	  fieldText: '默认排序',
	  sort: '3', //查询结果排序方式
	  fieldOptions: [{
	  		key: "3",
	  		value: "默认排序",
	  		status: true,
	  	},
	  	
		{
			key: "5",
			value: "招标数量从多到少",
			status: false,
		},
		
		
		{
			key: "7",
			value: "土地数量从多到少",
			status: false,
		},
		
	  ],
	  companyId:'',
	  companyName:'',
	  cancelIndex:'',
	  customerId:'',
	  dialogVisible: false,
	  dialogVisible1: false,
	  tableData:[],
	  total:0,
	  pageNum:1,
	  pageSize:20
    };
  },
  computed: {
    checkJskBidQueryDto() {
        let arr = [];
		let flag = false;
		let data = {};
      
     
     
     
     
     
      if (this.domicile.length > 0) {
        data = {
          title: "行政区划:",
          keyid: "domicile",
          value: this.domicile.join(","),
          key: "domicile"
        }
        flag = true;
        arr.push(data)
      }
     
      
      
      this.conditionsArr = arr
      return flag;
    },
  },
  created() {
  	api.uipGroupData().then(res=>{
  	          if (res.code==200) {
  	          	// 行政等级
  	          	this.uipExecutiveLevel=res.data.uipExecutiveLevel,
  	          	// 城投业务类型
  	          	this.uipBusinessType=res.data.uipBusinessType,
  	          	// 主体信用等级
  	          	this.bratingSubjectLevel=res.data.bratingSubjectLevel,
  	          	// 股东背景
  	          	this.shareholderBg=res.data.shareholderBg,
  	          	// 股权关系
  	          	this.equityRelationship=res.data.equityRelationship;
				
  	          }
  	}).catch(error=>{
		
  	});
  },
  mounted() {
    this.init();
  },
  methods: {
    domicileChange() {
    	let arr = this.$refs.address.getCheckedNodes();
    	let provinceIds = [],
    		cityIds = [],
    		areaIds = [];
    	this.domicile = [];
    	for (var i in arr) {
    		if (arr[i].parent) {
    			if (!arr[i].parent.checked) {
    				arr[i].hasChildren && cityIds.push(arr[i].value);
    				arr[i].hasChildren && this.domicile.push(arr[i].label);
    				!arr[i].hasChildren && areaIds.push(arr[i].value);
    				!arr[i].hasChildren && this.domicile.push(arr[i].label);
    			}
    		} else {
    			provinceIds.push(arr[i].value);
    			this.domicile.push(arr[i].label);
    		}
    	}
    	var obj = JSON.parse(JSON.stringify(this.jskBidQueryDto));
    	obj.provinceIds = provinceIds;
    	obj.cityIds = cityIds;
    	obj.areaIds = areaIds;
    	this.jskBidQueryDto = obj;
		this.search();
    },
    
   
   
    addressListfn() {
      var str = [];
      for (let x = 0; x < 3; x++) {
        for (let i = 0; i < jsk_data.length; i++) {
          if (jsk_data[i].regionLevel == x + 1 && x + 1 == 1) {
            str.push({
              id: jsk_data[i].id,
              label: jsk_data[i].regionName,
              short: jsk_data[i].short,
              value: jsk_data[i].parentId,
              children:jsk_data[i].id==900000?undefined:[],
            });
          } else if (jsk_data[i].regionLevel == x + 1 && x + 1 == 2&&str) {
            for (let j = 0; j < str.length; j++) {
              if (str[j].id == jsk_data[i].parentId) {
                str[j].children.push({
                  id: jsk_data[i].id,
                  label: jsk_data[i].regionName,
                  short: jsk_data[i].short,
                  value: jsk_data[i].parentId,
                  children: [],
                });
              }
            }
          } else if (jsk_data[i].regionLevel == x + 1 && x + 1 == 3) {
            for (let j = 0; j < str.length; j++) {
              if(str[j].children){
                for (let k = 0; k < str[j].children.length; k++) {
                  if (str[j].children[k].id == jsk_data[i].parentId) {
                    str[j].children[k].children.push({
                      id: jsk_data[i].id,
                      label: jsk_data[i].regionName,
                      short: jsk_data[i].short,
                      value: jsk_data[i].parentId,
                    });
                  }
                }
              }
            }
          }
        }
      }
      this.addressList = str;
    },
  
   
   
    reset() {
      Object.assign(this.$data, this.$options.data.call(this)); //重置data
      this.init();
   
    },
    init(){
      this.search();
      this.addressListfn();
    },
   
	checkuipExecutivebtn(val){
		this.uipExecutiveText =[];
		this.checkuipExecutive=true;
		this.search();
		
	},
	uipExecutiveLevelbtn(val){
		if(val.length>0){
			this.checkuipExecutive=false;
		}else if(val.length==0){
			this.checkuipExecutive=true;
		}
		this.search();
		
	},
	checkuipBusinessbtn(val){
		this.uipBusinessText =[];
		this.checkuipBusiness=true;
		this.search();
	},
	uipBusinessTypebtn(val){
		if(val.length>0){
			this.checkuipBusiness=false;
		}else if(val.length==0){
			this.checkuipBusiness=true;
		}
		this.search();
	},
	checkbratingSubjectbtn(val){
		this.bratingSubjectText =[];
		this.search();
		this.checkbratingSubject=true;
	},
	bratingSubjectLevelbtn(val){
		if(val.length>0){
			this.checkbratingSubject=false;
		}else if(val.length==0){
			this.checkbratingSubject=true;
		}
		this.search();
	},
	checkshareholderbtn(val){
		this.shareholderText =[];
		this.checkshareholder=true;
		this.search();
	},
	shareholderBgbtn(val){
		if(val.length>0){
			this.checkshareholder=false;
		}else if(val.length==0){
			this.checkshareholder=true;
		}
		this.search();
	},
	checkequityRelationshipbtn(val){
		this.equityRelationshipText =[];
		this.checkequityRelationship=true;
		this.search();
	},
	equityRelationshipbtn(val){
		if(val.length>0){
			this.checkequityRelationship=false;
		}else if(val.length==0){
			this.checkequityRelationship=true;
		}
		this.search();
	},
	handsequencingList(index) {
		this.fieldshow = false;
		this.sort = this.fieldOptions[index].key;
		for (let i = 0; i < this.fieldOptions.length; i++) {
			this.fieldOptions[i].status = false;
		}
		this.fieldText = this.fieldOptions[index].value;
		this.fieldOptions[index].status = true;
		this.search();
	},
	handleCurrentChange(pageNum) {
	  this.pageNum = pageNum;
	  this.search(pageNum, this.pageSize);
	},
	handleSizeChange(pageSize) {
	  this.pageSize = pageSize;
	  this.search(this.pageNum, pageSize);
	},
	reloadPage() {
		this.pageFlag = false;
		this.$nextTick(() => {
			this.pageFlag = true;
		});
	},
	async handleHistoryClaim(){
      let res = await api.historyClaim(this.companyName)
      if(res.code==200){
          this.dialogVisible2 = false;
          this.search();
        }else{
          this.$message.error(res.msg)
        }
    },
	claimbtn(item){
		if(item.claimStatus==1){
			return this.dialogVisible2=true;
		}
		this.companyId=item.companyId;
		var info={};
		api.infoHeader({companyId:this.companyId}).then(res=>{
				  // console.log(res)
		         info=res.data;
				 let params={
				 	companyId:item.companyId,
				 	uipId:item.uipId,
				 	companyName:item.companyName.replace(/<font color='red'>/g,'').replace(/<\/font>/g,''),
				 	creditLevel:info.bratingSubjectLevel,
				 	legalPerson:info.corporatePerson,
				 	registerCapital:info.registeredCapital,
				 	provinceId:info.provinceId,
				 	cityId:info.cityId,
				 	districtId:info.districtCode,
				 	registerAddress:info.provinceName+'-'+info.cityName+'-'+info.districtName,
				 	creditCode:info.creditCode,
				 }
				 api.claim(params).then(res1=>{
				    if (res1.code==200) {
				 		this.dialogVisible=true;
				 		this.customerId=res1.data.customerId;
				    }
				 }).catch(error=>{
				 	
				 });
		}).catch(error=>{
			
		});
		
	},
	cancelClaim(companyName,index){
		this.dialogVisible1 = true;
		this.companyName = companyName;
		this.cancelIndex = index;
	},
	confirm(){
		api.cancelClaim(this.companyName).then(res=>{
			if(res.code==200){
				this.dialogVisible1 = false;
				this.tableData[this.cancelIndex].claimStatus = 1
			}else{
				this.$message.error(res.msg)
			}
		})
	},
	claimopen(companyId,customerId){
		this.$router.push({ 
			path: '/enterprise/'+encodeStr(companyId),
			query: { 
				'customerId': customerId,
				'path':'business'
				} ,
			})
			this.dialogVisible=false;
						this.search();

	},
	search(pageNum, pageSize,exportFlag) {
	  this.dialogVisible=false;
	  if (!pageNum) {
	    this.pageNum = 1;
	  }
	  if (!pageSize) {
	    this.pageSize = 20;
	  }
	  if (!pageNum && !pageSize) {
	    this.reloadPage();
	  }
	  let params = {
	      pageNum: this.pageNum,
	      pageSize: this.pageSize,
	      sort: this.sort,
	  };
	  var data = JSON.parse(JSON.stringify(this.jskBidQueryDto));
	  if(this.keys){
	    params['keys'] = this.keys.split(' ');
	  }else{
	    delete params.keys
	  }
	  
	  if(data.provinceIds.length>0){
	   params['provinceIds'] = data.provinceIds;
	  }else{
	    delete params.provinceIds
	  }
	  if(data.cityIds.length>0){
	   params['cityIds'] = data.cityIds;
	  }else{
	    delete params.cityIds
	  }
	  if(data.areaIds.length>0){
	   params['areaIds'] = data.areaIds;
	  }else{
	    delete params.areaIds
	  }
	  if(this.uipExecutiveText.length>0){
	   params['uipExecutiveLevel'] = this.uipExecutiveText;
	  }else{
	    delete params.uipExecutiveLevel
	  }
	  if(this.uipBusinessText.length>0){
	   params['uipBusinessType'] = this.uipBusinessText;
	  }else{
	    delete params.uipBusinessType
	  }
	  if(this.bratingSubjectText.length>0){
	   params['bratingSubjectLevel'] = this.bratingSubjectText;
	  }else{
	    delete params.bratingSubjectLevel
	  }
	  if(this.shareholderText.length>0){
	   params['shareholderBg'] = this.shareholderText;
	  }else{
	    delete params.shareholderBg
	  }
	  if(this.equityRelationshipText.length>0){
	   params['equityRelationship'] = this.equityRelationshipText;
	  }else{
	    delete params.equityRelationship
	  }
	  this.isSkeleton = true;
	  api.uipSerach(params).then(res=>{
        this.isSkeleton = false
		  // console.log(res)
	            if (res.code==200) {
					this.tableData=res.rows;
					this.total=res.total;
	  			
	            }
	  }).catch(error=>{
	  });
	  
	},
	renlin(){
		this.dialogVisible=false;
		// this.$router.push({path:'/home',query: {id:'1'}})
		// 跳转地址
	},
	
	
  },
};
</script>
<style lang="scss" scoped>
	::v-deep  .dialog-renlin{
		margin-top:40vh !important;
		.el-dialog__body{
			padding: 0;
			text-align: center;
			padding-bottom: 24px;
		}
		.el-dialog__footer{
			padding: 0px;
			padding-bottom: 24px;
			.dialog-footer{
				display: inline-flex;
				align-items: center;
				justify-content: center;
				width: 100%;
				.dialog-footer-btn1{
					cursor: pointer;
					width: 72px;
					height: 28px;
					background: #0081FF;
					border-radius: 2px 2px 2px 2px;
					font-size: 12px;
					font-weight: 400;
					color: #FFFFFF;
					line-height: 28px;
					text-align: center;
					margin-right: 8px;
				}
				.dialog-footer-btn2{
					cursor: pointer;
					width: 72px;
					height: 28px;
					border-radius: 2px 2px 2px 2px;
					border: 1px solid #CCCCCC;
					line-height: 28px;
					text-align: center;
					font-size: 12px;
					font-weight: 400;
					color: rgba(35,35,35,0.8);
				}
			}
		}
	}
	.content{
	  padding: 0px 16px;
	  border-radius: 4px 4px 4px 4px;
	   background: #FFFFFF;
	   .content_item{
		   padding-top:20px;
		   display: flex;
		   align-items: flex-start;
	       .label{
	           width: 84px;
			   font-size: 14px;
			   font-weight: 400;
			   color: rgba(35,35,35,0.8);
	       }
	       .content_right{
	           
	           .ename_input{
	               width: 640px;
	               margin-right: 20px;
				  ::v-deep  .el-input-group__append{
					   cursor: pointer;
					   padding: 0px;
					   border-radius:2px;
					   border-top-left-radius: 0;
					   border-bottom-left-radius: 0;
					   .btn-search{
						   width: 70px;
						   color: #0081ff;
						   text-align: center;
					   }
				   }
	           }
			   .land_ipt_470 {
			   	width: 640px;
			   }
	       }
		   .item_ckquery_list {
		   	display: flex;
		   	 align-items: center;
		   	   .qualifications-tab{
		   	     margin-right: 4px;
		   	     border: 1px solid #e0e0e0;
		   	     padding: 2px 3px;
		   	     border-radius: 2px;
		   	     height: 34px;
		   	     margin-top: 1px;
		   	     span{
		   	       background: #fff;
		   	       display: inline-block;
		   	       cursor: pointer;
		   	       float: left;
		   	       border-radius: 2px;
		   	       padding: 3px 8px;
		   	       margin-top: 0.5px;
		   	     }
		   	     .action{
		   	       color: #ffffff;
		   	       background: #0081ff;
		   	     }
		   	   }
		   	   .ckquery_list_right{
		   	     width: 670px;
		   	   }
		   
		   }
		   
		
		 .item_ckquery_list .el-input__icon {
			position: relative;
			top: 1px;
		}
		.ckquery_list_right {
			width: 640px;
		}
		.register_count_ipt{
			margin-left: 0px;
			
		}
		.register_count_ipt .el-input__inner{
			width: 174px;
		}
		::v-deep .el-input-group__prepend{
			padding: 0 8px;
		}
		.content-projecttype{
			display: flex;
			align-items: center;
			justify-content: center;
			.projecttype{
				font-weight: 400;
				color: #232323;
				padding: 1px 5px;
				margin-right: 4px;
				cursor: pointer;
				border-radius: 3px 3px 3px 3px;
				font-size: 14px;
			}
			.projecttype:first-child{
				padding-left: 0px;
			}
			.projecttype:hover{
				background: #F3F4F5;
				padding: 1px 5px;
			}
			.activetype{
				background: #F3F4F5;
				padding: 1px 5px !important;
			}
		}
		
		
	   
	   }
	   .content_item_padding0{
		   padding: 0;
	   }
		
	}
	.bottomlist{
		width: 100%;
		background-color: #FFFFFF;
		
	     border-radius: 4px 4px 4px 4px;
		.bottomlist-title{
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 12px;
			padding: 16px ;
			 
			.title-right{
				display: flex;
				align-items: center;
				p:first-child{
					font-size: 12px;
					font-weight: 400;
					color: #3D3D3D;
					margin-right: 10px;
				}
				p:last-child{
					display: flex;
					align-items: center;
					font-size: 14px;
					font-weight: 400;
					color: rgba(35,35,35,0.8);
				}
				img{
					width: 18px;
					height: 18px;
				}
				.excel{
					cursor: pointer;
				}
			}
			
		}
		.bottomlist-title-left{
			display: inline-flex;;
			align-items: center;
			.title-left{
				border-left:2px solid #445781;
				padding-left:8px;
				padding-right:32px;
				font-size: 16px;
				height:16px;
				line-height: 16px;
				font-weight: bold;
				color: #232323;
			}
		}
		.bottomlist-content{
			
			padding-bottom: 0px;
		}

		
		.table-item-jf{
			padding:0px 16px;
			.list-titel-a{
				color:#0081FF;
			}
			::v-deep .el-table--border .el-table__cell:first-child .cell{
				padding:0px 8px;
				padding-left:12px;
				font-size: 12px;
				font-weight: 400;
			}
			 ::v-deep .el-table th.el-table__cell > .cell{
				padding:0px 8px;
				padding-left:12px;
				font-size: 12px;
				font-weight: 400;
			}
			 ::v-deep .el-table th.el-table__cell.is-leaf,  ::v-deep .el-table td.el-table__cell{
				border-bottom: 1px solid #E6EAF1;
			}
			 ::v-deep .el-table--border .el-table__cell{
				border-right:1px solid #E6EAF1;
			}
			::v-deep.el-table__fixed::before{
				height: 0;
			}
			.renling{
				display: flex;
				align-items: center;
				.list-titel-a{
					width: 264px;
					margin-right: 12px;
				}
				.renling-btn{
					display: flex;
					align-items: center;
					cursor: pointer;
					.renling-img-true{
						width: 16px;
						height: 16px;
						margin-right: 8px;
						background-image: url('../../../../assets/images/owner/renling1.png');
						background-size: 100% 100%;
						background-repeat: no-repeat;
					}
					.renling-img-false{
						width: 16px;
						height: 16px;
						margin-right: 8px;
						background-image: url('../../../../assets/images/owner/renling2.png');
						background-size: 100% 100%;
						background-repeat: no-repeat;
					}
					
					.renling-hui{
						font-size: 13px;
						font-weight: 400;
						color: rgba(35,35,35,0.4);
					}
					.renling-hei{
						font-size: 13px;
						font-weight: 400;
						color: #3D3D3D;
					}
					
					
				}
				
				
				.renling-btn:hover{
					.renling-hei{
						color: #0081FF;
					}
					
				}
				
			}
			
		}
		.table-item1{
			::v-deep .el-table__body-wrapper{
				color: #232323;
			}
		}
		.fixed-table{
			overflow:initial;

			::v-deep .el-table__header-wrapper{
				position: sticky;
				top:56px;
				z-index: 9;
			}
			::v-deep .el-table__fixed-header-wrapper{
				position: sticky;
				z-index: 9;
				top: 56px;
			}
			::v-deep .el-table__fixed{
				overflow-x: clip;
				overflow-y: clip;
			}
			
		}
		.table-item-jf1{
			border-top:1px solid  #EFEFEF;
		}
		.pagination{
			padding: 14px ;
		   .el-pagination{
			   float: right ;
		   }
		}
	}
	
	
</style>
