|
@@ -4,8 +4,9 @@ import LiquidChart from "@/components/Charts/LiquidChart.vue";
|
|
import LineChart from "@/components/Charts/LineChart.vue";
|
|
import LineChart from "@/components/Charts/LineChart.vue";
|
|
import PercentBarChart from "@/components/Charts/PercentBarChart.vue";
|
|
import PercentBarChart from "@/components/Charts/PercentBarChart.vue";
|
|
import {DashboardData} from "@/api/dashboard/types";
|
|
import {DashboardData} from "@/api/dashboard/types";
|
|
-import {AreaChartParams, AreaLineData, AreaParams} from "@/api/areaboard/types";
|
|
|
|
|
|
+import {AreaChartParams, AreaLineData} from "@/api/areaboard/types";
|
|
import {getAreaBoardLines, getAreaBoardPies} from "@/api/areaboard";
|
|
import {getAreaBoardLines, getAreaBoardPies} from "@/api/areaboard";
|
|
|
|
+import {Ref} from "vue";
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
provinceId: {
|
|
provinceId: {
|
|
@@ -39,7 +40,7 @@ const props = defineProps({
|
|
const pieStatus = ref(false);
|
|
const pieStatus = ref(false);
|
|
const pieMessage = ref("加载中...");
|
|
const pieMessage = ref("加载中...");
|
|
const pieChartData = ref<DashboardData>();
|
|
const pieChartData = ref<DashboardData>();
|
|
-async function getPieChartData(params: AreaParams) {
|
|
|
|
|
|
+async function getPieChartData(params: AreaChartParams) {
|
|
pieStatus.value = false;
|
|
pieStatus.value = false;
|
|
getAreaBoardPies(params)
|
|
getAreaBoardPies(params)
|
|
.then(({data}) => {
|
|
.then(({data}) => {
|
|
@@ -58,22 +59,21 @@ async function getPieChartData(params: AreaParams) {
|
|
const lineStatus = ref(false);
|
|
const lineStatus = ref(false);
|
|
const lineMessage = ref("加载中...");
|
|
const lineMessage = ref("加载中...");
|
|
const lineChartData = ref<AreaLineData>();
|
|
const lineChartData = ref<AreaLineData>();
|
|
-//const averageData = ref<number[][]>();
|
|
|
|
const curveData = ref<number[][]>();
|
|
const curveData = ref<number[][]>();
|
|
-async function getLineChartData(params: AreaParams) {
|
|
|
|
|
|
+const swCurveData = ref<number[][]>();
|
|
|
|
+const klCurveData = ref<number[][]>();
|
|
|
|
+const zzlCurveData = ref<number[][]>();
|
|
|
|
+async function getLineChartData(params: AreaChartParams) {
|
|
lineStatus.value = false;
|
|
lineStatus.value = false;
|
|
getAreaBoardLines(params)
|
|
getAreaBoardLines(params)
|
|
.then(({data}) => {
|
|
.then(({data}) => {
|
|
lineChartData.value = data;
|
|
lineChartData.value = data;
|
|
- // // 柱状图
|
|
|
|
- // averageData.value = [];
|
|
|
|
- // averageData.value?.push(lineChartData.value?.frontNum || []);
|
|
|
|
- // averageData.value?.push(lineChartData.value?.afterNum || []);
|
|
|
|
// 曲线图
|
|
// 曲线图
|
|
curveData.value = [];
|
|
curveData.value = [];
|
|
curveData.value?.push(lineChartData.value?.curve || []);
|
|
curveData.value?.push(lineChartData.value?.curve || []);
|
|
curveData.value?.push(lineChartData.value?.num || []);
|
|
curveData.value?.push(lineChartData.value?.num || []);
|
|
lineStatus.value = true;
|
|
lineStatus.value = true;
|
|
|
|
+ lineChartData.value = undefined;
|
|
})
|
|
})
|
|
.catch((error) => {
|
|
.catch((error) => {
|
|
lineStatus.value = false;
|
|
lineStatus.value = false;
|
|
@@ -81,6 +81,15 @@ async function getLineChartData(params: AreaParams) {
|
|
console.log(error.message);
|
|
console.log(error.message);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+async function getLineChartDataSub(result: Ref<number[][] | undefined>, params: AreaChartParams) {
|
|
|
|
+ let tempData: AreaLineData;
|
|
|
|
+ getAreaBoardLines(params).then(({data}) => {
|
|
|
|
+ tempData = data;
|
|
|
|
+ result.value = [];
|
|
|
|
+ result.value?.push(tempData?.curve || []);
|
|
|
|
+ result.value?.push(tempData?.num || []);
|
|
|
|
+ });
|
|
|
|
+}
|
|
/**
|
|
/**
|
|
* 筛选条件
|
|
* 筛选条件
|
|
*/
|
|
*/
|
|
@@ -89,6 +98,7 @@ const dataParams: AreaChartParams = reactive({
|
|
city_id: 0,
|
|
city_id: 0,
|
|
school_id: 0,
|
|
school_id: 0,
|
|
grade_id: 0,
|
|
grade_id: 0,
|
|
|
|
+ device_id: 0,
|
|
start_time: Math.ceil(Date.parse("2023/1/1 00:00") / 1000),
|
|
start_time: Math.ceil(Date.parse("2023/1/1 00:00") / 1000),
|
|
end_time: Math.ceil(Date.now() / 1000),
|
|
end_time: Math.ceil(Date.now() / 1000),
|
|
});
|
|
});
|
|
@@ -103,7 +113,14 @@ watchEffect(() => {
|
|
// 饼图数据
|
|
// 饼图数据
|
|
getPieChartData(dataParams);
|
|
getPieChartData(dataParams);
|
|
// 折线图数据
|
|
// 折线图数据
|
|
|
|
+ dataParams.device_id = 0;
|
|
getLineChartData(dataParams);
|
|
getLineChartData(dataParams);
|
|
|
|
+ dataParams.device_id = 1;
|
|
|
|
+ getLineChartDataSub(swCurveData, dataParams);
|
|
|
|
+ dataParams.device_id = 6;
|
|
|
|
+ getLineChartDataSub(klCurveData, dataParams);
|
|
|
|
+ dataParams.device_id = 7;
|
|
|
|
+ getLineChartDataSub(zzlCurveData, dataParams);
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -133,15 +150,18 @@ watchEffect(() => {
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
<div class="item">
|
|
<div class="item">
|
|
- <LiquidChart
|
|
|
|
- id="liquidChart2"
|
|
|
|
- :key="pieChartData?.afterAverage"
|
|
|
|
- :data="pieChartData?.afterAverage || 0"
|
|
|
|
- height="200px"
|
|
|
|
- width="200px"
|
|
|
|
- color="#5563ac"
|
|
|
|
- bg-color="#cacce6"
|
|
|
|
- class="chart" />
|
|
|
|
|
|
+ <template v-if="pieChartData?.countRecord && pieChartData.countRecord > 4">
|
|
|
|
+ <LiquidChart
|
|
|
|
+ id="liquidChart2"
|
|
|
|
+ :key="pieChartData?.afterAverage"
|
|
|
|
+ :data="pieChartData?.afterAverage || 0"
|
|
|
|
+ height="200px"
|
|
|
|
+ width="200px"
|
|
|
|
+ color="#5563ac"
|
|
|
|
+ bg-color="#cacce6"
|
|
|
|
+ class="chart" />
|
|
|
|
+ </template>
|
|
|
|
+ <div v-else class="pieEmpty p1">训练数据不足</div>
|
|
<p>全体学员训练近期</p>
|
|
<p>全体学员训练近期</p>
|
|
<p>专注力评估均值</p>
|
|
<p>专注力评估均值</p>
|
|
</div>
|
|
</div>
|
|
@@ -167,17 +187,20 @@ watchEffect(() => {
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
<div class="item">
|
|
<div class="item">
|
|
- <CircleChart
|
|
|
|
- id="circleChart2"
|
|
|
|
- :key="pieChartData?.after"
|
|
|
|
- :data="pieChartData?.after || 0"
|
|
|
|
- height="200px"
|
|
|
|
- width="200px"
|
|
|
|
- color="#5563ac"
|
|
|
|
- bg-color="#e4e7f4"
|
|
|
|
- font-color="#5563ac"
|
|
|
|
- font-size="30px"
|
|
|
|
- :round-cap="Boolean(true)" />
|
|
|
|
|
|
+ <template v-if="pieChartData?.countRecord && pieChartData.countRecord > 4">
|
|
|
|
+ <CircleChart
|
|
|
|
+ id="circleChart2"
|
|
|
|
+ :key="pieChartData?.after"
|
|
|
|
+ :data="pieChartData?.after || 0"
|
|
|
|
+ height="200px"
|
|
|
|
+ width="200px"
|
|
|
|
+ color="#5563ac"
|
|
|
|
+ bg-color="#e4e7f4"
|
|
|
|
+ font-color="#5563ac"
|
|
|
|
+ font-size="30px"
|
|
|
|
+ :round-cap="Boolean(true)" />
|
|
|
|
+ </template>
|
|
|
|
+ <div v-else class="pieEmpty p2">训练数据不足</div>
|
|
<p>近期训练</p>
|
|
<p>近期训练</p>
|
|
<p>专注力50以上训练占比</p>
|
|
<p>专注力50以上训练占比</p>
|
|
</div>
|
|
</div>
|
|
@@ -197,8 +220,11 @@ watchEffect(() => {
|
|
<template v-if="lineStatus">
|
|
<template v-if="lineStatus">
|
|
<line-chart
|
|
<line-chart
|
|
id="lineChart1"
|
|
id="lineChart1"
|
|
- :key="curveData?.toString()"
|
|
|
|
- :data-sets="curveData || [[], []]"
|
|
|
|
|
|
+ :key="dataParams?.toString()"
|
|
|
|
+ :dataSets="curveData || [[], []]"
|
|
|
|
+ :dataSW="swCurveData || [[], []]"
|
|
|
|
+ :dataKL="klCurveData || [[], []]"
|
|
|
|
+ :dataZZL="zzlCurveData || [[], []]"
|
|
height="558px"
|
|
height="558px"
|
|
width="100%" />
|
|
width="100%" />
|
|
</template>
|
|
</template>
|
|
@@ -335,5 +361,24 @@ watchEffect(() => {
|
|
.empty {
|
|
.empty {
|
|
padding: 200px 0;
|
|
padding: 200px 0;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ .pieEmpty {
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+ width: 180px;
|
|
|
|
+ height: 180px;
|
|
|
|
+ margin: 10px auto;
|
|
|
|
+ color: red;
|
|
|
|
+ border-radius: 50%;
|
|
|
|
+
|
|
|
|
+ &.p1 {
|
|
|
|
+ line-height: 160px;
|
|
|
|
+ border: 5px solid #2f539b;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ &.p2 {
|
|
|
|
+ line-height: 120px;
|
|
|
|
+ border: 20px solid #2f539b;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|