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

160 lines
5.4 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"
2021-03-30 15:51:15 +08:00
style="width:96%;margin: 0 auto;"
2021-03-18 09:03:15 +08:00
/>
<create-class ref="createClass" @refresh="classRefresh" />
</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';
export default {
name: 'ClassManage',
components: {
2021-04-01 16:28:30 +08:00
CreateClass
2021-03-18 09:03:15 +08:00
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
classQueryForm: {
leftSpan: 14,
columnNum: 3,
labelWidth: '90px',
textAlign: 'right',
reset: true,
queryObject: {
name: {
type: 'text',
label: '班级名称:'
2021-03-25 18:34:41 +08:00
},
2021-03-25 19:46:02 +08:00
creatorName: {
type: 'text',
label: '创建人:'
2021-03-18 09:03:15 +08:00
}
}
},
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'),
2021-06-07 16:11:36 +08:00
width: '450',
2021-03-18 09:03:15 +08:00
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'
},
2021-06-07 16:11:36 +08:00
{
name: '时长查看',
handleClick: this.handleDurationView,
type: 'primary'
},
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: [
2021-03-26 13:31:12 +08:00
{ text: '新建班级', handler: this.classCreate }
2021-03-18 09:03:15 +08:00
]
}
};
},
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(() => { });
},
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
},
2021-06-07 16:11:36 +08:00
handleDurationView(index, row) {
this.$router.push({ path: '/info/durationView', query: { classId: row.id, className: row.name } });
},
2021-03-18 09:03:15 +08:00
classCreate() {
this.$refs.createClass.doShow();
}
}
};
</script>
<style scoped>
</style>