reloaded vor 5 Jahren
Ursprung
Commit
29b6f16363
2 geänderte Dateien mit 118 neuen und 6 gelöschten Zeilen
  1. 4 0
      src/store/index.js
  2. 114 6
      src/views/train-plan/score.vue

+ 4 - 0
src/store/index.js

@@ -24,6 +24,8 @@ import count from '@frame/store/count';
 import setting from '@frame/store/setting';
 import trainBatch from '@frame/store/train-plan-year';
 import attendance from '@frame/store/attendance';
+import group from '@frame/store/group';
+import uploadtask from '@frame/store/uploadtask';
 
 import nation from '@frame/store/nation';
 import completion from '@frame/store/question-completion';
@@ -71,6 +73,8 @@ export default new Vuex.Store({
     setting,
     trainBatch,
     attendance,
+    group,
+    uploadtask,
   },
   state: { ...ustate, ...dostate },
   mutations: { ...umutations, ...domutations },

+ 114 - 6
src/views/train-plan/score.vue

@@ -1,22 +1,121 @@
 <template>
   <div id="score">
-    <p>score</p>
+    <list-frame title="学生成绩查看" @query="onsearch" :total="total" :needFilter="false" :needAdd="false">
+      <el-form :inline="true" size="mini">
+        <el-form-item label="期">
+          <el-select v-model="form.termid" placeholder="请选择期数" @change="getBatch">
+            <el-option v-for="(i, index) in termList" :key="index" :label="`第${i.term}期`" :value="i._id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="批次">
+          <el-select v-model="form.batchid" placeholder="请先选择期数" @change="getClasses">
+            <el-option v-for="(i, index) in batchList" :key="index" :label="i.name" :value="i._id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="班级">
+          <el-select v-model="form.classid" placeholder="请先选择批次">
+            <el-option v-for="(i, index) in classList" :key="index" :label="i.name" :value="i._id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="">
+          <el-button type="primary" size="mini" @click="onsearch()"> 查询</el-button>
+        </el-form-item>
+      </el-form>
+      <data-table :fields="fields" :data="list" :opera="opera" @viewtask="viewtask"> </data-table>
+    </list-frame>
+    <el-dialog title="学生作业" :visible.sync="dialog">
+      <data-table :fields="taskfields" :data="tasklist"> </data-table>
+    </el-dialog>
   </div>
 </template>
 
 <script>
+import _ from 'lodash';
+import listFrame from '@frame/layout/admin/list-frame';
+import dataTable from '@frame/components/data-table';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: student } = createNamespacedHelpers('student');
+const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
+const { mapActions: classes } = createNamespacedHelpers('classes');
+const { mapActions: group } = createNamespacedHelpers('group');
+const { mapActions: uploadtask } = createNamespacedHelpers('uploadtask');
 export default {
   name: 'score',
   props: {},
-  components: {},
+  components: {
+    listFrame,
+    dataTable,
+  },
   data: function() {
-    return {};
+    return {
+      classList: [],
+      batchList: [],
+      termList: [],
+      fields: [
+        { label: '学生姓名', prop: 'name' },
+        { label: '个人分', prop: 'selfscore' },
+        { label: '总分', prop: 'score' },
+        { label: '小组分', prop: 'groupscore' },
+      ],
+      opera: [
+        {
+          label: '查看学生作业',
+          icon: 'el-icon-view',
+          method: 'viewtask',
+        },
+      ],
+      form: {},
+      list: [],
+      total: 0,
+      dialog: false,
+      taskfields: [
+        { label: '科目名称', prop: 'lessonname' },
+        { label: '科目成绩', prop: 'score' },
+      ],
+      tasklist: [],
+    };
+  },
+  created() {
+    this.searchinfo();
+  },
+  methods: {
+    ...trainplan({ planfetch: 'fetch' }),
+    ...classes({ classesquery: 'query' }),
+    ...student({ stuquery: 'query', findscore: 'findscore' }),
+    async searchinfo() {
+      const res = await this.planfetch(this.defaultOption.planid);
+      let terms = res.data.termnum;
+      this.$set(this, `termList`, terms);
+      if (this.defaultOption.termid) {
+        this.form.termid = this.defaultOption.termid;
+        this.getBatch(this.form.termid);
+      }
+    },
+    getBatch(termid) {
+      let batchs = this.termList.filter(f => f._id === termid);
+      if (batchs.length > 0) {
+        let { batchnum } = batchs[0];
+        this.$set(this, `batchList`, batchnum);
+      }
+    },
+    async getClasses(batchid) {
+      const res = await this.classesquery({ batchid });
+      this.$set(this, `classList`, res.data);
+    },
+    async onsearch({ skip = 0, limit = 10, ...info } = {}) {
+      const res = await this.findscore({ skip, limit, termid: this.form.termid, classid: this.form.classid, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `total`, res.total);
+        this.$set(this, `list`, res.data);
+      }
+    },
+    async viewtask({ data }) {
+      this.dialog = true;
+      this.$set(this, `tasklist`, data.tasks);
+    },
   },
-  created() {},
-  methods: {},
   computed: {
-    ...mapState(['user']),
+    ...mapState(['user', 'defaultOption']),
     pageTitle() {
       return `${this.$route.meta.title}`;
     },
@@ -24,6 +123,15 @@ export default {
   metaInfo() {
     return { title: this.$route.meta.title };
   },
+  watch: {
+    defaultOption: {
+      handler(val) {
+        this.form.termid = this.defaultOption.termid;
+        this.getBatch(this.form.termid);
+      },
+      deep: true,
+    },
+  },
 };
 </script>