<!--
 * @Author: liuzhenlin 461480418@qq.ocm
 * @Date: 2023-01-12 11:57:48
 * @LastEditors: wanglj wanglijie@dashoo.cn
 * @LastEditTime: 2025-03-26 18:00:04
 * @Description: file content
 * @FilePath: \opms\pages\schedule\index.vue
-->
<template>
  <!-- 页面内容 -->
  <div class="home">
    <!-- <van-pull-refresh v-model="loading" @refresh="onRefresh"> -->
          <van-tabs v-model:active="active" @click-tab="onClickTab">
            <van-tab title="即将上机">
              <div class="list-container">
                <soon-geton v-if="active === 0" ref="soonGetonRef" />
              </div>
            </van-tab>
            <van-tab title="正在上机">
              <div class="list-container">
                <in-progress v-if="active === 1" ref="inProgressRef" />
              </div>
            </van-tab>
            <van-tab title="等待审核">
              <div class="list-container">
                <my-appoint v-if="active === 2" ref="myAppointRef" />
              </div>
            </van-tab>
            <van-tab title="预约记录">
              <div class="list-container">
                <appoint-record v-if="active === 3" ref="recordRef" />
              </div>
            </van-tab>
            <van-tab title="送样预约">
              <div class="list-container">
                <sample-appoint-list v-if="active === 4" ref="sampleAppointListRef" />
              </div>
            </van-tab>
          </van-tabs>
    <!-- </van-pull-refresh> -->
    <van-tabbar route :placeholder="true">
      <van-tabbar-item replace to="/home" icon="wap-home-o">首页</van-tabbar-item>
      <van-tabbar-item replace to="/instr-follow" icon="star">收藏仪器</van-tabbar-item>
      <van-tabbar-item replace to="/instr-list" icon="printer">全部仪器</van-tabbar-item>
      <van-tabbar-item replace to="/instr-appoint-record" icon="label">我的预约</van-tabbar-item>
    </van-tabbar>
  </div>
</template>
<script>
  import SoonGeton from './soonGeton/index.vue'
  import InProgress from './inProgress/index.vue'
  import MyAppoint from './myAppoint/index.vue'
  import AppointRecord from './appointRecord/index.vue'
  import SampleAppointList from './SampleAppointList.vue'

  export default {
    name: 'appointList',
    components: { SoonGeton, InProgress, MyAppoint, AppointRecord, SampleAppointList },
    data() {
      return {
        loading: false,
        active: 0,
        activeTab: 0
      }
    },
    // onLoad(option) {
    //   console.log(option)
    //   if (option.type && option.type === 'inProgress') {
    //     this.curInstTabIndex = 1
    //   }
    //   console.log('onLoad')
    //   setTimeout(() => {
    //     this.showTemp = true
    //     this.initList()
    //   }, 500)
    // },

    // onShow() {
    //   setTimeout(() => {
    //     if (!this.$refs.soonGetonRef) {
    //       return
    //     }
    //     switch (this.curInstTabIndex) {
    //       case 0:
    //         this.$refs.soonGetonRef.onRefresh()
    //         break
    //       case 1:
    //         this.$refs.inProgressRef.onRefresh()
    //         break
    //       case 2:
    //         this.$refs.myAppointRef.onRefresh()
    //         break
    //     }
    //   })
    // },

    methods: {
      // 下拉刷新被触发
      onRefresh() {
        // this.initList()
        this.loading = false
      },
      onClickTab(e) {
        this.active = e.name
      }
      // initList() {
      //   if (this.curAppointTypeIndex == 0) {
      //     switch (this.curInstTabIndex) {
      //       case 0:
      //         if (!this.$refs.soonGetonRef) return
      //         this.$refs.soonGetonRef.queryForm.pageNum = 1
      //         this.$refs.soonGetonRef.appointList = []
      //         this.$refs.soonGetonRef.getInstList()
      //         break
      //       case 1:
      //         if (!this.$refs.inProgressRef) return
      //         this.$refs.inProgressRef.queryForm.pageNum = 1
      //         this.$refs.inProgressRef.appointList = []
      //         this.$refs.inProgressRef.getInstList()
      //         break
      //       case 2:
      //         if (!this.$refs.myAppointRef) return
      //         this.$refs.myAppointRef.queryForm.pageNum = 1
      //         this.$refs.myAppointRef.appointList = []
      //         this.$refs.myAppointRef.getInstList()
      //         break
      //     }
      //   } else if (this.curAppointTypeIndex == 1) {
      //     this.$refs.sampleDeliveryRef.queryForm.pageNum = 1
      //     this.$refs.sampleDeliveryRef.getSampleAppointList()
      //   }
      // },
    }
  }
</script>
<style lang="scss" scoped>
  * {
    box-sizing: border-box;
  }
  .home {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-top: 10px;
    .list-container {
      height: 100%;
      background-color: #f7f8fa;
      padding: 10px;
      overflow-y: auto;
      flex: 1;
    }
    .van-tabs {
      flex: 1;
      height: 0;
      display: flex;
      flex-direction: column;
    }
    :deep(.van-tabs__content) {
      flex: 1;
      height: 0;
    }
    .van-tab__panel {
      height: 100%;
    }
  }
</style>
