<!-- 线上审核供应商信息 -->
<template>
  <div class="supplierInfo">
    <dym-form :componentList="componentList" :formValue="dataForm"></dym-form>
  </div>
</template>
<script>
import BasePage from '@/pages/basePage.js'
import { dymForm, dateRangePicker } from 'newepoch-components'
import taskManageApi from '@/api/dataAudit/taskManageApi.js'
import SelectBusinessDate from '@/pages/dataAudit/taskManage/common/SelectBusinessDate.vue'
import * as format from '@/filters/index'
export default {
  extends: new BasePage(),
  components: {
    dymForm,
    dateRangePicker,
    SelectBusinessDate
  },
  props: {
    form: {
      type: [Object],
      default: function () {
        return {}
      }
    }
  },
  data () {
    return {
      attrs1: {
        disabled1: true,
        disabled2: true,
        placeholder1: '',
        placeholder2: ''
      },
      dataForm: {
        // businessDate: []
      },
      componentList: [
        // 法人代表
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.legalRepresentative,
          value: 'legalPersonName',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '70px',
          prop: 'legalPersonName'
        },
        // 是否三证合一
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.threeCertificates,
          value: 'registerType',
          disabled: true,
          componentName: 'SelectDictionary',
          dictTypeCode: 'ZDZD0024',
          cols: [24, 24, 24, 8],
          labelWidth: '100px',
          prop: 'registerType',
          placeholder: ''
        },
        // 三证合一编号
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.threeCertificatesNumber,
          value: 'creditCode',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '100px',
          maxlength: '20',
          prop: 'creditCode',
          placeholder: ''
        },
        // 回寄地址
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.backSendAddress,
          value: 'reMailAddress',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '70px',
          type: 'textarea',
          rows: 4,
          prop: 'reMailAddress'
        },
        // 营业执照号码
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.businessLicenseNumber,
          value: 'businessLicenseNum',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '100px',
          prop: 'businessLicenseNum',
          maxlength: '20',
          placeholder: ''
        },
        // 组织机构号码
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.organizationNumber,
          value: 'orgNumber',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '100px',
          prop: 'orgNumber',
          maxlength: '20',
          placeholder: ''
        },
        // 核准日期
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.approvedDate,
          value: 'approvedTime',
          disabled: true,
          componentName: 'el-date-picker',
          cols: [24, 24, 24, 8],
          labelWidth: '100px',
          prop: 'approvedTime',
          placeholder: ''
        },
        // 营业日期
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.businessTerm,
          value: 'businessDate',
          attrs: {
            disabled1: true,
            disabled2: true,
            placeholder1: '',
            placeholder2: '',
            middleText: '至'
          },
          componentName: SelectBusinessDate,
          cols: [24, 24, 24, 8],
          labelWidth: '100px',
          prop: 'businessDate',
          placeholder: ''
        }
      ]
    }
  },
  methods: {
    loadData (params) {
      let _this = this
      taskManageApi.offLine.getSupplierInfo(params).then(res => {
        if (res && res.data) {
          _this.dataForm = Object.assign({}, res.data)
          if (_this.UtilJs.isEmpty(res.data.creditCode)) {
            _this.$set(_this.dataForm, 'registerType', '0')
          } else {
            _this.$set(_this.dataForm, 'registerType', '1')
          }
          _this.$set(_this.dataForm, 'businessDate', [this.formatTime(res.data.licenseTermStartDate), this.formatTime(res.data.licenseTermEndDate)])
        }
      })
    },
    formatTime (value) {
      return format.formatDateNull(value).indexOf('1900-01-01') !== -1 ? '' : value
    }
  },
  watch: {}
}
</script>
<style scoped lang="scss" src="@/styles/dataAudit/taskManage/supplierInfo.scss">
</style>
