提交 f36948b0 authored 作者: wangjialong209's avatar wangjialong209

数据统计优化修改

上级 dec782ac
<!--
* @Author: czj
* @Date: 2023-03-21 10:14:46
* @Description:
* @FilePath: \AdministrationHome\src\components\AnalyseModule\components\EyeStabilityTable.vue
-->
<!-- -->
<template>
<div class="container_box">
<table class="table_box">
<tr>
<th v-for="(e, i) in labers" :key="i">{{ e.label }}</th>
</tr>
<tr v-for="(item, index) in table_data" :key="index">
<td v-for="(e, i) in labers" :key="i">
<div v-if="typeof item[e.key] === 'object'">
<el-popover placement="top-start" width="200" trigger="hover">
<div>
<el-form label-width="80px">
<el-form-item label="正确数据: ">
<span v-for="(o, b) in item[e.key].exactness.value">{{ o
}},</span>
</el-form-item>
<el-form-item label="错误数据: ">
<span v-for="(o, b) in item[e.key].wrong.value">{{ o }},</span>
</el-form-item>
</el-form>
</div>
<el-button slot="reference" type="text" size="mini">{{ item[e.key].accuracy.value }}</el-button>
</el-popover>
</div>
<div v-else>{{ item[e.key] }}</div>
</td>
</tr>
</table>
</div>
</template>
<script>
export default {
props: ['table_data', 'labers'],
data() {
return {
};
},
components: {},
computed: {},
created() {
},
mounted() { },
methods: {
test(item) {
console.log('判断对象');
console.log(item);
console.log(typeof item == 'object');
},
}
}
</script>
<style lang="scss" scoped>
.container_box {
width: 100%;
height: 100%;
}
.table_box {
width: 100%;
// min-height: 100%;
text-align: center;
font-size: 14px;
border-top: 1px solid #E4E7ED;
border-left: 1px solid #E4E7ED;
border-collapse: collapse;
th,
td {
margin: 0;
padding: 0;
font-size: 14px;
border-bottom: 1px solid #E4E7ED;
border-right: 1px solid #E4E7ED;
}
th {
padding: 15px 0;
color: #909399;
}
td {
padding: 5px 0;
color: #303133;
}
}
</style>
......@@ -24,7 +24,7 @@
</div>
<div v-else>
<div v-for="(h, key, j) in item['distribute']" :key="j">
{{ key }}({{ item['distribute'][key] }}人)
{{ key }}({{ item['distribute'][key] }}人),
</div>
</div>
</div>
......
......@@ -40,6 +40,10 @@
<div class="content_container" v-if="original_data.type == 'simple_table'">
<simple-table :table_data="original_data"></simple-table>
</div>
<!-- 眼光稳定性 -->
<div class="content_container" v-if="original_data.type == 'eye_stability_table'">
<eye-stability-table :table_data="original_data.list" :labers="original_data.labers"></eye-stability-table>
</div>
</div>
</template>
......@@ -48,6 +52,7 @@ import Table from './components/table';
import LineChart from './components/LineChart.vue';
import BarChart from './components/BarChart.vue';
import SimpleTable from './components/SimpleTable.vue';
import EyeStabilityTable from './components/EyeStabilityTable.vue';
export default {
props: ['module_data'],
data() {
......@@ -56,7 +61,7 @@ export default {
};
},
components: { Table, LineChart, BarChart, SimpleTable },
components: { Table, LineChart, BarChart, SimpleTable, EyeStabilityTable },
computed: {},
created() {
......
......@@ -57,3 +57,29 @@ export function secondsToMinutes(s) {
export function toPercent(num, total) {
return (Math.round(num / total * 10000) / 100.00 + "%");// 小数点后两位百分比
}
//统计相同数据出现的次数
export function countOccurrences(arr) {
// 创建一个空对象用于存储每个数据的出现次数
const result = {};
// 遍历数组
for (let i = 0; i < arr.length; i++) {
// 获取当前数据
const item = arr[i];
// 如果该数据已经存在于 result 对象中,则将出现次数加 1
if (result[item]) {
result[item]++;
}
// 否则,将该数据添加到 result 对象中,并将出现次数设置为 1
else {
result[item] = 1;
}
}
// 返回统计结果
return result;
}
......@@ -49,21 +49,8 @@
</AnalyseModule>
</div>
</el-col>
</el-row>
<!-- <el-row class="row_container">
<el-col :span="8" v-if="review_conditions && review_conditions.is_breedScore">
<div class="centenr_container">
<AnalyseModule :module_data="breed_score" v-if="breed_score">
</AnalyseModule>
</div>
</el-col>
<el-col :span="8" v-if="review_conditions && review_conditions.is_getHighesLowesttScore">
<div class="centenr_container">
<AnalyseModule :module_data="get_highes_lowestt_score_data" v-if="get_highes_lowestt_score_data">
</AnalyseModule>
</div>
</el-col>
</el-row> -->
</div>
</div>
......@@ -87,37 +74,39 @@
<div>
<div class="module_header">错误方向分析</div>
<div>
<el-row class="row_container">
<el-col :span="12" v-if="review_conditions && review_conditions.is_WrongPosition">
<div class="module_header">错误部位</div>
<el-col :span="12" v-if="review_conditions && review_conditions.is_WrongPosition" class="unit_container">
<div class="centenr_container">
<AnalyseModule :module_data="wrong_position_data" v-if="wrong_position_data"></AnalyseModule>
</div>
</el-col>
<el-col :span="12" v-if="review_conditions && review_conditions.is_ErrorLevel">
<div class="module_header">错误等级</div>
<el-col :span="12" v-if="review_conditions && review_conditions.is_ErrorLevel" class="unit_container">
<div class="centenr_container">
<AnalyseModule :module_data="error_level_data" v-if="error_level_data">
</AnalyseModule>
</div>
</el-col>
<el-col :span="12" v-if="review_conditions && review_conditions.is_WrongColor">
<div class="module_header">错误颜色</div>
<el-col :span="12" v-if="review_conditions && review_conditions.is_WrongColor" class="unit_container">
<div class="centenr_container">
<AnalyseModule :module_data="wrong_color_data" v-if="wrong_color_data">
</AnalyseModule>
</div>
</el-col>
<el-col :span="12" v-if="review_conditions && review_conditions.is_WrongGroup">
<div class="module_header">错误组别</div>
<el-col :span="12" v-if="review_conditions && review_conditions.is_WrongGroup" class="unit_container">
<div class="centenr_container">
<AnalyseModule :module_data="wrongG_group_data" v-if="wrongG_group_data">
</AnalyseModule>
</div>
</el-col>
<el-col :span="12" v-if="review_conditions && review_conditions.is_getHighesLowesttScore"
class="unit_container">
<div class="centenr_container">
<AnalyseModule :module_data="eye_stability_data" v-if="eye_stability_data">
</AnalyseModule>
</div>
</el-col>
</el-row>
</div>
......@@ -125,7 +114,7 @@
<div>
<div class="module_header">老师点评</div>
<div style="padding: 0 10px;box-sizing: border-box;">
<el-input type="textarea" :rows="6" placeholder="暂无内容" disabled>
<el-input v-model="found_remark" type="textarea" :rows="6" placeholder="暂无内容" disabled>
</el-input>
</div>
</div>
......@@ -138,7 +127,7 @@
<script>
import Header from '@/components/ExaminationHeader/succinct.vue';
import { toPercent } from '@/utils/tool';
import { toPercent, countOccurrences } from '@/utils/tool';
import { get_read_over_detail } from '@/api/student';
import AnalyseModule from '@/components/AnalyseModule/index.vue';
......@@ -177,6 +166,8 @@ export default {
breed_score: null,
//最高成绩..
get_highes_lowestt_score_data: null,
//眼光稳定性
eye_stability_data: null,
//对错题分析
wrong_question_data: null,
exactness_question_data: null,
......@@ -188,6 +179,9 @@ export default {
wrong_color_data: null,
//错误组别
wrongG_group_data: null,
//老师点评
found_remark: null,
};
},
......@@ -208,7 +202,7 @@ export default {
get_read_over_detail(this.examination_questions_id).then(res => {
console.log('获取试题详情');
console.log(res);
this.found_remark = res.found_remark || '';
this.head_data.title = res.review_content.EyeStability.title;//标题
this.is_loading = false;
this.review_conditions = res.review_conditions;//审阅条件
......@@ -219,6 +213,7 @@ export default {
this.breed_score = this.changeBreedScore(res.review_content.breedScore);//品种得分
//最高分、最低分、平均分,中位数、众数、离散(变异系数)
this.get_highes_lowestt_score_data = this.getHighesLowesttScore(res.review_content.getHighesLowesttScore);
this.eye_stability_data = this.changeEyeStability(res.review_content.EyeStability);
//对错题分析
if (res.review_content.top_data) this.wrong_question_data = this.changeWrong(res.review_content.top_data.datadesc);//错题分析
if (res.review_content.top_data) this.exactness_question_data = this.changeRight(res.review_content.top_data.dataasc);//对题分析
......@@ -226,6 +221,9 @@ export default {
this.error_level_data = this.changeErrorLevel(res.review_content.ErrorLevel);//错误等级
this.wrong_color_data = this.changeWrongColor(res.review_content.WrongColor);//错误颜色
this.wrongG_group_data = this.changeWrongGroup(res.review_content.WrongGroup);//错误组别
console.log('处理好的数据');
console.log(this.wrong_position_data);
}
})
},
......@@ -352,6 +350,41 @@ export default {
}
},
//眼光稳定性
changeEyeStability(datas) {
if (!datas) return false;
let list = [];
let labers = [
{ label: '题目', key: 'title' },
{ label: '答案', key: 'answer' },
{ label: '稳定性', key: 'stability' }
];
//处理稳定性数据
const changeStability = (items) => {
let all_num = items.exactness.length + items.wrong.length;
let Accuracy = toPercent(items.exactness.length, all_num);//准确率
return {
accuracy: { label: '正确率', value: Accuracy },
exactness: { label: '正确数据', value: items.exactness },
wrong: { label: '错误数据', value: items.wrong },
}
};
datas.data.forEach((element, index) => {
list.push({
title: datas.title[index],
answer: element.answer,
stability: changeStability(element)
});
});
return {
type: 'eye_stability_table',
chart_id: 'wrong_group',
color: '#529B2E',
title: '眼光稳定性',
labers,
list,
};
},
//易错/易对 等级分析
changeWrong(datas) {
if (!datas) return false;
......@@ -411,6 +444,8 @@ export default {
},
//错误部位
changeWrongPosition(datas) {
console.log('错误部位原始数据');
console.log(datas);
if (!datas) return false;
let keys = Object.keys(datas);
let list = [];
......@@ -425,7 +460,8 @@ export default {
position: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: datas[element].distribute,
// distribute: datas[element].distribute,
distribute: countOccurrences(datas[element].distribute)
});
});
return {
......@@ -454,7 +490,10 @@ export default {
level: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: datas[element].distribute,
// distribute: datas[element].distribute,
distribute: countOccurrences(datas[element].distribute),
//countOccurrences(datas[element].distribute)
});
});
return {
......@@ -483,7 +522,10 @@ export default {
color: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: datas[element].distribute,
// distribute: datas[element].distribute,
distribute: countOccurrences(datas[element].distribute),
//distribute: countOccurrences(datas[element].distribute),
});
});
return {
......@@ -512,7 +554,9 @@ export default {
group: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: datas[element].distribute,
// distribute: datas[element].distribute,
distribute: countOccurrences(datas[element].distribute),
//countOccurrences
});
});
return {
......
......@@ -54,7 +54,6 @@
</div>
<div>
<div class="module_header">
<el-row>
<el-col :span="12">
<div>
......@@ -94,49 +93,46 @@
</div>
</div>
<div>
<div class="module_header">错误方向分析</div>
<div>
<el-row class="row_container">
<el-col :span="12">
<div class="module_header">错误部位</div>
<el-col :span="12" class="unit_container">
<div class="centenr_container">
<AnalyseModule :module_data="wrong_position_data" v-if="wrong_position_data"
@changeSelect="changeSelects"></AnalyseModule>
</div>
</el-col>
<el-col :span="12">
<div class="module_header">错误等级</div>
<el-col :span="12" class="unit_container">
<div class="centenr_container">
<AnalyseModule :module_data="error_level_data" v-if="error_level_data" @changeSelect="changeSelects">
</AnalyseModule>
</div>
</el-col>
</el-row>
</div>
</div>
<div>
<div>
<el-row class="row_container">
<el-col :span="12">
<div class="module_header">错误颜色</div>
<el-col :span="12" class="unit_container">
<div class="centenr_container">
<AnalyseModule :module_data="wrong_color_data" v-if="wrong_color_data" @changeSelect="changeSelects">
</AnalyseModule>
</div>
</el-col>
<el-col :span="12">
<div class="module_header">错误组别</div>
<el-col :span="12" class="unit_container">
<div class="centenr_container">
<AnalyseModule :module_data="wrongG_group_data" v-if="wrongG_group_data" @changeSelect="changeSelects">
</AnalyseModule>
</div>
</el-col>
<el-col :span="12" class="unit_container">
<div class="centenr_container">
<AnalyseModule :module_data="eye_stability_data" v-if="eye_stability_data">
</AnalyseModule>
</div>
</el-col>
</el-row>
</div>
</div>
<div>
<div class="module_header">老师点评</div>
<div style="padding: 0 10px;box-sizing: border-box;">
<el-input type="textarea" :rows="6" placeholder="请输入内容">
<el-input type="textarea" :rows="6" placeholder="请输入内容" v-model="request_params.found_remark">
</el-input>
</div>
</div>
......@@ -151,7 +147,7 @@
import Header from '@/components/ExaminationHeader/succinct.vue';
import AnalyseModule from '@/components/AnalyseModule/index.vue';
import { get_test_results_count, save_read_over_data } from '@/api/student';
import { toPercent } from '@/utils/tool';
import { toPercent, countOccurrences } from '@/utils/tool';
import { Level } from 'chalk';
const standard_template = {
......@@ -166,11 +162,11 @@ export default {
is_search_show: true,
title: null,
right_buttons: [
{
text: '审核通过',
icon: 'el-icon-document-checked',
event: 'check',
},
// {
// text: '审核通过',
// icon: 'el-icon-document-checked',
// event: 'check',
// },
{
text: '保存',
icon: 'el-icon-plus',
......@@ -207,7 +203,8 @@ export default {
success_top: 10,
success_region_max: 100,
success_region_min: 10
}
},
found_remark: ''
},
is_loading: false,
......@@ -228,6 +225,8 @@ export default {
breed_score: null,
//最高成绩..
get_highes_lowestt_score_data: null,
//眼光稳定性
eye_stability_data: null,
//对错题分析
wrong_question_data: null,
exactness_question_data: null,
......@@ -286,6 +285,8 @@ export default {
this.breed_score = this.changeBreedScore(res.breedScore);//品种得分
//最高分、最低分、平均分,中位数、众数、离散(变异系数)
this.get_highes_lowestt_score_data = this.getHighesLowesttScore(res.getHighesLowesttScore);
//眼光稳定性
this.eye_stability_data = this.changeEyeStability(res.EyeStability);
//对错题分析
if (res.top_data) this.wrong_question_data = this.changeWrong(res.top_data.datadesc);//错题分析
if (res.top_data) this.exactness_question_data = this.changeRight(res.top_data.dataasc);//对题分析
......@@ -454,6 +455,45 @@ export default {
}
},
//眼光稳定性
changeEyeStability(datas) {
if (!datas) return false;
let list = [];
let labers = [
{ label: '题目', key: 'title' },
{ label: '答案', key: 'answer' },
{ label: '稳定性', key: 'stability' }
];
//处理稳定性数据
const changeStability = (items) => {
let all_num = items.exactness.length + items.wrong.length;
let Accuracy = toPercent(items.exactness.length, all_num);//准确率
return {
accuracy: { label: '正确率', value: Accuracy },
exactness: { label: '正确数据', value: items.exactness },
wrong: { label: '错误数据', value: items.wrong },
}
};
datas.data.forEach((element, index) => {
list.push({
title: datas.title[index],
answer: element.answer,
stability: changeStability(element)
});
});
return {
type: 'eye_stability_table',
chart_id: 'wrong_group',
color: '#529B2E',
title: '眼光稳定性',
labers,
list,
is_show: {
key: 'is_EyeStability',
value: this.request_params.is_EyeStability
}
};
},
//易错/易对 等级分析
changeWrong(datas) {
if (!datas) return false;
......@@ -530,7 +570,7 @@ export default {
position: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: datas[element].distribute,
distribute: countOccurrences(datas[element].distribute),
});
});
return {
......@@ -562,7 +602,7 @@ export default {
level: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: datas[element].distribute,
distribute: countOccurrences(datas[element].distribute),
});
});
return {
......@@ -594,7 +634,7 @@ export default {
color: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: datas[element].distribute,
distribute: countOccurrences(datas[element].distribute),
});
});
return {
......@@ -626,7 +666,7 @@ export default {
group: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: datas[element].distribute,
distribute: countOccurrences(datas[element].distribute),
});
});
return {
......@@ -705,4 +745,8 @@ export default {
width: 30%;
}
}
.unit_container {
margin-bottom: 15px;
}
</style>
......@@ -11,38 +11,44 @@
</el-card>
<el-card class="box-card">
<el-row>
<el-col :span="8">
<!-- 错误方位/区域 -->
<el-col :span="8" style="margin-bottom: 15px;" v-if="area_score_list">
<div class="centenr_container">
<AnalyseModule :module_data="area_score_list" v-if="area_score_list">
<AnalyseModule :module_data="area_score_list">
</AnalyseModule>
</div>
</el-col>
<el-col :span="8">
<!-- 错误部位 -->
<el-col :span="8" style="margin-bottom: 15px;" v-if="wrong_position_list">
<div class="centenr_container">
<AnalyseModule :module_data="wrong_group_list" v-if="wrong_group_list"></AnalyseModule>
<AnalyseModule :module_data="wrong_position_list"></AnalyseModule>
</div>
</el-col>
<el-col :span="8">
<!-- 错误颜色 -->
<el-col :span="8" style="margin-bottom: 15px;" v-if="wrong_color_list">
<div class="centenr_container">
<AnalyseModule :module_data="wrong_color_list" v-if="wrong_color_list">
<AnalyseModule :module_data="wrong_color_list">
</AnalyseModule>
</div>
</el-col>
<el-col :span="8" style="margin-top: 15px;">
<!-- 错误等级 -->
<el-col :span="8" style="margin-bottom: 15px;" v-if="error_level_list">
<div class="centenr_container">
<AnalyseModule :module_data="error_level_list" v-if="error_level_list">
<AnalyseModule :module_data="error_level_list">
</AnalyseModule>
</div>
</el-col>
<el-col :span="8" style="margin-top: 15px;">
<!-- 错误组别 -->
<el-col :span="8" style="margin-bottom: 15px;" v-if="wrong_group_list">
<div class="centenr_container">
<AnalyseModule :module_data="wrong_group_list" v-if="wrong_group_list">
<AnalyseModule :module_data="wrong_group_list">
</AnalyseModule>
</div>
</el-col>
<el-col :span="8" style="margin-top: 15px;">
<!-- 眼观稳定性 -->
<el-col :span="8" style="margin-bottom: 15px;" v-if="eye_stability_list">
<div class="centenr_container">
<AnalyseModule :module_data="eye_stability_list" v-if="eye_stability_list">
<AnalyseModule :module_data="eye_stability_list">
</AnalyseModule>
</div>
</el-col>
......@@ -66,11 +72,10 @@
<script>
import ExaminationHeader from '@/components/ExaminationHeader/index';
import AnswerCard from '../components/AnswerCard.vue';
// import AnalyseModule from '../components/AnalyseModule.vue';
import AnalyseModule from '@/components/AnalyseModule/index.vue';
import { get_test_results_detail } from '@/api/student';
import { array_conversion } from '@/utils/tool';
import { toPercent,countOccurrences } from '@/utils/tool';
const standard_template = {
id: null,
father_id: -1,//父级id
......@@ -115,10 +120,10 @@ export default {
test_text: '针对你在本次烟草知识考试中的表现,我认为你已经做得非常出色。你的答案准确地回答了考试中的问题,而且展现出了对烟草知识的全面了解。',
//图出区域数据
//区域区域数据
area_score_list: null,
//错误部位
wrong_group_list: null,
wrong_position_list: null,
//错误颜色
wrong_color_list: null,
//错误等级
......@@ -180,18 +185,17 @@ export default {
//烟草区域
this.area_score_list = this.changeAreaScore(res.statistical_results.AreaScore);
//错误部位
this.wrong_group_list = this.changeWrongPosition(res.statistical_results.WrongPosition);
this.wrong_position_list = this.changeWrongPosition(res.statistical_results.WrongPosition);
//错误颜色
this.wrong_color_list = this.changeWrongColor(res.statistical_results.WrongColor);
//错误等级
this.error_level_list = this.changeErrorLevel(res.statistical_results.ErrorLevel);
//错误组别
this.wrong_group_list = this.changeWrongGroup(res.statistical_results.WrongGroup);
//changeEyeStability
//眼光稳定性
this.eye_stability_list = this.changeEyeStability(res.statistical_results.EyeStability)
console.log('处理好的数据');
console.log(this.eye_stability_list);
console.log(this.area_score_list);
})
},
......@@ -230,7 +234,7 @@ export default {
position: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: datas[element].distribute,
distribute: countOccurrences(datas[element].distribute),
});
});
return {
......@@ -259,7 +263,7 @@ export default {
color: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: datas[element].distribute,
distribute: countOccurrences(datas[element].distribute),
});
});
return {
......@@ -287,7 +291,7 @@ export default {
level: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: datas[element].distribute,
distribute: countOccurrences(datas[element].distribute),
});
});
return {
......@@ -316,7 +320,7 @@ export default {
group: element,
answer: datas[element].answer,
wrong_num: datas[element].wrong_num,
distribute: datas[element].distribute,
distribute: countOccurrences(datas[element].distribute),
});
});
return {
......@@ -335,19 +339,27 @@ export default {
let labers = [
{ label: '题目', key: 'title' },
{ label: '答案', key: 'answer' },
{ label: '正确数据', key: 'exactness' },
{ label: '错题数据', key: 'wrong' },
{ label: '稳定性', key: 'stability' }
];
//处理稳定性数据
const changeStability = (items) => {
let all_num = items.exactness.length + items.wrong.length;
let Accuracy = toPercent(items.exactness.length, all_num);//准确率
return {
accuracy: { label: '正确率', value: Accuracy },
exactness: { label: '正确数据', value: items.exactness },
wrong: { label: '错误数据', value: items.wrong },
}
};
datas.data.forEach((element, index) => {
list.push({
title: datas.title[index],
answer: element.answer,
exactness: element.exactness,
wrong: element.wrong,
stability: changeStability(element)
});
});
return {
type: 'table',
type: 'eye_stability_table',
chart_id: 'wrong_group',
color: '#529B2E',
title: '眼光稳定性',
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论