lrf402788946 před 4 roky
rodič
revize
8c2bb5f56b
1 změnil soubory, kde provedl 5 přidání a 2 odebrání
  1. 5 2
      src/views/new-plan/stu-export.vue

+ 5 - 2
src/views/new-plan/stu-export.vue

@@ -3,7 +3,7 @@
     <detail-frame :title="pageTitle">
       <el-row type="flex" align="middle" justify="end" class="btn_bar">
         <el-col :span="3">
-          <el-button type="primary" size="mini" :disabled="selected.length <= 0">导出已选择计划下的学生</el-button>
+          <el-button type="primary" size="mini" :disabled="selected.length <= 0" @click="toExport">导出已选择计划下的学生</el-button>
         </el-col>
       </el-row>
       <data-table :fields="fields" :data="list" :total="total" :opera="[]" :select="true" :selected="selected" @handleSelect="handleSelect"></data-table>
@@ -36,7 +36,7 @@ export default {
   },
   created() {},
   methods: {
-    ...trainplan(['query']),
+    ...trainplan(['query', 'exportStudents']),
     async search({ skip = 0, limit = 10, ...info } = {}) {
       let planyearid = _.get(this.defaultOption, 'planyearid');
       const res = await this.query({ skip, limit, ...info, planyearid: planyearid });
@@ -51,6 +51,9 @@ export default {
     async toExport() {
       let ids = this.selected.map(i => i._id);
       // TODO连接接口去导出多个批次的学生
+      const res = await this.exportStudents(ids);
+      console.log(res);
+      if (this.$checkRes(res)) window.open(res.data);
     },
   },
   watch: {