<script setup lang="ts">
import { shallowRef, onMounted } from "vue";
import All from "./components/all.vue";
import Business from "./components/business.vue";
import { usePermission } from "/@/hooks/core";
import NoAuth from "/@/components/NoAuth/NoAuth.vue";

const pageName = "costAnalysisNoDepartment";
const actived = shallowRef("");

const { hasPermissionWithCode } = usePermission(pageName);

onMounted(() => {
  if (hasPermissionWithCode("3")) {
    actived.value = "3";
  } else if (hasPermissionWithCode("11")) {
    actived.value = "11";
  }
});
</script>

<template>
  <div class="report-container">
    <el-tabs v-model="actived" style="color: #fff" v-if="actived">
      <el-tab-pane label="查看全部" name="3" v-if="hasPermissionWithCode('3')">
        <all v-if="actived === '3'" />
      </el-tab-pane>

      <el-tab-pane
        name="11"
        label="查看业务公司"
        v-if="hasPermissionWithCode('11')"
      >
        <business v-if="actived === '11'" />
      </el-tab-pane>
    </el-tabs>
    <no-auth v-else />
  </div>
</template>

<style scoped lang="scss">
.report-container {
  height: calc(100vh - 48px);
  :deep(.el-tabs__header) {
    background-color: #fff;
    padding: 10px 10px 0;
  }
}
</style>
