BUG:教学管理成绩查询功能错误携带之前的班级

This commit is contained in:
fan 2023-01-03 15:38:52 +08:00
parent 845ffc335e
commit fe080d704f
2 changed files with 51 additions and 49 deletions

View File

@ -303,7 +303,9 @@ export default {
methods: {
//
initQueryModel() {
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;

View File

@ -13,10 +13,10 @@
</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',
},
],
actions: [{ text: '导出成绩', handler: this.exportGrade }],
},
prop: 'score'
}
],
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>