<template>
  <a-modal
    :title="modalTitle"
    :width="850"
    :visible="visible"
    :confirmLoading="confirmLoading"
    class="ant-modal2"
    @cancel="handleCancel"
  >
    <detail-list title="" :col="2">
      <detail-list-item term="类型：1.表示设备，2.表示部件，3.表示备件">{{ model.type }}</detail-list-item>
      <detail-list-item term="编码">{{ model.no }}</detail-list-item>
      <detail-list-item term="名称">{{ model.name }}</detail-list-item>
      <detail-list-item term="等级">{{ BaseTool.Object.getField(levelMap,model.level) }}</detail-list-item>
      <detail-list-item term="联系人">{{ model.person }}</detail-list-item>
      <detail-list-item term="联系电话">{{ model.mobile }}</detail-list-item>
      <detail-list-item term="联系地址">{{ model.address }}</detail-list-item>
      <detail-list-item term="排序">{{ BaseTool.Object.getField(sortMap,model.sort) }}</detail-list-item>
      <detail-list-item term="是否删除">{{ BaseTool.Object.getField(delFlagMap,model.delFlag) }}</detail-list-item>
      <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
      <detail-list-item term="创建人">{{ model.createdUserId }}</detail-list-item>
      <detail-list-item term="更新人">{{ model.updateUserId }}</detail-list-item>
      <detail-list-item term="更新人名称">{{ model.updateUserName }}</detail-list-item>
      <detail-list-item term="更新日期">{{ model.updateTime }}</detail-list-item>
    </detail-list>

    <template slot="footer">
      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">返回</a-button>
    </template>
  </a-modal>
</template>

<script>
import DetailList from '@/components/tools/DetailList'
const DetailListItem = DetailList.Item

export default {
  name: 'FirmSupplierDetail',
  components: {
    DetailList,
    DetailListItem
  },
  data () {
    return {
      confirmLoading: false,
      mdl: {},
      modalTitle: null,
      visible: false,
      // 下拉框map
      levelMap: {},
      sortMap: {},
      delFlagMap: {},
      model: {
        'type': null,
        'no': null,
        'name': null,
        'level': null,
        'person': null,
        'mobile': null,
        'address': null,
        'sort': null,
        'delFlag': null,
        'remark': null,
        'createdUserId': null,
        'updateUserId': null,
        'updateUserName': null,
        'updateTime': null
      }
    }
  },
  created () {
    // 下拉框map
    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.FIRM_SUPPLIER_LEVEL)
    this.sortMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.FIRM_SUPPLIER_SORT)
    this.delFlagMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.FIRM_SUPPLIER_DEL_FLAG)
  },
  methods: {
    base (record) {
      this.visible = true
      this.modalTitle = '详情'
      this.model = record
    },
    handleCancel () {
      this.visible = false
      this.confirmLoading = false
    }

  }
}
</script>
