|
@@ -6,7 +6,7 @@
|
|
|
v-model="searchModel.subjectCode"
|
|
|
:clearable="false"
|
|
|
default-first
|
|
|
- @default-selected="toPage(1)"
|
|
|
+ @default-selected="search"
|
|
|
></select-subject>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="分数间隔类型">
|
|
@@ -27,8 +27,9 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-space wrap>
|
|
|
- <el-button type="primary" @click="toPage(1)">查询</el-button>
|
|
|
+ <el-button type="primary" @click="search">查询</el-button>
|
|
|
<el-button @click="onExport">导出</el-button>
|
|
|
+ <el-button @click="onChart">查看统计图</el-button>
|
|
|
</el-space>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -42,20 +43,16 @@
|
|
|
stripe
|
|
|
>
|
|
|
<el-table-column type="index" label="序号" width="60" />
|
|
|
- <el-table-column prop="range" label="分数段" min-width="120" />
|
|
|
- <el-table-column prop="rangeCount" label="人数" min-width="100" />
|
|
|
- <el-table-column label="频率" min-width="100">
|
|
|
+ <el-table-column prop="range" label="分数段" min-width="120">
|
|
|
<template #default="scope">
|
|
|
- {{ scope.row.rangeRate.toFixed(2) }}%
|
|
|
+ {{ scope.row.score }} <=X<
|
|
|
+ {{ scope.row.scope + scope.row.range }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="分布图" min-width="200">
|
|
|
+ <el-table-column prop="rangeCount" label="人数" min-width="100" />
|
|
|
+ <el-table-column label="频率" min-width="100">
|
|
|
<template #default="scope">
|
|
|
- <el-progress
|
|
|
- :percentage="scope.row.rangeRate"
|
|
|
- :color="getSegmentColor(scope.row.rangeRate)"
|
|
|
- :show-text="false"
|
|
|
- />
|
|
|
+ {{ scope.row.rangeRate.toFixed(2) }}%
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -68,14 +65,22 @@
|
|
|
@current-change="toPage"
|
|
|
/>
|
|
|
</div>
|
|
|
+
|
|
|
+ <ChartModal
|
|
|
+ ref="chartModalRef"
|
|
|
+ title="课程成绩分段图"
|
|
|
+ :chart-options="chartOptions"
|
|
|
+ />
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
- import { reactive } from 'vue';
|
|
|
+ import { reactive, ref } from 'vue';
|
|
|
import { getSegmentAnalysisList } from '@/api/analysis';
|
|
|
import { ScoreSegmentItem, ScoreSegmentFilter } from '@/api/types/analysis';
|
|
|
import useTable from '@/hooks/table';
|
|
|
import { downloadExport } from '@/utils/download-export';
|
|
|
+ import ChartModal from '@/components/chart/ChartModal.vue';
|
|
|
+ import type { EChartsOption } from 'echarts';
|
|
|
|
|
|
defineOptions({
|
|
|
name: 'SegmentAnalysis',
|
|
@@ -90,14 +95,67 @@
|
|
|
const { dataList, pagination, loading, toPage, pageSizeChange } =
|
|
|
useTable<ScoreSegmentItem>(getSegmentAnalysisList, searchModel, false);
|
|
|
|
|
|
- function getSegmentColor(rate: number) {
|
|
|
- if (rate < 5) return '#f56c6c';
|
|
|
- if (rate < 15) return '#e6a23c';
|
|
|
- if (rate < 25) return '#409eff';
|
|
|
- return '#67c23a';
|
|
|
+ async function search() {
|
|
|
+ await toPage(1);
|
|
|
+ updateChartOption();
|
|
|
}
|
|
|
|
|
|
async function onExport() {
|
|
|
await downloadExport('exportSegmentAnalysisList', searchModel);
|
|
|
}
|
|
|
+
|
|
|
+ // 图表
|
|
|
+ const chartOptions = ref<EChartsOption>({} as EChartsOption);
|
|
|
+ function updateChartOption() {
|
|
|
+ chartOptions.value = {
|
|
|
+ legend: {
|
|
|
+ data: ['人数', '频率'],
|
|
|
+ },
|
|
|
+ toolbox: {
|
|
|
+ feature: {
|
|
|
+ saveAsImage: { show: true },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ data: dataList.value.map(
|
|
|
+ (item) => `${item.score} <=X< ${item.scope + item.range}`
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ yAxis: [
|
|
|
+ {
|
|
|
+ type: 'value',
|
|
|
+ name: '人数',
|
|
|
+ position: 'left',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'value',
|
|
|
+ name: '百分比',
|
|
|
+ position: 'right',
|
|
|
+ axisLabel: {
|
|
|
+ formatter: '{value} %',
|
|
|
+ },
|
|
|
+ max: 100,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ data: dataList.value.map((item) => item.rangeCount),
|
|
|
+ type: 'bar',
|
|
|
+ name: '人数',
|
|
|
+ yAxisIndex: 0,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data: dataList.value.map((item) => item.rangeRate),
|
|
|
+ type: 'line',
|
|
|
+ name: '频率',
|
|
|
+ yAxisIndex: 1,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ }
|
|
|
+ const chartModalRef = ref<typeof ChartModal>(null);
|
|
|
+ function onChart() {
|
|
|
+ chartModalRef.value?.open();
|
|
|
+ }
|
|
|
</script>
|