BUG:教学管理成绩查询功能错误携带之前的班级
This commit is contained in:
parent
845ffc335e
commit
fe080d704f
@ -303,7 +303,9 @@ export default {
|
||||
methods: {
|
||||
// 获取默认查询参数
|
||||
initQueryModel() {
|
||||
this.formModel = localStore.get(this.$route.path) || this.formModel;
|
||||
if (!this.queryForm.notRecord) {
|
||||
this.formModel = localStore.get(this.$route.path) || this.formModel;
|
||||
}
|
||||
this.buildForm();
|
||||
if (typeof this.queryForm.initLoadCallback === 'function') {
|
||||
this.queryForm.initLoadCallback(this.formModel);
|
||||
@ -350,7 +352,6 @@ export default {
|
||||
// 构建查询表单对象、显示的查询对象
|
||||
const queryObject = {};
|
||||
const model = {};
|
||||
// debugger;
|
||||
for (const item in this.queryForm.queryObject) {
|
||||
if (this.queryForm.queryObject.show === false) {
|
||||
continue;
|
||||
|
@ -1,22 +1,22 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="title_content">{{ $route.query.name + '成绩查询' }}</div>
|
||||
<el-button type="text" style="position: fixed;right: 20px;top: 70px;" @click="back">返回</el-button>
|
||||
<QueryListPage
|
||||
ref="queryListPage"
|
||||
:query-form="queryForm"
|
||||
:pager-config="pagerConfig"
|
||||
:query-list="queryList"
|
||||
style="width:90%;margin: 0 auto;"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<div class="title_content">{{ $route.query.name + '成绩查询' }}</div>
|
||||
<el-button type="text" style="position: fixed;right: 20px;top: 70px;" @click="back">返回</el-button>
|
||||
<QueryListPage
|
||||
ref="queryListPage"
|
||||
:query-form="queryForm"
|
||||
:pager-config="pagerConfig"
|
||||
:query-list="queryList"
|
||||
style="width:90%;margin: 0 auto;"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getClassGradeList } from '@/api/management/userexam'
|
||||
import { getClassListUnPage } from '@/api/company'
|
||||
import XLSX from 'xlsx'
|
||||
import localStore from 'storejs'
|
||||
import { getClassGradeList } from '@/api/management/userexam';
|
||||
import { getClassListUnPage } from '@/api/company';
|
||||
import XLSX from 'xlsx';
|
||||
import localStore from 'storejs';
|
||||
export default {
|
||||
name: 'GradeList',
|
||||
data() {
|
||||
@ -26,20 +26,21 @@ export default {
|
||||
labelWidth: '90px',
|
||||
textAlign: 'right',
|
||||
reset: false,
|
||||
notRecord: true,
|
||||
queryObject: {
|
||||
orgId: {
|
||||
type: 'select',
|
||||
noClearable: true,
|
||||
label: '班级:',
|
||||
config: {
|
||||
data: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
data: []
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryList: {
|
||||
query: this.queryFunction,
|
||||
@ -49,60 +50,60 @@ export default {
|
||||
columns: [
|
||||
{
|
||||
title: '姓名',
|
||||
prop: 'nickname',
|
||||
prop: 'nickname'
|
||||
},
|
||||
{
|
||||
title: '学号',
|
||||
prop: 'account',
|
||||
prop: 'account'
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
prop: 'result',
|
||||
type: 'tag',
|
||||
columnValue: row => ['未知', '通过', '不通过', '未参加', '未提交'][row.result],
|
||||
tagType: row => ['', 'success', 'danger', 'info', 'warning'][row.result],
|
||||
tagType: row => ['', 'success', 'danger', 'info', 'warning'][row.result]
|
||||
},
|
||||
{
|
||||
title: '得分',
|
||||
prop: 'score',
|
||||
},
|
||||
prop: 'score'
|
||||
}
|
||||
],
|
||||
actions: [{ text: '导出成绩', handler: this.exportGrade }],
|
||||
},
|
||||
}
|
||||
actions: [{ text: '导出成绩', handler: this.exportGrade }]
|
||||
}
|
||||
};
|
||||
},
|
||||
async created() {
|
||||
const resp = await getClassListUnPage()
|
||||
const classList = []
|
||||
const resp = await getClassListUnPage();
|
||||
const classList = [];
|
||||
resp.data &&
|
||||
resp.data.forEach(item => {
|
||||
classList.push({ value: item.id, label: item.name })
|
||||
localStore.set(this.$route.path, { orgId: classList[0].value + '' })
|
||||
})
|
||||
this.queryForm.queryObject.orgId.config.data = classList
|
||||
classList.push({ value: item.id, label: item.name });
|
||||
localStore.set(this.$route.path, { orgId: classList[0].value + '' });
|
||||
});
|
||||
this.queryForm.queryObject.orgId.config.data = classList;
|
||||
},
|
||||
methods: {
|
||||
exportGrade() {
|
||||
// ;
|
||||
const wb = XLSX.utils.book_new()
|
||||
const data = [{ A: '学号', B: '姓名', C: '得分' }]
|
||||
const wb = XLSX.utils.book_new();
|
||||
const data = [{ A: '学号', B: '姓名', C: '得分' }];
|
||||
this.queryList.data &&
|
||||
this.queryList.data.forEach(item => {
|
||||
data.push({ A: item.account, B: item.username, C: item.score })
|
||||
})
|
||||
const ws = XLSX.utils.json_to_sheet(data, { skipHeader: true })
|
||||
ws['!cols'] = [{ width: 20 }, { width: 20 }, { width: 20 }]
|
||||
XLSX.utils.book_append_sheet(wb, ws, 'file')
|
||||
XLSX.writeFile(wb, `${this.$route.query.name}成绩.xlsx`)
|
||||
data.push({ A: item.account, B: item.username, C: item.score });
|
||||
});
|
||||
const ws = XLSX.utils.json_to_sheet(data, { skipHeader: true });
|
||||
ws['!cols'] = [{ width: 20 }, { width: 20 }, { width: 20 }];
|
||||
XLSX.utils.book_append_sheet(wb, ws, 'file');
|
||||
XLSX.writeFile(wb, `${this.$route.query.name}成绩.xlsx`);
|
||||
},
|
||||
queryFunction(params) {
|
||||
return getClassGradeList({ pcId: this.$route.query.examId, ...params })
|
||||
return getClassGradeList({ pcId: this.$route.query.examId, ...params });
|
||||
},
|
||||
back() {
|
||||
this.$router.go(-1)
|
||||
},
|
||||
},
|
||||
}
|
||||
this.$router.go(-1);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
Loading…
Reference in New Issue
Block a user