<template>
  <div>
    <div class="my-title">查看</div>
    <div style="margin-left: 20px;margin-right: 20px">
      <e-desc title="基本信息" column="1" labelWidth="160px">
        <e-desc-item label="点检时间">{{getDate(dataForm.rowRersion)}}</e-desc-item>
        <e-desc-item label="设备名称">{{dataForm.equipmentName}}</e-desc-item>
        <e-desc-item label="设备编号">{{dataForm.codeNumber}}</e-desc-item>
        <e-desc-item label="备注说明" span="3">{{dataForm.notes}}</e-desc-item>
      </e-desc>
      <e-desc title="点检项目" column="1" labelWidth="500px">
        <e-desc-item label="1. 设备外观清洁；内部打扫干净，无残留。">
          {{dataForm.one ? Number(dataForm.one) === 1 ? "✅": "❌":""}}
        </e-desc-item>
        <e-desc-item label="2. 各滑动面及导轨丝杆等传动部位，润滑充足，无损坏，运转无杂音。">
          {{dataForm.two ? Number(dataForm.two) === 1 ? "✅": "❌":""}}
        </e-desc-item>
        <e-desc-item label="3. 油路畅通，油量充足；冷却液无变质。">
          {{dataForm.three ? Number(dataForm.three) === 1 ? "✅": "❌":""}}
        </e-desc-item>
        <e-desc-item label="4. 系统运转正常，无报警，无异常。">
          {{dataForm.four ? Number(dataForm.four) === 1 ? "✅": "❌":""}}
        </e-desc-item>
        <e-desc-item label="5. 做好交接班工作，记录清晰完整。">
          {{dataForm.five ? Number(dataForm.five) === 1 ? "✅": "❌":""}}
        </e-desc-item>
      </e-desc>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="onChose">返回</el-button>
    </span>
  </div>
</template>

<script>
  import EDesc from '../common/e-desc'
  import EDescItem from '../common/e-desc-item'
  import {getInspectionDetail} from '@/api/device'
  import {getDate} from '@/utils/date-util'
export default {
    name: 'inspection-detail',
    components: {
      EDesc, EDescItem
    },
    data () {
      return {
        visible: false,
        id: 0,
        dataForm: {}
      }
    },
    methods: {
      getDate,
      onChose () {
        this.$emit('onChose')
      },
      async init (id) {
        this.visible = true
        this.id = id || 0
        this.dataForm = {}
        this.getDetails()
      },
      getDetails () {
        getInspectionDetail(this.id).then(({data}) => {
          if (data && data.code === '200') {
            this.dataForm = data.data
          }
        })
      }
    }
  }
</script>

<style scoped>
.my-line{
  border-bottom: 1px solid #c0c4cc;
  margin-bottom: 10px;
}
.title{
  padding: 10px 0 ;
}
</style>
