فهرست منبع

Merge branch 'master' of http://git.cc-lotus.info/new_train/train-center

lrf402788946 5 سال پیش
والد
کامیت
f5b3f5791f
4فایلهای تغییر یافته به همراه265 افزوده شده و 31 حذف شده
  1. 4 0
      src/store/index.js
  2. 48 19
      src/views/student/index.vue
  3. 99 6
      src/views/train-plan/print.vue
  4. 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 },

+ 48 - 19
src/views/student/index.vue

@@ -2,14 +2,19 @@
   <div id="index">
     <list-frame title="学生管理" @query="search" :total="total" :needFilter="false" @add="$router.push({ path: '/student/detail' })">
       <el-form :inline="true" size="mini">
-        <el-form-item label="选择计划">
-          <el-select v-model="searchInfo.planid" @change="getTerm" clearable>
-            <el-option v-for="(i, index) in planList" :key="index" :label="i.title" :value="i.id"></el-option>
+        <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="searchInfo.termid" clearable>
-            <el-option v-for="(i, index) in termList" :key="index" :label="i.term" :value="i._id"></el-option>
+        <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>
@@ -24,8 +29,9 @@
 <script>
 import listFrame from '@frame/layout/admin/list-frame';
 import dataTable from '@frame/components/data-table';
-import { createNamespacedHelpers } from 'vuex';
+import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions } = createNamespacedHelpers('student');
+const { mapActions: classes } = createNamespacedHelpers('classes');
 const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
 
 export default {
@@ -64,23 +70,26 @@ export default {
       { label: '手机号', prop: 'phone' },
       { label: '邮箱', prop: 'email' },
     ],
+    form: {},
     searchInfo: {},
     list: [],
-    planList: [],
+    classList: [],
+    batchList: [],
     termList: [],
     total: 0,
   }),
   created() {
     this.getPlan();
   },
-  computed: {},
+  computed: { ...mapState(['user', 'defaultOption']) },
   methods: {
-    ...trainplan({ getPlanList: 'query' }),
+    ...trainplan({ planfetch: 'fetch' }),
     ...mapActions(['query', 'delete']),
+    ...classes({ classesquery: 'query' }),
     async search({ skip = 0, limit = 10, ...info } = {}) {
-      let data;
-      this.searchInfo.termid && this.searchInfo.termid !== '' ? (data = { termid: this.searchInfo.termid }) : '';
-      const res = await this.query({ skip, limit, ...data });
+      //let data;
+      // this.searchInfo.termid && this.searchInfo.termid !== '' ? (data = { termid: this.searchInfo.termid }) : '';
+      const res = await this.query({ skip, limit, termid: this.form.termid, classid: this.form.classid });
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);
         this.$set(this, `total`, res.total);
@@ -95,13 +104,33 @@ export default {
       this.search();
     },
     async getPlan() {
-      let res = await this.getPlanList();
-      if (res.errcode === 0) this.$set(this, `planList`, res.data);
+      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);
     },
-    getTerm(data) {
-      let term = this.planList.find(f => f.id === data);
-      if (term) this.$set(this, `termList`, term.termnum);
-      else this.$set(this, `termList`, []);
+  },
+  watch: {
+    defaultOption: {
+      handler(val) {
+        this.form.termid = this.defaultOption.termid;
+        this.getBatch(this.form.termid);
+      },
+      deep: true,
     },
   },
 };

+ 99 - 6
src/views/train-plan/print.vue

@@ -1,22 +1,106 @@
 <template>
   <div id="print">
-    <p>print</p>
+    <list-frame title="打印管理" @query="search" :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="请先选择期数">
+            <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>
+          <el-button type="primary" @click="search">查询</el-button>
+          <el-button @click="nameList()">打印学生名签</el-button>
+          <el-button @click="signList()">打印学生签到表</el-button>
+          <el-button @click="certList()">打印学生证书</el-button>
+          <el-button @click="classLesson()">打印班级课表</el-button>
+        </el-form-item>
+      </el-form>
+      <template>
+        <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
+          <el-table-column type="selection" width="55"> </el-table-column>
+          <el-table-column prop="batch" label="批次"> </el-table-column>
+          <el-table-column prop="name" label="班级名称" show-overflow-tooltip> </el-table-column>
+        </el-table>
+        <!-- <div style="margin-top: 20px">
+          <el-button @click="nameList()">打印学生名签</el-button>
+          <el-button @click="signList()">打印学生签到表</el-button>
+          <el-button @click="certList()">打印学生证书</el-button>
+          <el-button @click="classLesson()">打印班级课表</el-button>
+        </div> -->
+      </template>
+    </list-frame>
   </div>
 </template>
 
 <script>
+import listFrame from '@frame/layout/admin/list-frame';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: classes } = createNamespacedHelpers('classes');
+const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
 export default {
   name: 'print',
   props: {},
-  components: {},
+  components: { listFrame },
   data: function() {
-    return {};
+    return {
+      form: {},
+      termList: [],
+      batchList: [],
+      tableData: [],
+      total: 0,
+      classList: [],
+    };
+  },
+  created() {
+    this.searchinfo();
+  },
+  methods: {
+    ...trainplan({ planfetch: 'fetch' }),
+    ...classes({ classesquery: 'query' }),
+    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 search() {
+      const res = await this.classesquery({ batchid: this.form.batchid, termid: this.form.termid });
+      this.$set(this, `tableData`, res.data);
+      this.$set(this, `total`, res.total);
+    },
+    handleSelectionChange(val) {
+      this.classList = val;
+    },
+    nameList() {
+      console.log(this.classList);
+    },
+    signList() {
+      console.log(this.classList);
+    },
+    certList() {
+      console.log(this.classList);
+    },
+    classLesson() {
+      console.log(this.classList);
+    },
   },
-  created() {},
-  methods: {},
   computed: {
-    ...mapState(['user']),
+    ...mapState(['user', 'defaultOption']),
     pageTitle() {
       return `${this.$route.meta.title}`;
     },
@@ -24,6 +108,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>
 

+ 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>