<!-- 文件审批 -->
<script lang="ts" setup name="qualityFile">
import all from './components/approve/all.vue' // 全部
import drafts from './components/approve/drafts.vue' // 草稿箱
import pending from './components/approve/pending.vue' // 待审批
import inApprove from './components/approve/inApproval.vue' // 审批中
import passed from './components/approve/passed.vue' // 已通过
import unPassed from './components/approve/unPassed.vue' // 未通过
import cancel from './components/approve/cancel.vue' // 未通过
export interface menuType {
  name: string
  comp: any
}
const menu = shallowRef<menuType[]>([
  { name: '全部', comp: all },
  { name: '草稿箱', comp: drafts },
  { name: '待审批', comp: pending },
  { name: '审批中', comp: inApprove },
  { name: '已通过', comp: passed },
  { name: '未通过', comp: unPassed },
  { name: '已取消', comp: cancel },
])
const current = ref('全部')
const currentComp = shallowRef(all)
watch(current, (newValue) => {
  currentComp.value = menu.value.filter(item => item.name === newValue)[0].comp
})
</script>

<template>
  <div class="container">
    <div class="btns">
      <!-- 三级菜单 -->
      <el-radio-group v-model="current">
        <el-radio-button v-for="item in menu" :key="item.name" :label="item.name">
          {{ item.name }}
        </el-radio-button>
      </el-radio-group>
    </div>
    <!-- 展示区域 -->
    <component :is="currentComp" />
  </div>
</template>

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

  .btns {
    position: fixed;
    top: 67px;
    right: 15px;
    z-index: 999;
  }
}
</style>
