<template>
  <div class="ele-body">
    <el-card shadow="never" v-loading="loading">
      <div class="switch">
        <div class="switch_left">
          <ul>
            <li
              v-for="item in tabOptions"
              :key="item.key"
              :class="{ active: activeComp == item.key }"
              @click="activeComp = item.key"
            >
              {{ item.name }}
            </li>
          </ul>
        </div>
        <!-- <div class="right" style="padding: 10px">
          <el-button @click="$router.go(-1)">返回</el-button>
        </div> -->
      </div>
      <div class="main">
        <div v-if="activeComp == 'point'">
          <InspectionPoint />
        </div>
        <div v-if="activeComp == 'anmac'">
          <Maintenance />
        </div>
        <div v-if="activeComp == 'warehouseInventory'">
          <WarehouseInventory />
        </div>
        <div v-if="activeComp == 'measuringSubmit'">
          <MeasuringSubmit />
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
  import InspectionPoint from '../inspectionPoint';
  import MeasuringSubmit from '../measuringSubmit';
  import Maintenance from '../maintenance';
  import WarehouseInventory from '../warehouseInventory';
  export default {
    components: {
      InspectionPoint,
      MeasuringSubmit,
      Maintenance,
      WarehouseInventory
    },
    data() {
      return {
        activeComp: 'point',
        tabOptions: [
          { key: 'point', name: '巡点检配置' },
          { key: 'anmac', name: '保养配置' },
          { key: 'warehouseInventory', name: '仓库盘点配置' },
          { key: 'measuringSubmit', name: '量具送检配置' }
        ],
        // 加载状态
        loading: false
      };
    },
    mounted() {
      console.log(this.$route.query);
      switch (this.$route.query.title) {
        case '巡检点':
          this.activeComp = 'point';
          break;
        case '保养':
          this.activeComp = 'anmac';
          break;
        case '量具送检':
          this.activeComp = 'measuringSubmit';
          break;
        case '仓库盘点配置':
          this.activeComp = 'warehouseInventory';
          break;
        default:
          break;
      }
    }
  };
</script>

<style lang="scss" scoped>
  ::v-deep .el-card__body {
    padding-top: 0;
    padding-left: 0;
  }
  .main {
    padding-left: 17px;
    .plan {
      padding-top: 15px;
    }
  }
</style>
