<template>
  <div class="page-dialog">
    <block-header :title="title"></block-header>
    <el-table
        border
        size="mini"
        :highlight-current-row="true"
        :header-row-class-name="headerStyle"
        :data="data"
        stripe
        style="width: 100%;">
      <el-table-column align="center" prop="clientName" label="姓名"></el-table-column>
      <el-table-column align="center" width="140" prop="riskGmtCreated" :formatter="dateFormats" label="修改日期"></el-table-column>
      <el-table-column align="center" prop="riskType" label="风险等级" ></el-table-column>
      <el-table-column align="center" prop="riskContent" label="风险描述" ></el-table-column>
      <el-table-column align="center" prop="memo" label="备注"></el-table-column>
    </el-table>
  </div>
</template>

<script>
import * as moment from "moment";
export default {
  name: 'RiskInfo',
  props: {
    dialogVisible: {
      type: Boolean,
      required: true,
    },
    title: {
      type: String,
      required: true,
    },
    params: {
      type: Object,
      required: true
    },
  },
  data() {
    return {
      form: {
        current: 1,
        size: 1000,
        riskType: "",
        certNo: "",
        endDate: "",
        startDate: ""
      },
      data: []
    }
  },
  async created() {
    const params = this.params;
    this.form.certNo = params.idCard;
    await this.init()
  },
  methods: {
    headerStyle() {
      return "tableHeaderStyle";
    },
    async init() {
      const res = await this.$$post('/risk/getRiskLogPage', this.form);
      const {success, result} = res.data;
      if (success && result !== null) {
        this.data = result.records;
      }
    },
    /*日期*/
    dateFormats: function (row, column) {
      let date = row[column.property]
      if (date === undefined) {
        return ''
      }
      return moment(date).format("YYYY-MM-DD")
    },
    handleClose() {
      this.$emit("handleClose");
    }
  }
}
</script>

<style>

</style>
