|
@@ -3,29 +3,34 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24" class="style">
|
|
|
<el-col :span="24" class="top">
|
|
|
- <!-- <topInfo></topInfo> -->
|
|
|
<NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="main">
|
|
|
- <classList
|
|
|
- :job="job"
|
|
|
- :name="name"
|
|
|
- :job_list="job_list"
|
|
|
- :headNameList="headNameList"
|
|
|
- @assign="clickAssign"
|
|
|
- :assignShow="assignShow"
|
|
|
- :assignForm="assignForm"
|
|
|
- @outForm="outAssignShow"
|
|
|
- @onForm="onAssignShow"
|
|
|
- :stuNameList="stuNameList"
|
|
|
- :groupList="groupList"
|
|
|
- @saveGroup="saveGroup"
|
|
|
- @exitGroup="exitGroup"
|
|
|
- @deleteGroup="deleteGroup"
|
|
|
- @joinGroup="joinGroup"
|
|
|
- :stuIdAndGroupId="stuIdAndGroupId"
|
|
|
- :noGroupStudentNames="noGroupStudentNames"
|
|
|
- ></classList>
|
|
|
+ <span v-if="this.user.type === '1'">
|
|
|
+ <headClassList :headClassList="headClassList" @clickStu="clickStu"></headClassList>
|
|
|
+ </span>
|
|
|
+ <span v-else>
|
|
|
+ <classList
|
|
|
+ :stuNameList="stuNameList"
|
|
|
+ :groupList="groupList"
|
|
|
+ @createGroup="createGroup"
|
|
|
+ :createGroupDialog="createGroupDialog"
|
|
|
+ :groupForm="groupForm"
|
|
|
+ @saveGroup="saveGroup"
|
|
|
+ @deleteGroup="deleteGroup"
|
|
|
+ @exitGroup="exitGroup"
|
|
|
+ @joinGroup="joinGroup"
|
|
|
+ :stuIdAndGroupId="stuIdAndGroupId"
|
|
|
+ :noGroupStudentNames="noGroupStudentNames"
|
|
|
+ ></classList>
|
|
|
+ <!-- :groupList="groupList"
|
|
|
+ @saveGroup="saveGroup"
|
|
|
+ @exitGroup="exitGroup"
|
|
|
+ @deleteGroup="deleteGroup"
|
|
|
+ @joinGroup="joinGroup"
|
|
|
+ :stuIdAndGroupId="stuIdAndGroupId"
|
|
|
+ :noGroupStudentNames="noGroupStudentNames" -->
|
|
|
+ </span>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="foot">
|
|
|
<footInfo></footInfo>
|
|
@@ -38,52 +43,40 @@
|
|
|
<script>
|
|
|
import NavBar from '@/layout/common/topInfo.vue';
|
|
|
import footInfo from '@/layout/common/footInfo.vue';
|
|
|
+import headClassList from '@/layout/class/headClassList.vue';
|
|
|
import classList from '@/layout/class/classList.vue';
|
|
|
-// import { createNamespacedHelpers, mapGetters } from 'vuex';
|
|
|
import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
|
|
|
const { mapActions: mapGroup } = createNamespacedHelpers('group');
|
|
|
const { mapActions: mapStudent } = createNamespacedHelpers('student');
|
|
|
const { mapActions: mapclasses } = createNamespacedHelpers('classes');
|
|
|
-const type = '班长';
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
|
components: {
|
|
|
NavBar, //头部导航
|
|
|
- footInfo, //底部导航
|
|
|
+ headClassList, //班主任中管理的学生列表
|
|
|
classList, //班级名单
|
|
|
+ footInfo, //底部导航
|
|
|
},
|
|
|
data: () => ({
|
|
|
- job_list: [
|
|
|
- {
|
|
|
- name: '班长',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '学委',
|
|
|
- },
|
|
|
- ],
|
|
|
- name: '',
|
|
|
- xsid: '',
|
|
|
- // 班主任看学生名单
|
|
|
- headNameList: [],
|
|
|
- assignShow: false,
|
|
|
- assignForm: {},
|
|
|
+ // 班主任看班级名单
|
|
|
+ headClassList: [],
|
|
|
// 学生看学生名单
|
|
|
stuNameList: [],
|
|
|
+ // 班级分组
|
|
|
groupList: [],
|
|
|
- stuIdAndGroupId: '',
|
|
|
- // noGroupStudentNames: '',
|
|
|
+ createGroupDialog: false,
|
|
|
+ groupForm: {},
|
|
|
+ stuIdAndGroupId: {},
|
|
|
noGroupStudentNames: [],
|
|
|
title: '',
|
|
|
isleftarrow: '',
|
|
|
- transitionName: 'fade',
|
|
|
navShow: true,
|
|
|
- job: '',
|
|
|
}),
|
|
|
created() {
|
|
|
- this.findList();
|
|
|
- this.search();
|
|
|
+ this.searchInfo();
|
|
|
this.searchstu();
|
|
|
+ this.findGroup();
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
@@ -99,75 +92,37 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
- ...mapStudent({ list: 'query', add: 'create', fet: 'fetch', updates: 'update' }),
|
|
|
- //班主任
|
|
|
- async search() {
|
|
|
- let termid = this.user.termid;
|
|
|
- let batchid = this.user.batchid;
|
|
|
- let stuid = this.user.userid;
|
|
|
- let classid = this.user.classid;
|
|
|
- const res = await this.list({ classid });
|
|
|
- console.log(res);
|
|
|
- this.$set(this, `headNameList`, res.data);
|
|
|
+ ...mapclasses({ classList: 'query', classFetch: 'fetch' }),
|
|
|
+ ...mapStudent({ stuQery: 'query', add: 'create', fet: 'fetch', updates: 'update' }),
|
|
|
+ ...mapGroup(['query', 'create', 'delete', 'insert', 'exit']),
|
|
|
+ // 班主任查询管理班级列表
|
|
|
+ async searchInfo() {
|
|
|
+ const res = await this.classList(this.user.userid);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `headClassList`, res.data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 班主任跳转到班级信息
|
|
|
+ clickStu(id) {
|
|
|
+ this.$router.push({ path: '/class/classStuList', query: { id: id } });
|
|
|
},
|
|
|
//学生
|
|
|
async searchstu() {
|
|
|
- let termid = this.user.termid;
|
|
|
- let batchid = this.user.batchid;
|
|
|
- let stuid = this.user.userid;
|
|
|
let classid = this.user.classid;
|
|
|
- const res = await this.list({ classid });
|
|
|
- console.log(res);
|
|
|
-
|
|
|
+ const res = await this.stuQery({ classid });
|
|
|
this.$set(this, `stuNameList`, res.data);
|
|
|
},
|
|
|
-
|
|
|
- //点击派遣
|
|
|
- async clickAssign({ id, name, job }) {
|
|
|
- this.assignShow = true;
|
|
|
- this.$set(this, `xsid`, id);
|
|
|
- this.$set(this, `name`, name);
|
|
|
- this.$set(this.assignForm, `job`, job);
|
|
|
- },
|
|
|
- //指派职务
|
|
|
- async onAssignShow(assignForm) {
|
|
|
- this.assignShow = false;
|
|
|
- this.assignForm.id = this.xsid;
|
|
|
- let data = this.assignForm;
|
|
|
- let res = await this.updates(data);
|
|
|
- let classid = this.user.classid;
|
|
|
- const ress = await this.list({ classid });
|
|
|
- this.$set(this, `headNameList`, ress.data);
|
|
|
- this.$message({
|
|
|
- message: '成功',
|
|
|
- type: 'success',
|
|
|
- });
|
|
|
- },
|
|
|
- outAssignShow() {
|
|
|
- this.assignShow = false;
|
|
|
- },
|
|
|
- ...mapGroup(['query', 'create', 'delete', 'insert', 'exit']),
|
|
|
- ...mapStudent({ stuQery: 'query' }),
|
|
|
- // 查询小组列表
|
|
|
- async findList() {
|
|
|
- let data = {};
|
|
|
- data.termid = this.user.termid;
|
|
|
- data.batchid = this.user.batchid;
|
|
|
- data.classid = this.user.classid;
|
|
|
+ // 查询组
|
|
|
+ async findGroup() {
|
|
|
let stuid = this.user.userid;
|
|
|
- // data.termid = termid;
|
|
|
- // data.batchid = batchid;
|
|
|
- // data.classid = classid;
|
|
|
- const result = await this.query(data);
|
|
|
+ const result = await this.query();
|
|
|
const groupList = result.data;
|
|
|
- console.log(noGroupStudentNames);
|
|
|
this.$set(this, 'groupList', groupList);
|
|
|
// 找出登陆者在哪个组
|
|
|
// 找出组id
|
|
|
let groupId = '';
|
|
|
// 所有有组学生id
|
|
|
let studentIds = [];
|
|
|
-
|
|
|
var i = groupList.findIndex(value => {
|
|
|
var v = value.students.findIndex(value => {
|
|
|
studentIds.push(value.stuid);
|
|
@@ -178,6 +133,7 @@ export default {
|
|
|
if (i != -1) {
|
|
|
groupId = groupList[i].id;
|
|
|
}
|
|
|
+ // 學生id+組id
|
|
|
let stuIdAndGroupId = {};
|
|
|
// 登陆者id
|
|
|
stuIdAndGroupId.stuid = stuid;
|
|
@@ -187,12 +143,8 @@ export default {
|
|
|
// let job = this.user.job;
|
|
|
// console.log(stuIdAndGroupId.job);
|
|
|
// stuIdAndGroupId.job = job;
|
|
|
- stuIdAndGroupId.type = type;
|
|
|
-
|
|
|
this.$set(this, 'stuIdAndGroupId', stuIdAndGroupId);
|
|
|
- // 所有学生
|
|
|
- let studentList = await this.stuQery(data);
|
|
|
- studentList = studentList.data;
|
|
|
+ let studentList = this.stuNameList;
|
|
|
// 没有组的学生名字
|
|
|
let noGroupStudentNames = [];
|
|
|
// 循环所有学生id
|
|
@@ -207,26 +159,23 @@ export default {
|
|
|
// 未分组学生id(studentIds(有组学生id))(studentList所有学生)(noGroupStudentNames没有组的学生名字)
|
|
|
this.$set(this, 'noGroupStudentNames', noGroupStudentNames);
|
|
|
},
|
|
|
- // 创建小组
|
|
|
+ // 创建分组-打開dialog
|
|
|
+ createGroup() {
|
|
|
+ this.createGroupDialog = true;
|
|
|
+ },
|
|
|
+ // 提交创建分组-班长职责
|
|
|
async saveGroup({ data }) {
|
|
|
- data.termid = this.user.termid;
|
|
|
- data.batchid = this.user.batchid;
|
|
|
- data.classid = this.user.classid;
|
|
|
-
|
|
|
const result = await this.create(data);
|
|
|
if (result.errcode == 0) {
|
|
|
- this.findList();
|
|
|
+ this.createGroupDialog = false;
|
|
|
+ this.findGroup();
|
|
|
}
|
|
|
},
|
|
|
- // 加入小组
|
|
|
- async joinGroup({ groupId }) {
|
|
|
- let data = {};
|
|
|
- data.groupid = groupId;
|
|
|
- data.stuid = this.user.userid;
|
|
|
- data.stuname = this.user.name;
|
|
|
- const result = await this.insert(data);
|
|
|
+ // 删除分组-班长职责
|
|
|
+ async deleteGroup({ groupId }) {
|
|
|
+ const result = await this.delete(groupId);
|
|
|
if (result.errcode == 0) {
|
|
|
- this.findList();
|
|
|
+ this.findGroup();
|
|
|
}
|
|
|
},
|
|
|
// 退出小组
|
|
@@ -236,14 +185,18 @@ export default {
|
|
|
data.stuid = this.user.userid;
|
|
|
const result = await this.exit(data);
|
|
|
if (result.errcode == 0) {
|
|
|
- this.findList();
|
|
|
+ this.findGroup();
|
|
|
}
|
|
|
},
|
|
|
- // 删除小组
|
|
|
- async deleteGroup({ groupId }) {
|
|
|
- const result = await this.delete(groupId);
|
|
|
+ // 加入小组
|
|
|
+ async joinGroup({ groupId }) {
|
|
|
+ let data = {};
|
|
|
+ data.groupid = groupId;
|
|
|
+ data.stuid = this.user.userid;
|
|
|
+ data.stuname = this.user.name;
|
|
|
+ const result = await this.insert(data);
|
|
|
if (result.errcode == 0) {
|
|
|
- this.findList();
|
|
|
+ this.findGroup();
|
|
|
}
|
|
|
},
|
|
|
},
|
|
@@ -265,7 +218,7 @@ export default {
|
|
|
min-height: 570px;
|
|
|
}
|
|
|
.foot {
|
|
|
- height: 50px;
|
|
|
+ height: 90px;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
</style>
|