|
@@ -13,7 +13,17 @@
|
|
</el-col>
|
|
</el-col>
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
<el-tab-pane label="班级分组" name="second">
|
|
<el-tab-pane label="班级分组" name="second">
|
|
- <classGroup :groupList="groupList" :stuIdAndGroupId="stuIdAndGroupId"></classGroup>
|
|
|
|
|
|
+ <classGroup
|
|
|
|
+ :groupList="groupList"
|
|
|
|
+ :stuIdAndGroupId="stuIdAndGroupId"
|
|
|
|
+ :noGroupStu="noGroupStu"
|
|
|
|
+ :groupForm="groupForm"
|
|
|
|
+ @saveGroup="saveGroup"
|
|
|
|
+ @joinGroup="joinGroup"
|
|
|
|
+ @exitGroup="exitGroup"
|
|
|
|
+ @affirm="affirm"
|
|
|
|
+ @deleteGroup="deleteGroup"
|
|
|
|
+ ></classGroup>
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
<el-tab-pane label="平时成绩" name="third">
|
|
<el-tab-pane label="平时成绩" name="third">
|
|
<daily :data="studentList"></daily>
|
|
<daily :data="studentList"></daily>
|
|
@@ -64,7 +74,12 @@ export default {
|
|
activeName: 'first',
|
|
activeName: 'first',
|
|
// 小组列表
|
|
// 小组列表
|
|
groupList: [],
|
|
groupList: [],
|
|
|
|
+ // 登陆者所在组,id
|
|
stuIdAndGroupId: {},
|
|
stuIdAndGroupId: {},
|
|
|
|
+ // 未分组成员
|
|
|
|
+ noGroupStu: [],
|
|
|
|
+ // 创建小组form
|
|
|
|
+ groupForm: {},
|
|
//学生列表
|
|
//学生列表
|
|
studentList: [],
|
|
studentList: [],
|
|
// 平时分列表
|
|
// 平时分列表
|
|
@@ -78,8 +93,8 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
...pscore({ getPScoreList: 'query' }),
|
|
...pscore({ getPScoreList: 'query' }),
|
|
|
|
+ ...group({ groupQuery: 'query', groupDelete: 'delete', groupCreate: 'create', groupUpdate: 'update', groupInsert: 'insert', groupExit: 'exit' }),
|
|
...student({ getStudentList: 'query', updateStudent: 'update' }),
|
|
...student({ getStudentList: 'query', updateStudent: 'update' }),
|
|
- ...group({ groupQuery: 'query' }),
|
|
|
|
// first 查学生
|
|
// first 查学生
|
|
async toGetStudentList() {
|
|
async toGetStudentList() {
|
|
const res = await this.getStudentList({ classid: this.user.classid });
|
|
const res = await this.getStudentList({ classid: this.user.classid });
|
|
@@ -120,6 +135,70 @@ export default {
|
|
groupId: groupId,
|
|
groupId: groupId,
|
|
};
|
|
};
|
|
this.$set(this, 'stuIdAndGroupId', stuIdAndGroupId);
|
|
this.$set(this, 'stuIdAndGroupId', stuIdAndGroupId);
|
|
|
|
+ // 未分组成员
|
|
|
|
+ var is = this.groupList.map(value => {
|
|
|
|
+ var v = value.students.map(value => {
|
|
|
|
+ studentIds.push(value.stuid);
|
|
|
|
+ });
|
|
|
|
+ return studentIds;
|
|
|
|
+ });
|
|
|
|
+ let havegroupstuid = is[0];
|
|
|
|
+ var data = this.studentList.map(item => item.id);
|
|
|
|
+ let stuidlist = _.xorWith(data, havegroupstuid, _.isEqual);
|
|
|
|
+ let arr = [];
|
|
|
|
+ let stus = [];
|
|
|
|
+ for (const stuid of stuidlist) {
|
|
|
|
+ arr = this.studentList.filter(item => item.id === stuid);
|
|
|
|
+ stus = [...arr, ...stus];
|
|
|
|
+ }
|
|
|
|
+ this.$set(this, 'noGroupStu', stus);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // second 创建小组
|
|
|
|
+ async saveGroup({ data }) {
|
|
|
|
+ data.termid = this.user.termid;
|
|
|
|
+ data.batchid = this.user.batchid;
|
|
|
|
+ data.classid = this.user.classid;
|
|
|
|
+ const result = await this.groupCreate(data);
|
|
|
|
+ if (result.errcode == 0) {
|
|
|
|
+ this.findGroup();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // second 确定小组
|
|
|
|
+ async affirm() {
|
|
|
|
+ for (const val of this.groupList) {
|
|
|
|
+ val.status = '1';
|
|
|
|
+ const res = await this.groupUpdate(val);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // second 加入小组
|
|
|
|
+ async joinGroup({ groupId }) {
|
|
|
|
+ let data = {
|
|
|
|
+ groupid: groupId,
|
|
|
|
+ stuid: this.user.userid,
|
|
|
|
+ stuname: this.user.name,
|
|
|
|
+ };
|
|
|
|
+ const result = await this.groupInsert(data);
|
|
|
|
+ if (result.errcode == 0) {
|
|
|
|
+ this.findGroup();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //second 退出小组
|
|
|
|
+ async exitGroup({ groupId }) {
|
|
|
|
+ let data = {
|
|
|
|
+ groupid: groupId,
|
|
|
|
+ stuid: this.user.userid,
|
|
|
|
+ };
|
|
|
|
+ const result = await this.groupExit(data);
|
|
|
|
+ if (result.errcode == 0) {
|
|
|
|
+ this.findGroup();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // second 删除小组
|
|
|
|
+ async deleteGroup({ groupId }) {
|
|
|
|
+ const result = await this.groupDelete(groupId);
|
|
|
|
+ if (result.errcode == 0) {
|
|
|
|
+ this.findGroup();
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|