<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 v-if="form.devType==1">-->
        <!--<el-col :span="12">-->
          <!--<el-form-item label="计量范围" prop="devFlowRange">-->
            <!--<span v-if="form.devFlowRange">{{ form.devFlowRange }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->

        <!--<el-col :span="12">-->
          <!--<el-form-item label="精度等级" prop="devLevel">-->
            <!--<span v-if="form.devLevel">{{ form.devLevel }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->
      <!--</el-row>-->

      <!--<el-row v-if="form.devType==1">-->
        <!--<el-col :span="12">-->
          <!--<el-form-item label="连接口方向" prop="workElectricity">-->
            <!--<span v-if="form.workElectricity">{{ form.workElectricity }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->

        <!--<el-col :span="12">-->
          <!--<el-form-item label="内部编号" prop="devNumber">-->
            <!--<span v-if="form.devNumber">{{ form.devNumber }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->
      <!--</el-row>-->


      <!--<el-row v-if="form.devType==2">-->
        <!--<el-col :span="12">-->
          <!--<el-form-item label="公称直径" prop="devDiameter">-->
            <!--<span v-if="form.devDiameter">{{ form.devDiameter }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->

        <!--<el-col :span="12">-->
          <!--<el-form-item label="公称压力" prop="devPressure">-->
            <!--<span v-if="form.devPressure">{{ form.devPressure }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->
      <!--</el-row>-->

      <!--<el-row v-if="form.devType==2">-->
        <!--<el-col :span="12">-->
          <!--<el-form-item label="压力等级" prop="devLevel">-->
            <!--<span v-if="form.devLevel">{{ form.devLevel }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->

        <!--<el-col :span="12">-->
          <!--<el-form-item label="整定压力" prop="workElectricity">-->
            <!--<span v-if="form.workElectricity">{{ form.workElectricity }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->
      <!--</el-row>-->

      <!--<el-row v-if="form.devType==3">-->
        <!--<el-col :span="12">-->
          <!--<el-form-item label="介质" prop="devDiameter">-->
            <!--<span v-if="form.devDiameter">{{ form.devDiameter }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->

        <!--<el-col :span="12">-->
          <!--<el-form-item label="精准度" prop="devFlowRange">-->
            <!--<span v-if="form.devFlowRange">{{ form.devFlowRange }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->
      <!--</el-row>-->

      <!--<el-row v-if="form.devType==3">-->
        <!--<el-col :span="12">-->
          <!--<el-form-item label="防护等级" prop="devLevel">-->
            <!--<span v-if="form.devLevel">{{ form.devLevel }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->

        <!--<el-col :span="12">-->
          <!--<el-form-item label="报警限值" prop="workElectricity">-->
            <!--<span v-if="form.workElectricity">{{ form.workElectricity }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->
      <!--</el-row>-->

      <!--<el-row v-if="form.devType==3">-->
        <!--<el-col :span="12">-->
          <!--<el-form-item label="生产日期" prop="devDate">-->
            <!--<span v-if="form.devDate">{{ form.devDate }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->
      <!--</el-row>-->


      <!--<el-row v-if="form.devType==4">-->
        <!--<el-col :span="12">-->
          <!--<el-form-item label="设备类别" prop="devDiameter">-->
            <!--<span v-if="form.devDiameter">{{ form.devDiameter }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->
      <!--</el-row>-->


      <!--<el-row v-if="form.devType==5">-->
        <!--<el-col :span="12">-->
          <!--<el-form-item label="公称通径" prop="devDiameter">-->
            <!--<span v-if="form.devDiameter">{{ form.devDiameter }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->

        <!--<el-col :span="12">-->
          <!--<el-form-item label="流量范围" prop="devFlowRange">-->
            <!--<span v-if="form.devFlowRange">{{ form.devFlowRange }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->
      <!--</el-row>-->

      <!--<el-row v-if="form.devType==5">-->
        <!--<el-col :span="12">-->
          <!--<el-form-item label="准确度等级" prop="devLevel">-->
            <!--<span v-if="form.devLevel">{{ form.devLevel }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->

        <!--<el-col :span="12">-->
          <!--<el-form-item label="公称压力" prop="devPressure">-->
            <!--<span v-if="form.devPressure">{{ form.devPressure }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->
      <!--</el-row>-->

      <!--<el-row v-if="form.devType==5">-->
        <!--<el-col :span="12">-->
          <!--<el-form-item label="工作电源" prop="workElectricity">-->
            <!--<span v-if="form.workElectricity">{{ form.workElectricity }}</span>-->
            <!--<span v-else>-</span>-->
          <!--</el-form-item>-->
        <!--</el-col>-->

        <!--<el-col :span="12">-->
          <!--<el-form-item label="生产日期" prop="devDate">-->
            <!--<span v-if="form.devDate">{{ form.devDate }}</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-col :span="12">
          <el-form-item label="生产日期">
            <span v-if="form.devDate">{{ form.devDate }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="报废日期">
            <span v-if="form.devVoidDate">{{ form.devVoidDate }}</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>
