|
@@ -33,14 +33,14 @@
|
|
|
|
|
|
<script>
|
|
|
import NavBar from '@/layout/common/topInfo.vue';
|
|
|
-import achieves from './info/achieve.vue';
|
|
|
+import achieves from '@/layout/class/achieve.vue';
|
|
|
import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
|
|
|
const { mapActions: mapStudent } = createNamespacedHelpers('student');
|
|
|
const { mapActions: mapClass } = createNamespacedHelpers('classes');
|
|
|
const { mapActions: mapLesson } = createNamespacedHelpers('lesson');
|
|
|
const { mapActions: mapUploadtask } = createNamespacedHelpers('uploadtask');
|
|
|
const { mapActions: mapSubject } = createNamespacedHelpers('subject');
|
|
|
-
|
|
|
+const { mapActions: group } = createNamespacedHelpers('group');
|
|
|
export default {
|
|
|
name: 'achieve',
|
|
|
props: {},
|
|
@@ -70,6 +70,8 @@ export default {
|
|
|
taskid: '',
|
|
|
subname: '',
|
|
|
task: [],
|
|
|
+ homework: [],
|
|
|
+ groupsocre: '',
|
|
|
}),
|
|
|
created() {
|
|
|
this.search();
|
|
@@ -97,66 +99,21 @@ export default {
|
|
|
...mapLesson({ lessoninfo: 'fetch', lessonlist: 'query' }),
|
|
|
...mapUploadtask({ uploadtaskinfo: 'fetch', uploadtasklist: 'query', uploadtaskupdate: 'update' }),
|
|
|
...mapSubject({ subjectinfo: 'fetch', subjectlist: 'query' }),
|
|
|
+ ...group({ groupinfo: 'query', groupfetch: 'fetch', findbystuid: 'findbystuid', groupupdate: 'update' }),
|
|
|
// 平时成绩学生名单查询+作业成绩学生名单查询
|
|
|
async search() {
|
|
|
let classid;
|
|
|
- if (this.user.type === '1') classid = this.classid;
|
|
|
- else classid = this.user.classid;
|
|
|
+ classid = this.user.classid;
|
|
|
const res = await this.list({ classid });
|
|
|
+
|
|
|
this.$set(this, `peaceAchieveList`, res.data);
|
|
|
let classsid = this.user.classid;
|
|
|
const result = await this.uploadtasklist({ classsid });
|
|
|
|
|
|
- for (const accc of res.data) {
|
|
|
- var arr = result.data.filter(item => item.studentid === accc.id);
|
|
|
- }
|
|
|
-
|
|
|
- // let lessons = [];
|
|
|
- let lessone = [];
|
|
|
- let stus = [];
|
|
|
- for (const val of result.data) {
|
|
|
- let newsid = val.lessonid;
|
|
|
- let classid = this.user.classid;
|
|
|
- //查询这个班的课程
|
|
|
- const lessonInfo = await this.lessonlist({ classid });
|
|
|
-
|
|
|
- for (const hic of lessonInfo.data) {
|
|
|
- //过滤出有作业的科目
|
|
|
- var fff = hic.lessons.filter(item => item.subid === newsid);
|
|
|
- for (const less of fff) {
|
|
|
- this.$set(this, `subname`, less.subname);
|
|
|
- }
|
|
|
- }
|
|
|
- val.subName = this.subname;
|
|
|
-
|
|
|
- const stuInfo = await this.fet(val.studentid);
|
|
|
-
|
|
|
- if (stuInfo.data.name) {
|
|
|
- val.stuName = stuInfo.data.name;
|
|
|
- //创建学生名字相关数组
|
|
|
- let stu = [{ stuname: stuInfo.data.name, id: val.studentid, lesson: [] }];
|
|
|
- //合并数组
|
|
|
- stus = [...stu, ...stus];
|
|
|
- //去掉重复数组对象
|
|
|
- var appArray = _.uniqBy(stus, _.isEqual);
|
|
|
- //合并数组
|
|
|
- this.$set(this, `achieveList`, appArray);
|
|
|
- let lessonss = [{ name: this.subname, id: val.studentid, taskid: val.id, score: val.score }];
|
|
|
- lessone = [...lessonss, ...lessone];
|
|
|
- }
|
|
|
-
|
|
|
- for (const ss of appArray) {
|
|
|
- var vre = lessone.filter(item => item.id === ss.id);
|
|
|
-
|
|
|
- ss.lesson = vre;
|
|
|
- }
|
|
|
- // for (const eee of appArray) {
|
|
|
- // eee.less = lessone;
|
|
|
- // var qq = eee.less.filter(item => item.id === eee.id);
|
|
|
-
|
|
|
- // }
|
|
|
+ for (const accc of result.data) {
|
|
|
+ var arr = res.data.filter(item => item.id === accc.studentid);
|
|
|
+ this.$set(this, `achieveList`, arr);
|
|
|
}
|
|
|
- this.$set(this, `task`, appArray);
|
|
|
},
|
|
|
// 学委上作业分+存储学生id
|
|
|
clickAchieve({ id }) {
|
|
@@ -179,14 +136,37 @@ export default {
|
|
|
async onConfirm(peaceScore) {
|
|
|
let data = {};
|
|
|
data.id = this.studid;
|
|
|
- data.selfscore = Number(peaceScore) + Number(peaceScore);
|
|
|
+
|
|
|
+ const ress = await this.fet(this.studid);
|
|
|
+
|
|
|
+ data.selfscore = Number(ress.data.selfscore) + Number(peaceScore);
|
|
|
+
|
|
|
const res = await this.updates(data);
|
|
|
this.$message({
|
|
|
message: '平时成绩上分成功',
|
|
|
type: 'success',
|
|
|
});
|
|
|
- this.showPicker = false;
|
|
|
+
|
|
|
+ let classid = this.user.classid;
|
|
|
+
|
|
|
+ const group = await this.findbystuid({ stuid: this.studid });
|
|
|
+
|
|
|
+ for (const acc of group.data.students) {
|
|
|
+ var ref = this.peaceAchieveList.filter(item => item.id === acc.stuid);
|
|
|
+
|
|
|
+ for (const aaa of ref) {
|
|
|
+ acc.stores = aaa.selfscore;
|
|
|
+ }
|
|
|
+ let asd = group.data.students.map(i => i.stores);
|
|
|
+ let nes = asd.filter(d => d);
|
|
|
+ let snewcore = eval(nes.join('+'));
|
|
|
+ this.groupsocre = snewcore;
|
|
|
+ }
|
|
|
+ group.data.score = Number(data.selfscore) + Number(this.groupsocre);
|
|
|
+ let groups = group.data;
|
|
|
+ const groupup = await this.groupupdate(groups);
|
|
|
this.search();
|
|
|
+ this.showPicker = false;
|
|
|
},
|
|
|
// 作业成绩列表
|
|
|
async searchinfo({ ...info } = {}) {
|
|
@@ -231,9 +211,9 @@ export default {
|
|
|
},
|
|
|
//为了获取当前点击学生id和当前学生上传的作业
|
|
|
async onsist({ id }) {
|
|
|
- var arr = this.task.filter(item => item.id === id);
|
|
|
+ const result = await this.uploadtasklist({ studentid: id });
|
|
|
|
|
|
- this.$set(this, `lesson`, arr);
|
|
|
+ this.$set(this, `lesson`, result.data);
|
|
|
},
|
|
|
async opensave({ id, name, score }) {
|
|
|
this.show = true;
|
|
@@ -243,8 +223,10 @@ export default {
|
|
|
},
|
|
|
async onsave(form) {
|
|
|
this.form.id = this.taskid;
|
|
|
+
|
|
|
let res = await this.uploadtaskupdate(this.form);
|
|
|
this.show = false;
|
|
|
+ this.search();
|
|
|
},
|
|
|
},
|
|
|
};
|