<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="部件编号">{{ model.no }}</detail-list-item>
      <detail-list-item term="部件名称">{{ model.name }}</detail-list-item>
      <detail-list-item term="部件类别">{{ model.typeName }}</detail-list-item>
      <detail-list-item term="部件等级">{{ BaseTool.Object.getField(levelMap,model.level) }}</detail-list-item>
      <detail-list-item term="所属设备">{{ model.sbName }}</detail-list-item>
      <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
      <detail-list-item term="创建人">{{ model.createdUserName }}</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: 'PartInfoDetail',
  components: {
    DetailList,
    DetailListItem
  },
  data () {
    return {
      confirmLoading: false,
      mdl: {},
      modalTitle: null,
      visible: false,
      model: {
        'no': null,
        'name': null,
        'typeId': null,
        'level': null,
        'producerId': null,
        'sourceType': null,
        'sourceSbId': null,
        'sbId': null,
        'unit': null,
        'guigeId': null,
        'buyDate': null,
        'startDate': null,
        'nextCheckDate': null,
        'guaranteeDate': null,
        'workYear': null,
        'retirementDate': null,
        'sbImage': null,
        'status': null,
        'remark': null,
        'createdUserId': null,
        'updateUserId': null,
        'updateTime': null,
        'sbName': null,
        'createUserName': null,
        'producerName': null,
        'guigeName': null,
        'typeName': null,
        'sourceSbName': null
      },
      statusMap: {},
      unitMap: {},
      sourceTypeMap: {},
      levelMap: {}
    }
  },
  created () {
    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PART_STATUS)
    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PART_LEVEL)
    this.sourceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBTYPE_SOURCETYPE)
  },
  methods: {
    base (record) {
      this.visible = true
      this.modalTitle = '详情'
      this.model = record
    },
    handleCancel () {
      this.visible = false
      this.confirmLoading = false
    }

  }
}
</script>
