<template>
  <el-dialog :close-on-click-modal="false" :visible.sync="visible" :modal-append-to-body="false">
    <div slot="title">
      <span class="title-bold">设备详情</span>
    </div>
    <el-form :model="dataForm" ref="dataForm" :label-width="formLabelWidth">
      <el-row>
        <el-col :span="12">
          <el-form-item label="设备所属层级">
            <el-input style="width:100%" v-if="dataForm.level === 1" value="本级设备" readonly></el-input>
            <el-input v-if="dataForm.level === 2" value="外接设备" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="所属节点名称">
            <el-input style="width:100%" v-if="dataForm.level === 1" v-model="dataForm.stationName"></el-input>
            <el-input style="width:100%" v-if="dataForm.level === 2" v-model="dataForm.lineName"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="设备名称">
            <el-input style="width:100%" v-model="dataForm.name" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="设备编码">
            <el-input style="width:100%" v-model="dataForm.code" readonly></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="设备类型">
            <el-input style="width:100%" v-if="dataForm.type === 1" value="应用服务器" readonly></el-input>
            <el-input style="width:100%" v-if="dataForm.type === 2" value="数据库服务器" readonly></el-input>
            <el-input style="width:100%" v-if="dataForm.type === 3" value="集群服务器" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="设备IP地址">
            <el-input style="width:100%" v-model="dataForm.specifications" readonly></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="端口">
            <el-input style="width:100%" v-model="dataForm.port" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="生产厂家">
            <el-input style="width:100%" v-model="dataForm.factory" readonly></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="部署地址">
            <el-input style="width:100%" v-model="dataForm.deployAddress" readonly></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="备注">
            <el-input style="width:100%" type="textarea" v-model="dataForm.remark" rows="5" resize="none" readonly></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button size='medium' type='primary' @click="visible = false">关闭</el-button>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    data() {
      return {
        dialogDetail: 'padding:10px',
        id: null,
        visible: true,
        formLabelWidth: '120px',
        dataForm: {},
        options: [],
        optionType: [{
          label: '站点服务器',
          value: 1
        }]
      }
    },
    created() {
    },
    methods: {
      init(bean) {
        this.dataForm = {}
        this.visible = true
        this.$http({
          url: this.$http.adornUrl(`/eqEquipment/getId/` + bean.id),
          method: 'get'
        }).then(data => {
          if (data && data.code === 0) {
            this.dataForm = data.bean
            this.dataForm.stationName = this.dataForm.sname
            this.dataForm.lineName = this.dataForm.liName
          }
        })
      }
    }
  }
</script>
<style scoped>
  .el_row_detail{
    margin: 10px;
    font-size: 14px;
  }
  .detail_div{
    font-weight: bold;
  }
  .el-textarea{
    width: 100%;
  }
</style>
