<template>
  <el-dialog
    title="总部企业" 
    :visible.sync="infoVisible"
    :close-on-click-modal="false"
    :close-on-press-escape="false"
    @close="infoClose"
    custom-class="headquarterEnterprise-dialog"
    append-to-body
    width="75%"
  >
    <div class="headquarterEnterprise-box">
      <el-form :inline="true" :model="formInline" size="small" class="headquarterEnterprise-form" ref="queryFrom">
        <el-col :span="21">
          <el-form-item label="企业名称：">
            <el-input v-model.trim="formInline.enterpriseName" placeholder="请输入内容"></el-input>
          </el-form-item>
          <el-form-item label="统一社会信用代码："> <!-- 申报单位 -->
            <el-input v-model.trim="formInline.creditCode" placeholder="请输入统一社会信用代码"></el-input>
          </el-form-item>
          <el-form-item label="总部类型：">
            <el-select class="ignoreElement" v-model="formInline.status" placeholder="请选择总部类型">
              <!-- <el-option
                v-for="dict in dict.type.bms_approval_status"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value">
              </el-option> -->
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item>
            <el-button size="mini" @click="resetQuery('queryFrom')">重置</el-button>
            <el-button size="mini" type="primary" @click="handleQuery('queryFrom')">查询</el-button>
          </el-form-item>
        </el-col>
      </el-form>
      <!-- <el-row class="radio_btn"> -->
      <el-col class="radio_btn">
        <el-radio-group v-model="formInline.statusChange" @change="toggleOptionsEnter" fill="#134EE6">
          <el-radio-button label="0">全部(343)</el-radio-button>
          <el-radio-button label="1">省级总部(67)</el-radio-button>
          <el-radio-button label="2">市级总部(149)</el-radio-button>
          <el-radio-button label="3">区级总部(127)</el-radio-button>
        </el-radio-group>
      </el-col>
      <!-- </el-row> -->
      <section>
        <el-table 
          v-loading="loading" 
          class="dataMap-two-table" 
          :data="tableData" 
          :row-class-name="tableRowClassName" 
          :header-cell-style="{background:'#D1D9E6'}"
          height="500px"
        >  <!-- :max-height="tabHeader" -->
          <el-table-column label="序号" type="index" align="center" width="50"/>
          <el-table-column label="企业名称" prop="enterpriseName" align="center"/>
          <el-table-column label="统一信用代码" prop="creditCode" align="center" />
          <el-table-column label="总部类型" prop="type" align="center" width="100">
            <template slot-scope="scope">
              <div>{{ scope.row.type }}</div>
            </template>
          </el-table-column>
          <el-table-column label="税收(亿元)" prop="taxRevenue" align="center" width="100"/>
          <el-table-column label="产值(亿元)" prop="productionValue" align="center" width="100"/>
          <el-table-column label="营收(亿元)" prop="revenue" align="center" width="100" />
          <el-table-column label="销售额(亿元)" prop="sale" align="center" width="100" />
          <el-table-column label="操作" align="center" width="100">
            <template slot-scope="scope">
              <div class="project-trace-table-number" @click="enterpriseInfo(scope.row)">企业详情</div>
            </template>
          </el-table-column>
        </el-table>
        <my-pagination 
          :total="total"
          :page="pagination.current"
          :limit="pagination.size"
          @pagination="getPagination"
          :current-page.sync="pagination.current" 
        ></my-pagination>
      </section>
    </div>
  </el-dialog>
</template>
<script>
import myPagination from "@/views/components/Pagination/index.vue"
export default {
  components:{myPagination},
  name: "honorDialog",
  data() {
    return {
      infoVisible: false,
      loading: false,
      tableData:[
        {
          enterpriseName:"XX信息技术服务有限公司",
          creditCode:"91310311118959380R",
          type:"制造业总部",
          taxRevenue:"506.63",
          productionValue:"201",
          revenue:"188",
          sale:"199",
        },{
          enterpriseName:"XX信息技术服务有限公司",
          creditCode:"91310311118959380R",
          type:"制造业总部",
          taxRevenue:"506.63",
          productionValue:"201",
          revenue:"188",
          sale:"199",
        },{
          enterpriseName:"XX信息技术服务有限公司",
          creditCode:"91310311118959380R",
          type:"制造业总部",
          taxRevenue:"506.63",
          productionValue:"201",
          revenue:"188",
          sale:"199",
        },
      ],
      formInline:{
        enterpriseName:"",
        creditCode:"",
        statusChange:"0"
      },
      pagination: {
        current:1,
        size:10,
      },
      total:40,
    }
  },
  methods:{
    open(){
      this.infoVisible = true;
    },
    infoClose(){
      this.infoVisible = false;
    },
    // 获取页码
    getPagination(pages) {
      this.pagination.current = pages.page;
      this.pagination.size = pages.limit;
    },
    // 重置
    resetQuery(){},
    // 查询
    handleQuery(){},
    // 大类数量点击
    enterpriseInfo(row){
      // this.$router.push({
      //   name: 'enterpriselibraryInfo',
      //   query: { userId: row.id, creditCode: row.tyshxydm }
      // })
    },
    // tab切换
    toggleOptionsEnter(val){
      // this.handleQuery();
    },
    // 修改table背景色
    tableRowClassName({row, rowIndex}){
      if (rowIndex % 2 !== 0) {
        return 'evenNumber-row';
      }
      return '';
    },
  },
}
</script>
<style lang="scss" scoped>
::v-deep .headquarterEnterprise-dialog {
  margin-top: 10vh !important;
}
</style>