guhongwei 5 years ago
parent
commit
88f77028b8
3 changed files with 71 additions and 2 deletions
  1. 8 2
      src/router/index.js
  2. 7 0
      src/views/teacher/index.vue
  3. 56 0
      src/views/teacher/printTea.vue

+ 8 - 2
src/router/index.js

@@ -54,6 +54,11 @@ const system = [
     meta: { title: '教师', sub: '管理' },
     component: () => import('@/views/teacher/index.vue'),
   },
+  {
+    path: '/teacher/printTea',
+    meta: { title: '教师打印' },
+    component: () => import('@/views/teacher/printTea.vue'),
+  },
   {
     path: '/teacher/means',
     name: 'teacher_means',
@@ -516,8 +521,9 @@ const routes = [
     ],
   },
   {
-    path: '/teacher/index',
-    component: () => import('@/views/teacher/index.vue'),
+    path: '/teacher/printTea',
+    meta: { title: '教师打印预览' },
+    component: () => import('@/views/teacher/printTea.vue'),
   },
   {
     path: '/yearPlan/index',

+ 7 - 0
src/views/teacher/index.vue

@@ -10,6 +10,9 @@
         </template>
       </template>
       <el-row type="flex" align="middle" justify="end" class="btn_bar">
+        <el-col :span="3" style="text-align:right;padding:0 10px;">
+          <el-button type="primary" size="mini" @click="printView()">打印预览</el-button>
+        </el-col>
         <el-col :span="3">
           <el-button size="mini" type="primary" @click="downloadTemplate">下载上传教师评分模板</el-button>
         </el-col>
@@ -172,6 +175,10 @@ export default {
     downloadTemplate() {
       window.open('/teacherScoreTemplate.xlsx');
     },
+    // 打印教师
+    printView() {
+      this.$router.push({ path: '/teacher/printTea', query: {} });
+    },
   },
 };
 </script>

+ 56 - 0
src/views/teacher/printTea.vue

@@ -0,0 +1,56 @@
+<template>
+  <div id="printTea">
+    <detail-frame :title="mainTitle" returns="./index">
+      <teacherPrint :teacherList="teacherList"></teacherPrint>
+    </detail-frame>
+  </div>
+</template>
+
+<script>
+import teacherPrint from '@frame/parts/print/teacherPrint.vue';
+import detailFrame from '@frame/layout/admin/detail-frame';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('teacher');
+export default {
+  metaInfo: { title: '教师打印' },
+  name: 'printTea',
+  props: {},
+  components: {
+    detailFrame,
+    teacherPrint,
+  },
+  data: function() {
+    return {
+      teacherList: [],
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...mapActions(['query', 'delete', 'scoreImport', 'status']),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      const res = await this.query({ skip, status: '4', ...info });
+      if (this.$checkRes(res)) {
+        console.log(res.data);
+        this.$set(this, `teacherList`, res.data);
+      }
+    },
+  },
+  computed: {
+    mainTitle() {
+      let meta = this.$route.meta;
+      let main = meta.title || '';
+      let sub = meta.sub || '';
+      return `${main}${sub}`;
+    },
+    keyWord() {
+      let meta = this.$route.meta;
+      let main = meta.title || '';
+      return main;
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>