<template>
  <a-modal
    :title="modalTitle"
    :width="850"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @cancel="handleCancel"
  >
    <detail-list title="" :col="2">
      <detail-list-item term="名称">{{ model.name }}</detail-list-item>
      <detail-list-item term="字段名称">{{ model.fieldKey }}</detail-list-item>
      <detail-list-item term="表头显示">{{ BaseTool.Object.getField(useTypeMap,model.useType) }}</detail-list-item>
      <detail-list-item term="类型">{{ BaseTool.Object.getField(typeMap,model.type) }}</detail-list-item>
      <detail-list-item term="数据词典类型">{{ model.dictType }}</detail-list-item>
      <detail-list-item term="性质">{{ BaseTool.Object.getField(natureMap,model.nature) }}</detail-list-item>
      <detail-list-item term="标识">{{ BaseTool.Object.getField(codeValueMap,model.codeValue) }}</detail-list-item>
      <detail-list-item term="排序">{{ model.sort }}</detail-list-item>
      <detail-list-item term="创建人">{{ model.createdUserName }}</detail-list-item>
      <detail-list-item term="更新人">{{ model.updateUserName }}</detail-list-item>
      <detail-list-item term="更新日期">{{ model.updateTime }}</detail-list-item>
      <detail-list-item term="备注">{{ model.remark }}</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: 'FillInfoDetail',
  components: {
    DetailList,
    DetailListItem
  },
  data () {
    return {
      confirmLoading: false,
      mdl: {},
      modalTitle: null,
      visible: false,
      // 下拉框map
      useTypeMap: {},
      typeMap: {},
      natureMap: {},
      codeValueMap: {},
      model: {
        'fieldKey': null,
        'name': null,
        'dictType': null,
        'useType': null,
        'codeValue': null,
        'type': null,
        'nature': null,
        'remark': null,
        'sort': null,
        'createdUserId': null,
        'updateUserId': null,
        'updateUserName': null,
        'updateTime': null
      }
    }
  },
  created () {
    // 下拉框map
    this.useTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.FILL_INFO_USE_TYPE)
    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.FILL_INFO_TYPE)
    this.natureMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.FILL_INFO_NATURE)
    this.codeValueMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.FILL_INFO_CODE_VALUE)
  },
  methods: {
    base (record) {
      this.visible = true
      this.modalTitle = '详情'
      this.model = record
    },
    handleCancel () {
      this.visible = false
      this.confirmLoading = false
    }

  }
}
</script>
