// 中登异常信息
<template>
  <data-table operateBtnLayout
              :columns="columns"
              :sourceData.sync="sourceData"
              :showPage="false">
    <template slot="transDesc" slot-scope="scope">
      <span-plus :text="scope.data.row.transDesc"></span-plus>
    </template>
    <template slot="exceptionDesc" slot-scope="scope">
      <span-plus :text="scope.data.row.exceptionDesc"></span-plus>
    </template>
    <template slot="solution" slot-scope="scope">
      <span-plus :text="scope.data.row.solution"></span-plus>
    </template>
<!--    <template slot="exceptionSolution" slot-scope="scope">-->
<!--      <span-plus :text="scope.data.row.exceptionSolution"></span-plus>-->
<!--    </template>-->
  </data-table>
</template>
<script>
import { DataTable, SpanPlus } from 'newepoch-components'
import * as format from '@/filters/index'
import factoringBusiness from '@/api/factoringBusinessInfoApi'
export default {
  components: {
    DataTable,
    SpanPlus
  },
  props: {
    queryData: {
      type: Object,
      default () {
        return {}
      }
    }
  },
  data () {
    const { factoringBusinessInfo } = this.$i18n.messages[this.$i18n.locale]
    return {
      queryParas: {
        assetCode: null
      },
      sourceData: [],
      columns: [
        // 登记证明编号
        {
          prop: 'djzmNum',
          align: 'center',
          width: '140px',
          label: factoringBusinessInfo.register_proof_num
        },
        // 登记时间
        {
          prop: 'registTime',
          align: 'center',
          width: '130px',
          label: factoringBusinessInfo.register_time
          // format: row => format.formatDatetime(row.registTime)
        },
        // 异常财产描述
        {
          prop: 'transDesc',
          align: 'left',
          width: '110px',
          label: factoringBusinessInfo.exception_property_descripe,
          slot: true
        },
        // 异常情况
        {
          prop: 'exceptionDesc',
          align: 'left',
          width: '110px',
          label: factoringBusinessInfo.exception_situation,
          slot: true
        },
        // 中登建议解决方案
        {
          prop: 'solution',
          align: 'left',
          width: '120px',
          label: factoringBusinessInfo.zd_solution,
          slot: true
        },
        // 反馈人
        {
          prop: 'fankuiUserName',
          align: 'left',
          width: '60px',
          label: factoringBusinessInfo.feedback_person
        },
        // 反馈时间
        {
          prop: 'fankuiTime',
          align: 'center',
          width: '130px',
          label: factoringBusinessInfo.feedback_time,
          format: row => format.formatDatetime(row.fankuiTime)
        },
        // 处理状态
        {
          prop: 'dealStatus',
          align: 'left',
          width: '60px',
          label: factoringBusinessInfo.deal_status,
          format: row => {
            return format.formatDict(row.dealStatus, 'ZDZD0031')
          }
        },
        // 解决方式
        {
          prop: 'exceptionSolution',
          align: 'left',
          width: '120px',
          label: factoringBusinessInfo.solution,
          format: (row) => { return format.formatDict(row.exceptionSolution, 'tracemgr_zhongdeng_solution') }
        },
        // 解决时间
        {
          prop: 'dealTime',
          align: 'center',
          width: '130px',
          label: factoringBusinessInfo.solve_time,
          format: row => format.formatDatetime(row.dealTime)
        }
      ]
    }
  },
  mounted () {
    this.queryParas.assetCode = this.queryData.assetCode
  },
  methods: {
    handleFilter () {
      factoringBusiness.zhongdengApi.zhongDengData(this.queryParas).then(res => {
        if (res && res.data) {
          let receiceData = res.data
          this.sourceData = receiceData.map((value) => ({
            djzmNum: value.djzmNum,
            registTime: value.registTime,
            transDesc: value.transDesc,
            exceptionDesc: value.exceptionDesc,
            solution: value.solution,
            fankuiUserName: value.fankuiUserName,
            fankuiTime: value.fankuiTime,
            dealStatus: value.dealStatus,
            exceptionSolution: value.exceptionSolution,
            dealTime: value.dealTime
          }))
          // this.sourceData = res.data
        }
      })
    }
  },
  watch: {
    'queryData.assetCode': {
      handler: function (val) {
        this.queryParas.assetCode = val
      },
      immediate: true
    }
  }
}
</script>
