<!--列入严重违法（行政处罚）-->
<template>
  <div class="main-content m20">
    <!--头部-查询-->
    <div class="content-header">
      <div class="body search-body">
        <el-row style="margin-bottom:10px">
          <el-col :span="10">
            <label class="label-name" style="width: 220px">统一社会信用代码/注册号：</label>
            <div class="search-input-box">
              <el-input v-model="searchForm.uscc" clearable size="mini" type="text" class="search-input" placeholder="请输入统一社会信用代码/注册号" @keyup.enter.native="search" />
            </div>
          </el-col>
          <el-col :span="10">
            <label class="label-name">主体名称：</label>
            <div class="search-input-box">
              <el-input v-model="searchForm.entName" clearable size="mini" type="text" class="search-input" placeholder="请输入主体名称" @keyup.enter.native="search" />
            </div>
          </el-col>
          <el-col :span="4" style="padding-left: 20px">
            <el-button size="mini" type="primary" @click="findEnt">查询</el-button>
            <el-button size="mini" @click="searchForm={}">重置</el-button>
          </el-col>
        </el-row>
      </div>
    </div>
    <!--body-查询结果-->
    <div class="content-body">
      <div class="body">
        <el-table
          ref="multipleTable"
          v-loading="loading"
          :data="list"
          tooltip-effect="dark"
          style="width: 95%;margin:0 auto;padding-bottom: 40px"
          :fit="true"
          :header-cell-style="{background:'#8cc3fb',color:'#fff'}"
        >
          <el-table-column type="index" label="序号" width="80px" align="center" />
          <el-table-column label="统一社会信用代码/注册号" width="230" align="left">
            <template slot-scope="scope">
              {{ scope.row.uniscid || scope.row.regno }}
            </template>
          </el-table-column>
          <el-table-column prop="entname" :show-overflow-tooltip="true" label="主体名称" min-width="200" align="left" />
          <el-table-column prop="regstateCn" label="企业状态" width="200" align="left" />
          <el-table-column prop="name" label="法定代表人" width="200" align="left" />
          <el-table-column prop="regorgCn" label="登记机关" min-width="200" align="left" />
          <el-table-column label="成立日期" width="200" align="left">
            <template slot-scope="scope">
              {{ $moment(scope.row.estdate).format('YYYY-MM-DD') }}
            </template>
          </el-table-column>
          <el-table-column prop="oper" label="操作" width="100" align="center">
            <template slot-scope="scope">
              <el-button size="mini" type="primary" @click="startTask(scope.row)">办理</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>

<script>
import { listEnt } from '@/api/entBase'
import { startIncludeIllegal } from '@/api/illegal'
import { findOrganization } from '@/api/user'

export default {
  data() {
    return {
      searchForm: {},
      list: [],
      loading: false,
      decisionOrgan: JSON.parse(sessionStorage.getItem('user')).decisionOrgan
    }
  },
  mounted() {
  },
  methods: {
    findEnt() {
      if (!this.searchForm.uscc && !this.searchForm.entName) {
        return
      }
      this.loading = true
      listEnt(this.searchForm).then(res => {
        this.list = res.data
        this.loading = false
      })
    },
    // 启动待办
    startTask(item) {
      // 判断用户的区是否满足条件
      const code = this.decisionOrgan.scountrycode
      if (!(item.suporg && (item.suporg.startsWith(code) || item.suporg.startsWith(code)))) {
        this.$message.warning('该主体不属于' + this.decisionOrgan.sregorgname)
        return
      }

      this.$confirm('是否确认启动待办', '提示').then(() => {
        const params = {
          pripid: item.pripid
        }
        this.loading = true
        startIncludeIllegal(params).then(res => {
          this.loading = false
          if (res.code === 0) {
            this.$router.push({ path: '/illegal/listed/accept', query: { tasklistid: res.data.tasklistid, bizseq: res.data.bizseqid, workflowId: res.data.workflowid }})
          } else {
            this.$message.error(res.msg)
          }
        })
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.main-content{
  background: #Fff;
  padding: 0;
  .content-header{
    background: white;
    .label-name {
      text-align: right;
      display: inline-block;
      width: 220px;
      font-size: $table-content-font-size;
    }
    .search-input-box{
      display: inline-block;
      width: calc(100% - 220px);
      // width: 300px;
    }
    .search-input{
      cursor: pointer;

    }
    .body{
      padding: 20px 0 ;
      border-top:none;
      margin-bottom: 40PX;
    }
  }
  .content-body{
    background:white;
    margin-bottom: 100px;
  }
  .header{
    /* height:50PX;
    padding:15PX 10PX;
    border:1PX solid #eee; */
    .title{
      font-weight: 600;
      font-size: 1.2rem;
    }
  }
  .page-box{
    margin:10PX;
    .el-pagination{
      text-align: right;
    }
  }
}
.fixed-bottom {
  position: fixed;
  width: 100%;
  bottom: -10px;
  right: 0;
  z-index: 99;
  padding: 10px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(to bottom, #fff 0%,#8bbef6 100%);
  box-shadow:  1px -4px 4px rgba(0, 21, 41, 0.08);
}
.content-body{
  background: #fff;
  /deep/.el-table .warning-row {
    background: #eaf4fe!important;
  }
}
</style>
<style lang="scss">
.content-body .el-table-column--selection .cell{
  padding-right: 0px;
}
</style>
