<template>
  <div class="manage-container">
    <vab-query-form>
      <vab-query-form-left-panel>
        <el-select v-model="value1" placeholder="请选择项目">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
        <el-select v-model="value2" placeholder="请选择设备">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
        <el-input v-model="input" placeholder="请输入内容"></el-input>
        <el-button type="primary">查询</el-button>
      </vab-query-form-left-panel>
      <vab-query-form-right-panel>
        <router-link to="/iot/components/index">
          <el-button type="primary">添加触发器</el-button>
        </router-link>
      </vab-query-form-right-panel>
    </vab-query-form>
    <el-table
      v-loading="listLoading"
      :data="tableData"
      stripe
      border
      style="width: 100%"
    >
      <el-table-column
        prop="id"
        label="序号"
        width="80"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="name"
        label="名称"
        width="180"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="relation"
        label="关联传感器"
        width="180"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="condition"
        label="触发条件类型"
        width="180"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="parameter"
        label="参数"
        width="180"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="implement"
        label="执行类型"
        width="180"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="loop"
        label="循环"
        width="180"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="state"
        label="状态"
        width="180"
        align="center"
      ></el-table-column>
      <el-table-column fixed="right" label="操作" width="160" align="center">
        <el-button type="text" size="small">编辑</el-button>
        <el-button type="text" size="small">删除</el-button>
      </el-table-column>
    </el-table>
    <el-pagination
      :background="background"
      :current-page="queryForm.page"
      :layout="layout"
      :page-size="queryForm.size"
      :total="total"
      style="text-align: right"
      @current-change="handleCurrentChange"
      @size-change="handleSizeChange"
    ></el-pagination>
  </div>
</template>

<script>
export default {
  name: 'Police',
  data() {
    return {
      input: '',
      value1: '',
      value2: '',
      currentPage1: 5,
      currentPage2: 5,
      currentPage3: 5,
      currentPage4: 4,
      options: [
        { value: '选项1', label: '所有设备' },
        { value: '选项2', label: '已连接设备' },
        { value: '选项3', label: '未连接设备' },
        { value: '选项4', label: '已禁用设备' },
        { value: '选项5', label: '已删除设备' },
      ],
      tableData: [
        {
          id: '1',
          name: '太湖过滤装置',
          relation: '关联设置',
          condition: '数值高于{X}',
          parameter: '100',
          implement: '控制设备，微信通知',
          loop: '100',
          state: '正常',
        },
        {
          id: '2',
          name: '太湖过滤装置',
          relation: '关联设置',
          condition: '数值高于{X}',
          parameter: '100',
          implement: '控制设备，微信通知',
          loop: '100',
          state: '正常',
        },
        {
          id: '3',
          name: '太湖过滤装置',
          relation: '关联设置',
          condition: '数值高于{X}',
          parameter: '100',
          implement: '控制设备，微信通知',
          loop: '100',
          state: '正常',
        },
      ],
    };
  },
};
</script>

<style lang="scss" scoped>
.manage-wrap {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  .el-input {
    width: 200px !important;
  }
  .el-select {
    width: 200px !important;
  }
  .manage-button {
    padding-left: 12px;
    margin-bottom: 30px;
  }
}
</style>

<style lang="scss">
.el-submenu__title:hover {
  background-color: rgba(#1890ff, 0.085) !important;
  color: hsla(208, 100%, 55%, 0.95) !important;
}
.el-dialog {
  .el-dialog__header {
    background-color: #1890ff !important;
    padding: 15px 20px;
    text-align: left !important;
    .el-dialog__title {
      color: #e8f4ff !important;
    }
    .el-dialog__headerbtn .el-dialog__close {
      color: #e8f4ff !important;
    }
  }
  .el-dialog__body {
    padding: 20px !important;
    .el-form-item {
      margin-bottom: 10px !important;
      .el-input {
        width: 100% !important;
      }
      .el-select {
        width: 100% !important;
      }
    }
    .el-form-item:last-child {
      margin-bottom: 20px !important;
    }
  }
}
</style>
