<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="设备编号">{{dataForm.code}}</e-desc-item>
        <e-desc-item label="设备型号">{{dataForm.modelStr}}</e-desc-item>
        <e-desc-item label="所属部门">{{dataForm.orgStr}}</e-desc-item>
        <e-desc-item label="设备维护人">{{dataForm.maintainerStr}}</e-desc-item>
        <e-desc-item label="最后一次上报时间">{{dataForm.lastReportTime}}</e-desc-item>
        <e-desc-item label="温度（℃）">{{dataForm.temperature}}</e-desc-item>
        <e-desc-item label="湿度（%）">{{dataForm.humidity}}</e-desc-item>
        <e-desc-item label="最后一次报警时间">{{dataForm.lastAlarmTime}}</e-desc-item>
        <e-desc-item label="备注说明" span="3">{{dataForm.notes}}</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 { getTempDetail } from '@/api/temp'
  export default {
    name: 'order-detail',
    components: {
      EDesc, EDescItem
    },
    data () {
      return {
        visible: false,
        id: 0,
        dataForm: {}
      }
    },
    methods: {
      onChose () {
        this.$emit('onChose')
      },
      async init (id) {
        this.visible = true
        this.id = id || 0
        this.dataForm = {}
        this.getDetails()
      },
      getDetails () {
        getTempDetail(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>
