<template>
  <div>
<!--    <div class="business-info">-->
<!--      <el-divider></el-divider>-->
<!--    </div>-->
    <data-table :operateBtnLayout="''" :sourceData="sourceData"
                max-height="300"
                :columns="columns" :showPage="showPage">
      <!-- 编号 -->
      <template slot="number" slot-scope="scope">
        {{scope.data.$index + 1}}
      </template>
    </data-table>
  </div>
</template>

<script>
import * as format from '@/filters/index.js'
import { DataTable } from 'newepoch-components'
export default {
  name: 'enterpriseChangeInfo',
  components: {
    DataTable
  },
  props: {
    sourceData: {
      type: Array,
      default: function () {
        return []
      }
    }
  },
  data () {
    return {
      showPage: false,
      columns: [
        // 序号
        {
          prop: 'number',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.number,
          width: '30px',
          slot: true
        },
        // 变更日期
        {
          prop: 'changeTime',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.changeDate,
          width: '50px',
          format: (row) => {
            return format.formatDate(row.changeTime)
          }
        },
        // 变更项目
        {
          prop: 'changeItem',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.changeProject,
          width: ''
        },
        // 变更后
        {
          prop: 'contentBefore',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.changeBefore,
          width: '',
          format: (row) => {
            if (row.changeItem.toString().indexOf('投资人变更') >= 0) {
              return row.contentBefore
            } else if (row.changeItem.toString().indexOf('日期') >= 0 || row.changeItem.toString().indexOf('时间') >= 0) {
              return format.formatDateTpcModify(row.contentBefore)
            } else if (row.changeItem === '注册资本币种') {
              return format.formatDict(row.contentBefore, 'ZDC0141')
            } else if (row.changeItem === '企业状态') {
              return format.formatDict(row.contentBefore, 'ZDC0140')
            } else if (row.changeItem === '企业类型') {
              return format.formatDict(row.contentBefore, 'ZDC0113')
            } else if (row.changeItem === '股票类型') {
              return format.formatDict(row.contentBefore, 'ZDC0142')
            } else if (row.changeItem === '法人类型') {
              return format.formatDict(row.contentBefore, 'ZDC0143')
            } else if (row.changeItem === '企业标签') {
              return format.formatDict(row.contentBefore, 'ZD0040')
            } else if (row.changeItem === '是否是小微企业') {
              return format.formatDict(row.contentBefore, 'ZD0003')
            } else if (row.changeItem === '实收注册资本币种') {
              return format.formatDict(row.contentBefore, 'ZDC0141')
            } else if (row.changeItem === '行业分类') {
              return format.formatDict(row.contentBefore, 'ZD0007')
            }
            return row.contentBefore
          }
        },
        // 变更前
        {
          prop: 'contentContent',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.changeAfter,
          width: '',
          format: (row) => {
            if (row.changeItem.toString().indexOf('投资人变更') >= 0) {
              return row.contentContent
            } else if (row.changeItem.toString().indexOf('日期') >= 0 || row.changeItem.toString().indexOf('时间') >= 0) {
              return format.formatDateTpcModify(row.contentContent)
            } else if (row.changeItem === '注册资本币种') {
              return format.formatDict(row.contentContent, 'ZDC0141')
            } else if (row.changeItem === '企业状态') {
              return format.formatDict(row.contentContent, 'ZDC0140')
            } else if (row.changeItem === '企业类型') {
              return format.formatDict(row.contentContent, 'ZDC0113')
            } else if (row.changeItem === '股票类型') {
              return format.formatDict(row.contentContent, 'ZDC0142')
            } else if (row.changeItem === '法人类型') {
              return format.formatDict(row.contentContent, 'ZDC0143')
            } else if (row.changeItem === '企业标签') {
              return format.formatDict(row.contentContent, 'ZD0040')
            } else if (row.changeItem === '是否是小微企业') {
              return format.formatDict(row.contentContent, 'ZD0003')
            } else if (row.changeItem === '实收注册资本币种') {
              return format.formatDict(row.contentContent, 'ZDC0141')
            } else if (row.changeItem === '行业分类') {
              return format.formatDict(row.contentContent, 'ZD0007')
            }
            return row.contentContent
          }
        }
      ]
    }
  }
}
</script>

<style scoped lang="scss">
  @import '@/styles/enterpriseInfoManage/supplierInfoManage/businessInfo.scss';
</style>
