<!--  -->
<template>
  <div class="main-content blackInfo">
    <div class="content-header">
      <!-- <span class="title">主体失信异常名单信息详情</span> -->
      <h2 style="display: inline-block;margin: 0px;padding: 5px">{{ entname }}</h2>
      <!-- <el-button type="warning" icon="el-icon-caret-left" size="mini" class="back-btn" @click="$router.back()">返回上一层</el-button> -->
    </div>
    <div class="content-body">
      <!-- v-if="abnLists.length > 0" -->
      <el-row v-if="abnLists.length > 0">
        <!-- <div class="tab">
          <div class="tab-title"><label>列入经营异常名录信息</label></div>
        </div> -->
        <el-table
          :data="abnLists"
          tooltip-effect="dark"
          style="width: 100%"
          :fit="true"
          :row-class-name="tableRowClassName"
          :header-cell-style="{background:'#8cc3fb',color:'#fff'}"
        >
          <el-table-column type="index" label="序号" width="50" align="center" />
          <el-table-column prop="specause" :show-overflow-tooltip="true" label="列入原因" min-width="120" align="left" />
          <el-table-column prop="a" :show-overflow-tooltip="true" label="列入法律法规及政策依据" min-width="140" align="left" />
          <el-table-column prop="includeWritsno" :show-overflow-tooltip="true" label="列入决定书" min-width="130" align="left">
            <template slot-scope="scope">
              <el-link @click="incOnlinePdf(scope.row)">{{ scope.row.includeWritsno }}</el-link>
            </template>
          </el-table-column>
          <el-table-column prop="abntime" :show-overflow-tooltip="true" label="列入日期" min-width="90" align="left" />
          <el-table-column prop="intoDecorg" :show-overflow-tooltip="true" label="作出决定机关" min-width="120" align="left" />
          <el-table-column prop="remexcpresCn" :show-overflow-tooltip="true" label="移出原因" min-width="120" align="left" />
          <el-table-column prop="remreasons" :show-overflow-tooltip="true" label="移出法律法规及政策依据" min-width="130" align="left" />
          <el-table-column prop="remWritsno" :show-overflow-tooltip="true" label="移出决定书" min-width="120" align="left">
            <template slot-scope="scope">
              <el-link @click="remOnlinePdf(scope.row)">{{ scope.row.remWritsno }}</el-link>
            </template>
          </el-table-column>
          <el-table-column prop="remdate" :show-overflow-tooltip="true" label="移出日期" min-width="90" align="left" />
          <el-table-column prop="remDecorg" :show-overflow-tooltip="true" label="移出决定机关" min-width="120" align="left" />
        </el-table>
      </el-row>
      <el-row v-if="illegalLists.length > 0" style="margin-top: 10px">
        <div class="tab">
          <div class="tab-title"><label>列入严重违法失信企业名单</label></div>
        </div>
        <el-table :data="illegalLists" tooltip-effect="dark" style="width: 100%" :fit="true">
          <el-table-column type="index" label="序号" width="50" align="center" />
          <el-table-column prop="abntime" :show-overflow-tooltip="true" label="列入日期" min-width="90" align="left" />
          <el-table-column prop="busname" :show-overflow-tooltip="true" label="作出决定机关" min-width="120" align="left" />
          <el-table-column prop="serillrea" :show-overflow-tooltip="true" label="列入原因" min-width="120" align="left" />
          <el-table-column prop="lostcreditexplain" :show-overflow-tooltip="true" label="列入法律法规及政策依据" min-width="130" align="left" />
          <el-table-column prop="remdate" :show-overflow-tooltip="true" label="移出日期" min-width="90" align="left" />
          <el-table-column prop="busname" :show-overflow-tooltip="true" label="移出作出决定机关" min-width="120" align="left" />
          <el-table-column prop="remexcpres" :show-overflow-tooltip="true" label="移出原因" min-width="120" align="left" />
          <el-table-column prop="lostcreditexplainrem" :show-overflow-tooltip="true" label="移出法律法规及政策依据" min-width="130" align="left" />
        </el-table>
      </el-row>
      <!-- <el-row v-if="abnLists.length > 0">
        <div class="tab">
          <div class="tab-title"><label>失信企业名单</label></div>
        </div>
        <el-table :data="tableData" tooltip-effect="dark" style="width: 100%" :fit="true">
          <el-table-column prop="index" label="序号" min-width="30" align="center" />
          <el-table-column prop="busname" :show-overflow-tooltip="true" label="业务名称" min-width="120" align="left" />
        </el-table>
      </el-row> -->
    </div>
  </div>
</template>

<script>
import { getBlackInfoDetails } from '@/api/blacklist'
import { word2Pdf } from '@/api/system'
export default {
// import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    // 这里存放数据
    return {
      adnIds: '',
      illegalIds: '',
      entname: '',
      pripid: '',
      abnLists: [],
      illegalLists: []
    }
  },
  // 监听属性 类似于data概念
  computed: {},
  // 监控data中的数据变化
  watch: {},
  // 生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {
    this.abnIds = this.$route.query.abnIds
    this.illegalIds = this.$route.query.illegalIds || this.illegalIds
    this.entname = this.$route.query.entname
    this.pripid = this.$route.query.pripid

    this.loadInfo()
  },
  // 方法集合
  methods: {
    tableRowClassName({ row, rowIndex }) {
      if (rowIndex % 2 === 1) {
        return 'warning-row'
      }
    },
    // pdf格式在线查看(列异)
    incOnlinePdf(row) {
      // row.url = `${process.env.VUE_APP_DOWNLOAD_URL}/` + row.url
      word2Pdf(row.includePath, row.includeBizseq, row.includeWritstype).then(res => {
        if (res.code === 0) {
          window.open(`${process.env.VUE_APP_DOWNLOAD_URL}/` + res.data, '_blank')
        } else {
          this.$message.error(res.msg)
        }
      })
    },
    // pdf格式在线查看(移异)
    remOnlinePdf(row) {
      // row.url = `${process.env.VUE_APP_DOWNLOAD_URL}/` + row.url
      word2Pdf(row.remPath, row.remBizseq, row.remWritstype).then(res => {
        if (res.code === 0) {
          window.open(`${process.env.VUE_APP_DOWNLOAD_URL}/` + res.data, '_blank')
        } else {
          this.$message.error(res.msg)
        }
      })
    },
    loadInfo() {
      getBlackInfoDetails(this.abnIds, this.illegalIds).then(res => {
        if (res.code === 0) {
          this.abnLists = res.data.abnLists || this.abnLists
          this.illegalLists = res.data.illegalLists || this.illegalLists
        }
      })
      console.log(this.abnLists.length)
    }
  }
}
</script>
<style lang='scss' scoped>
//@import url(); 引入公共css类
.main-content{
  padding: 10pt;
  .back-btn{
    position:absolute;
    right:40pt;
  }
  .content-header,.content-body{
    background: white;
    padding:10PX 10PX;
    border:1PX solid #eee;
  }
  .content-header{
    height:60PX;
    .title{
      font-weight: 700;
      font-size: $font-size-sub-title;
    }
  }
  .content-body{
    padding:20pt;
      .tab{
        .tab-title{
          label{
            display:inline-block;
          }
        }
      }
    .form{
      margin-bottom: 20pt;
    }
  }
}
</style>
