rt-sim-training-client/src/views/organization/index.vue

559 lines
22 KiB
Vue
Raw Normal View History

2020-12-31 09:32:25 +08:00
<template>
2021-03-11 18:09:26 +08:00
<div style="position: relative;">
2021-01-05 13:56:51 +08:00
<div class="back_box">
<el-button type="text" @click="goBack">返回</el-button>
</div>
2021-03-11 18:09:26 +08:00
<div style="width: 100%;margin: 20px 0 50px;text-align: center;font-size: 28px;font-weight: bold;">{{ $store.state.user.companyName + '教学管理' }}</div>
<div style="width: 80%;margin: 0 auto;overflow: hidden;">
<el-menu
default-active="1"
style="width: 200px;float: left;"
active-text-color="#00BFFF"
@open="handleOpen"
@close="handleClose"
>
<el-menu-item index="1" @click="clickMenu">
<img :src="classIcon" style="width: 20px;height: 20px;margin-right: 10px;">
<span style="font-size: 20px;">班级管理</span>
</el-menu-item>
<el-submenu index="2">
<template slot="title">
<img :src="lessonIcon" style="width: 20px;height: 20px;margin-right: 10px;">
<span style="font-size: 20px;">课程管理</span>
</template>
<el-menu-item-group>
<el-menu-item index="2-1" style="font-size: 18px;" @click="clickMenu">发布课程管理</el-menu-item>
<el-menu-item index="2-2" style="font-size: 18px;" @click="clickMenu">草稿课程管理</el-menu-item>
</el-menu-item-group>
</el-submenu>
<el-menu-item index="3" @click="clickMenu">
<img :src="examIcon" style="width: 20px;height: 20px;margin-right: 10px;">
<span slot="title" style="font-size: 20px;">考试管理</span>
</el-menu-item>
<el-menu-item index="4" @click="clickMenu">
<img :src="ruleIcon" style="width: 20px;height: 20px;margin-right: 10px;">
<span slot="title" style="font-size: 20px;">评价管理</span>
</el-menu-item>
</el-menu>
<div style="width: calc(100% - 200px);margin-left: 200px;">
<div v-if="defaultActive === '1'">
<div style="display: flex; justify-content: space-between;width: 80%;margin: 0 auto;">
<el-form :inline="true" :model="classFormModel" size="small">
<el-form-item label="班级名称:">
<el-input v-model="classFormModel.className" placeholder="班级名称" />
</el-form-item>
<el-form-item>
<el-button @click="classQuery">班级查询</el-button>
</el-form-item>
</el-form>
<el-button type="primary" size="small" style="width: 80px;height: 32px;" @click="classCreate">新建班级</el-button>
</div>
<el-table :data="classData" border style="width: 80%;margin: 0 auto;">
<el-table-column prop="name" label="班级" />
<el-table-column prop="num" label="人数" />
<el-table-column prop="createDate" label="创建日期" />
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" size="small">导入学生</el-button>
<el-button type="text" size="small">查看名册</el-button>
<el-button type="text" size="small">删除</el-button>
<el-button type="text" size="small"> 评价查询</el-button>
</template>
</el-table-column>
</el-table>
2021-03-12 18:44:43 +08:00
<QueryListPage
ref="classQueryListPage"
:query-form="classQueryForm"
:pager-config="pagerConfig"
:query-list="classQueryList"
style="width:80%;margin: 0 auto;"
/>
2021-01-07 15:14:58 +08:00
</div>
2021-03-11 18:09:26 +08:00
<div v-if="defaultActive === '2-1'">
2021-03-12 18:44:43 +08:00
<QueryListPage
ref="lessonQueryListPage"
:query-form="lessonQueryForm"
:pager-config="pagerConfig"
:query-list="lessonQueryList"
style="width:80%;margin: 0 auto;"
/>
2021-03-11 18:09:26 +08:00
</div>
<div v-if="defaultActive === '2-2'">
<QueryListPage
2021-03-12 18:44:43 +08:00
ref="draftLessonQueryListPage"
2021-03-11 18:09:26 +08:00
:query-form="draftLessonQueryForm"
:pager-config="pagerConfig"
:query-list="draftLessonQueryList"
style="width:80%;margin: 0 auto;"
2021-01-06 13:23:16 +08:00
/>
</div>
2021-03-11 18:09:26 +08:00
<div v-if="defaultActive === '3'">
<div style="display: flex; justify-content: space-between;width: 80%;margin: 0 auto;">
<el-form :inline="true" :model="examFormModel" size="small">
<el-form-item label="学年:">
<el-select v-model="examFormModel.academicYear" placeholder="请选择" :clearable="true">
<el-option
v-for="item in academicYearList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="学期:">
<el-select v-model="examFormModel.semester" placeholder="请选择" :clearable="true">
<el-option
v-for="item in semesterList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="examQuery">考试查询</el-button>
</el-form-item>
</el-form>
<el-button type="primary" size="small" style="width: 80px;height: 32px;" @click="examCreate">新建考试</el-button>
</div>
<el-table :data="examData" border style="width: 80%;margin: 0 auto;">
<el-table-column prop="name" label="试卷名称" />
<el-table-column prop="className" label="考试班级" />
<el-table-column prop="createDate" label="创建日期" />
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" size="small">成绩查询</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div v-if="defaultActive === '4'">
<div style="display: flex; justify-content: space-between;width: 80%;margin: 0 auto;">
<el-form :inline="true" :model="ruleFormModel" size="small">
<el-form-item label="学年:">
<el-select v-model="ruleFormModel.academicYear" placeholder="请选择" :clearable="true">
<el-option
v-for="item in academicYearList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="学期:">
<el-select v-model="ruleFormModel.semester" placeholder="请选择" :clearable="true">
<el-option
v-for="item in semesterList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="ruleQuery">规则查询</el-button>
</el-form-item>
</el-form>
<el-button type="primary" size="small" style="width: 100px;height: 32px;" @click="ruleCreate">新建评价规则</el-button>
</div>
<el-table :data="ruleData" border style="width: 80%;margin: 0 auto;">
<el-table-column type="index" width="50" />
<el-table-column prop="content" label="规则内容" />
<el-table-column prop="createDate" label="创建日期" />
<el-table-column prop="className" label="适用班级" />
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" size="small">删除</el-button>
<el-button type="text" size="small">修改</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
2021-03-12 18:44:43 +08:00
<create-by-published ref="createByPublished" @refresh="draftLessonRefresh" />
<edit-lesson-info ref="editLessonInfo" @refresh="lessonRefresh" />
<publish-lesson ref="publishLesson" @refresh="draftLessonRefresh" />
</div>
2020-12-31 09:32:25 +08:00
</template>
<script>
2021-03-11 18:09:26 +08:00
import ClassIcon from '@/assets/teachManage/class.png';
import LessonIcon from '@/assets/teachManage/lesson.png';
import ExamIcon from '@/assets/teachManage/exam.png';
import RuleIcon from '@/assets/teachManage/rule.png';
import ConstConfig from '@/scripts/ConstConfig';
2021-03-12 18:44:43 +08:00
import { getLessonDraftListNoMapId } from '@/api/jmap/lessondraft';
import { getLessonListSystem, forceDeleteLesson } from '@/api/jmap/lesson';
import { getClassListPage } from '@/api/company';
import CreateByPublished from './createByPublished';
import EditLessonInfo from './editLessonInfo';
import { getPublishMapListOnline, getPublishMapInfo } from '@/api/jmap/map';
import { delLesson } from '@/api/jmap/lessondraft';
import PublishLesson from './publishLesson';
2020-12-31 09:32:25 +08:00
export default {
name: 'Organization',
2021-03-12 18:44:43 +08:00
components: {
CreateByPublished,
EditLessonInfo,
PublishLesson
},
2020-12-31 09:32:25 +08:00
data() {
return {
2021-03-11 18:09:26 +08:00
classIcon: ClassIcon,
lessonIcon: LessonIcon,
examIcon: ExamIcon,
ruleIcon: RuleIcon,
defaultActive: '1',
classData: [{ name: '测试班级', num: 30, createDate: '2021.03.11' }],
lessonData: [{ name: '测试课程', className: '测试班级', createDate: '2021.03.11' }],
examData: [{ name: '测试课程', className: '测试班级', createDate: '2021.03.11' }],
ruleData: [{ content: '平时考勤30%考试成绩70%', createDate: '2021.03.11', className: '测试班级' }],
academicYearList: [],
semesterList: [{ label: '上学期', value: 'top' }, { label: '下学期', value: 'down' }],
2021-03-12 18:44:43 +08:00
mapIdList: [],
lineCode: '',
2021-03-11 18:09:26 +08:00
classFormModel: {
className: ''
},
lessonFormModel: {
academicYear: '',
semester: ''
2021-01-07 15:14:58 +08:00
},
2021-03-11 18:09:26 +08:00
examFormModel: {
academicYear: '',
semester: ''
},
ruleFormModel: {
academicYear: '',
semester: ''
},
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
2021-03-12 18:44:43 +08:00
classQueryForm: {
},
classQueryList: {
query: this.getAllClassList,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '班级名称',
prop: 'name',
width: '200'
},
{
title: '课程地图',
prop: 'mapId',
type: 'tag',
width: '250',
columnValue: (row) => {
return this.$convertField(row.mapId, this.mapIdList, ['id', 'name']);
},
tagType: (row) => { return 'success'; }
},
{
title: this.$t('lesson.courseDescription'),
prop: 'remarks'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '200',
buttons: [
{
name: '导入学生',
handleClick: this.handleEditLessonInfo,
type: 'primary'
},
{
name: '查看名册',
handleClick: this.handleEditLessonInfo,
type: 'primary'
},
{
name: '评价查询',
handleClick: this.handleEditLessonInfo,
type: 'primary'
},
{
name: '删除',
handleClick: this.handleDeleteLesson,
type: 'danger'
}
]
}
]
},
lessonQueryForm: {
// leftSpan: 16,
// offsetSpan: 17
2021-03-11 18:09:26 +08:00
show: false
},
2021-03-12 18:44:43 +08:00
lessonQueryList: {
query: getLessonListSystem,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('lesson.courseName'),
prop: 'name',
width: '200'
},
{
title: '课程地图',
prop: 'mapId',
type: 'tag',
width: '250',
columnValue: (row) => {
return this.$convertField(row.mapId, this.mapIdList, ['id', 'name']);
},
tagType: (row) => { return 'success'; }
},
{
title: this.$t('lesson.courseDescription'),
prop: 'remarks'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '200',
buttons: [
{
name: '修改课程',
handleClick: this.handleEditLessonInfo,
type: 'primary'
},
{
name: '删除',
handleClick: this.handleDeleteLesson,
type: 'danger'
}
]
}
]
},
draftLessonQueryForm: {
leftSpan: 16,
offsetSpan: 17
},
2021-03-11 18:09:26 +08:00
draftLessonQueryList: {
2021-03-12 18:44:43 +08:00
query: getLessonDraftListNoMapId,
2021-03-11 18:09:26 +08:00
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('lesson.courseName'),
prop: 'name'
},
{
title: this.$t('lesson.courseDescription'),
prop: 'remarks'
},
{
title: this.$t('global.status'),
prop: 'status',
type: 'tag',
columnValue: (row) => {
return this.$convertField(row.status, ConstConfig.ConstSelect.releaseReview, ['value', 'label']);
},
tagType: (row) => { return 'success'; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '400',
buttons: [
{
name: this.$t('lesson.courseDetails'),
2021-03-12 18:44:43 +08:00
handleClick: this.goLessonDetail,
2021-03-11 18:09:26 +08:00
type: 'primary',
showControl: (row) => {
return row.status !== '1';
}
},
{
name: this.$t('lesson.contentSorting'),
2021-03-12 18:44:43 +08:00
handleClick: this.treeSortLesson,
2021-03-11 18:09:26 +08:00
type: 'primary',
showControl: (row) => {
return row.status !== '1';
}
},
{
name: this.$t('global.release'),
2021-03-12 18:44:43 +08:00
handleClick: this.publishLesson,
2021-03-11 18:09:26 +08:00
type: 'primary',
showControl: (row) => {
2021-03-12 18:44:43 +08:00
return row.status === '0';
2021-03-11 18:09:26 +08:00
}
},
{
name: this.$t('global.delete'),
handleClick: this.deleteLesson,
2021-03-12 18:44:43 +08:00
type: 'danger'
2021-03-11 18:09:26 +08:00
}
]
}
2021-03-12 18:44:43 +08:00
],
actions: [
{ text: '从发布课程新建', handler: this.lessonCreateByOld },
{ text: '新建课程', handler: this.lessonCreate }
2021-03-11 18:09:26 +08:00
]
}
2020-12-31 09:32:25 +08:00
};
},
2021-01-06 13:23:16 +08:00
computed: {
2021-03-11 18:09:26 +08:00
2021-01-06 13:23:16 +08:00
},
mounted() {
2021-03-11 18:09:26 +08:00
this.academicYearList = [];
const nowYear = new Date().getFullYear();
for (let i = 2020; i < nowYear + 1; i++) {
this.academicYearList.push({ label: `${i}-${i + 1}学年`, value: i });
}
2021-03-12 18:44:43 +08:00
this.mapIdList = [];
getPublishMapListOnline().then(response => {
this.mapIdList = response.data;
});
this.lessonQuery();
2021-01-06 13:23:16 +08:00
},
2021-03-11 18:09:26 +08:00
methods:{
handleOpen(val) {
2021-01-07 15:14:58 +08:00
},
2021-03-11 18:09:26 +08:00
handleClose(val) {
2021-01-06 13:23:16 +08:00
},
2021-03-11 18:09:26 +08:00
clickMenu(val) {
2021-03-12 18:44:43 +08:00
this.defaultActive = val.index;
if (val.index === '2-1') {
this.lessonRefresh();
} else if (val.index === '2-2') {
this.draftLessonRefresh();
}
},
getAllClassList(params) {
return getClassListPage(this.$store.state.user.companyId, params);
},
publishLesson(index, row) {
console.log(row, '==');
this.$refs.publishLesson.doShow(row);
2021-01-06 13:23:16 +08:00
},
2021-03-11 18:09:26 +08:00
goBack() {
this.$router.go(-1);
2021-01-06 13:23:16 +08:00
},
2021-03-11 18:09:26 +08:00
classQuery() {
2021-01-06 13:23:16 +08:00
},
2021-03-11 18:09:26 +08:00
classCreate() {
2021-01-07 15:14:58 +08:00
},
2021-03-12 18:44:43 +08:00
lessonQuery(nums = [2, 3, 4, 5, 6], target = 11) {
let mapData = {};
nums.some((item, index, array) =>{
let result = target - item;
if (mapData[item] || mapData[item] === 0) {
mapData = [mapData[item], index];
return true;
} else {
mapData[result] = index;
}
result = target - array[array.length - index - 1];
if (mapData[array[array.length - index - 1]] || mapData[array[array.length - index - 1]] === 0) {
mapData = [mapData[array[array.length - index - 1]], array.length - index - 1];
return true;
} else {
mapData[result] = array.length - index - 1;
}
});
return mapData;
2021-01-07 15:14:58 +08:00
},
2021-03-11 18:09:26 +08:00
lessonCreate() {
2021-03-12 18:44:43 +08:00
this.$router.push({ path: `/info/createLesson` });
},
lessonCreateByOld() {
this.$refs.createByPublished.doShow();
2021-01-07 15:14:58 +08:00
},
2021-03-11 18:09:26 +08:00
examQuery() {
2021-01-06 13:23:16 +08:00
},
2021-03-11 18:09:26 +08:00
examCreate() {
2021-01-05 13:56:51 +08:00
},
2021-03-11 18:09:26 +08:00
ruleQuery() {
2021-01-05 13:56:51 +08:00
},
2021-03-11 18:09:26 +08:00
ruleCreate() {
2021-03-12 18:44:43 +08:00
},
goLessonDetail(index, row) {
getPublishMapInfo(row.mapId).then(resp => {
this.lineCode = resp.data.lineCode;
this.$router.push({ path: '/info/editLesson', query: { lessonId: row.id, mapId: row.mapId, prdType: row.prdType, lineCode: this.lineCode } });
});
},
treeSortLesson(index, row) {
this.$router.push({ path: '/info/sortLesson', query: { lessonId: row.id } });
},
deleteLesson(index, row) {
this.$confirm('此操作将删除草稿课程,且无法恢复,是否继续?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
delLesson(row).then(response => {
this.$message.success(this.$t('tip.successfullyDelete'));
this.draftLessonRefresh();
}).catch(() => {
this.$messageBox(this.$t('tip.failDelete'));
});
}).catch(() => { });
},
handleDeleteLesson(index, 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.lessonRefresh();
}).catch((error) => {
this.$messageBox(this.$t('error.deleteFailed') + ':' + error.message);
this.lessonRefresh();
});
}).catch(() => { });
},
handleEditLessonInfo(index, row) {
this.$refs.editLessonInfo.doShow(row);
},
lessonRefresh() {
this.$nextTick(() => {
this.$refs.lessonQueryListPage.refresh(true);
});
},
draftLessonRefresh() {
this.$nextTick(() => {
this.$refs.draftLessonQueryListPage.refresh(true);
});
2020-12-31 09:32:25 +08:00
}
}
};
</script>
<style scoped>
2021-01-05 13:56:51 +08:00
.back_box {
2021-03-11 18:09:26 +08:00
height: 20px;
2021-01-05 13:56:51 +08:00
z-index: 36;
2021-01-12 10:19:43 +08:00
width: 40px;
2021-01-05 13:56:51 +08:00
text-align: center;
position: absolute;
2021-03-11 18:09:26 +08:00
right: 20px;
top: -20px;
2021-01-06 13:23:16 +08:00
}
2020-12-31 09:32:25 +08:00
</style>