|
@@ -5,6 +5,11 @@ import {getGradeSelect} from "@/api/grade";
|
|
|
import {getAreaSchool} from "@/api/areaboard";
|
|
|
import {SchoolList} from "@/api/school/types";
|
|
|
import ComboCharts from "@/views/admin/components/ComboCharts.vue";
|
|
|
+import {getUrlParam, trimInput} from "@/utils";
|
|
|
+import {StudentItem, StudentParams} from "@/api/student/types";
|
|
|
+import {getStudentLists} from "@/api/student";
|
|
|
+import {useRouter} from "vue-router";
|
|
|
+const router = useRouter();
|
|
|
|
|
|
defineOptions({
|
|
|
name: "DashboardSchool",
|
|
@@ -60,23 +65,97 @@ function changeDate() {
|
|
|
dataParams.end_time = Math.ceil(datePicker.value[1] / 1000);
|
|
|
}
|
|
|
// 获取图表数据条件
|
|
|
+const chartStatus = ref(false);
|
|
|
const chartParams: AreaChartParams = reactive({});
|
|
|
/**
|
|
|
* 获取页面数据
|
|
|
*/
|
|
|
-function getPageData() {
|
|
|
+function getSchoolPageData() {
|
|
|
+ // 图表参数
|
|
|
chartParams.school_id = dataParams.school_id;
|
|
|
chartParams.grade_id = dataParams.grade_id;
|
|
|
chartParams.start_time = dataParams.start_time;
|
|
|
chartParams.end_time = dataParams.end_time;
|
|
|
+ chartStatus.value = true;
|
|
|
+ // 学生参数
|
|
|
+ studentParams.school_id = dataParams.school_id;
|
|
|
+ studentParams.grade_id = dataParams.grade_id;
|
|
|
+ getStudentData();
|
|
|
+}
|
|
|
+/**
|
|
|
+ * 学生数据
|
|
|
+ */
|
|
|
+const studentParams: StudentParams = reactive({
|
|
|
+ school_id: 0,
|
|
|
+ grade_id: 0,
|
|
|
+ search: "",
|
|
|
+ page: 1,
|
|
|
+ page_size: 10,
|
|
|
+});
|
|
|
+const dataMessage = ref("加载中...");
|
|
|
+const studentCount = ref(0);
|
|
|
+const studentData = ref<StudentItem[]>();
|
|
|
+async function getStudentData() {
|
|
|
+ getStudentLists(studentParams)
|
|
|
+ .then(({data}) => {
|
|
|
+ const {count, lists} = data;
|
|
|
+ studentCount.value = count;
|
|
|
+ studentData.value = lists;
|
|
|
+ if (!(count && count > 0 && lists.length > 0)) {
|
|
|
+ dataMessage.value = "没有符合搜索条件的记录!";
|
|
|
+ if (studentParams.grade_id == 0 && studentParams.search == "") {
|
|
|
+ dataMessage.value = "暂时还没有任何学生绑定学校!";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //window.scroll({top: 2000, left: 0, behavior: "smooth"});
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ dataMessage.value = error.message;
|
|
|
+ console.log(error.message);
|
|
|
+ });
|
|
|
+}
|
|
|
+function alertTrainingError() {
|
|
|
+ ElMessage.error("该学生训练数据还不足以进行训练效果分析,请至少完成16次专注力训练后再来查看。");
|
|
|
+}
|
|
|
+function alertEvaluationError() {
|
|
|
+ ElMessage.error("该学生还未进行过测评,暂无测评数据。");
|
|
|
+}
|
|
|
+function getSchoolSearch() {
|
|
|
+ const current = router.currentRoute.value.path;
|
|
|
+ router.push(
|
|
|
+ current +
|
|
|
+ "?school=" +
|
|
|
+ dataParams.school_id +
|
|
|
+ "&grade=" +
|
|
|
+ dataParams.grade_id +
|
|
|
+ "&start=" +
|
|
|
+ dataParams.start_time +
|
|
|
+ "&end=" +
|
|
|
+ dataParams.end_time
|
|
|
+ );
|
|
|
}
|
|
|
-
|
|
|
onMounted(() => {
|
|
|
// 获取学校
|
|
|
getSchoolData();
|
|
|
gradeData.value = [{id: 0, name: "全部班级"}];
|
|
|
+ let school = getUrlParam("school");
|
|
|
+ if (school && Number(school) > 0) {
|
|
|
+ dataParams.school_id = Number(school);
|
|
|
+ }
|
|
|
+ let grade = getUrlParam("grade");
|
|
|
+ if (grade && Number(grade) > 0) {
|
|
|
+ dataParams.grade_id = Number(grade);
|
|
|
+ }
|
|
|
+ let start = getUrlParam("start");
|
|
|
+ if (start && Number(start) > 0) {
|
|
|
+ dataParams.start_time = Number(start);
|
|
|
+ }
|
|
|
+ let end = getUrlParam("end");
|
|
|
+ if (end && Number(end) > 0) {
|
|
|
+ dataParams.end_time = Number(end);
|
|
|
+ }
|
|
|
// 获取页面数据
|
|
|
- getPageData();
|
|
|
+ getSchoolPageData();
|
|
|
});
|
|
|
</script>
|
|
|
|
|
@@ -85,6 +164,7 @@ onMounted(() => {
|
|
|
<div class="search-box s2">
|
|
|
<el-select
|
|
|
v-model="dataParams.school_id"
|
|
|
+ filterable
|
|
|
placeholder="全部学校"
|
|
|
size="large"
|
|
|
@change="getGradeData(dataParams.school_id)">
|
|
@@ -104,15 +184,68 @@ onMounted(() => {
|
|
|
value-format="x"
|
|
|
@change="changeDate()" />
|
|
|
</div>
|
|
|
- <el-button color="#4284f2" size="large" @click="getPageData()">查找</el-button>
|
|
|
+ <el-button color="#4284f2" size="large" @click="getSchoolSearch()">查找</el-button>
|
|
|
</div>
|
|
|
<!-- Echarts 图表 -->
|
|
|
<ComboCharts
|
|
|
+ v-if="chartStatus"
|
|
|
:key="chartParams?.toString()"
|
|
|
:schoolId="chartParams.school_id"
|
|
|
:gradeId="chartParams.grade_id"
|
|
|
:startTime="chartParams.start_time"
|
|
|
:endTime="chartParams.end_time" />
|
|
|
+ <!-- 学生列表-->
|
|
|
+ <div class="student-container">
|
|
|
+ <!-- 学生查找 -->
|
|
|
+ <div class="student-search">
|
|
|
+ <el-input
|
|
|
+ v-model="studentParams.search"
|
|
|
+ placeholder="请输入学生名称或手机号码"
|
|
|
+ size="large"
|
|
|
+ @input="(value:string) => (studentParams.search = trimInput(value))" />
|
|
|
+ <el-button size="large" type="primary" @click="getStudentData()">查找</el-button>
|
|
|
+ </div>
|
|
|
+ <!-- 学生数据 -->
|
|
|
+ <div class="list-table">
|
|
|
+ <el-table :data="studentData" style="width: 100%">
|
|
|
+ <el-table-column align="center" label="序号" max-width="120" type="index" />
|
|
|
+ <el-table-column prop="name" label="学生名称" align="center" />
|
|
|
+ <el-table-column prop="grade_name" label="所在班级" align="center" />
|
|
|
+ <el-table-column prop="phone" label="手机号码" align="center" />
|
|
|
+ <el-table-column prop="create_time" label="注册时间" align="center" />
|
|
|
+ <el-table-column prop="count" label="训练次数" align="center" />
|
|
|
+ <el-table-column label="操作" align="center" min-width="160">
|
|
|
+ <template #default="scope">
|
|
|
+ <router-link :to="'/schoolBoard/training?id=' + scope.row.id" class="table-btn">训练报告</router-link>
|
|
|
+ <router-link v-if="scope.row.count > 16" :to="'/schoolBoard/result?id=' + scope.row.id" class="table-btn"
|
|
|
+ >训练效果分析</router-link
|
|
|
+ >
|
|
|
+ <button v-else class="table-btn disabled" @click="alertTrainingError()">训练效果分析</button>
|
|
|
+ <router-link
|
|
|
+ v-if="scope.row.count > 0"
|
|
|
+ :to="'/schoolBoard/evaluation?id=' + scope.row.id"
|
|
|
+ class="table-btn"
|
|
|
+ >测评数据对比</router-link
|
|
|
+ >
|
|
|
+ <button v-else class="table-btn disabled" @click="alertEvaluationError()">测评数据对比</button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!-- 无数据插槽 -->
|
|
|
+ <template #empty>
|
|
|
+ <div class="empty">
|
|
|
+ <img src="../../../assets/empty.png" alt="数据为空" />
|
|
|
+ <p>{{ dataMessage }}</p>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table>
|
|
|
+ <pagination
|
|
|
+ v-if="studentCount > 0"
|
|
|
+ v-model:total="studentCount"
|
|
|
+ v-model:page="studentParams.page"
|
|
|
+ v-model:limit="studentParams.page_size"
|
|
|
+ @pagination="getStudentData()" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -143,10 +276,11 @@ onMounted(() => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-:deep(.el-select),
|
|
|
-:deep(.el-date-editor) {
|
|
|
+:deep(.el-select) {
|
|
|
--el-select-input-focus-border-color: none !important;
|
|
|
+}
|
|
|
|
|
|
+:deep(.search-box .el-date-editor) {
|
|
|
width: 300px;
|
|
|
margin: 0;
|
|
|
overflow: hidden;
|
|
@@ -163,6 +297,8 @@ onMounted(() => {
|
|
|
}
|
|
|
|
|
|
:deep(.el-input__wrapper) {
|
|
|
+ background: #fff;
|
|
|
+ border-radius: 12px;
|
|
|
box-shadow: none !important;
|
|
|
}
|
|
|
|
|
@@ -174,7 +310,81 @@ onMounted(() => {
|
|
|
box-shadow: none !important;
|
|
|
}
|
|
|
|
|
|
+:deep(.el-select .el-input__wrapper.is-focus) {
|
|
|
+ box-shadow: none !important;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-table .el-table__header .el-table__cell .cell) {
|
|
|
+ overflow: visible;
|
|
|
+ white-space: nowrap;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-table th.el-table__cell) {
|
|
|
+ background: #e9ebee;
|
|
|
+}
|
|
|
+
|
|
|
.mobile .el-col {
|
|
|
margin-bottom: 10px;
|
|
|
}
|
|
|
+
|
|
|
+.student-container {
|
|
|
+ position: relative;
|
|
|
+ padding: 20px 30px;
|
|
|
+}
|
|
|
+
|
|
|
+.student-search {
|
|
|
+ margin-bottom: 20px;
|
|
|
+ font-size: 16px;
|
|
|
+
|
|
|
+ .el-select {
|
|
|
+ width: 180px;
|
|
|
+ margin: 0 20px 0 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-input {
|
|
|
+ width: 250px;
|
|
|
+ margin: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ :deep(.el-input__inner) {
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-button {
|
|
|
+ padding: 0 26px;
|
|
|
+ margin: 0 20px;
|
|
|
+ font-size: 16px;
|
|
|
+ background: #4284f2;
|
|
|
+ border-radius: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ b {
|
|
|
+ font-size: 20px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.list-table {
|
|
|
+ overflow: hidden;
|
|
|
+ background: #fff;
|
|
|
+ border-radius: 25px;
|
|
|
+
|
|
|
+ .table-btn {
|
|
|
+ display: inline-block;
|
|
|
+ height: 38px;
|
|
|
+ padding: 0 15px;
|
|
|
+ margin-right: 10px;
|
|
|
+ line-height: 38px;
|
|
|
+ color: #fff;
|
|
|
+ background: #4284f2;
|
|
|
+ border-radius: 6px;
|
|
|
+
|
|
|
+ &.disabled {
|
|
|
+ background: #bfbfbf;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.empty {
|
|
|
+ padding: 200px 0;
|
|
|
+}
|
|
|
</style>
|