<template>
  <el-dialog title="设备详情" :visible.sync="detailOpen" width="800px" append-to-body destroy-on-close :close-on-click-modal="false">
    <el-form label-width="80px">
      <el-row>
        <el-col :span="12">
          <el-form-item label="设备编号">
            <span>{{ detailInfo.number }}</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="所属厂家">
            <span v-if="detailInfo.type">{{ $parent.typeFormat(detailInfo) }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="位号">
            <span>{{ detailInfo.tag }}</span>
          </el-form-item>
        </el-col>

        <el-col :span="24">
          <el-form-item label="安装位置">
            <span>{{ detailInfo.position }}</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="高报">
            <span v-if="detailInfo.highAlarm">{{ detailInfo.highAlarm }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="高高报">
            <span v-if="detailInfo.highHighAlarm">{{ detailInfo.highHighAlarm }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="低报">
            <span v-if="detailInfo.lowAlarm">{{ detailInfo.lowAlarm }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="低低报">
            <span v-if="detailInfo.lowLowAlarm">{{ detailInfo.lowLowAlarm }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="量程">
            <span v-if="detailInfo.range">{{ detailInfo.range }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="单位">
            <span v-if="detailInfo.unit">{{ detailInfo.unit }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="创建时间">
            <span v-if="detailInfo.createdAt">{{ detailInfo.createdAt }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </el-dialog>
</template>

<script>
  import { getData } from "@/api/gasdata/data";
  export default {
    name: "detail-info",
    data(){
        return{
          detailOpen: false,
          detailInfo: {}
        }
    },
    methods:{
      openDetail(gasId){
        this.detailOpen = true;
        this.getGasData(gasId);
      },
      getGasData(gasId){
        getData(gasId).then(res =>{
          if(res.code == 200){
            this.detailInfo = res.data;
          }
        })
      }
    }
  }
</script>

<style scoped>

</style>
