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

166 lines
5.6 KiB
Vue
Raw Normal View History

2021-03-18 09:03:15 +08:00
<template>
<div style="width: 100%;height: 100%;">
<QueryListPage
ref="classQueryListPage"
:query-form="classQueryForm"
:pager-config="pagerConfig"
:query-list="classQueryList"
style="width:90%;margin: 0 auto;"
/>
<create-class ref="createClass" @refresh="classRefresh" />
<bind-lessons ref="bindLessons" />
</div>
</template>
<script>
2021-03-25 13:03:12 +08:00
import { getClassListPage, deleteDeptInfo } from '@/api/company';
2021-03-18 09:03:15 +08:00
import CreateClass from './createClass';
import BindLessons from './bindLessons';
export default {
name: 'ClassManage',
components: {
CreateClass,
BindLessons
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
classQueryForm: {
leftSpan: 14,
columnNum: 3,
labelWidth: '90px',
textAlign: 'right',
reset: true,
queryObject: {
name: {
type: 'text',
label: '班级名称:'
}
}
},
classQueryList: {
2021-03-25 13:03:12 +08:00
query: getClassListPage,
2021-03-18 09:03:15 +08:00
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '班级名称:',
prop: 'name',
width: '200'
},
{
title: '人数',
prop: 'numberOfPeople'
},
{
title: '创建日期',
prop: 'createTime'
},
2021-03-25 13:03:12 +08:00
{
title: '创建人',
2021-03-25 14:09:03 +08:00
prop: 'creatorName'
2021-03-25 13:03:12 +08:00
},
2021-03-18 09:03:15 +08:00
{
type: 'button',
title: this.$t('global.operate'),
width: '450',
buttons: [
{
name: '编辑班级',
handleClick: this.handleUpdateClass,
2021-03-25 14:09:03 +08:00
type: 'primary',
showControl: (row) => {
return row.creatorId == this.userId;
}
2021-03-18 09:03:15 +08:00
},
{
name: '学生管理',
handleClick: this.handleStudentDetail,
type: 'primary'
},
{
name: '评价查询',
handleClick: this.handleGradeCheck,
type: 'primary'
},
{
name: '排课',
handleClick: this.handleBindLesson,
2021-03-25 14:09:03 +08:00
type: 'primary',
showControl: (row) => {
return row.creatorId == this.userId;
}
2021-03-18 09:03:15 +08:00
},
{
name: '删除',
handleClick: this.handleDeleteClass,
2021-03-25 14:09:03 +08:00
type: 'danger',
showControl: (row) => {
return row.creatorId == this.userId;
}
2021-03-18 09:03:15 +08:00
}
]
}
],
actions: [
{ text: '新建班级', handler: this.classCreate },
{ text: '返回', handler: this.goBack }
]
}
};
},
2021-03-25 14:09:03 +08:00
computed: {
userId() {
return this.$store.state.user.id;
}
},
2021-03-18 09:03:15 +08:00
methods: {
handleUpdateClass(index, row) {
this.$refs.createClass.doShow(row);
},
2021-03-19 15:49:05 +08:00
handleGradeCheck(index, row) {
this.$router.push({ path: '/info/totalGrade', query: { orgId: row.id } });
2021-03-18 09:03:15 +08:00
},
classRefresh() {
this.$nextTick(() => {
this.$refs.classQueryListPage.refresh(true);
});
},
handleDeleteClass(index, row) {
this.$confirm('此操作将班级,且无法恢复,是否继续?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
deleteDeptInfo(row.id).then(response => {
this.$message.success('删除班级成功!');
this.classRefresh();
}).catch(() => {
this.$messageBox('删除班级失败!');
this.classRefresh();
});
}).catch(() => { });
},
goBack() {
this.$router.go(-1);
},
handleStudentDetail( index, row ) {
2021-03-25 14:09:03 +08:00
this.$router.push({ path: '/info/studentManage', query: { classId: row.id, className: row.name, creatorId: row.creatorId} });
2021-03-18 09:03:15 +08:00
},
handleBindLesson(index, row) {
this.$refs.bindLessons.doShow(row);
},
classCreate() {
this.$refs.createClass.doShow();
}
}
};
</script>
<style scoped>
</style>