<template>
  <a-modal
    :title="modalTitle"
    :width="850"
    :visible="visible"
    :confirmLoading="confirmLoading"
    class="ant-modal2"
    @cancel="handleCancel"
  >
    <a-divider orientation="left">报修详情</a-divider>
    <detail-list title="" :col="2">
      <detail-list-item term="报修单号">{{ model.applicationNo }}</detail-list-item>
      <detail-list-item term="设备名称">{{ model.sbName }}</detail-list-item>
      <detail-list-item term="部件名称">{{ model.partName }}</detail-list-item>
      <detail-list-item term="报修人">{{ model.repairUserName }}</detail-list-item>
      <detail-list-item term="报修来源">{{ BaseTool.Object.getField(this.sourceMap, model.applicationSource) }}</detail-list-item>
      <detail-list-item term="紧急等级"><badge :text="BaseTool.Object.getField(levelMap,model.applicationLevel)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_LEVEL[model.applicationLevel]"/></detail-list-item>
      <detail-list-item term="报修时间">{{ model.applicationApplyTime }}</detail-list-item>
    </detail-list>
    <a-divider orientation="left">维修详情</a-divider>
    <detail-list title="" :col="2">
      <detail-list-item term="维修单号">{{ model.repairNo }}</detail-list-item>
      <detail-list-item term="维修开始时间">{{ model.repairStartTime }}</detail-list-item>
      <detail-list-item term="维修结束时间">{{ model.repairEndTime }}</detail-list-item>
      <detail-list-item term="维修人员">{{ model.repairPersonName }}</detail-list-item>
    </detail-list>
    <detail-list title="" :col="1">
      <detail-list-item term="维修描述">{{ model.repairDescripition }}</detail-list-item>
    </detail-list>
    <a-divider orientation="left">验收详情</a-divider>
    <detail-list title="" :col="2">
      <detail-list-item term="验收开始时间">{{ model.startTime }}</detail-list-item>
      <detail-list-item term="验收结束时间">{{ model.endTime }}</detail-list-item>
      <detail-list-item term="维修人员">{{ model.checkUserName }}</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="验收状态"><badge :text="BaseTool.Object.getField(statusMap,model.status)" :status="DictCache.COLOR.REPAIR_CHECK_STATUS[model.status]"/></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: 'RepairCheckDetail',
  components: {
    DetailList,
    DetailListItem
  },
  data () {
    return {
      confirmLoading: false,
      mdl: {},
      modalTitle: null,
      visible: false,
      // 下拉框map
      statusMap: {},
      sourceMap: {},
      levelMap: {},
      model: {
        'applicationNo': null,
        'repairNo': null,
        'applicationId': null,
        'repairId': null,
        'startTime': null,
        'endTime': null,
        'repairUseId': null,
        'descripition': null,
        'status': null,
        'remark': null,
        'updateTime': null,
        'createdUserId': null,
        'updateUserId': null,
        'createdUserName': null,
        'updateUserName': null
      }
    }
  },
  created () {
    // 下拉框map
    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_CHECK_STATUS)
    this.sourceMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE)
    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_LEVEL)
  },
  methods: {
    base (record) {
      this.visible = true
      this.modalTitle = '详情'
      this.model = record
    },
    handleCancel () {
      this.visible = false
      this.confirmLoading = false
    }

  }
}
</script>
