parent
23bf70ff73
commit
ca17b3eb1d
6 changed files with 67 additions and 676 deletions
@ -1,368 +0,0 @@ |
||||
<template> |
||||
<div> |
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<div class="flex-between m-b-10"> |
||||
<el-page-header @back="goBack" :content="experimentalName"></el-page-header> |
||||
</div> |
||||
|
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<el-tabs v-model="activeName" @tab-click="handleClick"> |
||||
<el-tab-pane v-for="item in classInfo" :label="item.className" :name="item.id"></el-tab-pane> |
||||
</el-tabs> |
||||
<div class="stat"> |
||||
<div class="nums"> |
||||
<div class="item"> |
||||
<p class="name">实验总人数</p> |
||||
<p class="val">{{ total }}</p> |
||||
</div> |
||||
<div class="item"> |
||||
<p class="name">实验平均分</p> |
||||
<p class="val">{{ avg }}</p> |
||||
</div> |
||||
</div> |
||||
<div class="chart" id="chart"></div> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<div class="flex-between m-b-20"> |
||||
<el-form label-width="100px"> |
||||
<div class="flex-between"> |
||||
<div></div> |
||||
<div> |
||||
<el-input placeholder="请输入学校/学生姓名" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input> |
||||
</div> |
||||
</div> |
||||
</el-form> |
||||
<div></div> |
||||
<div> |
||||
<el-button type="primary" @click="delAllData">批量删除</el-button> |
||||
<el-button type="primary" @click="exportData">导出</el-button> |
||||
</div> |
||||
</div> |
||||
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="reportId"> |
||||
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> |
||||
<el-table-column type="index" width="100" label="序号" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.$index + (page - 1) * pageSize + 1 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="schoolName" label="学校" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="experimentalName" label="考核名称" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ experimentalName }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="userName" label="学生姓名" align="center"></el-table-column> |
||||
<el-table-column prop="workNumber" label="学号" align="center"></el-table-column> |
||||
<el-table-column prop="score" label="分数" align="center"></el-table-column> |
||||
<el-table-column prop="submitTime" label="提交时间" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="220"> |
||||
<template slot-scope="scope"> |
||||
<!-- <el-button type="text" @click="edit(scope.row)">修改分数</el-button> --> |
||||
<el-button type="text" @click="show(scope.row)">查看成绩报告</el-button> |
||||
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="page"> |
||||
</el-pagination> |
||||
</div> |
||||
</el-card> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Setting from "@/setting"; |
||||
import util from "@/libs/util"; |
||||
import echarts from "echarts"; |
||||
import axios from 'axios'; |
||||
|
||||
export default { |
||||
data() { |
||||
return { |
||||
id: this.$route.query.id, |
||||
classId: this.$route.query.classId, |
||||
projectId: this.$route.query.projectId, |
||||
assessmentId:'', |
||||
classInfo: [ |
||||
{ |
||||
architectureId: "", |
||||
className: "全部", |
||||
createTime: "2021-12-30 12:02:33", |
||||
id: "", |
||||
isDel: 0, |
||||
} |
||||
], |
||||
experimentalName: this.$route.query.experimentalName, |
||||
className: this.$route.query.class, |
||||
keyword: "", |
||||
listData: [], |
||||
multipleSelection: [], |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0, |
||||
avg: 0, |
||||
activeName:'', |
||||
token: util.local.get(Setting.tokenKey), |
||||
}; |
||||
}, |
||||
created() { |
||||
this.getData(); |
||||
let classInfo = JSON.parse(this.$route.query.classInfo) |
||||
for (var i=0;i<classInfo.length;i++){ |
||||
if(classInfo[i].className == "无指定范围"){ |
||||
|
||||
}else{ |
||||
this.classInfo.push(classInfo[i]) |
||||
} |
||||
} |
||||
for(var i=0;i<this.classInfo.length;i++){ |
||||
let id = this.classInfo[i].id |
||||
this.classInfo[i].id = id.toString() |
||||
} |
||||
const activeName2 = sessionStorage.getItem('activeName2') |
||||
if(activeName2 && this.classInfo.some(item => item.id === activeName2)) { |
||||
this.classId = "" |
||||
this.activeName = "" |
||||
}else { |
||||
this.classId = ""; |
||||
this.activeName = ""; |
||||
} |
||||
this.id = this.$route.query.id |
||||
}, |
||||
methods: { |
||||
handleClick(tab, event) { |
||||
sessionStorage.setItem('activeName2', tab.name) |
||||
if(this.activeName == 0){ |
||||
this.activeName = '' |
||||
} |
||||
this.getData() |
||||
}, |
||||
getData() { |
||||
if(this.activeName == 0){ |
||||
this.activeName = '' |
||||
} |
||||
this.$post(`${this.api.getAssessmentDetail}?assessmentId=${+this.id}&pageNum=${this.page}&pageSize=${this.pageSize}&classId=${this.activeName}`).then(res => { |
||||
if (res.status == 200){ |
||||
if(this.activeName == ''){ |
||||
this.activeName = '0' |
||||
} |
||||
this.avg = res.avgScore |
||||
this.total = res.peopleNum |
||||
let list = res.page.records; |
||||
if (list.length > 0){ |
||||
this.assessmentId = res.page.records[0].assessmentId; |
||||
let score = 0; |
||||
list.map(n => { |
||||
n.class = this.className; |
||||
score += n.score; |
||||
}); |
||||
} |
||||
this.listData = list; |
||||
this.getChart(); |
||||
} |
||||
}).catch(res => { |
||||
}); |
||||
}, |
||||
edit(row) { |
||||
if (this.systemId == 2 || this.systemId == 3) { |
||||
this.$router.push(`addexperiment?id=${row.reportId}&stuId=${row.userId}&studentName=${row.studentName}&class=${row.class}`); |
||||
} else { |
||||
this.$router.push(`addexperiment?id=${row.reportId}`); |
||||
} |
||||
}, |
||||
show(row) { |
||||
if (this.systemId == 2) { |
||||
this.$router.push(`showexperimentOption?id=${row.reportId}&stuId=${row.userId}&studentName=${row.studentName}&class=${row.class}`); |
||||
} else if (this.systemId == 3) { |
||||
this.$router.push(`showexperimentOptions?id=${row.reportId}&stuId=${row.userId}&studentName=${row.studentName}&class=${row.class}`); |
||||
} else { |
||||
if (this.className) { |
||||
this.$router.push(`show?id=${row.recordId}&projectId=${this.id}&reportId=${row.reportId}&studentId=${row.studentId}`); |
||||
} else { |
||||
this.$router.push(`show?id=${row.recordId}&type=1`); |
||||
} |
||||
} |
||||
}, |
||||
exportData() { |
||||
if (!this.listData.length) return false; |
||||
if (this.multipleSelection.length) { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.reportId; |
||||
}); |
||||
axios.get(`${this.api.exportAssessmentInfo}?assessmentId=${+this.id}&classId=${this.activeName}&ids=${ids.toString()}`,{ |
||||
headers: { |
||||
token: this.token |
||||
}, |
||||
responseType: 'blob' |
||||
}).then((res) => { |
||||
util.downloadFileDirect(`按数据库统计使用概况导出.xls`,new Blob([res.data])) |
||||
}).catch(res => {}) |
||||
} else { |
||||
axios.get(`${this.api.exportAssessmentInfo}?assessmentId=${+this.id}&classId=${this.activeName}&ids=`,{ |
||||
headers: { |
||||
token: this.token |
||||
}, |
||||
responseType: 'blob' |
||||
}).then((res) => { |
||||
util.downloadFileDirect(`按数据库统计使用概况导出.xls`,new Blob([res.data])) |
||||
}).catch(res => {}) |
||||
} |
||||
}, |
||||
handleDelete(row) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}) |
||||
.then(() => { |
||||
let ids = [row.reportId] |
||||
this.$post(`${this.api.deleteExperimentalReport}`,ids).then(res => { |
||||
util.successMsg("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => { |
||||
}); |
||||
}) |
||||
.catch(() => { |
||||
}); |
||||
}, |
||||
delAllData() { |
||||
if (this.multipleSelection.length != "") { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}) |
||||
.then(() => { |
||||
let newArr = this.multipleSelection; |
||||
let ids = [] |
||||
for (var i=0;i<newArr.length;i++){ |
||||
ids.push(newArr[i].reportId) |
||||
} |
||||
this.$post(`${this.api.deleteExperimentalReport}`,ids).then(res => { |
||||
util.successMsg("删除成功"); |
||||
this.$refs.table.clearSelection() |
||||
this.getData(); |
||||
}).catch(res => { |
||||
}); |
||||
}) |
||||
.catch(() => { |
||||
}); |
||||
} else { |
||||
util.errorMsg("请先选择数据 !"); |
||||
} |
||||
}, |
||||
handleSelectionChange(val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
handleCurrentChange(val) { |
||||
this.page = val; |
||||
this.getData(); |
||||
}, |
||||
getChart() { |
||||
let data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
||||
let list = this.listData; |
||||
list.map(n => { |
||||
n.score; |
||||
if (n.score >= 0 && n.score <= 10) { |
||||
data[0]++; |
||||
} else if (n.score > 10 && n.score <= 20) { |
||||
data[1]++; |
||||
} else if (n.score > 20 && n.score <= 30) { |
||||
data[2]++; |
||||
} else if (n.score > 30 && n.score <= 40) { |
||||
data[3]++; |
||||
} else if (n.score > 40 && n.score <= 50) { |
||||
data[4]++; |
||||
} else if (n.score > 50 && n.score <= 60) { |
||||
data[5]++; |
||||
} else if (n.score > 60 && n.score <= 70) { |
||||
data[6]++; |
||||
} else if (n.score > 70 && n.score <= 80) { |
||||
data[7]++; |
||||
} else if (n.score > 80 && n.score <= 90) { |
||||
data[8]++; |
||||
} else if (n.score > 90 && n.score <= 100) { |
||||
data[9]++; |
||||
} |
||||
}); |
||||
let myChart = echarts.init(document.getElementById("chart")); |
||||
myChart.setOption({ |
||||
title: { text: "实验分数分布图" }, |
||||
tooltip: {}, |
||||
xAxis: { |
||||
name: "分数", |
||||
type: "category", |
||||
boundaryGap: false, |
||||
data: ["0-10", "11-20", "21-30", "31-40", "41-50", "51-60", "61-70", "71-80", "81-90", "91-100"] |
||||
}, |
||||
yAxis: { |
||||
name: "人数", |
||||
type: "value" |
||||
}, |
||||
series: [{ |
||||
data, |
||||
type: "line", |
||||
areaStyle: {}, |
||||
color: ["#8191fd"] |
||||
}] |
||||
}); |
||||
}, |
||||
goBack() { |
||||
this.$router.back(); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
/deep/ .el-tabs__nav-wrap::after { |
||||
display: none; |
||||
} |
||||
|
||||
.stat { |
||||
display: flex; |
||||
|
||||
.nums { |
||||
display: flex; |
||||
align-items: center; |
||||
margin-right: 20px; |
||||
|
||||
.item:nth-child(1) { |
||||
background-image: url('../../../assets/img/total.png'); |
||||
} |
||||
|
||||
.item:nth-child(2) { |
||||
background-image: url('../../../assets/img/avg.png'); |
||||
} |
||||
|
||||
.item { |
||||
width: 300px; |
||||
padding: 30px 30px; |
||||
margin: 0 10px; |
||||
box-sizing: border-box; |
||||
border-radius: 8px; |
||||
background-size: 100% 100%; |
||||
background-repeat: no-repeat; |
||||
|
||||
p { |
||||
font-size: 18px; |
||||
color: #ffffff; |
||||
} |
||||
|
||||
.val { |
||||
margin-top: 10px; |
||||
color: #ffffff; |
||||
font-size: 36px; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.chart { |
||||
flex: 1; |
||||
height: 300px; |
||||
} |
||||
} |
||||
</style> |
@ -1,266 +0,0 @@ |
||||
<template> |
||||
<div> |
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<div class="flex-between m-b-10"> |
||||
<el-page-header @back="goBack" :content="experimentName"></el-page-header> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<div class="stat"> |
||||
<div class="nums"> |
||||
<div class="item"> |
||||
<p class="name">实验总人数</p> |
||||
<p class="val">{{ peopleNum }}</p> |
||||
</div> |
||||
<div class="item"> |
||||
<p class="name">实验平均分</p> |
||||
<p class="val">{{ avgScore }}</p> |
||||
</div> |
||||
</div> |
||||
<div class="chart" id="chart"></div> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<div class="flex-between m-b-20"> |
||||
<div> |
||||
<el-input placeholder="请输入学校/学生姓名" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input> |
||||
</div> |
||||
<div> |
||||
<el-button type="primary" @click="delAllData">批量删除</el-button> |
||||
<el-button type="primary" @click="exportData">导出</el-button> |
||||
</div> |
||||
</div> |
||||
<el-table ref="table" :data="listData" class="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="reportId"> |
||||
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> |
||||
<el-table-column type="index" width="100" label="序号" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.$index + (page - 1) * pageSize + 1 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="schoolName" label="学校" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="userName" label="学生姓名" align="center"></el-table-column> |
||||
<el-table-column prop="workNumber" label="学号" align="center"></el-table-column> |
||||
<el-table-column prop="score" label="分数" align="center"></el-table-column> |
||||
<el-table-column prop="submitTime" label="提交时间" align="center"> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="220"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="show(scope.row)">查看成绩报告</el-button> |
||||
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="page"> |
||||
</el-pagination> |
||||
</div> |
||||
</el-card> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { mapState, mapActions } from "vuex"; |
||||
import axios from 'axios' |
||||
import Setting from "@/setting"; |
||||
import util from "@/libs/util"; |
||||
import echarts from "echarts"; |
||||
|
||||
export default { |
||||
data() { |
||||
return { |
||||
permissions: this.$route.query.permissions, |
||||
experimentName: this.$route.query.projectName, |
||||
projectId: this.$route.query.projectId, |
||||
keyword: "", |
||||
searchTimer: null, |
||||
listData: [], |
||||
multipleSelection: [], |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0, |
||||
peopleNum: 0, // 总人数 |
||||
avgScore: 0, // 平均分 |
||||
token: util.local.get(Setting.tokenKey), |
||||
}; |
||||
}, |
||||
watch: { |
||||
keyword: function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initData(); |
||||
}, 500); |
||||
} |
||||
}, |
||||
mounted() { |
||||
this.getData(); |
||||
}, |
||||
methods: { |
||||
initData() { |
||||
this.$refs.table.clearSelection(); |
||||
this.page = 1; |
||||
this.getData(); |
||||
}, |
||||
getData() { |
||||
this.$post(`${this.api.getPracticeDetail}?pageNum=${this.page}&pageSize=${this.pageSize}&projectId=${this.projectId}&keyword=${this.keyword}`).then(res => { |
||||
// this.multipleSelection = res.page.records; |
||||
this.listData = res.page.records; |
||||
this.total = res.page.total; |
||||
let avgScore = +res.avgScore |
||||
this.avgScore = avgScore.toFixed(2) |
||||
this.peopleNum = res.peopleNum; |
||||
this.getChart(res.getFractionalSegmentNum); |
||||
}).catch(res => { |
||||
}); |
||||
}, |
||||
show(row) { |
||||
if (this.permissions) { |
||||
this.$router.push(`show?id=${row.projectId}&projectId=${this.projectId}&reportId=${row.reportId}`); |
||||
} else { |
||||
this.$router.push(`show?id=${row.projectId}&type=1`); |
||||
} |
||||
}, |
||||
exportData() { |
||||
if (this.multipleSelection.length) { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.reportId; |
||||
}); |
||||
axios.get(`${this.api.exportPracticeInfo}?projectId=${this.projectId}&ids=${ids.toString()}`,{ |
||||
headers: { |
||||
token: this.token |
||||
}, |
||||
responseType: 'blob' |
||||
}).then((res) => { |
||||
util.downloadFileDirect(`学生练习成绩.xls`,new Blob([res.data])) |
||||
}).catch(res => {}) |
||||
// location.href = `${this.api.exportPracticeInfo}?projectId=${this.projectId}&ids=${ids.toString()}`; |
||||
} else { |
||||
axios.get(`${this.api.exportPracticeInfo}?projectId=${this.projectId}&ids=`,{ |
||||
headers: { |
||||
token: this.token |
||||
}, |
||||
responseType: 'blob' |
||||
}).then((res) => { |
||||
util.downloadFileDirect(`学生练习成绩.xls`,new Blob([res.data])) |
||||
}).catch(res => {}) |
||||
// location.href = `${this.api.exportPracticeInfo}?projectId=${this.projectId}&ids=`; |
||||
} |
||||
}, |
||||
handleDelete(row) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.$post(this.api.deleteExperimentalReport, [row.reportId]).then(res => { |
||||
util.successMsg("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => { |
||||
}); |
||||
}).catch(() => { |
||||
}); |
||||
}, |
||||
delAllData() { |
||||
if (this.multipleSelection.length) { |
||||
this.$confirm("该项目下的所有成绩报告将会删除,是否继续?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.reportId; |
||||
}); |
||||
this.$post(this.api.deleteExperimentalReport, ids).then(res => { |
||||
this.multipleSelection = []; |
||||
this.$refs.table.clearSelection(); |
||||
util.successMsg("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => { |
||||
}); |
||||
}).catch(() => { |
||||
}); |
||||
} else { |
||||
util.errorMsg("请先选择数据 !"); |
||||
} |
||||
}, |
||||
handleSelectionChange(val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
handleCurrentChange(val) { |
||||
this.page = val; |
||||
this.getData(); |
||||
}, |
||||
getChart(num) { |
||||
let data = [num.num1, num.num2, num.num3, num.num4, num.num5, num.num6, num.num7, num.num8, num.num9, num.num10]; |
||||
let myChart = echarts.init(document.getElementById("chart")); |
||||
myChart.setOption({ |
||||
title: { text: "实验分数分布图" }, |
||||
tooltip: {}, |
||||
xAxis: { |
||||
name: "分数", |
||||
type: "category", |
||||
boundaryGap: false, |
||||
data: ["0-10", "11-20", "21-30", "31-40", "41-50", "51-60", "61-70", "71-80", "81-90", "91-100"] |
||||
}, |
||||
yAxis: { |
||||
name: "人数", |
||||
type: "value" |
||||
}, |
||||
series: [{ |
||||
data, |
||||
type: "line", |
||||
areaStyle: {}, |
||||
color: ["#8191fd"] |
||||
}] |
||||
}); |
||||
}, |
||||
goBack() { |
||||
this.$router.push("/achievement/list?per=2"); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.stat { |
||||
display: flex; |
||||
|
||||
.nums { |
||||
display: flex; |
||||
align-items: center; |
||||
margin-right: 20px; |
||||
|
||||
.item:nth-child(1) { |
||||
background-image: url('../../../assets/img/total.png'); |
||||
} |
||||
|
||||
.item:nth-child(2) { |
||||
background-image: url('../../../assets/img/avg.png'); |
||||
} |
||||
|
||||
.item { |
||||
width: 300px; |
||||
padding: 30px 30px; |
||||
margin: 0 10px; |
||||
box-sizing: border-box; |
||||
border-radius: 8px; |
||||
background-size: 100% 100%; |
||||
background-repeat: no-repeat; |
||||
|
||||
p { |
||||
font-size: 18px; |
||||
color: #ffffff; |
||||
} |
||||
|
||||
.val { |
||||
margin-top: 10px; |
||||
color: #ffffff; |
||||
font-size: 36px; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.chart { |
||||
flex: 1; |
||||
height: 300px; |
||||
} |
||||
} |
||||
</style> |
Loading…
Reference in new issue