/*
 * @Author: 张宁 18339727226@163.com
 * @Date: 2024-05-27 08:45:53
 * @LastEditors: 张宁 18339727226@163.com
 * @LastEditTime: 2024-06-04 09:34:13
 * @FilePath: \welcome-system-screen\src\stores\time\time.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { ref } from "vue";
import { defineStore } from "pinia";
// import { storeToRefs } from 'pinia';

export const useDataStore = defineStore("data", () => {
  const allData:Ref<any>  = ref({
    degreeDto: [],
    forecast:{},
    forecastFill:{},
    nationStudent:[],
    payDto:{},
    provinceDto:[],
    rankingDto:[],
    sexDto:{},
    today:{},
    totalDto:{}
  });
  const degreeDto=computed(() => allData.value.degreeDto);
  const forecast=computed(() => allData.value.forecast);
  const forecastFill=computed(() => allData.value.forecastFill);
  const nationStudent=computed(() => allData.value.nationStudent);
  const payDto=computed(() => allData.value.payDto);
  const provinceDto=computed(() => allData.value.provinceDto);
  const rankingDto=computed(() => allData.value.rankingDto);
  const sexDto=computed(()=> allData.value.sexDto);
  const today=computed(() => allData.value.today);
  const totalDto=computed(() => allData.value.totalDto);

  // 当日预报到报到率
  const forecastRate = computed(() => {
    forecast.value.reported / forecast.value.total
  }); 
  // 当日预报到总人数报到率
  const totalRate = computed(() => {
    totalDto.value.reportNumber / totalDto.value.totalNumber
  });

  // 选中的学院id
  const collageId = ref()
  // 切换选中的学院
  const setCollageId = (data:any)=>{
    collageId.value = data
  }
  // 学院对应的专业报道人数
  const professionRank = ref()
  const setProfessionRank = (data:any) => {
    professionRank.value = data;
  };

  const setData = (data:any) => {
    allData.value = data;
  };

  // 本科缴费人数
  const bkPay= ref()
  const setBkPay = (data:any) => {
    console.log('data',data);
    
    bkPay.value = data;
  };
  // 专科缴费人数
  const zkPay= ref()
  const setZkPay = (data:any) => {
    zkPay.value = data;
  };
  // 专升本缴费人数
  const zsbPay= ref()
  const setZsbPay = (data:any) => {
    zsbPay.value = data;
  };


  return { allData,degreeDto,forecast,forecastFill,nationStudent,payDto,provinceDto,rankingDto,sexDto,today,totalDto,setData,bkPay,zkPay,zsbPay,setBkPay,setZkPay,setZsbPay,setCollageId,collageId,professionRank,setProfessionRank,forecastRate,totalRate};
});
