<template>

  <div>
    <div class="contact-list">
      <el-table :data="records" stripe style="width: 100%">
        <el-table-column type="index" width="60"></el-table-column>
        <el-table-column prop="operatorBean.userName" sortable label="操作人"></el-table-column>
        <el-table-column prop="operateType" sortable label="联系类型" :formatter="operateTypeFormat"></el-table-column>
        <el-table-column prop="gmtCreated" sortable label="联系时间" :formatter="dateFormat"></el-table-column>
        <el-table-column prop="loanNo" sortable label="借款编号"></el-table-column>
        <el-table-column prop="operateDesc" sortable label="操作内容"></el-table-column>
      </el-table>
    </div>

  </div>

</template>

<script>

  import * as moment from "moment";


  export default {
    name: "ContactList",

    props: {
      clientNo: {
        type: String
      }

    },
    data() {
      return {
        records: [],
      }
    },
    mounted: function () {
      this.loadRecordData();
    },
    methods: {
      loadRecordData() {
        this.$$get(`/clientContact/getListByClientNo/${this.clientNo}`)
          .then(res => {
            if (res.data.code < 1)
              throw res.data.msg;
            this.records = res.data.data
          })
          .catch(err => this.$$msg.err(err))
      },
      dateFormat: function (row, column) {
        var date = row[column.property];
        if (date == undefined) {
          return "";
        }
        return moment(date).format("YYYY-MM-DD HH:mm:ss");
      },
      operateTypeFormat: function (row, column) {
        var operateType = row[column.property];
        return this.$enumUtils.toMsg('ClientContactTypeEnum', operateType);
      },
      nullFormat(row, column) {
        var param = row[column.property];
        if (param == null || param == '') {
          return ' ';
        }
        return param;
      }

    }
  }
</script>


<style lang="stylus" rel="stylesheet/stylus">

  .contact-list table th {
    color: #64656f;
    text-align: center;
    font-size: 16px;
  }

  .contact-list table td {
    color: #64656f;
    text-align: center;
    font-size: 16px;
  }

</style>





