|
@@ -79,6 +79,8 @@ export default {
|
|
|
title: '',
|
|
|
isleftarrow: '',
|
|
|
navShow: true,
|
|
|
+ //组中学生信息
|
|
|
+ gstuList: [],
|
|
|
}),
|
|
|
async created() {
|
|
|
await this.searchstu();
|
|
@@ -112,7 +114,6 @@ export default {
|
|
|
},
|
|
|
//班长分配班委会成员
|
|
|
async newsubmit({ data }) {
|
|
|
- console.log(data);
|
|
|
let res = await this.updates(data);
|
|
|
|
|
|
this.$checkRes(res, '分配成功', '分配失败');
|
|
@@ -139,7 +140,7 @@ export default {
|
|
|
});
|
|
|
return v != -1;
|
|
|
});
|
|
|
- console.log(studentIds);
|
|
|
+
|
|
|
if (i != -1) {
|
|
|
groupId = groupList[i].id;
|
|
|
}
|
|
@@ -149,32 +150,44 @@ export default {
|
|
|
stuIdAndGroupId.stuid = stuid;
|
|
|
// 登陆者属于哪个组id
|
|
|
stuIdAndGroupId.groupId = groupId;
|
|
|
- // 登陆者身份是否为班长
|
|
|
- // let job = this.user.job;
|
|
|
- // console.log(stuIdAndGroupId.job);
|
|
|
- // stuIdAndGroupId.job = job;
|
|
|
|
|
|
this.$set(this, 'stuIdAndGroupId', stuIdAndGroupId);
|
|
|
- console.log(stuIdAndGroupId);
|
|
|
+ console.log(stuIdAndGroupId.stuid);
|
|
|
|
|
|
let studentList = this.stuNameList;
|
|
|
- // 没有组的学生名字
|
|
|
- let noGroupStudentNames = [];
|
|
|
- // 循环所有学生id
|
|
|
- for (let i = 0; i < studentList.length; i++) {
|
|
|
- if (studentIds.length === 0) {
|
|
|
- noGroupStudentNames.push(studentList[i].name);
|
|
|
- } else {
|
|
|
- // 循环有组学生id
|
|
|
- for (let j = 0; j < studentIds.length; j++) {
|
|
|
- if (studentList[i].id != studentIds[j]) {
|
|
|
- noGroupStudentNames.push(studentList[i].name);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // // 没有组的学生名字
|
|
|
+ // let noGroupStudentNames = [];
|
|
|
+ // // 循环所有学生id
|
|
|
+ // for (let i = 0; i < studentList.length; i++) {
|
|
|
+ // if (studentIds.length === 0) {
|
|
|
+ // noGroupStudentNames.push(studentList[i].name);
|
|
|
+ // } else {
|
|
|
+ // // 循环有组学生id
|
|
|
+ // for (let j = 0; j < studentIds.length; j++) {
|
|
|
+ // if (studentList[i].id != studentIds[j]) {
|
|
|
+ // noGroupStudentNames.push(studentList[i].name);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // 所有有组学生id
|
|
|
+ var is = groupList.map(value => {
|
|
|
+ var v = value.students.map(value => {
|
|
|
+ studentIds.push(value.stuid);
|
|
|
+ });
|
|
|
+ return studentIds;
|
|
|
+ });
|
|
|
+ let havegroupstuid = is[0];
|
|
|
+ var data = studentList.map(item => item.id);
|
|
|
+ let stuidlist = _.xorWith(data, havegroupstuid, _.isEqual);
|
|
|
+ let arr = [];
|
|
|
+ let stus = [];
|
|
|
+ for (const stuid of stuidlist) {
|
|
|
+ arr = studentList.filter(item => item.id === stuid);
|
|
|
+ stus = [...arr, ...stus];
|
|
|
}
|
|
|
- // 未分组学生id(studentIds(有组学生id))(studentList所有学生)(noGroupStudentNames没有组的学生名字)
|
|
|
- this.$set(this, 'noGroupStudentNames', noGroupStudentNames);
|
|
|
+ this.$set(this, 'noGroupStudentNames', stus);
|
|
|
},
|
|
|
// 创建分组-打開dialog
|
|
|
createGroup() {
|
|
@@ -222,19 +235,27 @@ export default {
|
|
|
},
|
|
|
async openClick() {},
|
|
|
async onSubmit({ data }) {
|
|
|
- console.log(data);
|
|
|
+ console.log(this.gstuList);
|
|
|
+ var stu = this.gstuList.filter(item => item.type == '1');
|
|
|
+ console.log(stu);
|
|
|
+ for (const val of stu) {
|
|
|
+ val.type = 0;
|
|
|
+ val.groupid = data.groupid;
|
|
|
+ let res = await this.Setheadupdates(val);
|
|
|
+ }
|
|
|
+
|
|
|
+ data.type = 1;
|
|
|
let res = await this.Setheadupdates(data);
|
|
|
- console.log(res);
|
|
|
+ this.findGroup();
|
|
|
this.show = false;
|
|
|
},
|
|
|
opanSubmit(item) {
|
|
|
- this.form.groupid = item.id;
|
|
|
- console.log(item);
|
|
|
console.log(item.students);
|
|
|
- // var stu = item.students.filter(item => item.job == '普通学生');
|
|
|
- // console.log(stu);
|
|
|
+ this.$set(this, 'gstuList', item.students);
|
|
|
|
|
|
- // this.$set(this, 'columns', stu);
|
|
|
+ this.form.groupid = item.id;
|
|
|
+ var stu = item.students.filter(item => item.job == '普通学生');
|
|
|
+ this.$set(this, 'columns', stu);
|
|
|
if (this.user.job === '班长') {
|
|
|
if (item.status != '1') {
|
|
|
this.show = true;
|
|
@@ -246,7 +267,6 @@ export default {
|
|
|
},
|
|
|
async queren(item) {
|
|
|
item.status = '1';
|
|
|
- console.log(item);
|
|
|
const res = await this.update(item);
|
|
|
},
|
|
|
|