|
@@ -1,53 +1,90 @@
|
|
|
<template>
|
|
|
<div id="index">
|
|
|
<list-frame :title="pageTitle" @query="search" :total="total" :needFilter="false" :needAdd="false">
|
|
|
- <data-table :fields="fields" :data="list" :opera="opera"></data-table>
|
|
|
+ <data-table :fields="fields" :data="tableData" :opera="opera" @view="toTaskList"></data-table>
|
|
|
</list-frame>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-var moment = require('moment');
|
|
|
-import _ from 'lodash';
|
|
|
-import Vue from 'vue';
|
|
|
import listFrame from '@frame/layout/admin/list-frame';
|
|
|
import dataTable from '@frame/components/data-table';
|
|
|
-import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
-const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
|
|
|
+import _ from 'lodash';
|
|
|
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
|
|
|
+const { mapActions: lesson } = createNamespacedHelpers('lesson');
|
|
|
+const { mapActions: util } = createNamespacedHelpers('util');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
|
components: { listFrame, dataTable },
|
|
|
- data: () => {
|
|
|
- return {
|
|
|
- opera: [],
|
|
|
- fields: [{ label: '姓名', prop: 'name' }],
|
|
|
- info: {},
|
|
|
- list: [],
|
|
|
- total: 0,
|
|
|
- };
|
|
|
- },
|
|
|
+ data: () => ({
|
|
|
+ opera: [
|
|
|
+ {
|
|
|
+ label: '查看学生评分',
|
|
|
+ icon: 'el-icon-view',
|
|
|
+ method: 'view',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ fields: [
|
|
|
+ { label: '课程日期', prop: 'date' },
|
|
|
+ { label: '课程名称', prop: 'subname' },
|
|
|
+ { label: '课程教师', prop: 'teaname' },
|
|
|
+ ],
|
|
|
+ tableData: [],
|
|
|
+ total: 0,
|
|
|
+ }),
|
|
|
created() {
|
|
|
this.search();
|
|
|
},
|
|
|
- methods: {
|
|
|
- ...trainplan(['query', 'create', 'delete', 'update', 'notice']),
|
|
|
- async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
- const res = await this.query({ skip, limit, ...info });
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- console.log(res);
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
computed: {
|
|
|
- ...mapState(['user']),
|
|
|
+ ...mapState(['user', 'defaultOption']),
|
|
|
pageTitle() {
|
|
|
return `${this.$route.meta.title}`;
|
|
|
},
|
|
|
+ id() {
|
|
|
+ return this.defaultOption.classid;
|
|
|
+ },
|
|
|
},
|
|
|
metaInfo() {
|
|
|
return { title: this.$route.meta.title };
|
|
|
},
|
|
|
+ methods: {
|
|
|
+ ...lesson({ lessionInfo: 'fetch', lessionList: 'query' }),
|
|
|
+ ...util({ modelFetch: 'fetch' }),
|
|
|
+ async search({ skip, limit, ...info } = {}) {
|
|
|
+ const classid = this.id;
|
|
|
+ const userid = this.user.userid;
|
|
|
+ const lesson = await this.modelFetch({ model: 'lesson', classid });
|
|
|
+ let lessons = _.get(lesson.data, 'lessons', []);
|
|
|
+ // lesson排序,只去时间最早的作为作业的上传lessonid,需要和学生作业列表处相同处理
|
|
|
+ let r = lessons.filter(f => f.subid);
|
|
|
+ r = r.map(r => {
|
|
|
+ let time = r.time.split('-');
|
|
|
+ r.start = `${r.date} ${time[0]}`;
|
|
|
+ return r;
|
|
|
+ });
|
|
|
+ r = Object.values(_.groupBy(r, 'subid'));
|
|
|
+ r = r.map(a => {
|
|
|
+ let na = _.orderBy(a, ['start'], ['asc']);
|
|
|
+ return _.head(na);
|
|
|
+ });
|
|
|
+ console.log(r);
|
|
|
+ this.$set(this, `tableData`, r);
|
|
|
+ this.$set(this, `total`, r.length);
|
|
|
+ },
|
|
|
+ toTaskList(item) {
|
|
|
+ this.$router.push({ path: '/stuscore/scoreList', query: { lessonid: item.data._id, teacherid: item.data.teaid } });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ id: {
|
|
|
+ handler(val) {
|
|
|
+ if (val) this.search();
|
|
|
+ else this.$set(this, `tableData`, []);
|
|
|
+ },
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|