|
@@ -3,27 +3,17 @@
|
|
|
<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">
|
|
|
<achieves
|
|
|
- @clickDialog="opensave"
|
|
|
@submit="onsave"
|
|
|
- :peaceAchieveList="peaceAchieveList"
|
|
|
- :showPicker="showPicker"
|
|
|
- :peaceScore="peaceScore"
|
|
|
- @showBtn="showBtn"
|
|
|
- @onConfirm="onConfirm"
|
|
|
- :achieveList="achieveList"
|
|
|
- @submitss="onsist"
|
|
|
- :show="show"
|
|
|
- :form="form"
|
|
|
- :deptList="deptList"
|
|
|
+ @save="dailyUpdate"
|
|
|
+ :studentList="studentList"
|
|
|
+ :scoreList="scoreList"
|
|
|
+ :classInfo="classInfo"
|
|
|
:lesson="lesson"
|
|
|
- :lesslist="lesslist"
|
|
|
- :names="names"
|
|
|
- :score="score"
|
|
|
+ :achieveList="achieveList"
|
|
|
></achieves>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
@@ -36,11 +26,10 @@ import NavBar from '@/layout/common/topInfo.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: util } = createNamespacedHelpers('util');
|
|
|
+const { mapActions: classes } = createNamespacedHelpers('classes');
|
|
|
const { mapActions: mapUploadtask } = createNamespacedHelpers('uploadtask');
|
|
|
-const { mapActions: mapSubject } = createNamespacedHelpers('subject');
|
|
|
-const { mapActions: group } = createNamespacedHelpers('group');
|
|
|
+const { mapActions: pscore } = createNamespacedHelpers('personalscore');
|
|
|
export default {
|
|
|
name: 'achieve',
|
|
|
props: {},
|
|
@@ -49,33 +38,74 @@ export default {
|
|
|
achieves, //班级学生成绩列表
|
|
|
},
|
|
|
data: () => ({
|
|
|
- peaceAchieveList: [],
|
|
|
- showPicker: false,
|
|
|
- peaceScore: '',
|
|
|
- studid: '',
|
|
|
- lesson: [],
|
|
|
- lesslist: [],
|
|
|
- names: '',
|
|
|
- score: '',
|
|
|
- deptList: [],
|
|
|
+ studentList: [],
|
|
|
achieveList: [],
|
|
|
- show: false,
|
|
|
- form: {},
|
|
|
+ scoreList: [],
|
|
|
+ lesson: [],
|
|
|
+ classInfo: {},
|
|
|
title: '',
|
|
|
isleftarrow: '',
|
|
|
- transitionName: 'fade',
|
|
|
navShow: true,
|
|
|
- // 修改
|
|
|
- stuid: '',
|
|
|
- taskid: '',
|
|
|
- subname: '',
|
|
|
- task: [],
|
|
|
- homework: [],
|
|
|
- groupsocre: '',
|
|
|
}),
|
|
|
- created() {
|
|
|
- this.search();
|
|
|
- this.searchinfo();
|
|
|
+ async created() {
|
|
|
+ await this.getClass();
|
|
|
+ await this.toGetPScoreList();
|
|
|
+ await this.search();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...util({ modelFetch: 'fetch' }),
|
|
|
+ ...pscore({ getPScoreList: 'query', pscoreOpera: 'opera' }),
|
|
|
+ ...mapStudent({ list: 'query' }),
|
|
|
+ ...classes({ getClassInfo: 'fetch' }),
|
|
|
+ ...mapUploadtask({ uploadtaskinfo: 'fetch', uploadtasklist: 'query', uploadtaskupdate: 'update' }),
|
|
|
+ async getClass() {
|
|
|
+ const res = await this.getClassInfo(this.classid);
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `classInfo`, res.data);
|
|
|
+ const lres = await this.modelFetch({ model: 'lesson', classid: this.classid });
|
|
|
+ if (this.$checkRes(lres)) {
|
|
|
+ let { lessons } = lres.data;
|
|
|
+ if (lessons) {
|
|
|
+ lessons = _.uniqBy(
|
|
|
+ lessons.filter(f => f.subid),
|
|
|
+ 'subid'
|
|
|
+ );
|
|
|
+ this.$set(this, `lesson`, lessons);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 平时成绩学生名单查询+作业成绩学生名单查询
|
|
|
+ async search() {
|
|
|
+ let classid = this.classid;
|
|
|
+ const res = await this.list({ classid });
|
|
|
+ this.$set(this, `studentList`, res.data);
|
|
|
+ const result = await this.uploadtasklist({ classid });
|
|
|
+ // 整理学生的作业
|
|
|
+ const stuGroups = _.groupBy(result.data, 'studentid');
|
|
|
+ const aList = [];
|
|
|
+ for (const id in stuGroups) {
|
|
|
+ const head = stuGroups[id][0];
|
|
|
+ if (!head) continue;
|
|
|
+ const { stuname: name } = head;
|
|
|
+ const newobj = { name, lesson: stuGroups[id] };
|
|
|
+ aList.push(newobj);
|
|
|
+ }
|
|
|
+ this.$set(this, `achieveList`, aList);
|
|
|
+ },
|
|
|
+ //third 获取该班平时分
|
|
|
+ async toGetPScoreList() {
|
|
|
+ const res = await this.getPScoreList({ classid: this.classid });
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `scoreList`, res.data);
|
|
|
+ },
|
|
|
+ // third 平时分保存(添加/修改)
|
|
|
+ async dailyUpdate(data) {
|
|
|
+ const res = await this.pscoreOpera(data);
|
|
|
+ if (this.$checkRes(res, '修改成功', res.errmsg || '修改失败')) this.toGetPScoreList();
|
|
|
+ },
|
|
|
+ async onsave({ data }) {
|
|
|
+ const obj = { id: data.id, score: data.score };
|
|
|
+ await this.uploadtaskupdate(obj);
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
@@ -93,142 +123,6 @@ export default {
|
|
|
this.isleftarrow = to.meta.isleftarrow;
|
|
|
},
|
|
|
},
|
|
|
- methods: {
|
|
|
- ...mapStudent({ list: 'query', add: 'create', fet: 'fetch', updates: 'update' }),
|
|
|
- ...mapClass({ classinfo: 'fetch', classlist: 'query' }),
|
|
|
- ...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;
|
|
|
- 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 result.data) {
|
|
|
- var arr = res.data.filter(item => item.id === accc.studentid);
|
|
|
- this.$set(this, `achieveList`, arr);
|
|
|
- }
|
|
|
- },
|
|
|
- // 学委上作业分+存储学生id
|
|
|
- clickAchieve({ id }) {
|
|
|
- this.$set(this, `stuid`, id);
|
|
|
- this.show = true;
|
|
|
- },
|
|
|
- // 学委上作业分提交
|
|
|
- async submitAchieve(form) {
|
|
|
- this.form.id = this.stuid;
|
|
|
- let data = this.form;
|
|
|
- const res = await this.uploadtaskupdate(data);
|
|
|
- this.show = false;
|
|
|
- },
|
|
|
- // 平时成绩上分显示+学生id
|
|
|
- showBtn(id) {
|
|
|
- this.$set(this, `studid`, id);
|
|
|
- this.showPicker = true;
|
|
|
- },
|
|
|
- // 给学生上分
|
|
|
- async onConfirm(peaceScore) {
|
|
|
- let data = {};
|
|
|
- data.id = this.studid;
|
|
|
-
|
|
|
- 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',
|
|
|
- });
|
|
|
-
|
|
|
- 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 } = {}) {
|
|
|
- // let classid = this.user.classid;
|
|
|
- // const result = await this.uploadtasklist({ classid });
|
|
|
- // const res = await this.list({ classid });
|
|
|
- // 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._id === newsid);
|
|
|
- // for (const less of fff) {
|
|
|
- // this.$set(this, `subname`, less.subname);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // val.subName = this.subname;
|
|
|
- // const stuInfo = await this.fet(val.studentid);
|
|
|
- // val.stuName = stuInfo.data.name;
|
|
|
- // //创建学生名字相关数组
|
|
|
- // let stu = [{ stuname: stuInfo.data.name, id: val.studentid }];
|
|
|
- // //合并数组
|
|
|
- // stus = [...stu, ...stus];
|
|
|
- // //去掉重复数组对象
|
|
|
- // var appArray = _.uniqWith(stus, _.isEqual);
|
|
|
- // //合并数组
|
|
|
- // this.$set(this, `achieveList`, appArray);
|
|
|
- // let lessonss = [{ name: this.subname, id: val.studentid, taskid: val.id, score: val.score, less: [] }];
|
|
|
- // lessone = [...lessonss, ...lessone];
|
|
|
- // var appArrayss = _.uniqWith(lessone, _.isEqual);
|
|
|
- // this.$set(this, `task`, lessone);
|
|
|
- // console.log(appArrayss);
|
|
|
- // }
|
|
|
- },
|
|
|
- //为了获取当前点击学生id和当前学生上传的作业
|
|
|
- async onsist({ id }) {
|
|
|
- const result = await this.uploadtasklist({ studentid: id });
|
|
|
-
|
|
|
- this.$set(this, `lesson`, result.data);
|
|
|
- },
|
|
|
- async opensave({ id, name, score }) {
|
|
|
- this.show = true;
|
|
|
- this.$set(this, `names`, name);
|
|
|
- this.$set(this.form, `score`, score);
|
|
|
- this.$set(this, `taskid`, id);
|
|
|
- },
|
|
|
- async onsave(form) {
|
|
|
- this.form.id = this.taskid;
|
|
|
-
|
|
|
- let res = await this.uploadtaskupdate(this.form);
|
|
|
- this.show = false;
|
|
|
- this.search();
|
|
|
- },
|
|
|
- },
|
|
|
};
|
|
|
</script>
|
|
|
|