<template>
  <view class="container">
    <view class="tabs">
      <u-tabs
        :list="tabsList"
        font-size="30"
        :current="current"
        active-color="#2a56f7"
        @change="fnTabsChange"
      />
    </view>
    <task-list v-if="current === 0" />
    <enterprise-hidden-list v-if="current === 1" />
  </view>
</template>

<script>
import TaskList from "./task_list";
import EnterpriseHiddenList from "./enterprise_hidden_list";
export default {
  components: {
    TaskList,
    EnterpriseHiddenList,
  },
  data() {
    return {
      tabsList: [{ name: "专项检查管理" }, { name: "专项检查隐患管理" }],
      current: 0,
      recordCurrent: -1,
    };
  },
  onHide() {
    this.recordCurrent = this.current;
    this.current = -1;
  },
  onShow() {
    if (this.recordCurrent === -1) return;
    this.current = this.recordCurrent;
    this.recordCurrent = -1;
  },
  methods: {
    fnTabsChange(event) {
      this.current = event.index;
    },
  },
};
</script>

<style scoped lang="scss">
.container {
  width: 100%;
  height: calc(100vh - 45px);
  background: #fafafa;

  .tabs {
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #eeeeee;
  }
}
</style>
