Compare commits

..

4 Commits

3 changed files with 169 additions and 131 deletions

View File

@ -141,7 +141,6 @@ export function createPermissionGuard(router: Router) {
// update-begin-author:sunjianlei date:20230306 for: 修复登录成功后,没有正确重定向的问题 // update-begin-author:sunjianlei date:20230306 for: 修复登录成功后,没有正确重定向的问题
redirect: to.fullPath, redirect: to.fullPath,
// update-end-author:sunjianlei date:20230306 for: 修复登录成功后,没有正确重定向的问题 // update-end-author:sunjianlei date:20230306 for: 修复登录成功后,没有正确重定向的问题
}; };
} }
next(redirectData); next(redirectData);
@ -189,11 +188,13 @@ export function createPermissionGuard(router: Router) {
if (to.name === PAGE_NOT_FOUND_ROUTE.name) { if (to.name === PAGE_NOT_FOUND_ROUTE.name) {
// 动态添加路由后此处应当重定向到fullPath否则会加载404页面内容 // 动态添加路由后此处应当重定向到fullPath否则会加载404页面内容
next({ path: to.fullPath, replace: true, query: to.query }); //next({ path: to.fullPath, replace: true, query: to.query });
next({ path: PageEnum.BASE_HOME, replace: true, query: to.query });
} else { } else {
const redirectPath = (from.query.redirect || to.path) as string; const redirectPath = (from.query.redirect || to.path) as string;
const redirect = decodeURIComponent(redirectPath); const redirect = decodeURIComponent(redirectPath);
const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect }; //const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect };
const nextData = PageEnum.BASE_HOME;
next(nextData); next(nextData);
} }
}); });

View File

@ -54,6 +54,7 @@
<script> <script>
//import { pagination } from 'mock/_util'; //import { pagination } from 'mock/_util';
import { red } from '@ant-design/colors';
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import * as echarts from 'echarts'; import * as echarts from 'echarts';
@ -326,18 +327,31 @@
this.participate_Piechartloading = true; this.participate_Piechartloading = true;
this.tableloading = true; this.tableloading = true;
let result = await defHttp.get({ url: url, params: queryParams }); let result = await defHttp.get({ url: url, params: queryParams });
let totalRate = 0;
for (let key in result.gradeData) {
totalRate += parseFloat(result.gradeData[key].passRate);
}
console.log(totalRate, 'totalRate');
console.log(result, 'result'); console.log(result, 'result');
let chartsData = []; let chartsData = [];
for (let key in result.gradeData) { for (let key in result.gradeData) {
chartsData.push({ chartsData.push({
name: key + '级', name: key + '级',
value: result.gradeData[key].passRate, value: (parseFloat(result.gradeData[key].passRate) / totalRate) * 100,
}); });
} }
let option = { let option = {
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
conginee: false, conginee: false,
formatter: function (params) {
return params.name + ': ' + params.value.toFixed(1) + '%';
},
textStyle: {
color: '#ec2e30', //
fontSize: 14, //
fontWeight: 'bold', //
},
// //
itemStytle: { itemStytle: {
// //

View File

@ -15,7 +15,7 @@
<!--<a-cascader v-model:value="collegeMajor" expand-trigger="hover" :options="collegeMajorOptions" change-on-select />--> <!--<a-cascader v-model:value="collegeMajor" expand-trigger="hover" :options="collegeMajorOptions" change-on-select />-->
<!-- 主外层容器包括一级和二级菜单并排 --> <!-- 主外层容器包括一级和二级菜单并排 -->
<div class="dropdown-wrapper" ref="step1" @blur="loseFocus" tabindex="0"> <div class="dropdown-wrapper" @blur="loseFocus" tabindex="0">
<div class="dropdown-trigger" @click="toggleDropdown"> <div class="dropdown-trigger" @click="toggleDropdown">
<span class="trigger-label">{{ selectedLabel || '请选择学院' }}</span> <span class="trigger-label">{{ selectedLabel || '请选择学院' }}</span>
<DownOutlined class="trigger-icon" /> <DownOutlined class="trigger-icon" />
@ -45,8 +45,8 @@
</div> </div>
</div> </div>
<a-select v-model:value="entrydate" ref="step2" style="margin-left: 10px; width: 100px" :options="entrydateOptions" /> <a-select v-model:value="entrydate" style="margin-left: 10px; width: 100px" :options="entrydateOptions" />
<a-button style="margin-left: 10px" type="primary" ref="step3" @click="query">查询</a-button> <a-button style="margin-left: 10px" type="primary" @click="query">查询</a-button>
<div class="stats-container"> <div class="stats-container">
<span style="padding-left: 240px">{{ totalName }}总人数{{ total }}</span> <span style="padding-left: 240px">{{ totalName }}总人数{{ total }}</span>
<span>累计通过人数: {{ passNumberBottom }}</span> <span>累计通过人数: {{ passNumberBottom }}</span>
@ -59,7 +59,7 @@
<a-row :gutter="12"> <a-row :gutter="12">
<a-col :xl="14"> <a-col :xl="14">
<div style="padding-left: 10px; min-height: 200px"> <div style="padding-left: 10px; min-height: 200px">
<a-table size="small" :dataSource="dataSourceCet4" :columns="columns" ref="step4" :pagination="false" bordered :scroll="{ y: 290 }"> <a-table size="small" :dataSource="dataSourceCet4" :columns="columns" :pagination="false" bordered :scroll="{ y: 290 }">
<template #passRateSlot> <template #passRateSlot>
累计总通过率 累计总通过率
<a-tooltip :title="'累计通过人数 / ' + totalName + '总人数'" placement="top"> <a-tooltip :title="'累计通过人数 / ' + totalName + '总人数'" placement="top">
@ -70,7 +70,7 @@
</div> </div>
</a-col> </a-col>
<a-col :xl="10"> <a-col :xl="10">
<a-card class="card-with-piechart" ref="step5"> <a-card class="card-with-piechart">
<div style="width: 100%; height: 200px" class="piechart" id="piechart"> </div> <div style="width: 100%; height: 200px" class="piechart" id="piechart"> </div>
</a-card> </a-card>
</a-col> </a-col>
@ -82,14 +82,14 @@
</div> </div>
<div class="bottom-box"> <div class="bottom-box">
<div class="left-side"> <div class="left-side">
<a-card :loading="loading" :bordered="false" ref="step6"> <a-card :loading="loading" :bordered="false">
<div style="width: 100%; height: 350px" id="map2"> </div> <div style="width: 100%; height: 350px" id="map2"> </div>
</a-card> </a-card>
</div> </div>
<div class="right-side"> <div class="right-side">
<!-- <a-row :gutter="12"> --> <!-- <a-row :gutter="12"> -->
<!-- <a-col :xl="16"> --> <!-- <a-col :xl="16"> -->
<a-card :loading="map1loading" ref="step7"> <a-card :loading="map1loading">
<!-- <div class="query"> <!-- <div class="query">
<span <span
style="font-size: 15px; margin-right: 10px; display: flex; justify-content: center; align-items: center; font-weight: bold">年级: style="font-size: 15px; margin-right: 10px; display: flex; justify-content: center; align-items: center; font-weight: bold">年级:
@ -103,7 +103,6 @@
<!-- </a-row> --> <!-- </a-row> -->
</div> </div>
</div> </div>
<Tour :current="currentStep" :open="stepOpen" :steps="steps" @close="handleOpen(false)" @update:current="updateCurrent" />
</template> </template>
<script> <script>
@ -111,18 +110,15 @@
import * as echarts from 'echarts'; import * as echarts from 'echarts';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { DownOutlined, RightOutlined } from '@ant-design/icons-vue'; import { DownOutlined, RightOutlined } from '@ant-design/icons-vue';
import { Tour } from 'ant-design-vue'; // ant-design-vue Tour import { getThirdUserBindByWechat } from '../system/appconfig/ThirdApp.api';
export default { export default {
components: { components: {
DownOutlined, DownOutlined,
RightOutlined, RightOutlined,
Tour,
}, },
data() { data() {
return { return {
stepOpen: false,
currentStep: 0,
steps: [],
activeKey: '1', activeKey: '1',
allCollege: [], allCollege: [],
showBox: false, showBox: false,
@ -134,6 +130,7 @@
checkedOptions: [], checkedOptions: [],
collegetab2: [], collegetab2: [],
collegeMajorOptions: [], collegeMajorOptions: [],
collegeMajor: [],
loading: false, loading: false,
dataSourceCet4: [], dataSourceCet4: [],
dropdownVisible: false, dropdownVisible: false,
@ -142,6 +139,99 @@
selectedLabel: '全校', selectedLabel: '全校',
currentSubMenu: [], currentSubMenu: [],
currentSubSubMenu: [], currentSubSubMenu: [],
losefocus: false,
//
//menuData: [
// { key: '1', label: '' },
// { key: '2', label: '' },
// {
// key: '3',
// label: '',
// children: [
// { key: '3-1', label: '' },
// { key: '3-2', label: '' },
// { key: '3-3', label: '' },
// { key: '3-1', label: '' },
// { key: '3-2', label: '' },
// { key: '3-3', label: '' },
// { key: '3-1', label: '' },
// { key: '3-2', label: '' },
// { key: '3-3', label: '' },
// { key: '3-1', label: '' },
// { key: '3-2', label: '' },
// { key: '3-3', label: '' },
// { key: '3-1', label: '' },
// { key: '3-2', label: '' },
// { key: '3-3', label: '' },
// { key: '3-1', label: '' },
// { key: '3-2', label: '' },
// { key: '3-3', label: '' },
// ],
// },
// {
// key: '4',
// label: '',
// children: [
// { key: '3-1', label: '' },
// { key: '3-2', label: '' },
// { key: '3-3', label: '' },
// ],
// },
// {
// key: '5',
// label: '',
// children: [
// { key: '3-1', label: '' },
// { key: '3-2', label: '' },
// { key: '3-3', label: '' },
// ],
// },
// {
// key: '6',
// label: '',
// children: [
// { key: '3-1', label: '' },
// { key: '3-2', label: '' },
// { key: '3-3', label: '' },
// ],
// },
// {
// key: '7',
// label: '',
// children: [
// { key: '3-1', label: '' },
// { key: '3-2', label: '' },
// { key: '3-3', label: '' },
// ],
// },
// {
// key: '8',
// label: '',
// children: [
// { key: '3-1', label: '' },
// { key: '3-2', label: '' },
// { key: '3-3', label: '' },
// ],
// },
// {
// key: '9',
// label: '',
// children: [
// { key: '3-1', label: '' },
// { key: '3-2', label: '' },
// { key: '3-3', label: '' },
// ],
// },
// {
// key: '10',
// label: '',
// children: [
// { key: '3-1', label: '' },
// { key: '3-2', label: '' },
// { key: '3-3', label: '' },
// ],
// },
//],
columns: [ columns: [
{ {
title: '学年', title: '学年',
@ -211,8 +301,10 @@
visible: false, visible: false,
level: null, level: null,
college: [],
batch: null, batch: null,
entrydateOptions: [], entrydateOptions: [],
entrydate: [],
majorCheckOn: [], majorCheckOn: [],
// //
lastCollegeMajor: [], lastCollegeMajor: [],
@ -230,6 +322,9 @@
passRatePie: [], passRatePie: [],
lineXData: [], lineXData: [],
lineYData: [], lineYData: [],
collegeOptions: [],
collegeMajorOptions: [],
entrydateOptions: [],
college: null, college: null,
entrydate: 2017, // entrydate: 2017, //
// //
@ -239,7 +334,6 @@
topEntrydate: null, // topEntrydate: null, //
}; };
}, },
mounted() { mounted() {
this.getEntrydateAndCollegeData(); this.getEntrydateAndCollegeData();
this.getCollegeMajorData(); this.getCollegeMajorData();
@ -247,83 +341,11 @@
// this.allQuery(); // this.allQuery();
this.getCollegeOptions(); this.getCollegeOptions();
this.getEntrydate(); this.getEntrydate();
this.$nextTick(() => {
this.initStep();
});
this.isFirstAsk();
}, },
methods: { methods: {
isFirstAsk() {
const isFirstAsk = localStorage.getItem('isFirstAsk');
// 访isFirstAsk true
//
//this.handleOpen(true);
if (isFirstAsk === null || isFirstAsk === 'true') {
this.handleOpen(true);
// isFirstAsk localStorage
localStorage.setItem('isFirstAsk', 'false');
}
},
initStep() {
console.log('initstep');
this.steps = [
{
title: '选择学院/专业',
description: '请点击选择框选择学院和专业',
// Vue 2
//cover: function (h) {
// return h('img', {
// attrs: {
// alt: 'tour.png',
// src: 'https://user-images.githubusercontent.com/5378891/197385811-55df8480-7ff4-44bd-9d43-a7dade598d70.png'
// }
// });
//},
// this Vue ref
target: () => this.$refs.step1,
},
{
title: '选择年级',
description: '请点击选择框选择年级',
target: () => this.$refs.step2.$el,
},
{
title: '确认查询',
description: '请点击查询按钮进行查询并绘制图表',
target: () => this.$refs.step3.$el,
},
{
title: '表单介绍',
description: '该学院/专业该年级各个批次的成绩情况',
target: () => this.$refs.step4.$el,
},
{
title: '图表介绍',
description: '该学院/专业该年级在不同年级通过考试的人数占比',
target: () => this.$refs.step5.$el,
},
{
title: '图表介绍',
description: '该学院/专业该年级各个批次的通过率折线图',
target: () => this.$refs.step6.$el,
},
{
title: '图表介绍',
description: '本年级全校各学院通过率排名,点击学院柱状图可查看该学院的其他信息',
target: () => this.$refs.step7.$el,
},
];
},
loseFocus() { loseFocus() {
this.dropdownVisible = false; this.dropdownVisible = false;
}, },
handleOpen(val) {
console.log('handleOpen');
this.stepOpen = val;
},
updateCurrent(val) {
this.currentStep = val;
},
toggleDropdown() { toggleDropdown() {
this.dropdownVisible = !this.dropdownVisible; this.dropdownVisible = !this.dropdownVisible;
this.subMenuVisible = false; this.subMenuVisible = false;
@ -334,8 +356,6 @@
const parent = this.collegeMajorOptions.find((p) => p.children && p.children.some((child) => child.value === item.value)); const parent = this.collegeMajorOptions.find((p) => p.children && p.children.some((child) => child.value === item.value));
//console.log('1111', parent.label); //console.log('1111', parent.label);
console.log('2222', this.collegeMajorOptions); console.log('2222', this.collegeMajorOptions);
//collegeMajor
this.collegeMajor = [];
if (parent) { if (parent) {
this.selectedLabel = `${parent.label} / ${item.label}`; this.selectedLabel = `${parent.label} / ${item.label}`;
this.collegeMajor[0] = parent.value; this.collegeMajor[0] = parent.value;
@ -401,25 +421,25 @@
} }
}, },
// //
//async getCollegeMajorData() { async getCollegeMajorData() {
// const res = await defHttp.get({ url: this.Url.getCollegeMajor }); const res = await defHttp.get({ url: this.Url.getCollegeMajor });
// //map //map
// this.collegeMajorOptions = res.collegeMajor.map((item) => { this.collegeMajorOptions = res.collegeMajor.map((item) => {
// return { return {
// value: item.college, value: item.college,
// label: item.college, label: item.college,
// children: item.major.map((major) => { children: item.major.map((major) => {
// return { return {
// value: major, value: major,
// label: major, label: major,
// }; };
// }), }),
// }; };
// }); });
// // this.collegeMajor = ['']; // this.collegeMajor = [''];
// console.log(this.collegeMajor, 'collegeMajor'); console.log(this.collegeMajor, 'collegeMajor');
// console.log(this.collegeMajorOptions, 'collegeMajorOptions1'); console.log(this.collegeMajorOptions, 'collegeMajorOptions1');
//}, },
getCollegeOptions() { getCollegeOptions() {
defHttp.get({ url: this.Url.getCollege }).then((res) => { defHttp.get({ url: this.Url.getCollege }).then((res) => {
this.collegeOptions = res.colleges; this.collegeOptions = res.colleges;
@ -442,11 +462,14 @@
this.map2loading = true; this.map2loading = true;
const getEntrydate = await defHttp.get({ url: this.Url.getEntrydate }); const getEntrydate = await defHttp.get({ url: this.Url.getEntrydate });
this.entrydateOptions = getEntrydate.entrydates; this.entrydateOptions = getEntrydate.entrydates;
const name = ['西语学院'];
}, },
// //
async majorPassRate() { async majorPassRate() {
this.map3loading = true; this.map3loading = true;
const name = '西语学院';
}, },
dataChart(data, tab) { dataChart(data, tab) {
let seriesData = []; let seriesData = [];
@ -500,17 +523,30 @@
'#FAF0E6 ', '#FAF0E6 ',
]; ];
let j = 0; let j = 0;
//
for (let i in data) { let filteredData = [];
if (this.selectedLabel === '全校(不含艺体美外语)') {
for (let i in data) {
//
filteredData[i] = data[i].filter((college) => {
return !['体育科学学院', '美术学院', '音乐学院'].includes(college.college);
});
}
} else {
filteredData = data;
}
console.log('filteredData', filteredData);
for (let i in filteredData) {
xData = []; xData = [];
let yData = []; let yData = [];
for (let key in data[i]) { for (let key in filteredData[i]) {
xData.push(data[i][key].college); xData.push(filteredData[i][key].college);
// % // %
yData.push(data[i][key].passRate); yData.push(filteredData[i][key].passRate);
} }
console.log('xData', xData);
xData = xData.map((label) => label.split('').join('\n')); //x xData = xData.map((label) => label.split('').join('\n')); //x
seriesData.push({ seriesData.push({
name: i + '级累计总通过率', name: i + '级累计总通过率',
type: 'bar', type: 'bar',
@ -866,19 +902,6 @@
} }
console.log('tableData', tableData); console.log('tableData', tableData);
tableData.forEach((item) => {
const year = item.batch.substring(0, 4);
console.log('year', year);
if (item.batch.includes('12-01')) {
item.batch = `${year}冬季`;
} else if (item.batch.includes('06-01')) {
item.batch = `${year}夏季`;
} else if (item.batch.includes('09-01')) {
item.batch = `${year}夏季`;
} else if (item.batch.includes('03-01')) {
item.batch = `${year}春季`;
}
});
this.dataSourceCet4 = tableData; // this.dataSourceCet4 = tableData; //
this.total = result.total; // this.total = result.total; //
this.totalName = result.totalName; // this.totalName = result.totalName; //
@ -1145,7 +1168,7 @@
display: inline-block; display: inline-block;
} }
.dropdown-trigger { .dropdown-trigger {
width: 160px; /* ✅ 设置选择框宽度 */ width: 190px; /* ✅ 设置选择框宽度 */
height: 32px; height: 32px;
border: 1px solid #ccc; /* ✅ 添加边框 */ border: 1px solid #ccc; /* ✅ 添加边框 */
padding: 6px 12px; padding: 6px 12px;