班级管理

master
4 years ago
parent 62ac46f867
commit f12c8ffbf3
  1. BIN
      src/assets/img/class.png
  2. 47
      src/components/page/ClassAchievement.vue
  3. 14
      src/components/page/ClassInfo.vue
  4. 66
      src/components/page/ClassStudent.vue
  5. 256
      src/components/page/Dashboard.vue
  6. 1
      src/components/page/Student.vue
  7. 362
      src/components/page/classExperimentAss.vue
  8. 3
      src/main.js
  9. 5
      src/router/routes.js
  10. 12
      src/utils/api.js
  11. 83
      src/utils/http.js

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@ -30,17 +30,17 @@
</template>
</el-table-column>
<el-table-column prop="experimentalName" label="考核名称" align="center"></el-table-column>
<el-table-column prop="experimentalClassName" label="班级" align="center"></el-table-column>
<el-table-column prop="className" label="班级" align="center"></el-table-column>
<el-table-column prop="projectName" label="项目名称" align="center">
</el-table-column>
<el-table-column prop="number" label="成绩报告数量" align="center">
<el-table-column prop="experimentalReportNumber" label="成绩报告数量" align="center">
</el-table-column>
<el-table-column prop="creationTime" label="创建时间" align="center">
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" @click="entry(scope.row)">成绩管理</el-button>
<el-button v-if="projectPermissions" type="text" @click="handleDelete(scope.row)" :disabled="!scope.row.isdel">删除</el-button>
<el-button type="text" @click="handleDelete(scope.row)" :disabled="!scope.row.isdel">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -58,6 +58,8 @@ export default {
name: 'achievement',
data() {
return {
classId: this.$route.query.classId,
className: this.$route.query.className,
userId: this.$store.state.userLoginId,
keyword: '',
systemId: this.$config.systemId,
@ -138,19 +140,14 @@ export default {
background: 'rgba(255,255,255,.6)'
})
let data = {
searchContant: this.encodeString(this.keyword),
startTime: this.startingtime,
endtime: this.endtime,
month: this.month,
page: this.pageNo,
size: this.pageSize,
userId: this.userId,
systemId: this.systemId,
projectPermissions: this.projectPermissions
classId: this.classId,
searchContent: this.encodeString(this.keyword),
current: this.pageNo,
pageSize: this.pageSize,
}
this.$get(this.api.queryAchievementNew,data).then(res => {
this.listData = res.data.list
this.totals = res.data.total
this.$post(this.api.classAssessmentList,data).then(res => {
this.listData = res.list.list
this.totals = res.list.totalCount
this.$nextTick(() => {
this.loadIns.close()
})
@ -159,25 +156,19 @@ export default {
})
},
entry(row){
if(this.projectPermissions){
let classList = [{
classId: this.classId,
className: this.className
}]
this.$store.commit('addExperimentData',{experimentData: {
id: row.id,
name: row.projectName,
class: row.experimentalClassName,
systemId: this.systemId,
classList,
projectId: row.projectId,
experimentalName: row.experimentalName
}})
this.$router.push('experimentTeach')
}else{
this.$store.commit('addExperimentData',{experimentData: {
id: row.projectId,
name: row.projectName,
class: row.experimentalClassName,
systemId: this.systemId
}})
this.$router.push('experimentVir')
}
this.$router.push('classExperimentAss')
},
disabledSelection(row,index){
if(row.isdel == 0) return false

@ -1,4 +1,12 @@
<template>
<div>
<el-card shadow="hover" class="mgb20">
<div class="per_title" v-preventReClick @click="goback()">
<i class="el-icon-arrow-left"></i>
<span class="per_back">返回</span>
<span class="per_school">{{className}}</span>
</div>
</el-card>
<div class="Achievement-container">
<div class="tabs">
<a class="item" v-for="(item,index) in tabs" :key="index" :class="{active: index == activeName}" @click="tabChange(index)">{{item}}</a>
@ -11,6 +19,7 @@
<ClassAchievement></ClassAchievement>
</div>
</div>
</div>
</template>
<script>
@ -21,6 +30,8 @@ export default {
return {
activeName: 'first',
userId: this.$store.state.userId,
classId: this.$route.query.classId,
className: this.$route.query.className,
tabs: {
first: '学生管理',
second: '成绩管理'
@ -37,6 +48,9 @@ export default {
methods: {
tabChange(index){
this.activeName = index
},
goback() {
this.$router.back()
}
}
};

@ -8,22 +8,21 @@
<el-button type="primary" size="small" round @click="delAllSelection">批量删除</el-button>
</div>
<div>
<el-input placeholder="请输入学生姓名/学校名称" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input>
<el-input placeholder="请输入学生姓名/学号/账号" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input>
</div>
</div>
<el-table :data="studentData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" :row-key="getRowKeys">
<el-table :data="studentData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="studentId">
<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">
</el-table-column>
<el-table-column prop="account" label="账号" align="center">
</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="countries" label="账号角色" align="center">
<template slot-scope="scope">
{{roleStatus(scope.row.roleId)}}
</template>
<el-table-column prop="className" label="班级" align="center">
</el-table-column>
<el-table-column prop="account" label="账号" align="center">
</el-table-column>
<el-table-column prop="workNumber" label="学号" align="center">
</el-table-column>
<el-table-column prop="loginNumber" label="登录次数" align="center">
</el-table-column>
@ -99,9 +98,10 @@
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.uploadFile"
:action="this.api.uploadStudents"
:file-list="uploadList"
name="file"
:data="uploadData"
>
<el-button type="primary" class="ml20">上传文件<i class="el-icon-upload2 el-icon--right"></i></el-button>
</el-upload>
@ -140,6 +140,7 @@
<script>
import echarts from 'echarts'
import qs from 'qs'
export default {
name: 'dashboard',
data() {
@ -147,6 +148,7 @@ export default {
isDetail: false,
keyword: '',
schoolId: 2105,
classId: this.$route.query.classId,
form: {
userName: '',
account: '',
@ -222,7 +224,10 @@ export default {
schoolList: [],
uploadFaild: false,
token: '',
accountMsg: ''
accountMsg: '',
uploadData: {
classId: this.$route.query.classId
}
};
},
mounted() {
@ -232,21 +237,18 @@ export default {
},
watch: {
keyword: function(val) {
clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
this.getData()
},500)
}
},
methods: {
getData() {
let data = {
schoolId: '',
seachContent: this.encodeString(this.keyword),
classId: this.classId,
searchContent: this.encodeString(this.keyword),
page: this.pageNo,
size: this.pageSize
}
this.$get(this.api.queryStudent,data).then(res => {
this.$post(this.api.queryStudentList,data).then(res => {
this.studentData = res.data.list
this.totals = res.data.totalCount
}).catch(res => {});
@ -258,24 +260,24 @@ export default {
if(this.workNumberRepeat) return this.$message.warning('该学生学号已存在')
if(this.phoneRepeat) return this.$message.warning('该手机号已存在')
if(this.form.studentId) {
this.form.classId = this.classId
this.$put(this.api.updateStudent,this.form).then(res => {
if(res.errmessage == 'success') {
this.$message.success('提交成功!');
this.studentVisible = false
this.getData()
this.getStat()
}else{
this.$message.error(res.message);
}
}).catch(res => {});
}else{
this.form.classId = this.classId
this.form.uniqueIdentificationAccount = new Date().getTime()
this.$post(this.api.addStudent,this.form).then(res => {
this.$post(this.api.addStudentToClass,this.form).then(res => {
if(res.errmessage == 'success') {
this.$message.success('提交成功!');
this.studentVisible = false
this.getData()
this.getStat()
}else{
this.$message.error(res.message);
}
@ -390,21 +392,23 @@ export default {
location.href = this.api.download
},
handleDelete(row) {
this.$confirm('确定要删除吗?', '提示', {
this.$confirm('确定要删除该学生吗?', '提示', {
type: 'warning'
})
.then(() => {
this.$post(this.api.daleteStudent,[row.studentId]).then(res => {
let arr = []
arr.push(row.studentId)
let data = {
classId: this.classId,
studentIds: arr
}
this.$delbody(this.api.deleteStudents,data).then(res => {
this.$message.success('删除成功');
this.getData()
this.getStat()
}).catch(res => {});
})
.catch(() => {});
},
getRowKeys(row) {
return row.userId;
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
@ -414,20 +418,22 @@ export default {
let delList = newArr.map(item => {
return item.studentId
})
this.$confirm('确定要删除选中用户吗?', '提示', {
this.$confirm('确定要删除选中学生吗?', '提示', {
type: 'warning'
})
.then(() => {
let data = delList
this.$post(this.api.daleteStudent,data).then(res => {
let data = {
classId: this.classId,
studentIds: delList
}
this.$delbody(this.api.deleteStudents,data).then(res => {
this.$refs.table.clearSelection()
this.$message.success('删除成功');
this.getData()
this.getStat()
}).catch(res => {});
}).catch(() => {});
}else{
this.$message.error('请先选择数据 !');
this.$message.error('请先选择学生 !');
}
},
resetPassword(row){

@ -10,18 +10,18 @@
<el-form label-width="80px">
<div class="flex-center">
<el-form-item label="班级年份" class="userRadio">
<el-radio-group v-model="form.year" @change="getData">
<el-radio v-for="(item,index) in yearsList" :key="index" :label="item.id" border>{{item.name}}</el-radio>
<el-radio-group v-model="year" @change="getData">
<el-radio v-for="(item,index) in yearsList" :key="index" :label="item.value" border>{{item.name}}</el-radio>
</el-radio-group>
</el-form-item>
<div class="flex-center">
<el-form-item label="区间年份">
<el-date-picker v-model="startYear" align="right" type="year" style="margin-left: 10px;" :default-value="endYear"
<el-date-picker v-model="startYear" align="right" type="year" style="margin-left: 10px;" :default-value="endYear" @change="yearChange"
:picker-options="startTimeOptions" @focus="clickStartTime" placeholder="开始日期" format="yyyy" value-format="yyyy" clearable></el-date-picker>
</el-form-item>
<p class="toHr"></p>
<el-form-item label-width="0">
<el-date-picker v-model="endYear" align="right" type="year" style="margin-left: 10px;" :default-value="startYear"
<el-date-picker v-model="endYear" align="right" type="year" style="margin-left: 10px;" :default-value="startYear" @change="yearChange"
:picker-options="endTimeOptions" @focus="clickEndTime" placeholder="结束日期" format="yyyy" value-format="yyyy" clearable></el-date-picker>
</el-form-item>
</div>
@ -29,7 +29,7 @@
<div class="flex-between no-mb">
<div class="flex-center">
<el-form-item label="所属学期" class="userRadio">
<el-radio-group v-model="form.semester" @change="getData">
<el-radio-group v-model="semester" @change="getData">
<el-radio v-for="(item,index) in semesterList" :key="index" :label="item.id" border>{{item.name}}</el-radio>
</el-radio-group>
</el-form-item>
@ -51,34 +51,40 @@
<span>班级列表</span>
</div>
<el-row :gutter="20" class="classList-row">
<div v-for="item in classList" :key="item">
<div v-for="(item,index) in classList" :key="index">
<el-col :span="6">
<el-card shadow="hover" class="editor-btn mgb20">
<div class="flex-between" @click="toEdit(item)">
<img src="" alt="">
<img class="classIcon" src="../../assets/img/class.png" alt="">
<div class="flex-column">
<p>{{item.className}}</p>
<p class="className">{{item.className}}</p>
<div class="flex-column flex-start mat10">
<p>
<span>创建时间</span>
<span>{{item.classTime}}</span>
<span class="list-text">{{item.createTime}}</span>
</p>
<p>
<p class="mat10">
<span>所属年份</span>
<span class="list-text">{{item.years}}</span>
</p>
<p class="mat10">
<span>所属学期</span>
<span>{{item.classSemester}}</span>
<span class="list-text">{{item.classSemester}}</span>
</p>
</div>
</div>
<div class="flex-around">
</div>
<div class="list-btn flex-around editor-btn">
<el-button type="text" icon="el-icon-edit" @click="editClass(item)">编辑</el-button>
<el-button type="text" icon="el-icon-delete">删除</el-button>
<el-button type="text" icon="el-icon-delete" @click="delClass(item)">删除</el-button>
</div>
</el-card>
</el-col>
</div>
<el-col :span="6">
<el-card shadow="hover" class="editor-btn mgb20">
<div>
<el-button type="text" icon="el-icon-plus" @click="addClass">创建班级</el-button>
<el-card shadow="hover" class="editor-btn mgb20" @click.native="addClass">
<div class="flex-center addClass-view">
<el-button type="text" icon="el-icon-plus">创建班级</el-button>
</div>
</el-card>
</el-col>
@ -86,39 +92,36 @@
</el-card>
<!-- 添加编辑班级 -->
<el-dialog :title="classId ? '编辑班级' : '添加班级'" :visible.sync="classVisible" class="classDialog" width="30%" center>
<el-form :model="classForm" label-width="120px">
<el-form-item label="教学班级名称">
<el-input v-model="classForm.className" autocomplete="off"></el-input>
<el-form :model="classForm" :rules="classRules" ref="classForm" label-width="120px">
<el-form-item label="教学班级名称" prop="className">
<el-input placeholder="请输入教学班级名称" v-model="classForm.className" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="班级年份">
<el-form-item label="班级年份" prop="classYear">
<el-date-picker v-model="classForm.classYear" align="right" type="year" style="margin-left: 10px;"
placeholder="开始日期" format="yyyy" value-format="yyyy" clearable></el-date-picker>
placeholder="请选择班级年份" format="yyyy" value-format="yyyy" clearable></el-date-picker>
</el-form-item>
<el-form-item label="所属学期">
<el-form-item label="所属学期" prop="classSemester">
<el-select v-model="classForm.classSemester" placeholder="请选择所属学期">
<el-option label="春季学期" value="0"></el-option>
<el-option label="秋季学期" value="1"></el-option>
<el-option label="春季学期" :value="0"></el-option>
<el-option label="秋季学期" :value="1"></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="classVisible = false"> </el-button>
<el-button type="primary" @click="classVisible = false"> </el-button>
<el-button type="primary" @click="addClassSure('classForm')"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import bus from '../common/bus';
import axios from 'axios';
import { Loading } from 'element-ui'
export default {
data() {
return {
form:{
year: '',
semester: 0,
},
semester: '',
keyword: '',
startYear: '',
endYear: '',
@ -126,95 +129,118 @@ export default {
endTimeOptions: {},
yearsList: [
{
id: '',
value: '',
name: '不限'
},
{
id: 1,
value: '2021',
name: '2021'
},
{
id: 2,
value: '2020',
name: '2020'
},
{
id: 2,
value: '2019',
name: '2019'
},
{
id: 2,
value: '2018',
name: '2018'
},
{
id: 2,
value: '2017',
name: '2017'
},
{
id: 2,
value: '2016',
name: '2016'
},
{
id: 2,
value: '2015',
name: '2015'
}
],
semesterList: [
{
id: 0,
id: '',
name: '不限'
},
{
id: 1,
id: 0,
name: '春季学期'
},
{
id: 2,
id: 1,
name: '秋季学期'
}
],
classList: [{
id: 1,
className: '实验二班',
classTime: '2021',
classSemester: '秋季学期'
},
{
id: 2,
className: '实验二班',
classTime: '2021',
classSemester: '秋季学期'
},
{
id: 3,
className: '实验二班',
classTime: '2021',
classSemester: '秋季学期'
},
{
id: 4,
className: '实验二班',
classTime: '2021',
classSemester: '秋季学期'
}],
classList: [],
classId: '',
classVisible: false,
classForm: {
className: '',
classYear: '',
classSemester: '0'
}
classSemester: 0
},
classRules: {
className: [{ required: true, message: '请输入班级名称', trigger: 'blur' }],
classYear: [{ required: true, message: '请选择班级年份', trigger: 'blur' }],
classSemester: [{ required: true, message: '请选择所属学期', trigger: 'change' }],
},
loadIns: null,
pageNo: 1,
pageSize: 1000,
userId: this.$store.state.userLoginId,
roleId: Number(this.$store.state.userRoleId)
};
},
watch: {
keyword: function(val) {
year (val) {
this.startYear = val
this.endYear = val
},
keyword (val) {
this.getData()
}
},
mounted() {
this.getData()
},
methods: {
getData(){},
getData(){
this.loadIns = Loading.service({
background: 'rgba(255,255,255,.6)'
})
let data = {
className: this.encodeString(this.keyword),
beforeYears: this.startYear,
rearYears: this.endYear,
semester: this.semester,
roleId: this.roleId,
current: this.pageNo,
pageSize: this.pageSize,
userId: this.userId
}
this.$post(this.api.classList,data).then(res => {
res.data.list.map(e =>{
e.classSemester = e.semester == 0 ? '春季学期' : '秋季学期'
})
this.classList = res.data.list
// this.totals = res.data.total
this.$nextTick(() => {
this.loadIns.close()
})
}).catch(res => {
this.loadIns.close()
})
},
yearChange(){
this.getData()
if(!this.startYear && !this.endYear){
this.year = ''
}
},
//
clickStartTime() {
this.startTimeOptions.disabledDate = time => {
@ -243,16 +269,73 @@ export default {
}
}
},
//
addClass(){
this.classId = ''
this.classVisible = true
this.classForm = {
className: '',
classYear: '',
classSemester: 0
}
},
//
editClass(item){
this.classId = item.id
this.classId = item.classId
this.classVisible = true
this.classForm = {
className: item.className,
classYear: String(item.years),
classSemester: item.semester
}
},
//
delClass(item){
this.$confirm('确定要删除该班级吗?', '提示', {
type: 'warning'
})
.then(() => {
this.$del(this.api.deleteClass,{ classId: item.classId }).then(res => {
this.classList.splice(index,1)
this.$message.success('删除成功!');
this.getData()
}).catch(res => {})
}).catch(() => {});
},
addClassSure(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
let data = {
classId: this.classId,
className: this.classForm.className,
years: this.classForm.classYear,
semester: this.classForm.classSemester,
userId: this.userId
}
if(this.classId){
this.$post(this.api.editClass,data).then(res => {
this.$message.success('编辑成功!');
this.getData()
this.classVisible = false
}).catch(res => {})
}else{
this.$post(this.api.saveClass,data).then(res => {
this.$message.success('添加成功!');
this.getData()
this.classVisible = false
}).catch(res => {})
}
}
})
},
toEdit(item){
this.$router.push('classinfo')
this.$router.push({
path: '/classinfo',
query: {
classId: item.classId,
className: item.className
}
})
}
}
};
@ -264,12 +347,39 @@ export default {
margin: -20px 0 0 10px;
}
.classList-row /deep/ .el-card__body{
height: 100px;
height: 150px;
padding: 30px;
}
.classDialog /deep/ .el-date-editor.el-input{
width: 100%;
margin-left: 0!important;
}
.className{
font-size: 16px;
font-weight: 700;
}
.classIcon{
width: 97px;
height: 91px;
}
.mat10{
margin-top: 10px;
}
.addClass-view{
width: 100%;
height: 100%;
justify-content: center;
}
.addClass-view /deep/ .el-button{
font-size: 24px;
}
.list-text{
color: #666;
}
.list-btn{
border-top: 1px solid #eee;
padding: 10px 0;
}
.mag{
margin-right: 20px;
}

@ -42,6 +42,7 @@
<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="className" label="班级" align="center"></el-table-column>
<el-table-column prop="countries" label="账号角色" align="center">
<template slot-scope="scope">
{{roleStatus(scope.row.roleId)}}

@ -0,0 +1,362 @@
<template>
<div>
<el-card shadow="hover" class="mgb20">
<div class="flex-between" style="margin-bottom: 10px">
<div class="per_title" v-preventReClick @click="goback()">
<i class="el-icon-arrow-left"></i>
<span class="per_back">返回</span>
<span class="per_school">{{experimentalName}}</span>
</div>
</div>
<!-- <div class="tabs">
<a class="item" v-for="(item,index) in classList" :key="index" :class="{active: item.classId == classId}" @click="tabChange(item.classId)">{{item.className}}</a>
</div> -->
</el-card>
<el-card shadow="hover" class="mgb20">
<div class="stat">
<div class="cka-Overview">
<div class="newPractice-card">
<div class="newPractice-card-other">
<p style="font-size:18px">实验总人数</p>
<p style="font-size:36px">{{totals}}</p>
</div>
<div class="newPractice-card-other">
<p style="font-size:18px">实验平均分</p>
<p style="font-size:36px">{{avg}}</p>
</div>
</div>
</div>
<div class="chart" id="chart"></div>
</div>
</el-card>
<el-card shadow="hover" class="mgb20">
<div class="flex-between mgb20">
<div>
<el-button type="primary" size="small" @click="delAllData">批量删除</el-button>
<el-button type="primary" size="small" @click="exportData">导出</el-button>
</div>
<div>
<el-input placeholder="请输入学校/学生姓名" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input>
</div>
</div>
<el-tabs v-model="isRead" @tab-click="getData">
<el-tab-pane :label="'全部(' + totals + ')'" name="1"></el-tab-pane>
<el-tab-pane :label="'已批阅(' + already + ')'" name="2"></el-tab-pane>
<el-tab-pane :label="'待批阅(' + not + ')'" name="3"></el-tab-pane>
</el-tabs>
<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 + (pageNo - 1) * pageSize + 1}}
</template>
</el-table-column>
<el-table-column prop="schoolName" label="学校" align="center">
</el-table-column>
<el-table-column prop="class" label="班级" align="center">
<template slot-scope="scope">
{{classList.length ? classList.find(n => n.classId == classId).className : ''}}
</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="creationTime" label="提交时间" align="center">
</el-table-column>
<el-table-column prop="experimentalName" label="批阅状态" align="center">
<template slot-scope="scope">
{{reviewList.find(n => n.id == scope.row.isRead).name}}
</template>
</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="totals" @current-change="handleCurrentChange" :current-page="pageNo">
</el-pagination>
</div>
</el-card>
</div>
</template>
<script>
import echarts from 'echarts'
export default {
name: 'experiment',
data() {
return {
id: this.$store.state.experimentData.id,
projectName: this.$store.state.experimentData.name,
experimentalName: this.$store.state.experimentData.experimentalName,
className: this.$store.state.experimentData.class,
projectId: this.$store.state.experimentData.projectId,
classList: this.$store.state.experimentData.classList,
classId: '',
isRead: '1',
keyword: '',
listDataAll: [],
listData: [],
multipleSelection: [],
pageNo: 1,
pageSize: 10,
totals: 0,
avg: 0,
already: 0,
not: 0,
reviewList: [
{
id: 0,
name: '已批阅'
},{
id: 1,
name: '待批阅'
}
]
};
},
mounted() {
this.classId = this.classList[0].classId
this.getData()
},
methods: {
getData() {
let data = {
id: this.id,
classId: this.classId,
isRead: this.isRead == 1 ? '' : (this.isRead == 2 ? 0 : 1), //''01
searchContent: this.encodeString(this.keyword),
}
this.$get(this.api.getKdAchievement,data).then(res => {
let list = res.data
let score = 0
let already = 0
let not = 0
list.map(n => {
n.class = this.className
score += n.score
if(!n.isRead){
already++
}else{
not++
}
})
this.already = already
this.not = not
this.listDataAll = list
this.handlePage()
this.totals = list.length
this.avg = score ? (score / list.length).toFixed(2) : 0
this.getChart()
}).catch(res => {});
},
handlePage(){
let list = this.listDataAll
this.listData = list.slice((this.pageNo - 1) * this.pageSize,this.pageNo * this.pageSize)
this.totals = list.length
},
tabChange(classId){
this.classId = classId
this.getData()
},
edit(row){
this.$router.push(`/showExperiment?id=${row.reportId}&studentId=${row.userId}&userName=${row.userName}&edit=1`)
},
show(row){
this.$router.push(`/showExperiment?id=${row.reportId}&studentId=${row.userId}&userName=${row.userName}`)
},
exportData(){
if(!this.listData.length) return false
let selected = this.multipleSelection
let exportList = []
if(selected.length){
exportList = selected.map(item => {
return item.reportId
})
}else{
exportList = this.listData.map(item => {
return item.reportId
})
}
window.open(`${this.api.exportAchievement}?reportIds=${exportList.join(',')}&source=3`)
},
handleDelete(row) {
this.$confirm('确定要删除吗?', '提示', {
type: 'warning'
})
.then(() => {
this.$post(`${this.api.deleteReportByIds}?ids=${row.reportId}`).then(res => {
this.$message.success('删除成功');
this.getData()
}).catch(res => {});
})
.catch(() => {});
},
delAllData() {
if(this.multipleSelection.length != ''){
let newArr = this.multipleSelection
let delList = newArr.map(item => {
return `ids=${item.reportId}`
})
this.$confirm('确定要删除吗?', '提示', {
type: 'warning'
})
.then(() => {
this.$post(`${this.api.deleteReportByIds}?${delList.join('&')}`).then(res => {
this.$refs.table.clearSelection()
this.$message.success('删除成功')
this.getData()
}).catch(res => {})
})
.catch(() => {});
}else{
this.$message.error('请先选择数据 !');
}
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleCurrentChange(val) {
this.pageNo = val;
this.handlePage();
},
getChart(){
let data = [0,0,0,0,0,0,0,0,0,0]
let list = this.listDataAll
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',
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: 'bar',
color: ['#8191fd']
}]
})
},
goback() {
this.$router.back()
},
}
};
</script>
<style lang="scss" scoped>
.mag{
margin-right: 20px;
}
/deep/.el-tabs__nav-wrap::after{
display: none;
}
.stat{
display: flex;
.chart{
flex: 1;
height: 300px;
}
}
.cka-Overview {
width: 600px;
margin-right: 20px;
p {
font-size: 20px;
}
.newPractice-card {
display: flex;
align-items: center;
height: 100%;
.newPractice-card-other:nth-child(1) {
background-image: url('../../assets/img/total.png');
}
.newPractice-card-other:nth-child(2) {
background-image: url('../../assets/img/avg.png');
}
.newPractice-card-other {
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;
}
p:last-child {
margin-top: 10px;
color: #ffffff;
font-size: 26px;
}
}
}
}
.tabs{
display: flex;
align-items: center;
padding: 20px 0;
margin: 0;
z-index: 999;
background-color: #fff;
.item{
padding: 12px 20px;
margin-right: 10px;
color:#606266;
line-height: 1;
border-radius: 4px;
background-color: #fff;
border: 1px solid #dcdfe6;
cursor: pointer;
&.active{
color: #fff;
background-color: #9278ff;
border-color: #9278ff;
}
}
}
</style>

@ -11,7 +11,7 @@ import './assets/icon/iconfont.css';
import './components/common/directives';
import 'babel-polyfill';
import './util/rem';
import {post,get,del,put} from './utils/http';
import {post,get,del,delbody,put} from './utils/http';
import api from './utils/api';
import store from './store'
import config from '@/config'
@ -29,6 +29,7 @@ Vue.prototype.api = api;
Vue.prototype.$get = get;
Vue.prototype.$post = post;
Vue.prototype.$del = del;
Vue.prototype.$delbody = delbody;
Vue.prototype.$put = put;
Vue.prototype.$config = config

@ -65,6 +65,11 @@ export default [
component: () => import('../components/page/ExperimentAss.vue'),
meta: { title: '成绩管理' }
},
{
path: '/classExperimentAss',
component: () => import('../components/page/classExperimentAss.vue'),
meta: { title: '成绩管理' }
},
{
path: '/addexperiment',
component: () => import('../components/page/AddExperiment.vue'),

@ -169,4 +169,16 @@ export default {
queryPoint: `${host}/kdSys/queryPoint`,
querySubject: `${host}/kdSys/querySubject`,
queryItem: `${host}/kdSys/queryItem`,
// 班级管理
classList: `${host}/evaluation/class/management/classList`, //班级列表
saveClass: `${host}/evaluation/class/management/saveClass`, //新增班级
editClass: `${host}/evaluation/class/management/editClass`, //编辑班级
deleteClass: `${host}/evaluation/class/management/deleteClass`, //删除班级
queryStudentList: `${host}/evaluation/class/management/queryStudentList`, //学生列表
deleteStudents: `${host}/evaluation/class/management/deleteStudents`, //删除学生
addStudentToClass: `${host}/evaluation/class/management/addStudentToClass`, //新增学生
uploadStudents: `${host}/evaluation/class/management/uploadFile`, //批量导入学生到班级
classAssessmentList: `${host}/evaluation/class/management/classAssessmentList`, //成绩管理列表
}

@ -398,6 +398,89 @@ export function post(url, params) {
});
}
export function delbody(url, params){
getToken()
return new Promise((resolve, reject) =>{
axios.delete(url, {data: params})
.then(res => {
if(res.data.code == 99999){
this.$message.error(
res.data.message
)
}else{
if (res.data.status) {
switch (res.data.status) {
case 200:
resolve(res.data);
break;
// case 300:
// this.$message.error(
// res.data.errmessage
// );
// break;
case 500:
this.$message.error(
res.data.errmessage
);
break;
case 404:
this.$message.error(
res.data.errmessage
);
router.replace({
path: '/404',
});
break;
case 403:
this.$message.error(
res.data.errmessage
);
break;
case 401:
Message.error("token失效,请重新登录");
sessionStorage.removeItem('token');
router.replace('/login')
break;
case 405:
this.$message.error(
res.data.errmessage
);
break;
case 406:
this.$message.error(
res.data.errmessage
);
break;
case 1000201:
this.$message.error(
res.data.errmessage
);
break;
default:
reject(res)
}
}else if(res.data.code == 99999){
Message.error(res.data.message);
}else if(res.data.success){
resolve(res.data);
}else{
if(!res.data.success) {
resolve(res.data);
}
}
}
})
.catch(err => {
reject(err.data)
this.$message({
showClose: true,
message: '请求失败,请刷新页面重新进行请求',
type: 'error'
});
})
});
}
/**
* put修改
* @param {} url

Loading…
Cancel
Save