<template>
  <el-dialog title="详情" :visible.sync="open" width="800px" append-to-body destroy-on-close :close-on-click-modal="false">
    <el-form ref="form" label-width="90px">
      <el-row>
        <el-col :span="11">
          <el-form-item label="设备类型">
            <span>{{ devTypeFormatte() }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="13">
          <el-form-item label="出厂编号">
            <span>{{ form.devName }}</span>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="11">
          <el-form-item label="规格型号">
            <span v-if="form.devNo">{{ form.devNo }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>
        <el-col :span="13">
          <el-form-item label="设备位置">
            <span v-if="form.devAddr">{{ form.devAddr }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-form-item label="设备描述">
          <span v-if="form.devDescribe">{{ form.devDescribe }}</span>
          <span v-else>-</span>
        </el-form-item>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="制造单位">
            <span v-if="form.devCompany">{{ form.devCompany }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="设备状态">
            <span v-if="form.devStatus == 1">正常</span>
            <span v-else-if="form.devStatus == 2">停用</span>
            <span v-else-if="form.devStatus == 9">报废</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="预警天数">
            <span v-if="form.alarmDays">{{ form.alarmDays }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="启用日期">
            <span v-if="form.useDate">{{ form.useDate }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </el-dialog>

</template>

<script>
  import { getCycle } from "@/api/cycle/cycle";
  export default {
      name: "cycle-detail-info",
      data(){
          return{
            form: {},
            open: false
          }
      },
      methods:{
        openDetail(id){
          getCycle(id).then(res => {
            if(res.code == 200){
              this.form = res.data;
              this.open = true;
            }
          });
        },
        devTypeFormatte(){
          return this.selectDictLabel(this.$parent.cycleDevType,this.form.devType);
        }
      }
    }
</script>

<style scoped>

</style>
