<template>
  <div class="app-container urban" ref="urban">
    <Region v-if="province" :province="province" :dataQuery="dataQuery" @addressListbtn="addressListbtn"></Region>
    <div class="content" ref="queryForm">
      <div class="flex-box query-box">
        <div class="flex-box query-params">
          <span class="common-title">城投平台</span>
        </div>
      </div>
      <div class="search">
        <el-radio-group v-model="queryParams.radio" @change="changeRadio">
          <el-radio label="1">含下属辖区</el-radio>
          <el-radio label="2">本级</el-radio>
        </el-radio-group>
        <div class="search-box">
          <span style="cursor: pointer;" :class="searchState ? 'color':''" @click="handleSearch">筛选
            <i v-if="searchState" class="el-icon-caret-top" style="color:#0081FF;"></i>
            <i v-else class="el-icon-caret-bottom" style="color:rgba(35,35,35,0.4);"></i>
          </span>
          <div v-show="searchState" ref="showContent" class="search-main">
            <div class="item">
              <span class="wrap_label">行政等级</span>
              <div class="item_ckquery">
                <span :class="{color_text:xzdjCalss == ''}" @click="changeXZDJ('','')">全部</span>
                <template v-for="(item,index) in typeList.uipExecutiveLevel">
                  <span :class="{color_text:index+1 === xzdjCalss}" @click="changeXZDJ(index+1,item)">{{item}}</span>
                </template>
              </div>
            </div>
            <div class="item">
              <span class="wrap_label">城投业务类型</span>
              <div class="item_ckquery">
                <span :class="{'color_text':queryParams.uipBusinessType.length === 0}" @click="changeType('',1)">全部</span>
                <template v-for="(item,index) in typeList.uipBusinessType">
                  <span :class="{'color_text':queryParams.uipBusinessType.indexOf(item)!=-1}" @click="changeType(item,1)">{{item}}</span>
                </template>
              </div>
            </div>
            <div class="item">
              <span class="wrap_label">主体评级</span>
              <div class="item_ckquery">
                <span :class="{'color_text':queryParams.bratingSubjectLevel.length === 0}" @click="changeType('',2)">全部</span>
                <template v-for="(item,index) in typeList.bratingSubjectLevel">
                  <span :class="{'color_text':queryParams.bratingSubjectLevel.indexOf(item)!=-1}" @click="changeType(item,2)">{{item}}</span>
                </template>
              </div>
            </div>
            <div class="item">
              <span class="wrap_label">股东背景</span>
              <div class="item_ckquery">
                <span :class="{'color_text':queryParams.shareholderBg.length === 0}" @click="changeType('',3)">全部</span>
                <template v-for="(item,index) in typeList.shareholderBg">
                  <span :class="{'color_text':queryParams.shareholderBg.indexOf(item)!=-1}" @click="changeType(item,3)">{{item}}</span>
                </template>
              </div>
            </div>
            <div class="item">
              <span class="wrap_label">股权关系</span>
              <div class="item_ckquery">
                <span :class="{'color_text':queryParams.equityRelationship.length === 0}" @click="changeType('',4)">全部</span>
                <template v-for="(item,index) in typeList.equityRelationship">
                  <span :class="{'color_text':queryParams.equityRelationship.indexOf(item)!=-1}" @click="changeType(item,4)">{{item}}</span>
                </template>
              </div>
            </div>
            <div class="item">
              <span class="wrap_label">平台重要性</span>
              <div class="item_ckquery">
                <span :class="{'color_text':queryParams.platformImportance.length === 0}" @click="changeType('',5)">全部</span>
                <template v-for="(item,index) in typeList.platformImportance">
                  <span :class="{'color_text':queryParams.platformImportance.indexOf(item)!=-1}" @click="changeType(item,5)">{{item}}</span>
                </template>
              </div>
            </div>
            <!--<div class="item">-->
              <!--<span class="wrap_label" style="width: 78px;">开发区类别</span>-->
              <!--<div class="item_ckquery">-->
                <!--<span>全部</span>-->
                <!--<template v-for="(item,index) in lfqType">-->
                  <!--<span>{{item}}</span>-->
                <!--</template>-->
              <!--</div>-->
            <!--</div>-->
            <!--<div class="item">-->
              <!--<span class="wrap_label">更多筛选</span>-->
              <!--<div class="item_ckquery">-->
                <!--<span :class="addresslength>0?'select-active':''">注册地区{{addresslength>0?(addresslength+'项'):''}}</span>-->
                <!--<el-cascader ref="address" class="cascader-region" popper-class='cascader-region-addd'-->
                             <!--@input="addressListbtn"  v-model="queryParams.address" :options="addressList" :props="props" collapse-tags></el-cascader>-->
              <!--</div>-->
            <!--</div>-->
          </div>
        </div>
        <el-input class="search-input" placeholder="输入企业名称关键词" v-model="queryParams.keyword" clearable @clear="handleKeyword()">
          <template slot="prepend"><i class="el-icon-search"></i></template>
          <el-button slot="append" @click="handleKeyword">搜索</el-button>
        </el-input>
      </div>
      <div class="list-box">
        <div class="item">
          <div class="left">
            <p>{{statistics.count}}<span>家</span></p>
            <span>平台家数</span>
          </div>
          <img src="@/assets/images/urban/img1.png">
        </div>
        <div class="item">
          <div class="left">
            <p>{{statistics.creditBalance}}<span>亿元</span></p>
            <span>授信余额</span>
          </div>
          <img src="@/assets/images/urban/img2.png">
        </div>
        <div class="item">
          <div class="left">
            <p>{{statistics.totalAssets}}<span>亿元</span></p>
            <span>资产总额</span>
          </div>
          <img src="@/assets/images/urban/img3.png">
        </div>
        <div class="item">
          <div class="left">
            <p>{{statistics.accountsReceivable}}<span>亿元</span></p>
            <span>营收账款</span>
          </div>
          <img src="@/assets/images/urban/img4.png">
        </div>
        <div class="item">
          <div class="left">
            <p>{{statistics.nonStandardBalance}}<span>亿元</span></p>
            <span>非标余额</span>
          </div>
          <img src="@/assets/images/urban/img5.png">
        </div>
      </div>
    </div>
    <div class="content">
      <div class="flex-box query-box">
        <div class="flex-box query-params">
          <span class="common-title">城投平台列表</span>
        </div>
        <div class="flex-box query-ability">
          <span class="total">共{{tableDataTotal}}条</span>
          <span class="flex-box" @click="handleMessage"><img src="@/assets/images/ability_excel.png">导出EXCEL</span>
        </div>
      </div>
      <div class="table-item">
        <el-table
          v-if="tableDataTotal > 0"
          v-loading="tableLoading"
          :data="tableData"
          element-loading-text="Loading"
          @sort-change="sortChange"
          border
          fit
          highlight-current-row
        >
          <el-table-column label="序号" width="60" align="left" fixed>
            <template slot-scope="scope">{{ pageIndex * pageSize - pageSize + scope.$index + 1 }}</template>
          </el-table-column>
          <el-table-column prop="companyName" label="公司名称" width="300" fixed>
            <template slot-scope="scope">
              <router-link  :to="`/enterprise/${encodeStr(scope.row.companyId)}`" tag="a" class="a-link companyName" v-html="scope.row.companyName" ></router-link>
              <span @click="handleClick(scope.row)" class="table-span" style="color: #3D3D3D;cursor: pointer;" v-if="scope.row.claimStatus === 0"><img src="@/assets/images/urban/rl_icon1.png"/>认领</span>
              <span @click="handleCancelClaim(scope.row)" class="table-span" style="color: rgba(35,35,35,0.4);cursor: pointer;" v-if="scope.row.claimStatus === 1"><img src="@/assets/images/urban/rl_icon2.png"/>已认领</span>
            </template>
          </el-table-column>
          <el-table-column prop="city" label="区域" :formatter="formatStatus" width="150">
            <template slot-scope="scope">
              <router-link :to="{path:'/macro/economies',query:{provinceId:scope.row.provinceId,province:scope.row.province}}" tag="a" class="a-link">
                {{ scope.row.province}}{{scope.row.city ? '-': ''}}{{ scope.row.city}}{{scope.row.area ? '-': ''}}{{ scope.row.area}}
              </router-link>
              <!--<span v-else>-</span>-->
            </template>
          </el-table-column>
          <el-table-column prop="biddingCount" label="招标数量" :formatter="formatStatus" sortable="custom"  width="110" align="right"/>
          <el-table-column prop="landInfoCount" label="城投拿地" :formatter="formatStatus" sortable="custom" width="100" align="right"/>
          <el-table-column prop="supplierCount" label="供应商" :formatter="formatStatus" sortable="custom" width="100" align="right"/>
          <el-table-column prop="bondBalance" label="债券余额（亿元）" :formatter="formatStatus" sortable="custom" width="140" align="right"/>
          <el-table-column prop="bratingSubjectLevel" label="主体评级" :formatter="formatStatus" width="110" />
          <el-table-column prop="uipExecutiveLevel" label="行政级别" :formatter="formatStatus" width="110" />
          <el-table-column prop="shareholderBg" label="股东背景" :formatter="formatStatus" width="110" />
          <el-table-column prop="equityRelationship" label="股权关系" :formatter="formatStatus" width="110" />
          <el-table-column prop="platformImportance" label="平台重要性" :formatter="formatStatus" width="110" />
          <el-table-column prop="uipBusinessType" label="城投业务类型" :formatter="formatStatus" width="140" >
            <template slot="header" slot-scope="scope">
              <span>城投业务类型
                <el-tooltip popper-class="tips" effect="light" content="   根据主营业务构成划分为土地开发整理、基础设施建设、交通建设运营、棚改保障房建设、公用事业等7大类型。" placement="top">
                  <i class="el-icon-warning-outline"></i>
                </el-tooltip>
              </span>
            </template>
          </el-table-column>
          <el-table-column prop="actualController" label="实控人" :formatter="formatStatus" width="250" />
          <el-table-column prop="latestReportPeriod" label="最新报告期" :formatter="formatStatus" width="120" />
          <el-table-column prop="totalAssets" label="总资产（亿元）" :formatter="formatStatus" sortable="custom" width="130" align="right"/>
          <el-table-column prop="belongNetAssets" label="归母净资产（亿元）" :formatter="formatStatus" sortable="custom" width="160" align="right"/>
          <el-table-column prop="monetaryFunds" label="货币资金（亿元）" :formatter="formatStatus" sortable="custom" width="150" align="right"/>
          <el-table-column prop="landAssets" label="土地资产（亿元）" :formatter="formatStatus" sortable="custom" width="150" align="right"/>
          <el-table-column prop="restrictedAssets" label="受限资产（亿元）" :formatter="formatStatus" sortable="custom" width="150" align="right"/>
          <el-table-column prop="accountsReceivable" label="应收账款（亿元）" :formatter="formatStatus" sortable="custom" width="150" align="right"/>
          <el-table-column prop="otherReceivable" label="其他应收款（亿元）" :formatter="formatStatus" sortable="custom" width="160" align="right"/>
          <el-table-column prop="econData001" label="公益性＆准公益性主营占比（%）" :formatter="formatStatus" width="160" align="right"/>
          <el-table-column prop="receivableFromGovRatio" label="应收类款项来自政府占比（%）" :formatter="formatStatus" width="160" align="right"/>
          <el-table-column prop="govSubsidy" label="政府补助（亿元）" :formatter="formatStatus" width="130" align="right" />
          <el-table-column prop="specialPayable" label="专项应付款（亿元）" :formatter="formatStatus" width="140" align="right"/>
          <el-table-column prop="operatingIncome" label="营业收入（亿元）" :formatter="formatStatus" width="130" align="right"/>
          <el-table-column prop="belongNetProfit" label="归母净利润（亿元）" :formatter="formatStatus" width="140" align="right"/>
          <el-table-column prop="roe" label="净资产收益率（%）" :formatter="formatStatus" width="140" align="right"/>
          <el-table-column prop="netOperatingCashFlow" label="经营现金流量净额（亿元）" :formatter="formatStatus" width="160" align="right"/>
          <el-table-column prop="netFinancingCashFlow" label="筹资现金流量净额（亿元）" :formatter="formatStatus" width="160" align="right"/>
          <el-table-column prop="netInvestmentCashFlow" label="投资现金流量净额（亿元）" :formatter="formatStatus" width="160" align="right"/>
          <el-table-column prop="totalLiabilities" label="总负债（亿元）" :formatter="formatStatus" width="120" align="right"/>
          <el-table-column prop="uipInterestBearingDebt" label="有息债务（亿元）" :formatter="formatStatus" width="140" align="right"/>
          <el-table-column prop="econData002" label="有息债务/总负债（%）" :formatter="formatStatus" width="160" align="right"/>
          <el-table-column prop="tdr" label="资产负债率（%）" :formatter="formatStatus" width="140" align="right"/>
          <el-table-column prop="ofcb" label="综合融资成本（%）" :formatter="formatStatus" width="150" align="right"/>
          <el-table-column prop="cashRatio" label="现金比率" :formatter="formatStatus" width="110" align="right"/>
          <el-table-column prop="cashFlowRatio" label="现金流量比率" :formatter="formatStatus" width="120" align="right"/>
          <el-table-column prop="cashDebtRatio" label="现金到期债务比" :formatter="formatStatus" width="120" align="right"/>
          <el-table-column prop="creditBalance" label="授信余额（亿元）" :formatter="formatStatus" width="130" align="right"/>
          <el-table-column prop="econData003" label="授信余额/全部债务（%）" :formatter="formatStatus" width="160" align="right"/>
          <el-table-column prop="ebitdaIcr" label="EBITDA保障倍数" :formatter="formatStatus" width="150" align="right"/>
          <el-table-column prop="ppnBalanceProp" label="私募债余额占比（%）" :formatter="formatStatus" width="160" align="right"/>
          <el-table-column prop="econData004" label="一年内到期债权占比（%）" :formatter="formatStatus" width="160" align="right"/>
          <el-table-column prop="econData005" label="债券余额/有息债务（%）" :formatter="formatStatus" width="160" align="right"/>
          <el-table-column prop="loan" label="借款余额（亿元）" :formatter="formatStatus" width="140" align="right"/>
          <el-table-column prop="econData006" label="借款/有息债务（%）" :formatter="formatStatus" width="160" align="right"/>
          <el-table-column prop="nonStandardBalance" label="非标余额（亿元）" :formatter="formatStatus" width="140" align="right"/>
          <el-table-column prop="nonStandardRatio" label="非标余额/有息债务（%）" :formatter="formatStatus" width="160" align="right"/>
          <el-table-column prop="guaranteeAmount" label="对外担保金额（亿元）" :formatter="formatStatus" width="160" align="right"/>
          <el-table-column prop="guaranteeRatio" label="对外担保比例（%）" :formatter="formatStatus" width="160" align="right"/>
          <el-table-column prop="developmentZone" label="所属开发区" :formatter="formatStatus" width="160" />
          <!--<el-table-column prop="bl" label="开发区类别" width="160" />-->
        </el-table>
        <div class="empty" v-if="tableDataTotal === 0">
          <img class="img" src="@/assets/images/project/empty.png">
          <div class="p1">抱歉，没找到相关数据</div>
          <div class="p2">建议调整关键词或筛选条件，重新搜索</div>
        </div>
      </div>
      <div class="pagination-box" v-if="show_page && tableDataTotal>pageSize">
        <el-pagination background :current-page="pageIndex" :page-size="pageSize" :total="tableDataTotal" layout="prev, pager, next, jumper" @current-change="handleCurrentChange" @size-change="handleSizeChange" />
      </div>
    </div>
    <el-dialog :visible.sync="claimVisible" width="244" :show-close="false">
      <div>认领成功，是否完善客户信息？</div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="innerVisible = true">
          <router-link :to="`/enterprise/${encodeStr(companyId)}?customerId=${customerId}`" tag="a" >
            立即完善
          </router-link>
        </el-button>
        <el-button @click="claimVisible = false">稍后</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import {encodeStr} from "@/assets/js/common.js"
  import dataRegion from '@/assets/json/dataRegion'
  import { uipGroupData,urbanInvestmentPage,urbanInvestmentStatistics,claim,location,cancelClaim } from '@/api/macro/macro'
  import { infoHeader } from '@/api/detail/party-a/index'
  import Region from '../component/region'
export default {
  name: 'Urban',
  components: {
    Region
  },
  data() {
    return {
      encodeStr,
      queryParams:{
        keyword:'',
        uipExecutiveLevel:'', //行政级别
        uipBusinessType:[],   //城投业务类型
        bratingSubjectLevel:[],   //主体评级
        shareholderBg:[],   //股东背景
        equityRelationship:[],   //股权关系
        platformImportance:[],   //平台重要性
        address:[],
        radio:'1',
      },
      tableData:[],
      tableLoading: false,
      pageIndex: 1,
      pageSize: 20,
      tableDataTotal: null,
      selected:[],
      xzdjCalss:'',
      props: {
        value: 'id',
        multiple: true,
      },
      addressList: [],
      addresslength: 0,
      searchState:false,
      typeList:[],
      statistics:{},
      claimVisible:false,
      customerId:'',
      companyId:'',
      show_page:true,
      MaxPage:500,
      // 表格高度
      tableHeight: 0,
      dataQuery:{},
      province:'',
      provinceId:[]
    }
  },
  watch:{
    searchState:{
      handler(newVal, olVal) {
        if (newVal) {
          setTimeout(() => {
            document.addEventListener('click', this.handleSearch);
          }, 0);
        } else {
          document.removeEventListener('click', this.handleSearch);
        }
      }
    }
  },
  created() {
    this.dataRegion()
    this.getType()
    this.querySubmit()
    this.dataQuery=this.$route.query;
    if(this.dataQuery.provinceId){
      if(Array.isArray(this.dataQuery.province)){
        this.province=this.dataQuery.province[0];
      }else {
        this.province=this.dataQuery.province
        this.dataQuery.province = [this.dataQuery.province];
      }
      this.provinceId.push(this.dataQuery.provinceId)
    }else {
      location({}).then(res => {
        this.province=res.data.province;
        if(!this.dataQuery.provinceId){
          this.dataQuery.provinceId=res.data.provinceId
          let arr=[res.data.province]
          this.dataQuery.province=arr;
          this.provinceId.push(res.data.provinceId)
        }else {
          this.provinceId.push(this.dataQuery.provinceId)
        }
      })
    }
  },
  mounted() {
    this.$nextTick(() => {
      // window.innerHeight 浏览器窗口的可见高度，下面的 220 是除了table最大高度的剩余空间。
      // let height = this.$refs.urban.offsetHeight - this.$refs.queryForm.offsetHeight;
      // this.tableHeight = height;
      // console.log(window.innerHeight,"|||||||||")
      // console.log(this.$refs.urban.offsetHeight)
    })
  },
  methods: {
    getType(){
      uipGroupData({}).then(res => {
        this.typeList=res.data;
      })
    },
    // 查询提交
    async querySubmit() {
      this.tableLoading = true
      const params = { pageNum: this.pageIndex, pageSize: this.pageSize,type:Number(this.queryParams.radio)}
      const param={}
      // if(this.queryParams.address.length > 0){
      //   let arr = this.$refs.address.getCheckedNodes();
      //   let provinceCode = [],cityCode = [],countyCode = [];
      //   for (var i in arr) {
      //     if (arr[i].parent) {
      //       if (!arr[i].parent.checked) {
      //         arr[i].hasChildren && cityCode.push(arr[i].value);
      //         !arr[i].hasChildren && countyCode.push(arr[i].value);
      //       }
      //     } else {
      //       provinceCode.push(arr[i].value)
      //     }
      //   }
      //   if(provinceCode.length > 0){
      //     params.provinceIds=provinceCode
      //     param.provinceIds=provinceCode
      //   }
      //   if(cityCode.length > 0){
      //     params.cityIds=cityCode
      //     param.cityIds=cityCode
      //   }
      //   if(countyCode.length > 0){
      //     params.areaIds=countyCode
      //     param.areaIds=countyCode
      //   }
      // }

      if(this.provinceId.length > 0){
        params.provinceIds=[this.provinceId[0]]
      }
      if(this.provinceId.length > 1){
        params.cityIds=[this.provinceId[1]]
      }
      if(this.provinceId.length > 2){
        params.areaIds=[this.provinceId[2]]
      }

      if(this.queryParams.uipExecutiveLevel){
        params.uipExecutiveLevel=this.queryParams.uipExecutiveLevel;
        param.uipExecutiveLevel=this.queryParams.uipExecutiveLevel;
      }
      if(this.queryParams.uipBusinessType.length > 0){
        params.uipBusinessType=this.queryParams.uipBusinessType;
        param.uipBusinessType=this.queryParams.uipBusinessType;
      }
      if(this.queryParams.bratingSubjectLevel.length > 0){
        params.bratingSubjectLevel=this.queryParams.bratingSubjectLevel;
        param.bratingSubjectLevel=this.queryParams.bratingSubjectLevel;
      }
      if(this.queryParams.shareholderBg.length > 0){
        params.shareholderBg=this.queryParams.shareholderBg;
        param.shareholderBg=this.queryParams.shareholderBg;
      }
      if(this.queryParams.equityRelationship.length > 0){
        params.equityRelationship=this.queryParams.equityRelationship;
        param.equityRelationship=this.queryParams.equityRelationship;
      }
      if(this.queryParams.platformImportance.length > 0){
        params.platformImportance=this.queryParams.platformImportance;
        param.platformImportance=this.queryParams.platformImportance;
      }


      if(this.queryParams.field){
        params.field=this.queryParams.field
      }
      if(this.queryParams.order){
        params.order=this.queryParams.order
      }
      if(this.queryParams.keyword){
        params.keyword=this.queryParams.keyword
      }

      urbanInvestmentPage(params).then(res => {
        this.tableLoading = false
        this.tableData = res.data.list;
        this.tableDataTotal = res.data.totalCount
      })
      urbanInvestmentStatistics(params).then(res => {
        this.statistics=res.data;
      })
    },
    //地区
    async dataRegion() {
      // await axios.post("https://files.jiansheku.com/file/json/common/dataRegion.json", {}, {
      //   headers: {
      //     'Content-Type': 'application/json'
      //   }
      // }).then(res => {
      //   if (res.data.code == 200) {
      //     console.log(res.data.data)
      //   }
      // })
      var str = [];
      for (let x = 0; x < 3; x++) {
        for (let i = 0; i < dataRegion.length; i++) {
          if (dataRegion[i].regionLevel == x + 1 && x + 1 == 1) {
            str.push({
              'id': dataRegion[i].id,
              "label": dataRegion[i].regionName,
              "short": dataRegion[i].short,
              "value": dataRegion[i].parentId,
              "children": []
            });
          } else if (dataRegion[i].regionLevel == x + 1 && x + 1 == 2) {
            for (let j = 0; j < str.length; j++) {
              if (str[j].id == dataRegion[i].parentId) {
                str[j].children.push({
                  'id': dataRegion[i].id,
                  "label": dataRegion[i].regionName,
                  "short": dataRegion[i].short,
                  "value": dataRegion[i].parentId,
                  "children": []
                });
              }
            }
          } else if (dataRegion[i].regionLevel == x + 1 && x + 1 == 3) {
            for (let j = 0; j < str.length; j++) {
              for (let k = 0; k < str[j].children.length; k++) {
                if (str[j].children[k].id == dataRegion[i].parentId) {
                  str[j].children[k].children.push({
                    'id': dataRegion[i].id,
                    "label": dataRegion[i].regionName,
                    "short": dataRegion[i].short,
                    "value": dataRegion[i].parentId
                    // "children":[]
                  });
                }
              }
            }
          }
        }
      }
      this.addressList = str;
    },
    // 重置页数
    handleSizeChange(val) {
      this.pageIndex = 1
      this.pageSize = val
      this.querySubmit()
    },
    // 跳转指定页数
    handleCurrentChange(val) {
      if(this.MaxPage<val){
        this.show_page = false
        this.$nextTick(() => {
          this.pageIndex = 1
          this.$message.warning(`对不起，最多只能访问${this.MaxPage}页`)
          this.show_page = true
        })
      }else {
        this.pageIndex = val
        this.querySubmit()
      }
    },
    handleSearch(event){
      // this.searchState=!this.searchState;
      let dom = this.$refs.showContent;
      if (!dom.contains(event.target)) {
        this.searchState = !this.searchState;
        document.removeEventListener('click', this.handleSearch);
      }
    },
    changeXZDJ(index,name) {
      this.xzdjCalss = index;
      this.queryParams.uipExecutiveLevel=name;
      this.querySubmit()
    },
    addressListbtn(data) {
      this.province=data.province;
      this.provinceId=data.provinceId;
      this.dataQuery.province=data.provinces;
      let params={}
      if(data){
        if(this.provinceId.length > 0){
          params.provinceId=this.provinceId[0]
        }
        if(this.provinceId.length > 1){
          params.cityId=this.provinceId[1]
        }
        if(this.provinceId.length > 2){
          params.areaId=this.provinceId[2]
        }
      }
      location(params).then(res => {
        console.log(res.data)
      })
      this.pageIndex = 1;
      this.querySubmit()
    },
    changeType(item,index){
      switch (index) {
        case 1:
          if(item === ''){
            this.queryParams.uipBusinessType=[]
          }else {
            if (this.queryParams.uipBusinessType.indexOf(item) !== -1) {
              this.queryParams.uipBusinessType.splice(this.queryParams.uipBusinessType.indexOf(item), 1);
            } else {
              this.queryParams.uipBusinessType.push(item);
            }
          }
          break;
        case 2:
          if(item === ''){
            this.queryParams.bratingSubjectLevel=[]
          }else {
            if (this.queryParams.bratingSubjectLevel.indexOf(item) !== -1) {
              this.queryParams.bratingSubjectLevel.splice(this.queryParams.bratingSubjectLevel.indexOf(item), 1);
            } else {
              this.queryParams.bratingSubjectLevel.push(item);
            }
          }
          break;
        case 3:
          if(item === ''){
            this.queryParams.shareholderBg=[]
          }else {
            if (this.queryParams.shareholderBg.indexOf(item) !== -1) {
              this.queryParams.shareholderBg.splice(this.queryParams.shareholderBg.indexOf(item), 1);
            } else {
              this.queryParams.shareholderBg.push(item);
            }
          }

          break;
        case 4:
          if(item === ''){
            this.queryParams.equityRelationship=[]
          }else {
            if (this.queryParams.equityRelationship.indexOf(item) !== -1) {
              this.queryParams.equityRelationship.splice(this.queryParams.equityRelationship.indexOf(item), 1);
            } else {
              this.queryParams.equityRelationship.push(item);
            }
          }
          break;
        case 5:
          if(item === ''){
            this.queryParams.platformImportance=[]
          }else {
            if (this.queryParams.platformImportance.indexOf(item) !== -1) {
              this.queryParams.platformImportance.splice(this.queryParams.platformImportance.indexOf(item), 1);
            } else {
              this.queryParams.platformImportance.push(item);
            }
          }
          break;
      }
      this.pageIndex = 1;
      this.querySubmit()
    },
    formatStatus: function(row, column, cellValue) {
      return cellValue? cellValue : '-'
    },
    sortChange({ column, prop, order }){
      this.queryParams.field = prop
      if(column.order === "ascending"){
        this.queryParams.order = 'asc'
      }else if(column.order === "descending"){
        this.queryParams.order = 'desc'
      }else {
        this.queryParams.order=''
        this.queryParams.field=''
      }
      this.pageIndex = 1;
      this.querySubmit()
    },
    handleKeyword(){
      this.pageIndex = 1;
      this.querySubmit()
    },
    changeRadio(){
      this.pageIndex = 1;
      this.querySubmit()
    },
    handleMessage(){
      this.$message({
        message: '功能正在开发中',
        type: 'warning'
      });
    },
    handleClick(item){
      this.companyId=item.companyId;
      infoHeader({companyId:this.companyId}).then(res => {
        if(res.code === 200){
          let registerAddress=res.data.provinceName
          if(res.data.cityName){
            registerAddress=registerAddress+'-'+res.data.cityName
            if(res.data.districtName){
              registerAddress=registerAddress+'-'+res.data.districtName
            }
          }
          let params={
            uipId:item.uipId,
            companyName:item.companyName,
            companyId:item.companyId,
            creditLevel:item.bratingSubjectLevel,
            legalPerson:res.data.corporatePerson,
            registerCapital:res.data.registeredCapital,
            provinceId:res.data.provinceId || '',
            cityId:res.data.cityId || '',
            districtId:res.data.districtCode || '',
            registerAddress:registerAddress,
            creditCode:res.data.creditCode,
          }
          claim(params).then(res => {
            if(res.code === 200){
              this.claimVisible=true;
              this.customerId=res.data.customerId;
              this.querySubmit()
            }
          })
        }
      })
    },
    handleCancelClaim(item){
      // cancelClaim(encodeURIComponent(item.companyName),{
      //   headers: {
      //     "content-type": "application/json;charset=UTF-8",
      //   },
      // }).then(res => {
      //   if(res.code === 200){
      //     this.querySubmit()
      //   }
      // })
    }
  },
}
</script>
<style lang="scss">
  .el-tooltip__popper.is-light.tips{
    box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.1);
    border: 0;
    width: 300px;
    color:#232323;
  }
  .el-tooltip__popper.tips.is-light[x-placement^=top] .popper__arrow{
    border-top-color:#ffffff;
  }
  .el-tooltip__popper.tips.is-light[x-placement^=bottom] .popper__arrow{
    border-top-color:#ffffff;
  }
</style>
<style lang="scss" scoped>
  .app-container{
    padding: 0;
  }
  .urban{
    .content{
      background: #ffffff;
      padding: 16px;
      margin-bottom: 16px;
      border-radius: 4px;
      .search{
        margin-top: 22px;
        .search-box{
          display: inline-block;
          margin-right: 32px;
          margin-left: 32px;
          /*cursor: pointer;*/
          color:#232323;
          position: relative;
          .color{
            color:#0081FF;
          }
          .search-main{
            background: #ffffff;
            box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.1);
            border-radius: 4px;
            width: 880px;
            /*height: 337px;*/
            padding: 16px;
            position: absolute;
            top: 25px;
            left: 0;
            z-index: 999;
            .item{
              margin-bottom: 5px;
              /*display: flex;*/
              /*align-items: center;*/
              font-size: 14px;
              .wrap_label{
                color: rgba(35,35,35,0.8);
                margin-right: 12px;
                line-height: 30px;
                float: left;
              }
              .item_ckquery{
                position: relative;
                span{
                  color: #232323;
                  padding: 5px 12px;
                  display: inline-block;
                  cursor: pointer;
                  margin-right: 8px;
                }
                span:hover{
                  background: #F3F4F5;
                  border-radius: 4px;
                  color:#232323;
                }
                .color_text{
                  background: #F3F4F5;
                  border-radius: 4px;
                  color: #0081FF;
                }
                .select-active{
                  color: #0081FF;
                }
              }

              .cascader-region {
                position: absolute;
                left: 0;
                top: -6px;
                opacity: 0;
                line-height: 22px;
              }
            }
          }
        }
        ::v-deep .search-input{
          /*::v-deep .el-input{*/
            width: 260px;
            height: 32px;
            .el-input-group__prepend:first-child{
              padding: 0;
              background-color:#ffffff;
              border-right: 0;
              padding-left: 8px;
              i{
                color:#0081FF;
              }
            }
            .el-input__inner{
              border-left: 0;
              height: 32px;
              line-height: 32px;
            }
            .el-input-group__append:last-child{
              width: 60px;
              padding: 0;
              text-align: center;
              background: #F5F5F5;
              color:#0081FF;
              border-left: 0;
            }
          /*}*/
        }

      }
      .table-item{
        margin-top: 22px;
        .empty{
          margin: 0 auto;
          height: 550px;
          text-align: center;
          border-top: 1px solid #EFEFEF;
          .img{
            width: 108px;
            height: 108px;
            margin-bottom: 24px;
            margin-top: 150px;
          }
          .p1{
            color: #333333;
            font-size: 16px;
          }
          .p2{
            color: #999999;
            font-size: 14px;
            margin-top: 8px;
          }
        }
      }
      .companyName{
        width: 200px;
        display: inline-block;
        margin: 0;
      }
      .table-span{
        float: right;
        img{
          width: 16px;
          height: 16px;
          margin-bottom: -4px;
          margin-right: 5px;
          /*margin-left: 20px;*/
        }
      }
      .list-box{
        display: flex;
        justify-content: space-between;
        .item{
          margin-top: 24px;
          width: 19%;
          height: 96px;
          background: url("../../../assets/images/urban/icon_bg.png") no-repeat;
          background-size: 100%;
          .left{
            margin-left: 16px;
            float: left;
            margin-top: 24px;
            p{
              font-size: 26px;
              font-weight: 700;
              margin: 0;
              span{
                margin-left: 3px;
              }
            }
            span{
              font-size: 14px;
              color: #3D3D3D;
              font-weight: 400;
            }
          }
          img{
            float: right;
            margin-right: 16px;
            width: 41px;
            height: 42px;
            margin-top: 27px;
          }
        }
      }
    }
    ::v-deep .el-dialog{
      width: 244px;
      margin: 0 !important;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      .el-dialog__header{
        display: none;
      }
      .el-dialog__body{
        padding: 24px;
      }
      .el-dialog__footer{
        text-align: center;
        padding: 0 24px 24px;
        .el-button{
          width: 72px;
          height: 28px;
          border-radius: 2px;
          font-size: 12px;
        }
        .el-button:first-child{
          background: #0081FF;
          border: 1px solid #0081FF;

          color: #FFFFFF;
        }
        .el-button:last-child{
          background: #FFFFFF;
          border: 1px solid #CCCCCC;
          color: rgba(35,35,35,0.8);
        }
        .el-button--medium{
          padding: 0;
        }
      }
    }
  }
</style>
