<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.planName }}</detail-list-item>
      <detail-list-item term="仓库名称">{{ model.spareName }}</detail-list-item>
      <detail-list-item term="备件名称">{{ model.spareName }}</detail-list-item>
      <detail-list-item term="待盘数量">{{ model.checkNum}}</detail-list-item>
      <detail-list-item term="实际数量">{{ model.realNum}}</detail-list-item>
      <detail-list-item term="差异数量">{{ model.profitNum}}</detail-list-item>
      <detail-list-item term="备件金额">{{ model.price}}</detail-list-item>
      <detail-list-item term="差异金额">{{ model.profitPrice}}</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="任务状态"><badge :status="DictCache.COLOR.STORE_CHECK_JOB_STATUS[model.status]" :text="statusMap[model.status]" /></detail-list-item>
    </detail-list>
    <detail-list title="" :col="1">
      <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
  },
  data () {
    return {
      names: ['任务', '巡检'],
      confirmLoading: false,
      mdl: {},
      modalTitle: null,
      visible: false,
      // 下拉框map
      statusMap: {},
      sbStatusMap: {},
      model: {
        'planName': null,
        'startTime': null,
        'endTime': null,
        'storeName': null,
        'spareName': null,
        'profitNum': null,
        'price': null,
        'profitPrice': null,
        'realNum': null,
        'checkNum': null,
        'status': null
      }
    }
  },
  created () {
    // 下拉框map
    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.STORE_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>
