<!--开票信息履历-->
<template>
  <div>
    <dialog-edit :api="api" :title="$t('enterpriseInfoManage.supplierInfoManage.invoiceDialogTitle')"
                 :visible.sync="dialogVisible" width="1480px" :editModel="editModel" :form="form" class="dialog-table">
      <data-table :headTitle="$t('enterpriseInfoManage.supplierInfoManage.invoiceDialogTableTitle')"
                  :queryParas="{}" :sourceData.sync="sourceData" operateBtnLayout=""
                  :columns="columns" :showPage="showPage">
      </data-table>
    </dialog-edit>
  </div>
</template>

<script>
import { DialogEdit, DataTable } from 'newepoch-components'
import BaseEdit from '@/pages/baseEditPage'
import supplierInfoManageApi from '@/api/enterpriseInfoManage/companyApi'
import * as format from '@/filters/index'
export default {
  extends: new BaseEdit(),
  name: 'showInvoiceResumeEdit',
  components: {
    DialogEdit,
    DataTable
  },
  data () {
    return {
      showPage: false,
      sourceData: [],
      columns: [
        {
          // 修改内容
          prop: 'name',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.modifyContent
        },
        {
          // 修改前值
          prop: 'oldValue',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.modifyBefore
        },
        {
          // 修改后值
          prop: 'value',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.modifyAfter
        },
        {
          // 修改人
          prop: 'addUserId',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.invoiceDialogTableColumModifyUser
        },
        {
          // 修改时间
          prop: 'createHistoryTime',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.invoiceDialogTableColumModifyTime,
          format: (it) => { return format.formatDatetime(it.createHistoryTime, 'yyyy-MM-dd hh:mm') }
        }
      ]
    }
  },
  computed: {
    api () {
      return supplierInfoManageApi.invoiceListApi
    }
  },
  methods: {
    // 获取履历
    getList (params) {
      this.api.getinvoiceList(params).then(res => {
        if (res.data) {
          this.$set(this, 'sourceData', res.data)
        }
      })
    }
  },
  watch: {
    visible: {
      deep: true,
      immediate: true,
      handler (n, o) {
        if (n) {
          if (this.form.keyId) {
            this.getList({ keyId: this.form.keyId })
          } else {
            this.getList({ keyId: '' })
          }
        }
      }
    }
  }
}
</script>

<style scoped lang="scss">
</style>
