reloaded 5 years ago
parent
commit
457ca82c06
1 changed files with 95 additions and 6 deletions
  1. 95 6
      src/views/train-plan/print.vue

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

@@ -1,22 +1,102 @@
 <template>
 <template>
   <div id="print">
   <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-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>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
+import listFrame from '@frame/layout/admin/list-frame';
 import { mapState, createNamespacedHelpers } from 'vuex';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: classes } = createNamespacedHelpers('classes');
+const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
 export default {
 export default {
   name: 'print',
   name: 'print',
   props: {},
   props: {},
-  components: {},
+  components: { listFrame },
   data: function() {
   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: {
   computed: {
-    ...mapState(['user']),
+    ...mapState(['user', 'defaultOption']),
     pageTitle() {
     pageTitle() {
       return `${this.$route.meta.title}`;
       return `${this.$route.meta.title}`;
     },
     },
@@ -24,6 +104,15 @@ export default {
   metaInfo() {
   metaInfo() {
     return { title: this.$route.meta.title };
     return { title: this.$route.meta.title };
   },
   },
+  watch: {
+    defaultOption: {
+      handler(val) {
+        this.form.termid = this.defaultOption.termid;
+        this.getBatch(this.form.termid);
+      },
+      deep: true,
+    },
+  },
 };
 };
 </script>
 </script>