<template>
  <div class="tab-container">
    <el-tabs v-model="activeName" style="padding-left: 20px; padding-right: 20px;">
      <el-tab-pane label="活动进度" name="schedule">
        <schedule :batchNo="batchNo" :sessionName="sessionName"></schedule>
      </el-tab-pane>
      <el-tab-pane label="活动统计" name="statistics">
        <statistics :batchNo="batchNo"></statistics>
      </el-tab-pane>
    </el-tabs>

    <div class="btn-back">
      <el-button type="primary" @click="handleBack">返回</el-button>
    </div>
  </div>

</template>

<script setup lang="ts">
import { ref } from 'vue'
import { useRoute } from 'vue-router'

import statistics from '@/views/activity/component/statistics/index.vue'
import schedule from '@/views/activity/component/schedule/index.vue'

const { proxy } = getCurrentInstance() as ComponentInternalInstance;

const route = useRoute()
const type = route.params.type
const batchNo = route.params.batchNo
const sessionName = route.params.sessionName

const activeName = ref('schedule')

const handleBack = () => {

  if (type == '1') {
    const obj = { path: "/scale/SysScalePublish" };
    proxy?.$tab.closeOpenPage(obj);
  }

  if(type == '2') {
    const obj = { path: "/evaluate/evaluateList" };
    proxy?.$tab.closeOpenPage(obj);
  }
 
}
</script>

<style lang="scss" scoped>
.tab-container {
  position: relative;

  .btn-back {
    position: absolute;
    top: 5px;
    right: 20px;
  }
}
</style>
