guhongwei 4 年之前
父节点
当前提交
afbe77ed3c
共有 1 个文件被更改,包括 27 次插入2 次删除
  1. 27 2
      src/views/task/taskList.vue

+ 27 - 2
src/views/task/taskList.vue

@@ -1,6 +1,11 @@
 <template>
   <div id="taskList">
-    <list-frame :title="pageTitle" @query="search" :total="total" :needFilter="false" :needAdd="false">
+    <list-frame :title="pageTitle" @query="search" :needFilter="false" :needAdd="false" :needPag="false">
+      <el-col :span="24" class="total">
+        <p>
+          班级人数:<span>{{ stuTotal }}</span> 作业人数:<span>{{ total }}</span>
+        </p>
+      </el-col>
       <data-table :fields="fields" :data="tableData" :opera="opera" @view="toTaskDetail"></data-table>
     </list-frame>
   </div>
@@ -12,6 +17,7 @@ import dataTable from '@frame/components/data-table';
 import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: uploadtask } = createNamespacedHelpers('uploadtask');
 const { mapActions: task } = createNamespacedHelpers('task');
+const { mapActions: student } = createNamespacedHelpers('student');
 export default {
   name: 'taskList',
   props: {},
@@ -29,11 +35,13 @@ export default {
       { label: '作业得分', prop: 'score' },
     ],
     tableData: [],
+    stuTotal: 0,
     total: 0,
     options: undefined,
   }),
   created() {
     this.search();
+    this.searchstu();
   },
   computed: {
     ...mapState(['user', 'defaultOption']),
@@ -49,6 +57,7 @@ export default {
   },
   methods: {
     ...uploadtask(['fetch', 'query', 'update']),
+    ...student({ stuQuery: 'query' }),
     async search({ skip, limit, ...info } = {}) {
       const stutasks = await this.query({ skip, limit, lessonid: this.lessonid, classid: this.id });
       let tableData = _.uniqBy(stutasks.data, 'studentid');
@@ -58,6 +67,11 @@ export default {
     toTaskDetail(item) {
       this.$router.push({ path: '/task/taskDetail', query: { uploadtaskid: item.data._id } });
     },
+    // 查班级学生
+    async searchstu() {
+      let res = await this.stuQuery({ classid: this.id });
+      if (res.errcode == 0) this.$set(this, `stuTotal`, res.total);
+    },
   },
   watch: {
     defaultOption: {
@@ -81,4 +95,15 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.total {
+  padding: 0 0 15px 0;
+  p {
+    font-size: 18px;
+    span {
+      color: #ff0000;
+      font-weight: bold;
+    }
+  }
+}
+</style>