// 律所反馈信息
<template>
  <data-table operateBtnLayout
              :columns="columns"
              :sourceData.sync="sourceData"
              :showPage="false">
  </data-table>
</template>
<script>
import { DataTable } from 'newepoch-components'
import * as format from '@/filters/index'
import fincrm from '@/api/fincrm'
export default {
  components: {
    DataTable
  },
  props: {
    queryDataNum: {
      type: Object,
      default () {
        return {}
      }
    }
  },
  data () {
    const { factoringBusinessInfo } = this.$i18n.messages[this.$i18n.locale]
    return {
      queryParas: {
        assetCode: null
      },
      sourceData: [
        // {
        //   compliance_feedback_time: 2209017600000,
        //   law_review_pass_time: 2209017600000,
        //   law_feedback_info: '反馈信息A',
        //   law_feedback_opinion: '反馈意见1',
        //   compliance_opinion: '合规意见1',
        //   need_file: '需补文件1',
        //   compliance_person: '李四'
        // },
        // {
        //   compliance_feedback_time: 2209017600000,
        //   law_review_pass_time: 2209017600000,
        //   law_feedback_info: '反馈信息B',
        //   law_feedback_opinion: '反馈意见2',
        //   compliance_opinion: '合规意见2',
        //   need_file: '需补文件2',
        //   compliance_person: '张三'
        // }
      ],
      columns: [
        // 律所反馈信息
        {
          prop: 'feedbackFrequency',
          align: 'left',
          width: '110px',
          label: factoringBusinessInfo.law_feedback_info
        },
        // 律所反馈意见
        {
          prop: 'feedbackQuestionContent',
          align: 'left',
          width: '110px',
          label: factoringBusinessInfo.law_feedback_opinion
        },
        // 合规处理意见
        {
          prop: 'practicableSuggestion',
          align: 'left',
          width: '110px',
          label: factoringBusinessInfo.compliance_opinion
        },
        // 需补资料
        {
          prop: 'supplementNoFile',
          align: 'left',
          width: '110px',
          label: factoringBusinessInfo.need_file
        },
        // 相关方
        {
          prop: 'relationType',
          align: 'left',
          width: '110px',
          label: factoringBusinessInfo.relation_type
        },
        // 处理人
        {
          prop: 'relationChargeUserName',
          align: 'center',
          width: '110px',
          label: factoringBusinessInfo.relation_charge_user_name
        },
        // 处理时间
        {
          prop: 'dealTime',
          align: 'center',
          width: '110px',
          label: factoringBusinessInfo.deal_time,
          format: row => format.formatDatetime(row.dealTime)
        },
        // 处理状态
        {
          prop: 'relationDealStatus',
          align: 'center',
          width: '110px',
          label: factoringBusinessInfo.relation_deal_status
        },
        // 相关方意见
        {
          prop: 'relationResolution',
          align: 'center',
          width: '110px',
          label: factoringBusinessInfo.relation_resolution
        },
        // 相关方附件
        {
          prop: 'fileIds',
          align: 'center',
          width: '110px',
          label: factoringBusinessInfo.file_ids
        }
      ]
    }
  },
  mounted () {
    this.queryParas.assetCode = this.queryDataNum.assetCode
    // this.handleFilter()
  },
  methods: {
    handleFilter () {
      fincrm.invoiceOutApi.invoiceData(this.queryParas).then(res => {
        if (res && res.data) {
          let arrlawyer = res.data
          this.sourceData = arrlawyer.map((val, index) => ({
            feedbackFrequency: val.feedbackFrequency,
            feedbackQuestionContent: val.feedbackQuestionContent,
            practicableSuggestion: val.relationHistoryRelationDtos[0].practicableSuggestion,
            supplementNoFile: val.relationHistoryRelationDtos[0].supplementNoFile,
            relationType: val.relationHistoryRelationDtos[0].relationType,
            relationChargeUserName: val.relationHistoryRelationDtos[0].relationChargeUserName,
            dealTime: val.relationHistoryRelationDtos[0].dealTime,
            relationDealStatus: val.relationHistoryRelationDtos[0].relationDealStatus,
            relationResolution: val.relationHistoryRelationDtos[0].relationResolution,
            fileIds: val.relationHistoryRelationDtos[0].fileIds[0]
          }))
        }
      })
    }
  },
  watch: {
    'queryDataNum.assetCode': {
      handler: function (val) {
        this.queryParas.assetCode = val
      },
      immediate: true
    }
  }

}
</script>
