<template>
  <div class="equity-freezing-container">

    <el-tabs v-model="queryParams.type" @tab-click="handleClick" class="detail-tab">
      <el-tab-pane label="股权冻结" name="0"></el-tab-pane>
      <el-tab-pane label="历史股权冻结" :disabled="tableDataTotal==0" name="1"></el-tab-pane>
    </el-tabs>

    <head-form-new ref="headFormNew" title="" :form-data="formData" :query-params="queryParams" :total="tableDataTotal" :isExcel="true"
      @handle-search="handleSearch" />

    <skeleton v-if="isSkeleton" style="padding: 16px"></skeleton>

    <tables v-if="!isSkeleton" :indexFixed="true" :tableData="tableData" :forData="forData" :tableDataTotal="tableDataTotal"
      :queryParams="queryParams" @handle-current-change="handleCurrentChange">
      <template slot="operation-table" slot-scope="scope">
        <span style="color: #0081FF;cursor: pointer;" @click="viewDetail(scope.row)">操作</span>
      </template>
    </tables>
  </div>
</template>
<script>
import skeleton from '../component/skeleton';
import mixin from '@/views/detail/party-a/mixins/mixin';
import { getEquityFreezingApi } from "@/api/detail/party-a/riskInformation";
export default {
  name: "equityFreezingContainer",
  mixins: [mixin],
  components: {
    skeleton
  },
  props: ['companyId'],
  data() {
    return {
      queryParams: {
        cid: this.companyId,
        pageNum: 1,
        pageSize: 10,
        type: "0"
      },
      forData: [
        { label: '执行通知书文号', prop: 'name', width: '164' },
        { label: '被执行人', prop: 'companyName', minWidth: '146' },
        { label: '股权数额', prop: 'executionApplicant', width: '113' },
        { label: '执行法院', prop: 'court', minWidth: '146' },
        { label: '状态', prop: 'releaseDate', width: '50' },
        { label: '冻结起止日期', prop: 'source', width: '171' },
        { label: '公式时间', prop: 'source', width: '93' },
        { label: '操作', prop: 'operation-table', width: '50', slot: true },
      ],
      formData: [
        { type: 5, fieldName: 'time', value: '', placeholder: '选择日期', startTime: 'dateFrom', endTime: 'dateTo', uid: this.getUid() },
      ],
      //列表
      tableLoading: false,
      tableData: [],
      tableDataTotal: 0,
      showList: [],
      isSkeleton: true,
      resetStatus: false
    };
  },
  //可访问data属性
  created() {
    this.initDetail();
  },
  //计算集
  computed: {

  },
  //方法集
  methods: {
    async initDetail() {
      try {
        await this.handleQuery();
      } catch (error) {

      }
    },
    resetQueryParams() {
      const data = this.$options.data.call(this);
      this.queryParams = { ...data.queryParams, type: this.queryParams.type };
      this.formData[0].value = "";
    },
    async handleQuery(params) {
      try {
        let data = params ? params : this.queryParams;
        this.isSkeleton = true;
        const res = await getEquityFreezingApi(data);
        this.tableData = res.rows ? res.rows : [];
        this.tableDataTotal = res.total ? res.total : 0;
      } catch (error) {
        console.log(error);
      } finally {
        this.isSkeleton = false;
      }
    },
    handleClick(v) {
      if (v.name == this.queryParams.type) return;
      this.resetQueryParams();
      this.handleQuery();
    },
    // 查看详情
    viewDetail(row) {

    }
  },
}
</script>
<style lang="scss" scoped>
.equity-freezing-container {
  padding: 16px;
  background: #ffffff;
  border-radius: 4px;
  input {
    border: 1px solid #efefef;
  }
  ::v-deep .el-form-item {
    margin-right: 8px !important;
  }

  .query-box {
    margin: 10px 0 20px;
  }
  .cell-span {
    display: inline-block;
    position: relative;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    cursor: pointer;

    > span {
      display: inline-block;
      width: 37px;
      position: absolute;
      right: 0;
      bottom: 0;
      background-color: #fff;
      z-index: 1;
    }
  }

  .detail-tab {
    margin: 0 0 0 -16px;
    ::v-deep .el-tabs__nav-wrap::after {
      display: none;
    }
    ::v-deep .el-tabs__item {
      font-size: 16px;
      height: 30px;
      line-height: 30px;
      padding: 0 16px;
      &.is-active {
        font-weight: bold;
      }
    }
  }
  @import "@/assets/styles/search-common.scss";
}
</style>
