代码调整
This commit is contained in:
parent
8850460a0f
commit
fe4b04fb70
@ -1,21 +1,21 @@
|
||||
<template>
|
||||
<div style="width: 100%;">
|
||||
<QueryListPage
|
||||
ref="examQueryListPage"
|
||||
:card-padding="10"
|
||||
:query-form="examQueryForm"
|
||||
:pager-config="pagerConfig"
|
||||
:query-list="examQueryList"
|
||||
/>
|
||||
</div>
|
||||
<div style="width: 100%;">
|
||||
<QueryListPage
|
||||
ref="examQueryListPage"
|
||||
:card-padding="10"
|
||||
:query-form="examQueryForm"
|
||||
:pager-config="pagerConfig"
|
||||
:query-list="examQueryList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import config from '@/scripts/ConstConfig'
|
||||
import { getPapaerListOfOrg, getAllPapaerListOfOrg, lockPaper, invalidPaper, deletePaper } from '@/api/management/exam'
|
||||
import { getPublishMapListOnline } from '@/api/jmap/map'
|
||||
import config from '@/scripts/ConstConfig';
|
||||
import { getPapaerListOfOrg, getAllPapaerListOfOrg, lockPaper, invalidPaper, deletePaper } from '@/api/management/exam';
|
||||
import { getPublishMapListOnline } from '@/api/jmap/map';
|
||||
|
||||
const { paperStateArr, paperStateQueryMap } = config.ConstSelect
|
||||
const { paperStateArr, paperStateQueryMap } = config.ConstSelect;
|
||||
|
||||
export default {
|
||||
name: 'ExamManage',
|
||||
@ -23,7 +23,7 @@ export default {
|
||||
return {
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
mapIdList: [],
|
||||
examQueryForm: {
|
||||
@ -35,7 +35,7 @@ export default {
|
||||
queryObject: {
|
||||
name: {
|
||||
type: 'text',
|
||||
label: '试卷名称:',
|
||||
label: '试卷名称:'
|
||||
},
|
||||
findState: {
|
||||
type: 'select',
|
||||
@ -44,12 +44,12 @@ export default {
|
||||
config: {
|
||||
data: Object.entries(paperStateQueryMap).map(([i, v]) => ({
|
||||
value: Number(i),
|
||||
label: v,
|
||||
})),
|
||||
label: v
|
||||
}))
|
||||
},
|
||||
noClearable: true,
|
||||
},
|
||||
},
|
||||
noClearable: true
|
||||
}
|
||||
}
|
||||
},
|
||||
examQueryList: {
|
||||
query: obj => this.getListApi(obj),
|
||||
@ -58,11 +58,11 @@ export default {
|
||||
columns: [
|
||||
{
|
||||
title: '试卷名称',
|
||||
prop: 'name',
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: '简介',
|
||||
prop: 'profile',
|
||||
prop: 'profile'
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
@ -70,27 +70,27 @@ export default {
|
||||
type: 'tag',
|
||||
width: '80',
|
||||
columnValue: row => {
|
||||
return paperStateArr[row.state - 1]
|
||||
return paperStateArr[row.state - 1];
|
||||
},
|
||||
tagType: row => '',
|
||||
tagType: row => ''
|
||||
},
|
||||
{
|
||||
title: '开始时间',
|
||||
prop: 'startTime',
|
||||
prop: 'startTime'
|
||||
},
|
||||
{
|
||||
title: '截止时间',
|
||||
prop: 'endTime',
|
||||
prop: 'endTime'
|
||||
},
|
||||
{
|
||||
title: '满分',
|
||||
prop: 'fullScore',
|
||||
width: '80',
|
||||
width: '80'
|
||||
},
|
||||
{
|
||||
title: '及格分',
|
||||
prop: 'passScore',
|
||||
width: '80',
|
||||
width: '80'
|
||||
},
|
||||
{
|
||||
title: '时长',
|
||||
@ -98,171 +98,172 @@ export default {
|
||||
type: 'tag',
|
||||
width: '80',
|
||||
columnValue: row => row.validDuration,
|
||||
tagType: row => {},
|
||||
tagType: row => {}
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
prop: 'creatorName',
|
||||
width: '150',
|
||||
formatter: row => row.creatorInfo.name,
|
||||
formatter: row => row.creatorInfo.name
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
hide: () => this.hasTeachingDataManage(),
|
||||
width: '350',
|
||||
buttons: [
|
||||
{
|
||||
name: '成绩查询',
|
||||
handleClick: this.handleQueryGrade,
|
||||
type: 'primary',
|
||||
type: 'primary'
|
||||
},
|
||||
{
|
||||
name: '成绩统计',
|
||||
handleClick: this.handleGradeStatistics,
|
||||
type: 'success',
|
||||
type: 'success'
|
||||
},
|
||||
{
|
||||
name: '编辑',
|
||||
handleClick: this.handleEdit,
|
||||
type: 'primary',
|
||||
showControl: row => {
|
||||
return row.creatorId == this.userId && row.state === 1
|
||||
},
|
||||
return row.creatorId == this.userId && row.state === 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '封存',
|
||||
handleClick: this.handleLock,
|
||||
type: 'warning',
|
||||
showControl: row => {
|
||||
return row.creatorId == this.userId && row.state === 1
|
||||
},
|
||||
return row.creatorId == this.userId && row.state === 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '失效',
|
||||
handleClick: this.handleInvalid,
|
||||
type: 'danger',
|
||||
showControl: row => {
|
||||
return row.creatorId == this.userId && row.state === 2
|
||||
},
|
||||
return row.creatorId == this.userId && row.state === 2;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '删除',
|
||||
handleClick: this.handleDelete,
|
||||
type: 'danger',
|
||||
showControl: row => {
|
||||
return row.creatorId == this.userId && row.state === 1
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
return row.creatorId == this.userId && row.state === 1;
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
actions: [{ text: '新建试卷', handler: this.examCreate }],
|
||||
},
|
||||
}
|
||||
actions: [{ text: '新建试卷', handler: this.examCreate }]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
userId() {
|
||||
return this.$store.state.user.id
|
||||
return this.$store.state.user.id;
|
||||
},
|
||||
orgId() {
|
||||
return this.$store.state.user.companyId
|
||||
},
|
||||
return this.$store.state.user.companyId;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.mapIdList = []
|
||||
this.mapIdList = [];
|
||||
getPublishMapListOnline().then(response => {
|
||||
this.mapIdList = response.data
|
||||
})
|
||||
this.mapIdList = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
hasTeachingDataManage() {
|
||||
return this.$route.path.includes('/teachingDataManage/')
|
||||
return this.$route.path.includes('/teachingDataManage/');
|
||||
},
|
||||
getListApi(obj) {
|
||||
if (this.hasTeachingDataManage()) {
|
||||
return getAllPapaerListOfOrg({ ...obj })
|
||||
return getAllPapaerListOfOrg({ ...obj });
|
||||
} else {
|
||||
return getPapaerListOfOrg({ ...obj, orgId: this.orgId })
|
||||
return getPapaerListOfOrg({ ...obj, orgId: this.orgId });
|
||||
}
|
||||
},
|
||||
handleQueryGrade(index, row) {
|
||||
this.$router.push({ path: '/info/gradeList', query: { examId: row.id, name: row.name } })
|
||||
this.$router.push({ path: '/info/gradeList', query: { examId: row.id, name: row.name } });
|
||||
},
|
||||
handleGradeStatistics(index, row) {
|
||||
this.$router.push({ path: '/info/gradeStatistics', query: { examId: row.id, name: row.name } })
|
||||
this.$router.push({ path: '/info/gradeStatistics', query: { examId: row.id, name: row.name } });
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
this.$router.push({ path: `/info/examRule/draft/edit/${row.id}`, query: { source: 'org' } })
|
||||
this.$router.push({ path: `/info/examRule/draft/edit/${row.id}`, query: { source: 'org' } });
|
||||
},
|
||||
examCreate() {
|
||||
this.$router.push({ path: `/info/examRule/draft/add/0`, query: { source: 'org' } })
|
||||
this.$router.push({ path: `/info/examRule/draft/add/0`, query: { source: 'org' } });
|
||||
},
|
||||
handleLock(index, data) {
|
||||
this.$confirm('确定封存试卷吗? 该操作不能撤销!', this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
lockPaper(data.id)
|
||||
.then(res => {
|
||||
this.examRefresh()
|
||||
this.$message.success('封存试卷成功!')
|
||||
this.examRefresh();
|
||||
this.$message.success('封存试卷成功!');
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message.error('封存试卷失败' + error.message)
|
||||
})
|
||||
this.$message.error('封存试卷失败' + error.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {})
|
||||
.catch(() => {});
|
||||
},
|
||||
handleInvalid(index, data) {
|
||||
this.$confirm('该操作将使试卷失效,是否继续?', this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
invalidPaper(data.id)
|
||||
.then(res => {
|
||||
this.examRefresh()
|
||||
this.examRefresh();
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '操作成功!',
|
||||
})
|
||||
message: '操作成功!'
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message.error('操作失败:' + error.message)
|
||||
})
|
||||
this.$message.error('操作失败:' + error.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {})
|
||||
.catch(() => {});
|
||||
},
|
||||
handleDelete(index, data) {
|
||||
this.$confirm('确定删除该试卷吗?', this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => deletePaper(data.id))
|
||||
.then(resp => {
|
||||
this.examRefresh()
|
||||
this.examRefresh();
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!',
|
||||
})
|
||||
message: '删除成功!'
|
||||
});
|
||||
})
|
||||
.catch(res => {
|
||||
if (res.code && res.code !== 200) {
|
||||
this.$message({ type: 'error', message: res.message })
|
||||
this.$message({ type: 'error', message: res.message });
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
examRefresh() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.examQueryListPage.refresh(true)
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
this.$refs.examQueryListPage.refresh(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
@ -4,7 +4,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {queryMapListByUser, getPublishMapDetailById} from '@/api/jmap/map';
|
||||
import {queryMapListByUser, getPublishMapDetailById, getPublishMapListOnline} from '@/api/jmap/map';
|
||||
import Cookies from 'js-cookie';
|
||||
import { createSimulation } from '@/api/simulation';
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
@ -106,13 +106,17 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
queryMapListByUser().then(res=>{
|
||||
let api = queryMapListByUser;
|
||||
if (this.hasTeachingDataManage()) {
|
||||
api = getPublishMapListOnline;
|
||||
}
|
||||
api().then(res=>{
|
||||
this.mapList = [];
|
||||
res.data.forEach(element => {
|
||||
this.mapList.push({label:element.name, value:element.id});
|
||||
});
|
||||
this.queryForm.queryObject.mapId.config.data = [...this.mapList];
|
||||
this.queryForm.queryObject.mapId.config.default = this.mapList[0].value;
|
||||
this.queryForm.queryObject.mapId.config.default = this.mapList[0] ? this.mapList[0].value : '';
|
||||
this.showList = true;
|
||||
});
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user