<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.name }}</detail-list-item>
      <detail-list-item term="计划名称">{{ model.planName }}</detail-list-item>
      <detail-list-item :term="names[checkType-1]+'设备'">{{ model.sbName }}</detail-list-item>
      <!--<detail-list-item :term="names[checkType-1]+'部件'">{{ model.partName }}</detail-list-item>
      <detail-list-item term="部件编号">{{ model.partNo}}</detail-list-item>-->
      <detail-list-item term="标准工时">{{ model.standardHours }}</detail-list-item>
      <detail-list-item term="实际工时">{{ model.realHours }}</detail-list-item>
      <detail-list-item term="执行日期">{{ model.startTime }}</detail-list-item>
      <detail-list-item term="截至日期">{{ model.endTime }}</detail-list-item>
      <detail-list-item term="实际开始时间">{{ model.actualStartTime }}</detail-list-item>
      <detail-list-item term="实际结束时间">{{ model.actualEndTime }}</detail-list-item>
      <!--<detail-list-item term="是否停机"><badge :status="DictCache.COLOR.YES_NO[model.sbStatus]" :text="sbStatusMap[model.sbStatus]" /></detail-list-item>-->
      <detail-list-item term="任务状态"><badge :status="DictCache.COLOR.CHECK_JOB_STATUS[model.status]" :text="statusMap[model.status]" /></detail-list-item>
    </detail-list>
    <detail-list title="" :col="1">
      <detail-list-item :term="names[checkType-1]+'要求'">{{ model.requirement }}</detail-list-item>
      <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
      <detail-list-item term="检查结果">{{ model.feedback }}</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: 'CheckJobDetail',
  components: {
    DetailList,
    DetailListItem
  },
  props: {
    /**
     * 检查类型： 1-任务 2-巡检
     */
    checkType: {
      type: Number,
      default: 1
    }
  },
  data () {
    return {
      names: ['任务', '巡检'],
      confirmLoading: false,
      mdl: {},
      modalTitle: null,
      visible: false,
      // 下拉框map
      statusMap: {},
      sbStatusMap: {},
      model: {
        'planId': null,
        'startTime': null,
        'endTime': null,
        'actualStartTime': null,
        'actualEndTime': null,
        'checkedNum': null,
        'abnormalNum': null,
        'checkNum': null,
        'status': null,
        'sbStatus': null,
        'createdUserId': null,
        'updateUserId': null,
        'updateUserName': null,
        'updateTime': null
      }
    }
  },
  created () {
    // 下拉框map
    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_JOB_STATUS)
    this.sbStatusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
  },
  methods: {
    base (record) {
      this.visible = true
      this.modalTitle = '详情'
      this.model = record
    },
    handleCancel () {
      this.visible = false
      this.confirmLoading = false
    }

  }
}
</script>
