代码调整

This commit is contained in:
dong 2022-11-23 18:08:17 +08:00
parent 7a66fd7416
commit d1bfbe0aad
6 changed files with 312 additions and 291 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<query-list-page ref="user" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" /> <query-list-page ref="user" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<dialog-detail ref="detail" /> <dialog-detail ref="detail" />
<preview-answer ref="previewAnswer" :question-id="questionId" /> <preview-answer ref="previewAnswer" :question-id="questionId" />
</div> </div>

View File

@ -2,10 +2,10 @@
<div style="width: 100%;height: 100%;"> <div style="width: 100%;height: 100%;">
<QueryListPage <QueryListPage
ref="classQueryListPage" ref="classQueryListPage"
:card-padding="10"
:query-form="classQueryForm" :query-form="classQueryForm"
:pager-config="pagerConfig" :pager-config="pagerConfig"
:query-list="classQueryList" :query-list="classQueryList"
style="width:96%;margin: 0 auto;"
/> />
<create-class ref="createClass" @refresh="classRefresh" /> <create-class ref="createClass" @refresh="classRefresh" />
</div> </div>

View File

@ -1,253 +1,253 @@
<template> <template>
<div style="width: 100%;height: 100%;"> <div style="width: 100%;">
<QueryListPage <QueryListPage
ref="examQueryListPage" ref="examQueryListPage"
:query-form="examQueryForm" :card-padding="10"
:pager-config="pagerConfig" :query-form="examQueryForm"
:query-list="examQueryList" :pager-config="pagerConfig"
style="width:96%;margin: 0 auto;" :query-list="examQueryList"
/> />
</div> </div>
</template> </template>
<script> <script>
import config from '@/scripts/ConstConfig' import config from '@/scripts/ConstConfig';
import { getPapaerListOfOrg, lockPaper, unlockPaper, deletePaper } from '@/api/management/exam' import { getPapaerListOfOrg, lockPaper, unlockPaper, deletePaper } from '@/api/management/exam';
import { getPublishMapListOnline } from '@/api/jmap/map' import { getPublishMapListOnline } from '@/api/jmap/map';
const { paperStateArr, paperStateQueryArr } = config.ConstSelect const { paperStateArr, paperStateQueryArr } = config.ConstSelect;
export default { export default {
name: 'ExamManage', name: 'ExamManage',
data() { data() {
return { return {
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum', pageIndex: 'pageNum'
}, },
mapIdList: [], mapIdList: [],
examQueryForm: { examQueryForm: {
leftSpan: 14, leftSpan: 14,
textAlign: 'right', textAlign: 'right',
labelWidth: '90px', labelWidth: '90px',
reset: true, reset: true,
columnNum: 3, columnNum: 3,
queryObject: { queryObject: {
name: { name: {
type: 'text', type: 'text',
label: '试卷名称:', label: '试卷名称:'
}, },
findState: { findState: {
type: 'select', type: 'select',
label: '状态:', label: '状态:',
value: 1, value: 1,
config: { config: {
data: paperStateQueryArr.map((v, i) => ({ value: i + 1, label: v })), data: paperStateQueryArr.map((v, i) => ({ value: i + 1, label: v }))
}, },
noClearable: true, noClearable: true
}, }
}, }
}, },
examQueryList: { examQueryList: {
query: obj => getPapaerListOfOrg({ ...obj, orgId: this.orgId }), query: obj => getPapaerListOfOrg({ ...obj, orgId: this.orgId }),
selectCheckShow: false, selectCheckShow: false,
indexShow: false, indexShow: false,
columns: [ columns: [
{ {
title: '试卷名称', title: '试卷名称',
prop: 'name', prop: 'name'
}, },
{ {
title: '简介', title: '简介',
prop: 'profile', prop: 'profile'
}, },
{ {
title: '状态', title: '状态',
prop: 'state', prop: 'state',
type: 'tag', type: 'tag',
width: '80', width: '80',
columnValue: row => { columnValue: row => {
return paperStateArr[row.state - 1] return paperStateArr[row.state - 1];
}, },
tagType: row => '', tagType: row => ''
}, },
{ {
title: '开始时间', title: '开始时间',
prop: 'startTime', prop: 'startTime'
}, },
{ {
title: '截止时间', title: '截止时间',
prop: 'endTime', prop: 'endTime'
}, },
{ {
title: '满分', title: '满分',
prop: 'fullScore', prop: 'fullScore',
width: '80', width: '80'
}, },
{ {
title: '及格分', title: '及格分',
prop: 'passScore', prop: 'passScore',
width: '80', width: '80'
}, },
{ {
title: '时长', title: '时长',
prop: 'validDuration', prop: 'validDuration',
type: 'tag', type: 'tag',
width: '80', width: '80',
columnValue: row => row.validDuration, columnValue: row => row.validDuration,
tagType: row => {}, tagType: row => {}
}, },
{ {
title: '创建人', title: '创建人',
prop: 'creatorName', prop: 'creatorName',
width: '150', width: '150',
formatter: row => row.creatorInfo.name, formatter: row => row.creatorInfo.name
}, },
{ {
type: 'button', type: 'button',
title: this.$t('global.operate'), title: this.$t('global.operate'),
width: '350', width: '350',
buttons: [ buttons: [
{ {
name: '成绩查询', name: '成绩查询',
handleClick: this.handleQueryGrade, handleClick: this.handleQueryGrade,
type: 'primary', type: 'primary'
}, },
{ {
name: '成绩统计', name: '成绩统计',
handleClick: this.handleGradeStatistics, handleClick: this.handleGradeStatistics,
type: 'success', type: 'success'
}, },
{ {
name: '编辑', name: '编辑',
handleClick: this.handleEdit, handleClick: this.handleEdit,
type: 'primary', type: 'primary',
showControl: row => { showControl: row => {
return row.creatorId == this.userId && row.state === 1 return row.creatorId == this.userId && row.state === 1;
}, }
}, },
{ {
name: '封存', name: '封存',
handleClick: this.handleLock, handleClick: this.handleLock,
type: 'warning', type: 'warning',
showControl: row => { showControl: row => {
return row.creatorId == this.userId && row.state === 1 return row.creatorId == this.userId && row.state === 1;
}, }
}, },
{ {
name: '解封', name: '解封',
handleClick: this.handleUnlock, handleClick: this.handleUnlock,
type: 'danger', type: 'danger',
showControl: row => { showControl: row => {
return row.creatorId == this.userId && row.state === 2 return row.creatorId == this.userId && row.state === 2;
}, }
}, },
{ {
name: '删除', name: '删除',
handleClick: this.handleDelete, handleClick: this.handleDelete,
type: 'danger', type: 'danger',
showControl: row => { 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: { computed: {
userId() { userId() {
return this.$store.state.user.id return this.$store.state.user.id;
}, },
orgId() { orgId() {
return this.$store.state.user.companyId return this.$store.state.user.companyId;
}, }
}, },
created() { created() {
this.mapIdList = [] this.mapIdList = [];
getPublishMapListOnline().then(response => { getPublishMapListOnline().then(response => {
this.mapIdList = response.data this.mapIdList = response.data;
}) });
}, },
methods: { methods: {
handleQueryGrade(index, row) { 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) { 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) { 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() { 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) { handleLock(index, data) {
lockPaper(data.id) lockPaper(data.id)
.then(res => { .then(res => {
this.examRefresh() this.examRefresh();
this.$message.success('封存试卷成功!') this.$message.success('封存试卷成功!');
}) })
.catch(error => { .catch(error => {
this.$message.error('封存试卷失败:' + error.message) this.$message.error('封存试卷失败:' + error.message);
}) });
}, },
handleUnlock(index, data) { handleUnlock(index, data) {
this.$confirm('该操作将解封试卷,是否继续?', this.$t('global.tips'), { this.$confirm('该操作将解封试卷,是否继续?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'), confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'), cancelButtonText: this.$t('global.cancel'),
type: 'warning', type: 'warning'
}) })
.then(() => { .then(() => {
unlockPaper(data.id) unlockPaper(data.id)
.then(res => { .then(res => {
this.examRefresh() this.examRefresh();
this.$message({ this.$message({
type: 'success', type: 'success',
message: '解封试卷成功!', message: '解封试卷成功!'
}) });
}) })
.catch(res => { .catch(res => {
if (res.code == '10004') { if (res.code == '10004') {
this.$message({ type: 'error', message: '解封失败:试卷已被使用,无法解封!' }) this.$message({ type: 'error', message: '解封失败:试卷已被使用,无法解封!' });
} else if (res.code == '10003') { } else if (res.code == '10003') {
this.$message({ type: 'warning', message: '解封失败:无权限解封!' }) this.$message({ type: 'warning', message: '解封失败:无权限解封!' });
} else { } else {
this.$message({ type: 'error', message: '解封试卷失败!' }) this.$message({ type: 'error', message: '解封试卷失败!' });
} }
}) });
}) })
.catch(() => {}) .catch(() => {});
}, },
handleDelete(index, data) { handleDelete(index, data) {
this.$confirm('确定删除该试卷吗?', this.$t('global.tips'), { this.$confirm('确定删除该试卷吗?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'), confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'), cancelButtonText: this.$t('global.cancel'),
type: 'warning', type: 'warning'
}) })
.then(() => deletePaper(data.id)) .then(() => deletePaper(data.id))
.then(resp => { .then(resp => {
this.examRefresh() this.examRefresh();
this.$message({ this.$message({
type: 'success', type: 'success',
message: '删除成功!', message: '删除成功!'
}) });
}) })
.catch(res => { .catch(res => {
if (res.code && res.code !== 200) { if (res.code && res.code !== 200) {
this.$message({ type: 'error', message: res.message }) this.$message({ type: 'error', message: res.message });
} }
}) });
}, },
examRefresh() { examRefresh() {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.examQueryListPage.refresh(true) this.$refs.examQueryListPage.refresh(true);
}) });
}, }
}, }
} };
</script> </script>
<style scoped></style> <style scoped></style>

View File

@ -1,28 +1,25 @@
<template> <template>
<div> <div class="mianBox">
<div class="title_content">{{ companyName + '教学管理' }}</div> <div class="lessonManageInfo" :style="{width: widthLeft+'px'}">
<div class="lessonManageInfo"> <el-menu
<el-menu class="lessonManageMenu" default-active="2-1"> :default-active="defaultIndex"
<el-menu-item index="1" @click="clickMenu"> class="el-menu-vertical-demo lessonManageMenu"
<img :src="classIcon" class="teachMenu"> background-color="#545c64"
<span class="teachMenuTitle" :style="{color: $route.path.includes('classManage')?'#5BDBFF': '#000'}">班级管理</span> text-color="#fff"
</el-menu-item> router
<el-menu-item index="7" @click="clickMenu"> active-text-color="#ffd04b"
<img :src="ruleIcon" class="teachMenu"> >
<span class="teachMenuTitle" :style="{color: $route.path.includes('trainingManage')?'#5BDBFF': '#000'}">实训管理</span> <template>
</el-menu-item> <el-menu-item v-for="(item, i) in menuList" :key="i" :index="item.path">
<el-menu-item index="8" @click="clickMenu"> <img :src="item.imgUrl" class="teachMenu">
<img :src="lessonIcon" class="teachMenu"> <span>{{ item.name }}</span>
<span class="teachMenuTitle" :style="{color: $route.path.includes('theoryManage')?'#5BDBFF': '#000'}">理论题目管理</span> </el-menu-item>
</el-menu-item> </template>
<el-menu-item index="3" @click="clickMenu">
<img :src="examIcon" class="teachMenu">
<span slot="title" class="teachMenuTitle" :style="{color: $route.path.includes('examManage')?'#5BDBFF': '#000'}">考试管理</span>
</el-menu-item>
</el-menu> </el-menu>
<div class="lessonManageOther"> <drap-left :width-left="widthLeft" @drapWidth="drapWidth" />
<router-view /> </div>
</div> <div class="lessonManageOther" :style="{width: rightWidth, height: rightHeight}">
<router-view />
</div> </div>
</div> </div>
</template> </template>
@ -32,9 +29,13 @@ import ClassIcon from '@/assets/teachManage/class.png';
import LessonIcon from '@/assets/teachManage/lesson.png'; import LessonIcon from '@/assets/teachManage/lesson.png';
import ExamIcon from '@/assets/teachManage/exam.png'; import ExamIcon from '@/assets/teachManage/exam.png';
import RuleIcon from '@/assets/teachManage/rule.png'; import RuleIcon from '@/assets/teachManage/rule.png';
import drapLeft from '@/views/components/drapLeft/index';
export default { export default {
name: 'Organization', name: 'Organization',
components: {
drapLeft
},
data() { data() {
return { return {
classIcon: ClassIcon, classIcon: ClassIcon,
@ -44,41 +45,62 @@ export default {
mapIdList: [], mapIdList: [],
lessonList: [], lessonList: [],
classList: [] classList: [],
widthLeft: 200,
defaultIndex: '/teaching/organization/classManage',
menuList: [
{name: '班级管理', path: '/teaching/organization/classManage', imgUrl: ClassIcon},
{name: '实训管理', path: '/teaching/organization/trainingManage', imgUrl: RuleIcon},
{name: '理论题目管理', path: '/teaching/organization/theoryManage', imgUrl: LessonIcon},
{name: '考试管理', path: '/teaching/organization/examManage', imgUrl: ExamIcon}
]
}; };
}, },
computed: { computed: {
companyName() { companyName() {
return this.$store.state.user.companyName; return this.$store.state.user.companyName;
},
rightWidth() {
return `calc(100% - ${this.widthLeft}px)`;
},
rightHeight() {
return (this.height - 110) + 'px';
},
height() {
return this.$store.state.app.height;
} }
}, },
watch: {
'$route'(val) {
this.defaultIndex = val.path;
}
},
mounted() {
this.defaultIndex = this.$route.path;
},
methods:{ methods:{
clickMenu(val) { drapWidth(width) {
if (val.index === '1') { this.widthLeft = Number(width);
this.$router.replace('/teaching/organization/classManage');
} else if (val.index === '3') {
this.$router.replace('/teaching/organization/examManage');
} else if (val.index === '4') {
this.$router.replace('/teaching/organization/ruleManage');
} else if (val.index === '7') {
this.$router.replace('/teaching/organization/trainingManage'); //
} else if (val.index === '8') {
this.$router.replace('/teaching/organization/theoryManage');
}
} }
} }
}; };
</script> </script>
<style scoped> <style scoped>
.back_box {height: 20px;z-index: 36;width: 40px;text-align: center;position: absolute;right: 20px;top: -20px;}
.title_content {width: 100%;margin: 20px 0 30px;text-align: center;font-size: 28px;font-weight: bold;}
.teachMenu{width: 18px;height: 18px;margin-right: 8px;} .teachMenu{width: 18px;height: 18px;margin-right: 8px;}
.lessonIcon{font-size: 16px;} .lessonIcon{font-size: 16px;}
.teachMenuTitle{font-size: 18px;} .lessonManageOther{
.lessonManageBack{position: fixed;right: 20px;top: 70px;} border: 1px solid #DCDFE6;
.lessonManageOther{width: calc(100% - 200px);margin-left: 200px;} margin: 10px;
.lessonManageInfo{width: 96%;margin: 0 auto;overflow: hidden;} padding: 10px;
.lessonManageMenu{width: 200px;float: left;} overflow: auto;
}
.lessonManageMenu{
height: 100%;
}
.mianBox {
width: 100%;
height: 100%;
display: flex;
}
</style> </style>

View File

@ -2,10 +2,10 @@
<div style="width: 100%;height: 100%"> <div style="width: 100%;height: 100%">
<QueryListPage <QueryListPage
ref="ruleQueryListPage" ref="ruleQueryListPage"
:card-padding="10"
:query-form="ruleQueryForm" :query-form="ruleQueryForm"
:pager-config="pagerConfig" :pager-config="pagerConfig"
:query-list="ruleQueryList" :query-list="ruleQueryList"
style="width:96%;margin: 0 auto;"
/> />
<apply-class ref="applyClass" @refresh="refresh" /> <apply-class ref="applyClass" @refresh="refresh" />
</div> </div>

View File

@ -55,7 +55,6 @@ export default {
selectCheckShow: false, selectCheckShow: false,
paginationHiden: true, paginationHiden: true,
indexShow: true, indexShow: true,
height: 500,
columns: [ columns: [
{ {
title: this.$t('trainingManage.name'), title: this.$t('trainingManage.name'),