<template>
  <a-modal
    :title="modalTitle"
    :width="850"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @cancel="handleCancel"
  >
    <detail-list title="" :col="2">
      <detail-list-item term="维修单号">{{ model.repairNo }}</detail-list-item>
      <detail-list-item term="费用金额">{{ BaseTool.Amount.formatter(model.fee) }}</detail-list-item>
      <detail-list-item term="费用类别">{{ BaseTool.Object.getField(typeMap,model.type) }}</detail-list-item>
      <detail-list-item term="费用原因">{{ model.reason }}</detail-list-item>
      <detail-list-item term="费用描述">{{ model.descripition }}</detail-list-item>
      <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
      <detail-list-item term="更新日期">{{ model.updateTime }}</detail-list-item>
      <detail-list-item term="创建人">{{ model.createdUserName }}</detail-list-item>
      <detail-list-item term="更新人">{{ model.updateUserName }}</detail-list-item>
    </detail-list>
    <detail-list title="图片：" :col="6">
      <upload-image-detail :images-list="model.imageList"/>
    </detail-list>
    <detail-list title="" :col="8">
      <detail-list-item term="文件">
        <a-upload
          :multiple="true"
          :fileList="BaseTool.UPLOAD.transImg(model.fileList)"
        >
        </a-upload>
      </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: 'RepairFeeDetail',
  components: {
    DetailList,
    DetailListItem
  },
  data () {
    return {
      confirmLoading: false,
      mdl: {},
      modalTitle: null,
      visible: false,
      // 下拉框map
      typeMap: {},
      model: {
        'repairId': null,
        'fee': null,
        'type': null,
        'reason': null,
        'descripition': null,
        'remark': null,
        'updateTime': null,
        'createdUserId': null,
        'updateUserId': null,
        'createdUserName': null,
        'updateUserName': null
      }
    }
  },
  created () {
    // 下拉框map
    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_FEE_TYPE)
  },
  methods: {
    base (record) {
      this.visible = true
      this.modalTitle = '详情'
      this.model = record
    },
    handleCancel () {
      this.visible = false
      this.confirmLoading = false
    }

  }
}
</script>
