AIzhushou-screen/src/views/index/index.vue

394 lines
11 KiB
Vue
Raw Normal View History

2024-05-22 08:44:08 +08:00
<script setup lang="ts">
2024-05-23 15:47:12 +08:00
import zkItem from "@/components/zk-item";
2024-05-22 08:44:08 +08:00
import LeftTop from "./left-top.vue";
import LeftCenter from "./left-center.vue";
import LeftBottom from "./left-bottom.vue";
import CenterMap from "./center-map.vue";
2024-05-24 17:42:14 +08:00
import CenterTop from "./center-top.vue";
2024-05-22 08:44:08 +08:00
import RightTop from "./right-top.vue";
import RightCenter from "./right-center.vue";
import RightBottom from "./right-bottom.vue";
2024-05-24 17:42:14 +08:00
import RightTopTwo from "./right-top-two.vue";
import RightBottomTwo from "./right-bottom-two.vue";
2024-05-27 11:43:19 +08:00
import { useTimeStore } from "@/stores/index";
import { storeToRefs } from "pinia";
const timeStore = useTimeStore();
2024-05-31 18:55:17 +08:00
2024-07-05 16:28:10 +08:00
const { nowTitle, years, months, days,allDates } = storeToRefs(timeStore);
2024-05-31 18:55:17 +08:00
2024-07-01 14:34:40 +08:00
import { AdminPCIndex, WeekPay, StatisticsReportedRanking, GetBatch } from "@/api";
2024-05-31 18:55:17 +08:00
import { useDataStore } from "@/stores/index";
const dataStore = useDataStore();
2024-07-01 14:34:40 +08:00
const { allData, rankingDto, collageId, professionRank, batchData } = storeToRefs(dataStore)
2024-05-31 18:55:17 +08:00
2024-06-04 09:36:00 +08:00
const rightCenterRef: any = ref(null)
2024-05-31 18:55:17 +08:00
2024-06-04 09:36:00 +08:00
const mapRef: any = ref(null)
2024-06-28 15:51:37 +08:00
const rbRef: any = ref(null)
2024-05-31 18:55:17 +08:00
const tableData = ref()
2024-05-24 17:42:14 +08:00
const showRight = ref(true)
const changeRight = () => {
showRight.value = !showRight.value
2024-05-31 18:55:17 +08:00
if (!showRight.value && rbtwoRef) {
2024-06-04 09:36:00 +08:00
setTimeout(() => {
2024-05-31 18:55:17 +08:00
rbtwoRef.value.getData(professionRank.value)
})
}
};
/**
* @description: 处理map中的数据
* @param {*} data
* @return {*}
*/
const dealMapData = (data: any) => {
tableData.value = data.provinceDto?.map((item: any) => {
return {
name: item.provinceName,
2024-06-28 15:51:37 +08:00
// zk: item.degreesDto[0].paymentCompleted + item.degreesDto[0].nonPayment,
2024-05-31 18:55:17 +08:00
// zsb:item.degreesDto[1].paymentCompleted+ '/'+(item.degreesDto[1].paymentCompleted+item.degreesDto[1].nonPayment),
2024-06-28 15:51:37 +08:00
// bk: item.degreesDto[2].paymentCompleted + item.degreesDto[2].nonPayment,
zk: findDegree(item.degreesDto, '统招专科').paymentCompleted + findDegree(item.degreesDto, '统招专科').nonPayment,
zsb: findDegree(item.degreesDto, '统招专升本').paymentCompleted + findDegree(item.degreesDto, '统招专升本').nonPayment,
bk: findDegree(item.degreesDto, '统招本科').paymentCompleted + findDegree(item.degreesDto, '统招本科').nonPayment,
zkrate: divideAndFormat(findDegree(item.degreesDto, '统招专科').paymentCompleted, findDegree(item.degreesDto, '统招专科').paymentCompleted + findDegree(item.degreesDto, '统招专科').nonPayment),
bkrate: divideAndFormat(findDegree(item.degreesDto, '统招本科').paymentCompleted, findDegree(item.degreesDto, '统招本科').paymentCompleted + findDegree(item.degreesDto, '统招本科').nonPayment),
zbdrate: divideAndFormat(findDegree(item.degreesDto, '统招专科').paymentCompleted + findDegree(item.degreesDto, '统招本科').paymentCompleted, findDegree(item.degreesDto, '统招专科').paymentCompleted + findDegree(item.degreesDto, '统招专科').nonPayment + findDegree(item.degreesDto, '统招本科').paymentCompleted + findDegree(item.degreesDto, '统招本科').nonPayment),
num1: findDegree(item.degreesDto, '统招专科')?.paymentCompleted,
num2: findDegree(item.degreesDto, '统招专升本')?.paymentCompleted,
num3: findDegree(item.degreesDto, '统招本科')?.paymentCompleted,
reported: findDegree(item.degreesDto, '统招专科')?.paymentCompleted + findDegree(item.degreesDto, '统招专升本')?.paymentCompleted + findDegree(item.degreesDto, '统招本科')?.paymentCompleted,
AdmissionNum: findDegree(item.degreesDto, '统招专科').paymentCompleted + findDegree(item.degreesDto, '统招专科').nonPayment + findDegree(item.degreesDto, '统招本科').paymentCompleted + findDegree(item.degreesDto, '统招本科').nonPayment
2024-05-31 18:55:17 +08:00
}
})
2024-06-28 15:51:37 +08:00
tableData.value?.sort((a: any, b: any) => {
2024-07-01 14:34:40 +08:00
return b.reported - a.reported
2024-06-28 15:51:37 +08:00
})
2024-05-31 18:55:17 +08:00
tableData.value?.forEach((item: any, index: any) => {
item.sort = index + 1
item.sort = item.sort < 10 ? "0" + item.sort : item.sort;
if (item.zbdrate == '0.0%') {
item.zbdrate = '0%'
}
})
}
2024-06-28 15:51:37 +08:00
2024-05-31 18:55:17 +08:00
const divideAndFormat = (divisor: any, dividend: any) => {
if (dividend === 0) {
return "0.0%";
}
let result = (divisor / dividend) * 100;
return result.toFixed(1) + "%";
}
2024-06-28 15:51:37 +08:00
const findDegree = (degreesDto: any, degree: string) => {
return degreesDto.find(d => d.degreesName === degree)
}
2024-06-04 09:36:00 +08:00
const rbtwoRef: any = ref(null)
2024-05-31 18:55:17 +08:00
const getProfession = () => {
let params = {
2024-07-02 15:19:56 +08:00
"Id": collageId.value,
"Year": years.value,
"Month": months.value || null,
"Day": days.value || null
2024-05-31 18:55:17 +08:00
}
StatisticsReportedRanking(params).then(res => {
dataStore.setProfessionRank(res.data)
setTimeout(() => {
if (!showRight.value && rbtwoRef) {
rbtwoRef.value.getData(professionRank.value)
}
})
})
}
watch(collageId, () => {
getProfession()
})
/**
* @description: 获取页面数据
* @return {*}
*/
const getAdminPCIndex = () => {
2024-06-04 09:36:00 +08:00
let params = {
2024-06-28 15:51:37 +08:00
"CandidateCategory": 0,
2024-06-04 09:36:00 +08:00
"Year": years.value,
2024-06-13 14:43:16 +08:00
"Month": months.value || null,
"Day": days.value || null
2024-06-04 09:36:00 +08:00
}
AdminPCIndex(params).then((res: any) => {
2024-05-31 18:55:17 +08:00
dataStore.setData(res.data);
dataStore.setCollageId(res.data.rankingDto[0].collegeId)
dealMapData(res.data)
setTimeout(() => {
if (mapRef) {
mapRef.value.getMapChart(tableData.value)
}
2024-06-28 15:51:37 +08:00
if (rbRef) {
rbRef.value.rankProvince(tableData.value)
}
2024-05-31 18:55:17 +08:00
});
})
2024-05-24 17:42:14 +08:00
};
2024-07-02 15:19:56 +08:00
2024-07-05 16:28:10 +08:00
watch(allDates,()=>{
console.log('allDates',allDates.value);
payData()
getAdminPCIndex()
},{
deep: true
})
/* watch(years,()=>{
2024-07-03 14:05:16 +08:00
// console.log('years.value',years.value);
2024-07-02 15:19:56 +08:00
payData()
2024-07-05 16:04:06 +08:00
getAdminPCIndex()
2024-07-02 15:19:56 +08:00
})
watch(months,()=>{
2024-07-03 14:05:16 +08:00
// console.log('months.value',months.value);
2024-07-02 15:19:56 +08:00
payData()
2024-07-05 16:04:06 +08:00
getAdminPCIndex()
2024-07-02 15:19:56 +08:00
})
watch(days,()=>{
2024-07-03 14:05:16 +08:00
// console.log('days.value',days.value);
2024-07-02 15:19:56 +08:00
payData()
2024-07-05 16:04:06 +08:00
getAdminPCIndex()
2024-07-05 16:28:10 +08:00
}) */
2024-07-02 15:19:56 +08:00
2024-07-01 14:34:40 +08:00
const batchs = ref()
// 获取学历层次
2024-07-02 15:19:56 +08:00
/* const getBatch = () => {
2024-07-01 14:34:40 +08:00
GetBatch().then((res: any) => {
if (res.succeed) {
batchs.value = res.data.item1
dataStore.setBatchData(res.data.item1)
}
})
2024-07-02 15:19:56 +08:00
} */
2024-05-31 18:55:17 +08:00
// 缴费人数-- 本科 专科 专升本
2024-06-24 11:21:35 +08:00
/* const payData = () => {
2024-05-31 18:55:17 +08:00
let params: any = [{
"EducationalLevel": 3,
"Year": years.value,
2024-06-13 14:43:16 +08:00
"Month": months.value || null,
"Day": days.value || null
2024-05-31 18:55:17 +08:00
}, {
"EducationalLevel": 4,
"Year": years.value,
2024-06-13 14:43:16 +08:00
"Month": months.value || null,
"Day": days.value || null
2024-05-31 18:55:17 +08:00
}, {
"EducationalLevel": 6,
"Year": years.value,
2024-06-13 14:43:16 +08:00
"Month": months.value || null,
"Day": days.value || null
2024-05-31 18:55:17 +08:00
}]
for (let item of params) {
WeekPay(item).then((res: any) => {
switch (item.EducationalLevel) {
case 3:
dataStore.setBkPay(res.data);
case 4:
dataStore.setZkPay(res.data);
case 6:
dataStore.setZsbPay(res.data);
}
})
}
setTimeout(() => {
if (rightCenterRef) {
rightCenterRef.value.getData()
}
});
2024-06-24 11:21:35 +08:00
} */
/*
缴费人数---根据批次去区分
*/
const payData = () => {
2024-07-02 15:19:56 +08:00
let payParams: any = {
"CandidateCategory": 0,
"Id": null,
"Year": years.value,
"Month": months.value || null,
"Day": days.value || null,
}
WeekPay(payParams).then((res: any) => {
const bk = res.data.batchTodayPays?.find((item: any) => item.name === "统招本科");
const zk = res.data.batchTodayPays?.find((item: any) => item.name === "统招专科");
const zsb = res.data.batchTodayPays?.find((item: any) => item.name === "统招专升本");
2024-06-24 11:21:35 +08:00
dataStore.setBkPay(bk)
dataStore.setZkPay(zk)
dataStore.setZsbPay(zsb)
2024-07-02 15:19:56 +08:00
dataStore.setTotalPay(res.data?.payNum)
2024-06-24 11:21:35 +08:00
setTimeout(() => {
if (rightCenterRef) {
rightCenterRef.value.getData()
}
});
})
2024-05-31 18:55:17 +08:00
}
2024-06-04 09:36:00 +08:00
const timer: any = ref(null)
const startTimer = () => {
timer.value = setInterval(() => {
getAdminPCIndex();
payData();
}, 60000)
}
const clearTimer = () => {
clearInterval(timer.value)
}
2024-05-31 18:55:17 +08:00
onMounted(() => {
2024-07-02 15:19:56 +08:00
// getBatch();
2024-05-31 18:55:17 +08:00
getAdminPCIndex();
2024-07-01 14:34:40 +08:00
setTimeout(() => {
payData();
startTimer()
2024-07-02 15:19:56 +08:00
}, 100)
2024-07-01 14:34:40 +08:00
2024-05-31 18:55:17 +08:00
});
2024-05-22 08:44:08 +08:00
</script>
<template>
<div class="index-box">
<div class="contetn_left">
2024-05-24 17:42:14 +08:00
<zkItem class="contetn_left-top contetn_lt-item" title="迎新进度">
2024-05-22 08:44:08 +08:00
<LeftTop />
2024-05-23 15:47:12 +08:00
</zkItem>
<zkItem class="contetn_left-center contetn_lr-item" title="">
2024-05-22 08:44:08 +08:00
<LeftCenter />
2024-05-23 15:47:12 +08:00
</zkItem>
2024-05-27 11:43:19 +08:00
<zkItem class="contetn_left-bottom contetn_lb-item" title="">
2024-05-22 08:44:08 +08:00
<LeftBottom />
2024-05-23 15:47:12 +08:00
</zkItem>
2024-05-22 08:44:08 +08:00
</div>
<div class="contetn_center">
2024-05-24 17:42:14 +08:00
<CenterTop class="contetn_center_top" />
2024-06-17 16:30:21 +08:00
<CenterMap class="contetn_center_map" ref="mapRef" />
2024-05-22 08:44:08 +08:00
</div>
2024-05-31 18:55:17 +08:00
<div class="contetn_right" v-show="showRight">
2024-05-24 17:42:14 +08:00
<div class="change-btn" @click="changeRight"></div>
<zkItem class="contetn_left-bottom contetn_rt-one" title="缴费人数">
2024-05-22 08:44:08 +08:00
<RightTop />
2024-05-23 15:47:12 +08:00
</zkItem>
2024-05-27 11:43:19 +08:00
<zkItem class="contetn_left-bottom contetn_rc-item" :title="nowTitle + '缴费人数'" style="padding: 0 10px 16px 10px">
2024-05-31 18:55:17 +08:00
<RightCenter ref="rightCenterRef" />
2024-05-23 15:47:12 +08:00
</zkItem>
2024-05-31 18:55:17 +08:00
<zkItem class="contetn_left-bottom contetn_rb-item" title="报到人数区域排名 ">
2024-07-01 14:34:40 +08:00
<RightBottom ref="rbRef" />
2024-05-23 15:47:12 +08:00
</zkItem>
2024-05-22 08:44:08 +08:00
</div>
2024-05-31 18:55:17 +08:00
<div class="contetn_right" v-if="!showRight">
2024-05-24 17:42:14 +08:00
<div class="change-btn" @click="changeRight"></div>
<zkItem class="contetn_left-bottom contetn_rt_two" title="学院报到人数">
<RightTopTwo />
</zkItem>
<zkItem class="contetn_left-bottom contetn_rb-item" title="专业报到人数 ">
2024-05-31 18:55:17 +08:00
<RightBottomTwo ref="rbtwoRef" />
2024-05-24 17:42:14 +08:00
</zkItem>
</div>
2024-05-22 08:44:08 +08:00
</div>
</template>
<style scoped lang="scss">
.index-box {
width: 100%;
display: flex;
min-height: calc(100% - 64px);
justify-content: space-between;
}
2024-05-24 17:42:14 +08:00
2024-05-22 08:44:08 +08:00
//左边 右边 结构一样
.contetn_left,
.contetn_right {
display: flex;
flex-direction: column;
2024-05-24 17:42:14 +08:00
// justify-content: space-around;
2024-05-22 08:44:08 +08:00
position: relative;
2024-05-24 17:42:14 +08:00
width: 470px;
2024-05-22 08:44:08 +08:00
box-sizing: border-box;
flex-shrink: 0;
2024-05-24 17:42:14 +08:00
border: 2px solid rgba(107, 163, 247, 0.2);
border-radius: 16px;
2024-05-23 15:47:12 +08:00
background-clip: padding-box, border-box;
background-origin: padding-box, border-box;
2024-05-27 11:43:19 +08:00
background-image: linear-gradient(to bottom, rgba(0, 0, 51, 0.1), rgba(0, 0, 0, 0.1)), linear-gradient(0deg, rgba(43, 74, 158, 0.1), rgba(89, 153, 252, 0.1));
.change-btn {
2024-05-24 17:42:14 +08:00
position: absolute;
left: -60px;
top: calc(50% - 200px);
width: 55px;
height: 400px;
background: url('@/assets/img/zheke/right_change.png');
cursor: pointer;
}
2024-05-22 08:44:08 +08:00
}
2024-05-24 17:42:14 +08:00
2024-05-22 08:44:08 +08:00
.contetn_center {
flex: 1;
2024-05-23 15:47:12 +08:00
// margin: 0 54px;
2024-05-22 08:44:08 +08:00
display: flex;
flex-direction: column;
2024-05-24 17:42:14 +08:00
padding-top: 50px;
// justify-content: space-around;
align-items: center;
2024-05-27 11:43:19 +08:00
2024-05-24 17:42:14 +08:00
.contetn_center_top {
width: 100%;
padding: 0 36px;
margin-bottom: 30px;
}
2024-05-27 11:43:19 +08:00
2024-05-24 17:42:14 +08:00
.contetn_center_map {
width: 100%;
height: 700px;
display: flex;
justify-content: center;
2024-05-23 15:47:12 +08:00
2024-05-24 17:42:14 +08:00
}
2024-05-22 08:44:08 +08:00
2024-05-24 17:42:14 +08:00
}
2024-05-27 11:43:19 +08:00
.contetn_lt-item {
2024-05-24 17:42:14 +08:00
height: 300px;
}
2024-05-27 11:43:19 +08:00
2024-05-22 08:44:08 +08:00
.contetn_lr-item {
height: 310px;
}
2024-05-27 11:43:19 +08:00
.contetn_lb-item {
2024-05-24 17:42:14 +08:00
height: 310px;
margin-top: 130px;
}
2024-05-27 11:43:19 +08:00
.contetn_rt-one {
2024-05-24 17:42:14 +08:00
height: 240px;
}
2024-05-27 11:43:19 +08:00
.contetn_rt_two {
2024-05-24 17:42:14 +08:00
height: 640px;
}
2024-05-27 11:43:19 +08:00
.contetn_rc-item {
2024-05-24 17:42:14 +08:00
height: 380px;
}
2024-05-27 11:43:19 +08:00
.contetn_rb-item {
2024-05-24 17:42:14 +08:00
height: 310px;
}
2024-05-22 08:44:08 +08:00
</style>