<template>
  <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" append-to-body>
    <el-form ref="dataForm" :model="deviceForm" label-well-code="right" label-width="100px">
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="设备名称" prop="deviceName">
            <el-input v-model="deviceForm.deviceName" type="text" placeholder="未知" disabled/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="设备编号" prop="devcode">
            <el-input v-model="deviceForm.devcode" type="text" placeholder="未知" disabled/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="设备类型" prop="deviceType">
            <el-input v-model="deviceForm.deviceTypeName" type="text" placeholder="未知" disabled/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="设备型号" prop="modelId">
            <el-input v-model="deviceForm.modelName" type="text" placeholder="未知" disabled/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="在线状态" prop="wellCode">
            <el-input v-model="deviceForm.onlineStateName" type="text" placeholder="未知" disabled/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="权属单位" prop="concenCode">
            <el-input v-model="deviceForm.deptName" type="text" placeholder="未知" disabled/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="窨井编号" prop="wellCode">
            <el-input v-model="deviceForm.wellCode" type="text" placeholder="未知" disabled/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="布防状态" prop="bfztName">
            <el-input v-model="deviceForm.bfztName" type="text" placeholder="未知" disabled/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="24">
          <el-form-item label="位置" prop="position">
            <el-input v-model="deviceForm.position" type="text" placeholder="未知" disabled/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="安装日期" prop="installDate">
            <el-input v-model="deviceForm.installDate" type="text" placeholder="未知" disabled/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="集中器编号" prop="concenCode">
            <el-input v-model="deviceForm.concenCode" type="text" placeholder="未知" disabled/>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </el-dialog>
</template>

<script>

export default {
  name: 'DetailDevice',
  data() {
    return {
      dialogFormVisible: false, // 对话框是否显示
      dialogStatus: '', // 对话框类型：create,update
      deviceForm: {
        id: '',
        deviceName: '',
        devcode: '',
        deviceTypeName: '',
        wellCode: '',
        modelName: '',
        installDate: '',
        concenCode: '',
        onlineStateName: '',
        deptName: '',
        bfztName: '',
        position: ''
      }, // 表单
      textMap: {
        update: '编辑',
        create: '新增',
        detail: '详情'
      } // 表头显示标题z
    }
  },
  methods: {
    // 初始化对话框
    initDialog: function(dialogStatus, dialogFormVisible, row = null) {
      this.dialogStatus = dialogStatus
      this.dialogFormVisible = dialogFormVisible
      this.deviceForm = {
        id: row.id,
        deviceName: row.deviceName,
        devcode: row.devcode,
        deviceTypeName: row.deviceTypeName,
        wellCode: row.wellCode,
        modelName: row.modelName,
        installDate: row.installDate,
        concenCode: row.concenCode,
        onlineStateName: row.onlineStateName,
        deptName: row.deptName,
        bfztName: row.bfztName,
        position: row.position
      }
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .el-select{
    width: 100%;
  }
</style>
