<!-- 回寄地址变更履历 -->
<template>
  <div>
    <dialog-edit :visible.sync="dialogVisible" :form="form" :editModel="editModel" :api="api" :appendToBody="appendToBody"
                 :title="$t('enterpriseInfoManage.supplierInfoManage.resumeMailingAddressHeadTitle')">
      <data-table :api="api" :operateBtnLayout="operateBtnLayout" :queryParas="queryParas" :sourceData="modifyData"
                  :toolMenuFlag="toolMenuFlag" :columns="modifyColumns" :showPage="showPage" :menuFlag="menuFlag"
                  :headTitle="$t('enterpriseInfoManage.supplierInfoManage.resumeMailingAddress.headTitle')">
      </data-table>
    </dialog-edit>
  </div>
</template>

<script>
import BaseEdit from '@/pages/baseEditPage'
import * as format from '@/filters/index.js'
import { DialogEdit, DataTable } from 'newepoch-components'
import supplierInfoManageApi from '@/api/enterpriseInfoManage/supplierInfoManageApi.js'
export default {
  extends: new BaseEdit(),
  name: 'contactRecordEdit',
  components: {
    DialogEdit,
    DataTable
  },
  data () {
    return {
      showPage: false,
      appendToBody: true,
      toolMenuFlag: true,
      menuFlag: false,
      operateBtnLayout: '',
      queryParas: {},
      modifyData: [],
      contactData: [],
      modifyColumns: [
        // 修改内容
        {
          prop: 'name',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.modifyContent,
          width: '100px'
        },
        // 修改前值
        {
          prop: 'oldValue',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.resumeMailingAddress.modifyPreviousValue,
          width: '200px'
        },
        // 修改后值
        {
          prop: 'value',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.resumeMailingAddress.modifiedValue,
          width: '200px'
        },
        // 修改人
        {
          prop: 'modifyUserName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.resumeMailingAddress.modifier,
          width: '100px'
        },
        // 修改时间
        {
          prop: 'createHistoryTime',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.resumeMailingAddress.modificationTime,
          width: '150px',
          format: (row) => { return format.formatDatetime(row.createHistoryTime, 'yyyy-MM-dd hh:mm') }
        }
      ]
    }
  },
  computed: {
    api () {
      return supplierInfoManageApi.record
    }
  },
  methods: {
  },
  watch: {
    visible (val) {
      if (val) {
        let $this = this
        supplierInfoManageApi.record.getList({ keyId: this.form.keyId }).then(res => {
          if (res.success) {
            $this.modifyData = res.data
          } else {
            $this.error('获取履历失败')
          }
        })
      }
    }
  }
}
</script>

<style scoped>

</style>
