<template>
  <div class="attribTemplate">
    <div class="attribContent1">
      <div style="display: flex">
        <el-input
          placeholder="选择站点"
          v-model="filterText"
          class="attContentInput"
          style="width: 100%"
        >
          <template #suffix>
            <i class="el-icon-search el-input__icon"></i>
          </template>
        </el-input>
      </div>

      <div class="attSwitch">
        <el-tree
          :data="data"
          show-checkbox
          node-key="id"
          :default-expanded-keys="[2, 3]"
          :props="defaultProps"
        />
      </div>
    </div>
    <div class="attribContent2">
      <el-tabs
        v-model="activeName"
        type="card"
        @tab-click="handleClick"
        style="background-color: #fff; height: 100%"
        class="tabsSizeColor"
        v-if="activeBool"
      >
        <el-tab-pane label="模板1" name="first"> </el-tab-pane>
        <!-- <el-tab-pane label="视频监测设备" name="second"> </el-tab-pane>
        <el-tab-pane label="通信设备" name="third"> </el-tab-pane>
        <el-tab-pane label="通道列表" name="five"> </el-tab-pane> -->
      </el-tabs>
    </div>
  </div>
</template>
<script lang="ts">
import { defineComponent, ref, Ref } from "vue";

interface PowerEquipData {
  activeName: Ref;
  filterText: Ref;
}

export default defineComponent({
  name: "attribTemplate",
  components: {},
  props: {},
  data() {
    return {
      data: [
        {
          id: 1,
          label: "Level one 1",
          children: [
            {
              id: 4,
              label: "Level two 1-1",
            },
          ],
        },
        {
          id: 2,
          label: "Level one 2",
          children: [
            {
              id: 5,
              label: "Level two 2-1",
            },
            {
              id: 6,
              label: "Level two 2-2",
            },
          ],
        },
        {
          id: 3,
          label: "Level one 3",
          children: [
            {
              id: 7,
              label: "Level two 3-1",
            },
            {
              id: 8,
              label: "Level two 3-2",
            },
          ],
        },
      ],
      defaultProps: {
        children: "children",
        label: "label",
      },
    };
  },
  setup(): PowerEquipData {
    const activeName = ref("first");
    const filterText = ref("");
    return {
      activeName,
      filterText,
    };
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
    },
  },
});
</script>

<style lang="scss" scoped>
.attribTemplate {
  display: flex;
  height: calc(100vh - 100px);
  padding: 30px;
  margin-top: 50px;
  .attribContent1 {
    background-color: #fff;
    width: 15%;
    height: 100%;
    margin-right: 25px;
    padding: 20px;
    .el-input__icon {
      color: #409eff;
    }
    .el-input__inner:hover {
      border-color: #409eff;
    }
    .el-input__inner:focus {
      border-color: #409eff;
    }
    .attContentInput {
      margin: 0;
    }
    .attSwitch {
      margin-top: 20px;
      width: 100%;
      height: 20px;
      cursor: pointer;
      .attSwitchOne {
        display: flex;
        border: 0.5px solid silver;
        padding: 8px;
        font-size: 13px;
        div:nth-child(1) {
          width: 100%;
        }
      }
      .attSwitchOne:hover {
        background-color: #409eff;
      }
      .attSwitchOne:focus {
        background-color: #409eff;
      }
    }
  }
  .attribContent2 {
    background-color: #fff;
    width: 85%;
    height: 100%;
  }
}
</style>