<template>
  <div class="monthReport">
    <div class="monthContent1" v-if="modleBool">
      <div style="display: flex">
        <el-input
          placeholder="输入站点名称或关键字"
          v-model="filterText"
          class="attContentInput"
        >
          <template #suffix>
            <i class="el-icon-search el-input__icon"></i>
          </template>
        </el-input>
      </div>

      <div class="monthSwitch">
        <el-tree
          :data="data"
          show-checkbox
          node-key="id"
          :default-expanded-keys="[2, 3]"
          :props="defaultProps"
        />
      </div>
    </div>
    <div class="monthContent2" v-if="modleBool">
      <el-tabs
        v-model="activeName"
        type="card"
        @tab-click="handleClick"
        style="background-color: #fff; height: 100%"
        class="tabsSizeColor"
      >
        <el-tab-pane label="月报列表" name="monthList">
          <baseic-Table></baseic-Table>
        </el-tab-pane>
        <el-tab-pane label="月报模板" name="monthModel">
          <deviation-Table @modle="modleAll"></deviation-Table>
        </el-tab-pane>
      </el-tabs>
    </div>

    <report-Model
      v-if="!modleBool"
      style="width: 100%"
      @modle="modleAll"
    ></report-Model>
  </div>
</template>
<script>
import { useStore } from 'vuex'
import { defineComponent, ref } from 'vue'
import baseicTable from './tables/basicTable.vue'
import deviationTable from './tables/deviationTable.vue'
import reportModel from './reportModel.vue'

export default defineComponent({
  name: 'monthReport',
  components: { baseicTable, deviationTable, reportModel },
  props: {},
  setup() {
    const store = useStore()
    store

    const handleClick = (tab, event) => {
      console.log(tab, event)
    }

    // 表头样式设置
    const headClass = () => {
      return 'background:#FAFAFA !important;color: black;'
    }

    const modleBool = ref(true)
    const modleAll = (value) => {
      modleBool.value = value.modleBool
    }

    return {
      headClass,
      modleAll,
      modleBool,
      filterText: ref(''),
      activeName: ref('monthList'),
      handleClick, //tabs切换事件
      data: [
        {
          id: 1,
          label: '所有站点',
          children: [
            {
              id: 4,
              label: '分组1',
            },
            {
              id: 4,
              label: '分组2',
            },
            {
              id: 4,
              label: '分组3',
            },
          ],
        },
      ],
      defaultProps: {
        children: 'children',
        label: 'label',
      },
    }
  },
})
</script>

<style lang="scss">
.monthReport {
  display: flex;
  height: calc(100vh - 130px);
  // padding: 30px;
  // margin-top: 50px;
  .monthContent1 {
    background-color: #fff;
    width: 15%;
    height: 100%;
    margin-right: 25px;
    padding: 20px;
    min-width: 200px;
    .monthSwitch {
      margin-top: 20px;
      width: 100%;
      height: 20px;
      cursor: pointer;
    }
  }
  .monthContent2 {
    background-color: #fff;
    width: 85%;
    min-width: 845px;
    height: 100%;
    .basicHeader {
      margin-left: 15px;
      margin-top: 15px;
      margin-bottom: 15px;
      overflow: hidden;
    }
  }
}

// tab重置样式
.tabsSizeColor > .el-tabs__header .el-tabs__item {
  line-height: 50px;
  height: 50px;
  font-size: 16px;
}

.tabsSizeColor > .el-tabs__header .el-tabs__item.is-active {
  border-bottom: 2px solid #409eff;
  color: #409eff;
}
.el-tabs__header {
  margin-bottom: 0;
}
.el-tabs--card > .el-tabs__header .el-tabs__item,
.el-tabs--card > .el-tabs__header .el-tabs__nav {
  border: none;
}
</style>