考试调整

This commit is contained in:
fan 2021-03-29 15:01:43 +08:00
parent 5090b14819
commit 64a673419b
11 changed files with 255 additions and 206 deletions

View File

@ -309,3 +309,18 @@ export function getCanApplyToList(ruleId) {
method: 'get'
});
}
/** 给班级安排考试 */
export function applyExamToClass(clsId, data) {
return request({
url: `/api/company/orgExam/${clsId}`,
method: 'post',
data
});
}
/** 查询班级下的考试 */
export function getExamListInClass(clsId) {
return request({
url: `api/company/orgExam/${clsId}/list`,
method: 'get'
});
}

View File

@ -93,7 +93,7 @@ export function getExamListProject(params) {
params
});
}
/** 查询本项目下自己创建的考试列表不分页 */
/** 查询本项目下的考试列表不分页 */
export function getExamListProjectUnpage(params) {
return request({
url: `/api/exam/list/loginProject`,
@ -109,3 +109,11 @@ export function getExamListSelfByClassId(params) {
params
});
}
/** 根据地图ID和prdType查询试卷列表 */
export function getExamListByMapIdAndPrdType(mapId, prdType) {
return request({
url: `/api/exam/list/${mapId}`,
method: 'get',
params: { prdType: prdType }
});
}

View File

@ -1,16 +1,16 @@
<template>
<div class="joylink-card">
<div class="examDetailName">
{{ $t('exam.courseName') + ': '+ courseModel.name }}
试卷列表
</div>
<div id="examDetail">
<el-tabs
v-model="activeName"
class="examDetailActive"
>
<el-tab-pane :label="this.$t('exam.itemList')" name="first" class="examDetailPane">
<div v-if="courseModel.treeList.length != 0" style="height:100%;overflow:auto;">
<el-table :data="courseModel.treeList" border style="width: 100%;">
<!--<el-tabs-->
<!--v-model="activeName"-->
<!--class="examDetailActive"-->
<!--&gt;-->
<!--<el-tab-pane :label="this.$t('exam.itemList')" name="first" class="examDetailPane">-->
<div style="height:100%;overflow:auto;">
<el-table :data="tableData" border style="width: 100%;">
<el-table-column label="试卷名称">
<template slot-scope="scope">
<span :style="{color: scope.row.trial||valid ?'green':'black'}">{{ scope.row.name }}</span>
@ -34,49 +34,38 @@
</el-table-column>
</el-table>
</div>
<div v-else class="noList">
{{ $t('global.temporarilyNoData') }}
</div>
</el-tab-pane>
<el-tab-pane :label="this.$t('exam.permissionsDetails')" name="second" class="examDetailPane">
<limit-list ref="limitList" :course-model="courseModel" style="height:100%;overflow:auto;" @initLoadPage="loadInitPage" />
</el-tab-pane>
</el-tabs>
<!--</el-tab-pane>-->
<!--<el-tab-pane :label="this.$t('exam.permissionsDetails')" name="second" class="examDetailPane">-->
<!--<limit-list ref="limitList" :course-model="courseModel" style="height:100%;overflow:auto;" @initLoadPage="loadInitPage" />-->
<!--</el-tab-pane>-->
<!--</el-tabs>-->
</div>
<div class="btn-buy">
<!-- <el-button v-if="!isLocal" :disabled="disabled" type="success" @click="buy">{{ $t('exam.buy') }}</el-button> -->
<el-button v-if="hasPermssion && !isLocal" :disabled="disabled" type="primary" @click="distribute">{{ $t('exam.distributePermission') }}</el-button>
<el-button v-if="!$route.query.noPreLogout" type="primary" :disabled="disabled" @click="backLessonList">{{ $t('exam.returnCourseList') }}</el-button>
<!--<el-button v-if="hasPermssion && !isLocal" :disabled="disabled" type="primary" @click="distribute">{{ $t('exam.distributePermission') }}</el-button>-->
<!--<el-button v-if="!$route.query.noPreLogout" type="primary" :disabled="disabled" @click="backLessonList">{{ $t('exam.returnCourseList') }}</el-button>-->
<el-button v-if="$route.query.noPreLogout" type="primary" :disabled="disabled" @click="quit">退出</el-button>
</div>
</div>
</template>
<script>
import { getCourseLessonDetail } from '@/api/management/exam';
import { PermissionType } from '@/scripts/ConstDic';
import { getExamListByMapIdAndPrdType } from '@/api/management/exam';
// import { PermissionType } from '@/scripts/ConstDic';
import { UrlConfig } from '@/scripts/ConstDic';
import LimitList from '@/views/components/limits/index';
// import LimitList from '@/views/components/limits/index';
import { getSessionStorage } from '@/utils/auth';
import localStore from 'storejs';
import { superAdmin, admin } from '@/router/index';
export default {
name: 'ExamDetailView',
components: {
LimitList
},
// components: {
// LimitList
// },
data() {
return {
disabled: false,
courseModel: {
id: '',
name: this.$t('rules.lessonInput'),
price: 0,
remarks: '',
detail: [],
pmsList: [],
treeList: []
},
tableData: [],
EffectiveTypeList: [],
activeName: 'first',
expandList: [],
@ -87,19 +76,6 @@ export default {
isGzbShow() {
return getSessionStorage('project').startsWith('gzb');
},
hasPermssion() {
let isShow = false;
if (this.courseModel.pmsList && this.courseModel.pmsList.length) {
let count = 0;
this.courseModel.pmsList.forEach(element => {
count += element.remains;
});
if (count > 0) {
isShow = true;
}
}
return this.$store.state.user.companyId || isShow;
},
isLocal() { //
return process.env.VUE_APP_PRO === 'local';
},
@ -120,30 +96,16 @@ export default {
},
methods: {
loadInitPage() {
getCourseLessonDetail({lessonId: this.$route.query.lessonId}).then(resp =>{
if (resp.data) {
this.courseModel = {
id: resp.data.id,
name: resp.data.name,
pmsList: resp.data.permissionList || [],
prdType: resp.data.prdType,
mapId: resp.data.mapId,
PermissionType: PermissionType.EXAM,
treeList: resp.data.examDefinitionList,
systemFault: resp.data.systemFault
};
if (this.hasPermssion || resp.data.available) {
this.valid = true;
getExamListByMapIdAndPrdType(this.$route.query.mapId, this.$route.query.prdType).then(resp =>{
if (resp.data && resp.data.length) {
this.tableData = resp.data;
}
}
this.getExpandList(this.courseModel.id);
}).catch(()=>{
this.$alert('获取考试信息失败!', '提示', {
confirmButtonText: '确定',
type: 'error',
center: true,
callback: action => {
this.backLessonList();
}
});
});
@ -166,36 +128,12 @@ export default {
}
this.disabled = false;
},
backLessonList() {
this.disabled = true;
setTimeout(() => {
localStore.remove('examDetail' + this.$route.params.subSystem);
this.$router.push({ path: `${UrlConfig.trainingPlatform.examHome}/${this.$route.params.subSystem}`});
}, 100);
},
clickEvent(obj) {
const path = `${this.$route.path.match(/(\/.*)\/course/)[1]}${UrlConfig.examDetail}`;
if ((this.valid || obj.trial) && path.includes('device')) {
this.$router.replace({ path: `${path}/${obj.id}`, query: { subSystem: this.$route.params.subSystem, mapId: this.courseModel.mapId, noPreLogout: this.$route.query.noPreLogout }});
} else if (this.valid || obj.trial) {
this.$router.push({ path: `${path}/${obj.id}`, query: { subSystem: this.$route.params.subSystem, mapId: this.courseModel.mapId, noPreLogout: this.$route.query.noPreLogout }});
if (path.includes('device')) {
this.$router.replace({ path: `${path}/${obj.id}`, query: { subSystem: this.$route.params.subSystem, mapId: obj.mapId, prdType: obj.prdType, noPreLogout: this.$route.query.noPreLogout }});
} else {
this.confirmToBuy();
}
},
confirmToBuy() {
this.$confirm(this.$t('tip.accessCourseNo'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel')
}).then(() => {
this.buy();
}).catch(() => { });
},
getExpandList(id) {
let expand = getSessionStorage('trainingExamExpandList' + id);
expand = expand ? (expand + '').split(',') : '';
if (expand instanceof Array) {
this.expandList = expand;
this.$router.push({ path: `${path}/${obj.id}`, query: { subSystem: this.$route.params.subSystem, mapId: obj.mapId, noPreLogout: this.$route.query.noPreLogout }});
}
},
quit() {

View File

@ -216,9 +216,9 @@ export default {
this.disabled = true;
setTimeout(() => {
if (this.$route.query.subSystem) {
this.$router.push({ path: `${UrlConfig.trainingPlatform.course}/${this.$route.query.subSystem}`, query: {lessonId: this.examDetails.lessonId}});
this.$router.push({ path: `${UrlConfig.trainingPlatform.examHome}/${this.$route.query.subSystem}`, query: {lessonId: this.examDetails.lessonId}});
} else {
this.$router.replace({ path: '/device/course', query: {lessonId: this.examDetails.lessonId, noPreLogout: this.$route.query.noPreLogout}});
this.$router.replace({ path: '/device/course', query: {mapId: this.$route.query.mapId, prdType: this.$route.query.prdType, noPreLogout: this.$route.query.noPreLogout}});
}
}, 100);
},

View File

@ -6,21 +6,24 @@
</div>
</el-card>
<el-card v-loading="loading">
<el-table :data="tableData" border style="width: 100%">
<el-table-column prop="name" :label="this.$t('exam.courseName')" />
<el-table :data="tableData" border style="width: 100%" height="calc(100vh - 150px)">
<el-table-column prop="name" label="试卷名称" />
<el-table-column v-if="isGzbShow" prop="classNames" label="所属班级">
<template slot-scope="scope">
<el-tag v-for="(item, index) in scope.row.classNames" :key="index" type="success">{{ item }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="remarks" show-overflow-tooltip :label="this.$t('exam.courseDescription')" />
<el-table-column prop="duration" label="考试时长(分钟)">
<template slot-scope="scope">
<span>{{ Number(scope.row.duration) / 60 }}</span>
</template>
</el-table-column>
<el-table-column prop="fullPoint" label="总分" />
<el-table-column prop="remarks" show-overflow-tooltip label="试卷说明" />
<el-table-column :label="this.$t('global.operate')">
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="goLesson(scope.row)">
{{ $t('exam.enterTheExam') }}
</el-button>
<el-button v-if="project.endsWith('gzb') && isTeacher && userId === scope.row.creatorId" size="mini" type="danger" @click="handleDelete(scope.row)">
删除课程
<el-button size="mini" type="primary" @click="goExamDetail(scope.row)">
考试详情
</el-button>
</template>
</el-table-column>
@ -69,7 +72,7 @@ export default {
if (this.$route.params.subSystem) {
getSubSystemDetail(this.$route.params.subSystem).then(resp =>{
if (resp.data) {
this.tableData = resp.data.lessonList;
this.tableData = resp.data.examList;
} else {
this.tableData = [];
}
@ -85,24 +88,13 @@ export default {
});
}
},
goLesson(row) {
localStore.set('examDetail' + this.$route.params.subSystem, `${UrlConfig.trainingPlatform.course}/${this.$route.params.subSystem}?lessonId=${row.id}`);
this.$router.push({ path: `${UrlConfig.trainingPlatform.course}/${this.$route.params.subSystem}`, query: {lessonId: row.id}});
},
handleDelete(row) {
this.$confirm('此操作将删除课程及所有对应的试卷,且无法恢复,是否继续?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
forceDeleteLesson(row.id).then(response => {
this.$message.success(this.$t('publish.deleteSuccess'));
this.loadInitPage();
}).catch((error) => {
this.loadInitPage();
this.$messageBox(this.$t('error.deleteFailed') + ':' + error.message);
});
}).catch(() => { });
goExamDetail(row) {
const path = `${this.$route.path.match(/(\/.*)\/examHome/)[1]}${UrlConfig.examDetail}`;
if (path.includes('device')) {
this.$router.replace({ path: `${path}/${row.id}`, query: { subSystem: this.$route.params.subSystem, mapId: row.mapId, noPreLogout: this.$route.query.noPreLogout }});
} else {
this.$router.push({ path: `${path}/${row.id}`, query: { subSystem: this.$route.params.subSystem, mapId: row.mapId, noPreLogout: this.$route.query.noPreLogout }});
}
}
}
};

View File

@ -497,26 +497,23 @@ export default {
});
window.open(routeData.href, '_blank');
} else {
getPublishLessonListByMapId({mapId: this.mapId}).then(resp => {
const lesson = resp.data.find(item => {
return (this.$route.query.type === 'LW' && item.prdType === '01') || (this.$route.query.type === 'CW' && item.prdType === '02');
});
if (lesson) {
let prdType = '';
if (this.$route.query.type === 'LW') {
prdType = '01';
} else if (this.$route.query.type === 'CW') {
prdType = '02';
}
if (prdType) {
const routeData = this.$router.resolve({
path:'/device/course',
query:{
lessonId: lesson.id,
prdType: prdType,
mapId:this.mapId,
noPreLogout: true
}
});
window.open(routeData.href, '_blank');
} else {
this.$message.error('暂无考试系统数据!');
}
}).catch(() => {
this.$message.error('获取课程ID失败');
});
}
}
}

View File

@ -0,0 +1,97 @@
<template>
<el-dialog v-dialogDrag title="班级排考试" :visible.sync="dialogShow" width="400px" :before-close="doClose">
<el-form ref="form" :model="classModel" :rules="rules" label-width="120px" size="mini">
<el-form-item label="班级名称:" prop="name">
<el-input v-model="classModel.name" style="width: 220px;" :disabled="true" />
</el-form-item>
<el-form-item label="安排考试:" prop="lessonIds">
<el-select v-model="classModel.examIds" multiple placeholder="请选择">
<el-option
v-for="item in examList"
:key="item.id"
:label="item.name"
:value="item.id+''"
/>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogShow = false">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="create">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getExamListProjectUnpage } from '@/api/management/exam';
import { getExamListInClass, applyExamToClass } from '@/api/company';
export default {
name: 'CreateClass',
data() {
return {
dialogShow: false,
loading: false,
examList: [],
classModel: {
id: '',
name: '',
examIds: []
}
};
},
computed: {
rules() {
const baseRules = {
name: [
{ required: true, message: '请输入班级名称', trigger: 'blur' }
],
examIds: [
{ required: true, message: '请选择安排考试', trigger: 'change' }
]
};
return baseRules;
}
},
methods: {
async doShow(row) {
try {
this.examList = [];
const resp = await getExamListProjectUnpage();
this.examList = resp.data;
const rest = await getExamListInClass(row.id);
this.classModel.id = row.id;
this.classModel.name = row.name;
this.classModel.examIds = rest.data;
this.dialogShow = true;
} catch {
this.$message.error('获取试卷列表或班级数据异常!');
}
},
create() {
this.$refs.form.validate((valid) => {
if (valid) {
applyExamToClass( this.classModel.id, this.classModel.examIds).then(response => {
this.doClose();
this.$message.success('班级安排考试成功!');
}).catch(() => {
this.$message.error('班级安排考试失败!');
});
}
});
},
doClose() {
this.$refs.form.resetFields();
this.dialogShow = false;
}
}
};
</script>
<style>
.option-group {
margin: 10px 100px;
}
</style>

View File

@ -9,6 +9,7 @@
/>
<create-class ref="createClass" @refresh="classRefresh" />
<bind-lessons ref="bindLessons" />
<bind-exams ref="bindExams" />
</div>
</template>
@ -16,11 +17,13 @@
import { getClassListPage, deleteDeptInfo } from '@/api/company';
import CreateClass from './createClass';
import BindLessons from './bindLessons';
import BindExams from './bindExams';
export default {
name: 'ClassManage',
components: {
CreateClass,
BindLessons
BindLessons,
BindExams
},
data() {
return {
@ -70,7 +73,7 @@ export default {
{
type: 'button',
title: this.$t('global.operate'),
width: '450',
width: '510',
buttons: [
{
name: '编辑班级',
@ -95,6 +98,11 @@ export default {
handleClick: this.handleBindLesson,
type: 'primary'
},
{
name: '安排考试',
handleClick: this.handleBindExam,
type: 'primary'
},
{
name: '删除',
handleClick: this.handleDeleteClass,
@ -152,6 +160,9 @@ export default {
},
classCreate() {
this.$refs.createClass.doShow();
},
handleBindExam(index, row) {
this.$refs.bindExams.doShow(row);
}
}
};

View File

@ -15,6 +15,7 @@ import { getLessonProjectListNoPage } from '@/api/jmap/lesson';
import { getClassListUnPage } from '@/api/company';
import { getExamListProject, deleteExam } from '@/api/management/exam';
import localStore from 'storejs';
import { getPublishMapListOnline } from '@/api/jmap/map';
export default {
name: 'ExamManage',
@ -24,6 +25,7 @@ export default {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
mapIdList: [],
examQueryForm: {
leftSpan: 14,
textAlign: 'right',
@ -46,23 +48,6 @@ export default {
type: 'text',
label: '创建人:'
}
// self: {
// type: 'select',
// label: ':',
// config: {
// data: [
// { label: '', value: true },
// { label: '', value: false }
// ]
// }
// }
// clsId: {
// type: 'select',
// label: ':',
// config: {
// data: []
// }
// }
}
},
examQueryList: {
@ -74,15 +59,20 @@ export default {
title: '试卷名称',
prop: 'name'
},
// {
// title: '',
// prop: 'lessonId',
// type: 'tag',
// columnValue: (row) => {
// return this.$convertField(row.lessonId, this.lessonList || [], ['id', 'name']);
// },
// tagType: (row) => { }
// },
{
title: '归属地图',
prop: 'mapId',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.mapId, this.mapIdList, ['id', 'name']); },
tagType: (row) => { return ''; }
},
{
title: '产品类型',
prop: 'prdType',
type: 'tag',
columnValue: (row) => { if (row.prdType === '01') { return '现地工作站'; } else if (row.prdType === '02') { return '行调工作站'; } },
tagType: (row) => { return ''; }
},
{
title: '班级',
prop: 'clsIds',
@ -151,15 +141,13 @@ export default {
}
},
created() {
getLessonProjectListNoPage().then(response => {
this.lessonList = response.data;
this.lessonList.forEach(item => {
this.examQueryForm.queryObject.lessonId.config.data.push({ value: item.id, label: item.name });
});
});
getClassListUnPage().then(response => {
this.classList = response.data;
});
this.mapIdList = [];
getPublishMapListOnline().then(response => {
this.mapIdList = response.data;
});
},
methods: {
handleQueryGrade(index, row) {

View File

@ -15,7 +15,6 @@
import { getPublishMapListOnline } from '@/api/jmap/map';
import { getLessonProjectList, forceDeleteLesson } from '@/api/jmap/lesson';
import EditLessonInfo from './editLessonInfo';
import localStore from 'storejs';
export default {
name: 'LessonManage',
components: {
@ -96,11 +95,6 @@ export default {
return row.creatorId == this.userId;
}
},
{
name: '考试管理',
handleClick: this.handleExamManage,
type: 'primary'
},
{
name: '课程详情',
handleClick: this.handleLessonDetail,
@ -155,10 +149,6 @@ export default {
this.$refs.lessonQueryListPage.refresh(true);
});
},
handleExamManage(index, row) {
localStore.set('/info/organization/examManage', { lessonId: row.id });
this.$router.replace('/info/organization/examManage');
},
handleLessonDetail(index, row) {
this.$router.push(`/info/lessonDetail?lessonId=${row.id}`);
}

View File

@ -14,12 +14,14 @@
<script>
import { getExamList, deleteExam, setExamEfficacy, setExamEffectivey } from '@/api/management/exam';
import { UrlConfig } from '@/scripts/ConstDic';
import { getPublishMapListOnline } from '@/api/jmap/map';
export default {
name: 'List',
data() {
return {
BizTypeList: [],
mapIdList: [],
OrderTypeList: [],
PayTypeList: [],
PayStatusList: [],
@ -39,6 +41,13 @@ export default {
title: this.$t('publish.paperName'),
prop: 'name'
},
{
title: '归属地图',
prop: 'mapId',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.mapId, this.mapIdList, ['id', 'name']); },
tagType: (row) => { return ''; }
},
{
title: '产品类型',
prop: 'prdType',
@ -177,6 +186,10 @@ export default {
this.loadInitData();
},
mounted() {
this.mapIdList = [];
getPublishMapListOnline().then(response => {
this.mapIdList = response.data;
});
},
methods: {
loadInitData() {