<template>
  <div class="app-container">
    <el-form :model="form" :rules="rules" ref="form" label-width="100px" label-position='left'>
      <div class="info">
        <div class="title">设备基础信息</div>
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="设备编号" prop="deviceNumber">
              <el-input v-model="form.deviceNumber"></el-input>
            </el-form-item>
            <el-form-item label="设备类型" prop="deviceType">
              <el-input v-model="form.deviceType"></el-input>
            </el-form-item>
            <el-form-item label="创建时间" prop="createTime">
              <el-date-picker v-model="form.createTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期时间" style="width:100%;">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="质保日期" prop="warrantyTime">
              <el-date-picker v-model="form.warrantyTime" type="datetime" placeholder="选择日期时间" align="right" value-format="yyyy-MM-dd HH:mm:ss" style="width:100%;">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="设备名称" prop="deviceName">
              <el-input v-model="form.deviceName"></el-input>
            </el-form-item>
            <el-form-item label="设备标签" prop="deviceLabel">
              <el-input v-model="form.deviceLabel"></el-input>
            </el-form-item>
            <el-form-item label="设备状态" prop="deviceStatus">
              <el-select v-model="form.deviceStatus" placeholder="请选择" style="width:100%;">
                <el-option label="设备异常" value="1"></el-option>
                <el-option label="设备预警" value="2"></el-option>
                <el-option label="设备故障" value="3"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="设备型号" prop="deviceModel">
              <el-input v-model="form.deviceModel"></el-input>
            </el-form-item>
            <el-form-item label="所属仓房" prop="houseCode">
              <el-input v-model="form.houseCode"></el-input>
            </el-form-item>
            <el-form-item label="最后上线" prop="lastSeenTime">
              <el-date-picker v-model="form.lastSeenTime" type="datetime" placeholder="选择日期时间" align="right" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="pickerOptions" style="width:100%;">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div class="info">
        <div class="title1">
          <span>安装位置</span>
          <span class="title-right">设备安装点位由项目空间点位+安装位置描述两部分构成</span>
        </div>
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="安装点位" prop="installAdress">
              <el-select v-model="form.installAdress" placeholder="请选择" style="width:100%;">
                <el-option label="综合办公楼" value="综合办公楼"></el-option>
                <el-option label="产线厂房" value="产线厂房"></el-option>
                <el-option label="仓储楼" value="仓储楼"></el-option>
                <el-option label="活动中心" value="活动中心"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="安装位置" prop="installPoint">
              <el-input v-model="form.installPoint"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="设备详细地址" prop="deviceAddress">
              <el-input v-model="form.deviceAddress"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div class="info">
        <div class="title">
          <span>设备配置信息</span>
        </div>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="站点编号" prop="siteNumber">
              <el-input v-model="form.siteNumber"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="通道号" prop="channelNumber">
              <el-input v-model="form.channelNumber"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="描述" prop="windDescribe">
              <el-input type="textarea" v-model="form.windDescribe" placeholder="请输入内容" rows="4" maxlength="300" show-word-limit>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <div class="btns" style="text-align:center;">
            <el-button @click="goBack()">返回</el-button>
          </div>
        </el-row>
      </div>
      <!-- <div class="info">
        <div class="title1">
          <span>定时任务</span>
          <span class="title-right">设备安装点位由项目空间点位+安装位置描述两部分构成</span>
        </div>
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="定时任务" prop="timingTask">
              <el-select v-model="form.timingTask" placeholder="请选择" style="width:100%;">
                <el-option v-for="item in taskOptions" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        
      </div> -->
    </el-form>
  </div>
</template>

<script>
import { addEnergyMonitoringItem } from '@/api/equipConfig/equipConfiguration/index'
export default {
  data () {
    return {
      pickerOptions: {
        shortcuts: [{
          text: '今天',
          onClick (picker) {
            picker.$emit('pick', new Date());
          }
        }, {
          text: '昨天',
          onClick (picker) {
            const date = new Date();
            date.setTime(date.getTime() - 3600 * 1000 * 24);
            picker.$emit('pick', date);
          }
        }, {
          text: '一周前',
          onClick (picker) {
            const date = new Date();
            date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit('pick', date);
          }
        }]
      },
      loading: false,
      form: {
        orgCode: JSON.parse(localStorage.getItem("userInfo")).orgCode,
        id: '',
        deviceNumber: '',// 设备编号
        deviceModel: '',//设备型号
        createTime: '',//创建时间
        warrantyTime: '',//质保日期
        deviceName: '',//设备名称
        deviceLabel: '',//设备标签
        deviceStatus: '',//设备状态 (1：设备异常，2：设备预警，3：设备故障)
        deviceType: '',// 设备类型
        houseCode: '', //所属仓房
        lastSeenTime: '',//最后上线时间
        installAdress: '',//安装位置
        installPoint: '',//安装点位
        deviceAddress: '',//设备详细地址

        siteNumber: '',//站点编号
        channelNumber: '',// 通道号
        windDescribe: '',//描述
        // timingTask: '',//定时任务
      },
      rules: {
        name: [
          { required: true, message: '请输入活动名称', trigger: 'blur' },
          { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
        ],
      },
      taskOptions: [{
        value: '2小时',
        label: '2小时'
      }, {
        value: '6小时',
        label: '6小时'
      }, {
        value: '12小时',
        label: '12小时'
      }, {
        value: '24小时',
        label: '24小时'
      }, {
        value: '48小时',
        label: '48小时'
      }],
    }
  },
  created () {
    // console.log(this.$route.query, 'query')
  },
  mounted () {
    this.form = this.$route.params.data
  },
  methods: {
    tableDataAdd () {
      // this.tableData.
    },
    goBack () {
      this.$router.push({ name: "VentilationEquip" })
    },
    resetForm (formName) {
      this.$refs[formName].resetFields();
    }
  }
}
</script>
<style lang='scss' scoped>
.info {
  background-color: #fff;
  border-radius: 15px;
  padding: 10px 15px;
  .title {
    border-left: 4px solid #4a7de6;
    padding-left: 10px;
    margin-bottom: 20px;
  }
  .title1 {
    border-left: 4px solid #4a7de6;
    padding-left: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    .title-right {
      color: #ccc;
      font-size: 12px;
    }
  }
  .el-form {
    margin-top: 15px;
    padding-top: 10px;
  }
}
.btns {
  margin-bottom: 25px;
}
.info:nth-of-type(n + 2) {
  margin-top: 15px;
}

// ::v-deep .el-input__inner {
//   text-align: center;
// }
</style>
