lrf402788946 4 éve
szülő
commit
1d005fd3bd
3 módosított fájl, 91 hozzáadás és 0 törlés
  1. 6 0
      src/router/index.js
  2. 2 0
      src/store/index.js
  3. 83 0
      src/views/classes/newspaper.vue

+ 6 - 0
src/router/index.js

@@ -232,6 +232,12 @@ const routes = [
         meta: { title: '培训心得' },
         meta: { title: '培训心得' },
         component: () => import('@/views/experience/index.vue'),
         component: () => import('@/views/experience/index.vue'),
       },
       },
+      {
+        path: '/newspaper/index',
+        name: 'newspaper_index',
+        meta: { title: '新人才报' },
+        component: () => import('@/views/classes/newspaper.vue'),
+      },
     ],
     ],
   },
   },
   {
   {

+ 2 - 0
src/store/index.js

@@ -34,6 +34,7 @@ import task from '@frame/store/task';
 import trainvideo from '@frame/store/trainvideo';
 import trainvideo from '@frame/store/trainvideo';
 import cerconfirm from '@frame/store/cerconfirm';
 import cerconfirm from '@frame/store/cerconfirm';
 import score from '@frame/store/score';
 import score from '@frame/store/score';
+import talented from '@frame/store/talented';
 import experience from '@frame/store/experience';
 import experience from '@frame/store/experience';
 import * as ustate from '@frame/store/user/state';
 import * as ustate from '@frame/store/user/state';
 import * as umutations from '@frame/store/user/mutations';
 import * as umutations from '@frame/store/user/mutations';
@@ -78,6 +79,7 @@ export default new Vuex.Store({
     task,
     task,
     score,
     score,
     experience,
     experience,
+    talented,
   },
   },
   state: { ...ustate, ...dostate },
   state: { ...ustate, ...dostate },
   mutations: { ...umutations, ...domutations },
   mutations: { ...umutations, ...domutations },

+ 83 - 0
src/views/classes/newspaper.vue

@@ -0,0 +1,83 @@
+<template>
+  <div id="newspaper">
+    <list-frame title="新人才报" @query="search" :total="total" :needFilter="false" :needAdd="false">
+      <data-table :fields="fields" :data="list" :opera="opera" @download="download"></data-table>
+    </list-frame>
+  </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: talented } = createNamespacedHelpers('talented');
+
+export default {
+  metaInfo: { title: '新人才报' },
+  name: 'newspaper',
+  props: {},
+  components: {
+    listFrame,
+    dataTable,
+  },
+  data: () => ({
+    opera: [
+      {
+        label: '下载',
+        icon: 'el-icon-download',
+        method: 'download',
+      },
+    ],
+    fields: [{ label: '姓名', prop: 'stuname' }],
+    list: [],
+    classList: [],
+    total: 0,
+  }),
+  async created() {
+    this.search();
+  },
+  computed: { ...mapState(['user', 'defaultOption']) },
+  methods: {
+    ...talented(['query', 'export']),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      this.$set(this, `total`, 0);
+      const { classid } = this.defaultOption;
+      if (!classid) return;
+      const res = await this.query({ ...this.searchInfo, skip, limit, classid });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    // 下载
+    async download({ data }) {
+      const { id } = data;
+      const r = await this.export({ id });
+      if (this.$checkRes(r)) {
+        window.open(r.data);
+      }
+    },
+    async toGetStudent(classid) {
+      const res = await this.getStudent({ classid, job: '宣传委员' });
+      if (this.$checkRes(res)) this.$set(this, `studentList`, res.data);
+    },
+    async toExport(data) {
+      const r = await this.export(data);
+      if (this.$checkRes(r)) {
+        window.open(r.data);
+      }
+    },
+  },
+  watch: {
+    defaultOption: {
+      deep: true,
+      handler(val, oval) {
+        this.search();
+      },
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>