|
@@ -13,6 +13,9 @@ import { ClassList, SchoolList } from "@/api/school/types";
|
|
import { watch } from "vue";
|
|
import { watch } from "vue";
|
|
import { useUserStore } from "@/store/modules/user";
|
|
import { useUserStore } from "@/store/modules/user";
|
|
import { CaretBottom } from "@element-plus/icons-vue";
|
|
import { CaretBottom } from "@element-plus/icons-vue";
|
|
|
|
+import { getClassList } from "@/api/school";
|
|
|
|
+import { getDashboardData, getDashboardTop } from "@/api/dashboard";
|
|
|
|
+import { DashboardCard, DashboardData } from "@/api/dashboard/types";
|
|
const userStore = useUserStore();
|
|
const userStore = useUserStore();
|
|
watch(
|
|
watch(
|
|
() => userStore.schoolId,
|
|
() => userStore.schoolId,
|
|
@@ -24,66 +27,115 @@ watch(
|
|
/**
|
|
/**
|
|
* 数据卡片
|
|
* 数据卡片
|
|
*/
|
|
*/
|
|
-// 全部班级
|
|
|
|
-const classCount = 3000;
|
|
|
|
-// 全部教师
|
|
|
|
-const teacherCount = 5000;
|
|
|
|
-// 全部学生
|
|
|
|
-const studentCount = 6000;
|
|
|
|
-// 设备套数
|
|
|
|
-const equipmentCount = 50;
|
|
|
|
-// 累计训练次数
|
|
|
|
-const trainingCount = 2000;
|
|
|
|
|
|
+const cards: DashboardCard = reactive({});
|
|
|
|
+async function getDataCard(schoolId) {
|
|
|
|
+ getDashboardTop(schoolId)
|
|
|
|
+ .then(({ data }) => {
|
|
|
|
+ // 全部班级
|
|
|
|
+ cards.grade = data.grade;
|
|
|
|
+ // 全部教师
|
|
|
|
+ cards.teacher = data.teacher;
|
|
|
|
+ // 全部学生
|
|
|
|
+ cards.student = data.student;
|
|
|
|
+ // 设备套数
|
|
|
|
+ cards.equipment = data.equipment;
|
|
|
|
+ // 累计训练次数
|
|
|
|
+ cards.game = data.game;
|
|
|
|
+ })
|
|
|
|
+ .catch((error) => {
|
|
|
|
+ console.log(error);
|
|
|
|
+ });
|
|
|
|
+}
|
|
/**
|
|
/**
|
|
* 班级数据
|
|
* 班级数据
|
|
*/
|
|
*/
|
|
|
|
+const classData = ref<ClassList[]>();
|
|
// 班级编号
|
|
// 班级编号
|
|
-let classNumber = ref(0);
|
|
|
|
-const classData = ref<ClassList[]>([
|
|
|
|
- {
|
|
|
|
- id: 0,
|
|
|
|
- school_id: 0,
|
|
|
|
- name: "全部班级",
|
|
|
|
- },
|
|
|
|
-]);
|
|
|
|
-// function queryClassList() {
|
|
|
|
-// getClassList().then(({ data }) => {
|
|
|
|
-// classData.value.concat(data);
|
|
|
|
-// });
|
|
|
|
-// }
|
|
|
|
-watch(
|
|
|
|
- () => classNumber,
|
|
|
|
- (newValue, oldValue) => {
|
|
|
|
- console.log("userStore.schoolId", newValue, oldValue);
|
|
|
|
- // 班级切换后重新加载班级数据
|
|
|
|
- }
|
|
|
|
-);
|
|
|
|
-// 数据状态:1正常,2训练次数小于3,3过期,4缺省
|
|
|
|
-const dataStatus = ref(1);
|
|
|
|
|
|
+let classId = ref(0);
|
|
|
|
+async function getClassData(schoolId) {
|
|
|
|
+ getClassList(schoolId)
|
|
|
|
+ .then(({ data }) => {
|
|
|
|
+ data.unshift({ id: 0, name: "全部班级" });
|
|
|
|
+ classData.value = data;
|
|
|
|
+ //console.log(classData.value)
|
|
|
|
+ })
|
|
|
|
+ .catch((error) => {
|
|
|
|
+ console.log(error);
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+/**
|
|
|
|
+ * 图表数据
|
|
|
|
+ */
|
|
|
|
+const chartStatus = ref(false);
|
|
|
|
+const chartData: DashboardData = reactive({
|
|
|
|
+ // 初期专注力估值
|
|
|
|
+ frontAverage: 0,
|
|
|
|
+ // 近期专注力估值
|
|
|
|
+ afterAverage: 0,
|
|
|
|
+ // 初期50分以上的占比
|
|
|
|
+ front: 0,
|
|
|
|
+ // 近期50分以上的占比
|
|
|
|
+ after: 0,
|
|
|
|
+ // // 初期分期占比分析
|
|
|
|
+ // frontProportion: Proportion;
|
|
|
|
+ // // 近期分期占比分析
|
|
|
|
+ // afterProportion: Proportion;
|
|
|
|
+});
|
|
|
|
+async function getChartData(classId) {
|
|
|
|
+ getDashboardData(classId)
|
|
|
|
+ .then(({ data }) => {
|
|
|
|
+ // 初期专注力估值
|
|
|
|
+ chartData.frontAverage = data.frontAverage;
|
|
|
|
+ // 近期专注力估值
|
|
|
|
+ chartData.afterAverage = data.afterAverage;
|
|
|
|
+ // 初期50分以上的占比
|
|
|
|
+ chartData.front = data.front;
|
|
|
|
+ // 近期50分以上的占比
|
|
|
|
+ chartData.after = data.after;
|
|
|
|
+ // 初期分期占比分析
|
|
|
|
+ chartData.frontProportion = data.frontProportion;
|
|
|
|
+ // 近期分期占比分析
|
|
|
|
+ chartData.afterProportion = data.afterProportion;
|
|
|
|
+ chartStatus.value = true;
|
|
|
|
+ console.log(data);
|
|
|
|
+ })
|
|
|
|
+ .catch((error) => {
|
|
|
|
+ console.log(error);
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- //queryClassList();
|
|
|
|
|
|
+ // 获取班级
|
|
|
|
+ getClassData(userStore.schoolId);
|
|
|
|
+ // 数据卡片
|
|
|
|
+ getDataCard(userStore.schoolId);
|
|
|
|
+ // 图表数据
|
|
|
|
+ getChartData(classId.value);
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+// 数据状态:1正常,2训练次数小于3,3过期,4缺省
|
|
|
|
+const dataStatus = ref(1);
|
|
|
|
|
|
-const percentData = [5,5,65,10,10];
|
|
|
|
-const percentNumber = [1,2,13,2,2];
|
|
|
|
|
|
+const percentData = [5, 5, 65, 10, 10];
|
|
|
|
+const percentNumber = [1, 2, 13, 2, 2];
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
<div class="dashboard-container">
|
|
<div class="dashboard-container">
|
|
<!-- 数据卡片 -->
|
|
<!-- 数据卡片 -->
|
|
<DataCard
|
|
<DataCard
|
|
- :classes="classCount"
|
|
|
|
- :teachers="teacherCount"
|
|
|
|
- :students="studentCount"
|
|
|
|
- :equipments="equipmentCount"
|
|
|
|
- :trainings="trainingCount"
|
|
|
|
|
|
+ :key="cards"
|
|
|
|
+ :classes="cards.grade"
|
|
|
|
+ :teachers="cards.teacher"
|
|
|
|
+ :students="cards.student"
|
|
|
|
+ :equipments="cards.equipment"
|
|
|
|
+ :trainings="cards.game"
|
|
/>
|
|
/>
|
|
|
|
|
|
<!-- 班级选择 及 案例展示 -->
|
|
<!-- 班级选择 及 案例展示 -->
|
|
<div class="class-select clear">
|
|
<div class="class-select clear">
|
|
<el-select
|
|
<el-select
|
|
- v-model="classNumber"
|
|
|
|
|
|
+ v-model="classId"
|
|
placeholder="全部班级"
|
|
placeholder="全部班级"
|
|
size="large"
|
|
size="large"
|
|
:suffix-icon="CaretBottom"
|
|
:suffix-icon="CaretBottom"
|
|
@@ -105,10 +157,11 @@ const percentNumber = [1,2,13,2,2];
|
|
<p class="title">学员专注力平均值整体对比分析</p>
|
|
<p class="title">学员专注力平均值整体对比分析</p>
|
|
<el-row justify="space-between">
|
|
<el-row justify="space-between">
|
|
<el-col :xs="24" :sm="12">
|
|
<el-col :xs="24" :sm="12">
|
|
- <div class="item">
|
|
|
|
|
|
+ <div v-if="chartStatus" class="item">
|
|
<LiquidChart
|
|
<LiquidChart
|
|
id="liquidChart1"
|
|
id="liquidChart1"
|
|
- data="37.5"
|
|
|
|
|
|
+ :key="chartData.frontAverage"
|
|
|
|
+ :data="chartData.frontAverage ? chartData.frontAverage : 0"
|
|
height="200px"
|
|
height="200px"
|
|
width="200px"
|
|
width="200px"
|
|
color="#3a7fc2"
|
|
color="#3a7fc2"
|
|
@@ -120,10 +173,11 @@ const percentNumber = [1,2,13,2,2];
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :xs="24" :sm="12">
|
|
<el-col :xs="24" :sm="12">
|
|
- <div class="item">
|
|
|
|
|
|
+ <div v-if="chartStatus" class="item">
|
|
<LiquidChart
|
|
<LiquidChart
|
|
id="liquidChart2"
|
|
id="liquidChart2"
|
|
- data="57.6"
|
|
|
|
|
|
+ :key="chartData.afterAverage"
|
|
|
|
+ :data="chartData.afterAverage ? chartData.afterAverage : 0"
|
|
height="200px"
|
|
height="200px"
|
|
width="200px"
|
|
width="200px"
|
|
color="#5563ac"
|
|
color="#5563ac"
|
|
@@ -137,10 +191,11 @@ const percentNumber = [1,2,13,2,2];
|
|
</el-row>
|
|
</el-row>
|
|
<el-row justify="space-between">
|
|
<el-row justify="space-between">
|
|
<el-col :xs="24" :sm="12">
|
|
<el-col :xs="24" :sm="12">
|
|
- <div class="item">
|
|
|
|
|
|
+ <div v-if="chartStatus" class="item">
|
|
<CircleChart
|
|
<CircleChart
|
|
id="circleChart1"
|
|
id="circleChart1"
|
|
- data="37.5"
|
|
|
|
|
|
+ :key="chartData.front"
|
|
|
|
+ :data="chartData.front ? chartData.front : 0"
|
|
height="200px"
|
|
height="200px"
|
|
width="200px"
|
|
width="200px"
|
|
color="#3a7fc2"
|
|
color="#3a7fc2"
|
|
@@ -154,10 +209,11 @@ const percentNumber = [1,2,13,2,2];
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :xs="24" :sm="12">
|
|
<el-col :xs="24" :sm="12">
|
|
- <div class="item">
|
|
|
|
|
|
+ <div v-if="chartStatus" class="item">
|
|
<CircleChart
|
|
<CircleChart
|
|
id="circleChart2"
|
|
id="circleChart2"
|
|
- data="57.6"
|
|
|
|
|
|
+ :key="chartData.after"
|
|
|
|
+ :data="chartData.after ? chartData.after : 0"
|
|
height="200px"
|
|
height="200px"
|
|
width="200px"
|
|
width="200px"
|
|
color="#5563ac"
|
|
color="#5563ac"
|
|
@@ -179,27 +235,29 @@ const percentNumber = [1,2,13,2,2];
|
|
<p class="title">学员专注力评分分级占比分析</p>
|
|
<p class="title">学员专注力评分分级占比分析</p>
|
|
<el-row justify="space-between">
|
|
<el-row justify="space-between">
|
|
<el-col :xs="24" :sm="24" :md="12" :lg="24" :xl="12">
|
|
<el-col :xs="24" :sm="24" :md="12" :lg="24" :xl="12">
|
|
- <div class="bar">
|
|
|
|
|
|
+ <div v-if="chartStatus" class="bar">
|
|
<PercentBarChart
|
|
<PercentBarChart
|
|
id="barChart1"
|
|
id="barChart1"
|
|
|
|
+ :key="chartData.frontProportion"
|
|
width="400px"
|
|
width="400px"
|
|
height="500px"
|
|
height="500px"
|
|
title="全体学员初期训练专注力评分占比"
|
|
title="全体学员初期训练专注力评分占比"
|
|
- :percent="percentData"
|
|
|
|
- :data="percentNumber"
|
|
|
|
|
|
+ :percent="chartData.frontProportion.percentage"
|
|
|
|
+ :data="chartData.frontProportion.num"
|
|
class="chart"
|
|
class="chart"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :xs="24" :sm="24" :md="12" :lg="24" :xl="12">
|
|
<el-col :xs="24" :sm="24" :md="12" :lg="24" :xl="12">
|
|
- <div class="bar">
|
|
|
|
|
|
+ <div v-if="chartStatus" class="bar">
|
|
<PercentBarChart
|
|
<PercentBarChart
|
|
id="barChart2"
|
|
id="barChart2"
|
|
|
|
+ :key="chartData.afterProportion"
|
|
width="400px"
|
|
width="400px"
|
|
height="500px"
|
|
height="500px"
|
|
title="全体学员训练近期专注力评分平均占比"
|
|
title="全体学员训练近期专注力评分平均占比"
|
|
- :percent="percentData"
|
|
|
|
- :data="percentNumber"
|
|
|
|
|
|
+ :percent="chartData.afterProportion.percentage"
|
|
|
|
+ :data="chartData.afterProportion.num"
|
|
class="chart"
|
|
class="chart"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|