Parcourir la source

up:BUG处理,学员数据导出

yangdamao il y a 3 ans
Parent
commit
5c60ddeb3f

+ 11 - 1
src/components/tableList.vue

@@ -1809,7 +1809,7 @@
 import bankMsg from "./bankMsg";
 export default {
   components: { bankMsg },
-  props: ["tableSets", "tableData", "navText", "rowKey", "loading"],
+  props: ["tableSets", "tableData", "navText", "rowKey", "loading" ,"studentTable"],
   data: function () {
     return {
       diaviosOpen: false,
@@ -1893,6 +1893,12 @@ export default {
     },
   },
   created() {
+    if(this.studentTable){
+      let data = sessionStorage.getItem('studentTableList')
+      if(data && data !==''){
+        this.tableSet = JSON.parse(data)
+      } 
+    }
     this.inittableSet = JSON.stringify(this.tableSet);
     this.initTR();
   },
@@ -2424,6 +2430,7 @@ export default {
     },
     //自定义列全选按钮触发
     handleCheckAllChange(val) {
+      console.log(val,'val');
       this.checkedCities = val ? this.cities : [];
       this.isIndeterminate = false;
       if (val) {
@@ -2460,6 +2467,9 @@ export default {
       this.tableSet = [];
       this.$nextTick(() => {
         this.tableSet = copyTable;
+        if(this.studentTable){
+          sessionStorage.setItem('studentTableList',JSON.stringify(copyTable))
+        }     
       });
     },
     //自定义列重置

+ 8 - 0
src/newApi/classTab.js

@@ -72,6 +72,14 @@ export default {
             params: data
         })
     },
+    //导出班级学员列表
+    inquireGradegradeexportGrade(data) {
+        return request({
+            url: '/grade/grade/exportListGrade',
+            method: 'get',
+            params: data
+        })
+    },
     //查询学员学时列表
     inquireGradegradelistUserPeriod(data) {
         return request({

+ 29 - 0
src/views/education/classManageMent/studentMenu/index.vue

@@ -50,6 +50,7 @@
       :tableSets="tableSet"
       :tableData="tableData"
       :navText="navText"
+      :studentTable="true"
       @addClick="addClick"
       :loading="loading"
       @editInfo="editInfo"
@@ -111,6 +112,10 @@
           <el-option label="是" :value="1"> </el-option>
           <el-option label="否" :value="0"> </el-option>
         </el-select>
+         <el-button
+          size="medium"
+          @click="exportGrade"
+          >导出学员数据</el-button>
       </template>
       <template slot="btn" slot-scope="props">
         <el-button type="text" @click="addClick(props.scope.row, 2)"
@@ -582,6 +587,7 @@ import tableList from "@/components/tableList";
 import pagination from "@/components/pagination";
 import accountTag from "@/components/AccountTag";
 import quickLogin from "@/components/quickLogin";
+import * as baseUrls from "@/utils/request.js";
 
 export default {
   components: { tableList, pagination, accountTag, quickLogin },
@@ -1140,6 +1146,29 @@ export default {
         }
       }
     },
+    //导出学员数据
+    exportGrade(){
+      this.formData.gradeId = this.$route.query.id,
+      this.formData.status = '0,1',
+      console.log(this.formData,'this.formData');
+      this.$api
+        .inquireGradegradeexportGrade(this.formData)
+        .then((res) => {
+            if (res.msg) {
+              let url = baseUrls.baseURL + "common/download?fileName=" + res.msg;
+              let link = document.createElement("a");
+              let fileName = "班级学员数据" + ".xlsx";
+              document.body.appendChild(link);
+              link.href = url;
+              link.dowmload = fileName;
+              link.click();
+              link.remove();
+              this.$message.success("导出成功");
+            } else {
+              this.$message.error("导出失败");
+            }
+        })
+    },
     search(int) {
       this.loading = true;
       if (int === 1) {