<template>
  <div class="manage-container">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="项目信息" name="first">
        <project-index ref="project"></project-index>
      </el-tab-pane>
      <el-tab-pane label="站点信息" name="second">
        <device-index ref="device"></device-index>
      </el-tab-pane>
      <el-tab-pane label="车辆信息" name="three">
        <vehicle-index ref="vehicle"></vehicle-index>
      </el-tab-pane>
      <el-tab-pane label="报警联系人" name="four">
        <police-index ref="police"></police-index>
      </el-tab-pane>
      <el-tab-pane label="项目运行率报表" name="five">
        <run-index ref="run"></run-index>
      </el-tab-pane>
      <el-tab-pane label="告警管理" name="six">
        <alarm-index ref="alarm"></alarm-index>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import projectIndex from './components/project/index';
import deviceIndex from './components/device/index';
import vehicleIndex from './components/vehicle/index';
import policeIndex from './components/police/index';
import runIndex from './components/run/index';
import alarmIndex from './components/alarm/index';
export default {
  components: {
    projectIndex,
    deviceIndex,
    vehicleIndex,
    policeIndex,
    runIndex,
    alarmIndex,
  },
  data() {
    return {
      activeName: 'first',
    };
  },
  computed: {
    height() {
      return 500;
    },
  },
  created() {
    const type = this.$route.query.type;
    if (type === 'six') {
      this.activeName = 'six';
    }
  },
  mounted() {},
  methods: {
    handleClick(tab, event) {
      if (tab.paneName == 'first') {
        this.$refs['project'].showData();
      } else if (tab.paneName == 'second') {
        this.$refs['device'].showData();
      } else if (tab.paneName == 'three') {
        this.$refs['vehicle'].showData();
      } else if (tab.paneName == 'four') {
        this.$refs['police'].showData();
      } else if (tab.paneName == 'five') {
        this.$refs['run'].showData();
      } else if (tab.paneName == 'six') {
        this.$refs['alarm'].showData();
      }
    },
  },
};
</script>

<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-cascader {
        width: 100% !important;
      }
    }
    .el-form-item:last-child {
      margin-bottom: 20px !important;
    }
  }
  .dialog-footer {
    text-align: right;
  }
}
</style>
