<template>
  <div class="limit-high-consumption-container">
    <head-form-new 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="source" slot-scope="scope">
        <span v-if="scope.row.source" style="color: #0081FF;cursor: pointer;" @click="viewOriginalArticle(scope.row)">查看原文</span>
        <span v-else>-</span>
      </template>
    </tables>
  </div>
</template>
<script>
import skeleton from '../component/skeleton';
import mixin from '@/views/detail/party-a/mixins/mixin';
import { getLimitHighConsumptionApi } from "@/api/detail/party-a/riskInformation";
export default {
  name: "limitHighConsumptionContainer",
  mixins: [mixin],
  components: {
    skeleton
  },
  props: ['companyId'],
  data() {
    return {
      queryParams: {
        cid: this.companyId,
        pageNum: 1,
        pageSize: 10
      },
      forData: [
        { label: '限消令对象', prop: 'name', width: '215' },
        { label: '关联对象', prop: 'companyName', minWidth: '136' },
        { label: '申请执行人', prop: 'executionApplicant', width: '136' },
        { label: '执行法院', prop: 'court', minWidth: '171' },
        { label: '发布日期', prop: 'releaseDate', width: '136' },
        { label: '原文', prop: 'source', width: '136', slot: true },
      ],
      formData: [
        { type: 5, fieldName: 'time', value: '', placeholder: '发布日期', startTime: 'dateFrom', endTime: 'dateTo', uid: this.getUid() },
      ],
      //列表
      tableLoading: false,
      tableData: [],
      tableDataTotal: 0,
      isSkeleton: true
    };
  },
  //可访问data属性
  created() {
    this.initDetail();
  },
  //计算集
  computed: {

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

      }
    },
    async handleQuery(params) {
      try {
        let data = params ? params : this.queryParams;
        this.isSkeleton = true;
        const res = await getLimitHighConsumptionApi(data);
        this.tableData = res.rows ? res.rows : [];
        this.tableDataTotal = res.total ? res.total : 0;
      } catch (error) {
        console.log(error);
      } finally {
        this.isSkeleton = false;
      }
    },
    // 查看原文
    viewOriginalArticle(row) {
    }
  },
}
</script>
<style lang="scss" scoped>
.limit-high-consumption-container {
  background: #ffffff;
  border-radius: 4px;
  padding: 16px;
  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;
    }
  }
  @import "@/assets/styles/search-common.scss";
}
</style>
