lrf402788946 4 роки тому
батько
коміт
98d04c1b54
1 змінених файлів з 12 додано та 1 видалено
  1. 12 1
      src/views/classes/name-list.vue

+ 12 - 1
src/views/classes/name-list.vue

@@ -11,6 +11,7 @@
         <el-col :span="12">
           <el-button type="primary" size="mini" @click="addstu()">添加学生</el-button>
           <el-button type="primary" size="mini" @click="toComputIsFine()" :disabled="this.defaultOption.classid ? false : true">设置优秀学员</el-button>
+          <el-button type="primary" size="mini" @click="toExportList()">导出学生名单</el-button>
         </el-col>
       </el-col>
       <data-table :fields="fields" :data="list" :opera="opera" @edit="toEdit" @delete="toDelete" @post="toPost"> </data-table>
@@ -110,7 +111,7 @@ export default {
     this.seachGroup();
   },
   methods: {
-    ...mapActions(['query', 'delete', 'computedIsFine']),
+    ...mapActions(['query', 'delete', 'computedIsFine', 'toExport']),
     ...group({ groupQuery: 'query' }),
     async seachGroup() {
       let classid = this.id;
@@ -164,6 +165,16 @@ export default {
       const res = await this.computedIsFine(this.defaultOption.classid);
       if (this.$checkRes(res, '优秀学员设置成功', res.errmsg || '优秀学员设置失败')) this.search();
     },
+    // 导出学生名单
+    async toExportList() {
+      const msg = this.$message({ duration: 0, message: '正在导出,请稍后...' });
+      const res = await this.toExport({ classid: this.id });
+      msg.close();
+      if (this.$checkRes(res)) {
+        const { data } = res;
+        window.open(data);
+      }
+    },
   },
   computed: {
     ...mapState(['user', 'defaultOption']),