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

        <el-col :span="12">
          <el-form-item label="设备状态">
            <span v-if="detailInfo.reportStatus">{{ detailInfo.reportStatus }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

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

        <el-col :span="12">
          <el-form-item label="报警开始时间">
            <span v-if="detailInfo.starttime">{{ detailInfo.starttime }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="报警结束时间">
            <span v-if="detailInfo.endtime">{{ detailInfo.endtime }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="上报数值">
            <span v-if="detailInfo.nd">{{ detailInfo.nd }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="报警状态">
            <span v-if="detailInfo.status">{{ $parent.statusFormat(detailInfo) }}</span>
            <span v-else>-</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 v-if="detailInfo.reason">{{ $parent.reasonFormat(detailInfo) }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="处置结果">
            <span v-if="detailInfo.remark">{{ detailInfo.remark }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </el-dialog>
</template>

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

<style scoped>

</style>
