Quellcode durchsuchen

导出样式修改

lex-xin vor 4 Jahren
Ursprung
Commit
bab2aea275

+ 3 - 3
src/views/accompanyManager/accompanyList.vue

@@ -8,9 +8,9 @@
         class="newBand"
         v-permission="'export/practiceGroup'"
         @click="onStudentExport"
-        style="width: 120px"
+        style="width: 150px; max-width:150px"
       >
-        网管课续费提醒
+        网管课续费提醒导出
       </div>
       <div
         class="newBand"
@@ -476,7 +476,7 @@ export default {
                 } else {
                   let objectUrl = URL.createObjectURL(blob);
                   let link = document.createElement("a");
-                  let fname = "网管课续费提醒" + new Date().getTime(); //下载文件的名字
+                  let fname = "网管课续费提醒" + new Date().getTime() + '.xls'; //下载文件的名字
                   link.href = objectUrl;
                   link.setAttribute("download", fname);
                   document.body.appendChild(link);

+ 9 - 45
src/views/afterSchoolManager/afterWorkList.vue

@@ -259,6 +259,7 @@ import {
   findStudentExtraExerciseDetail
 } from "@/api/afterSchool";
 import { getEmployeeOrgan } from "@/api/buildTeam";
+import { Export } from '@/utils/downLoadFile'
 import axios from "axios";
 import { getToken } from "@/utils/auth";
 export default {
@@ -341,52 +342,15 @@ export default {
       this.getList();
     },
     // 导出
-    onExport () {
-      let url = "/api-web/export/extraExercisesReplys";
+    async onExport () {
       let obj = this.getDate();
-      const options = {
-        method: "get",
-        headers: {
-          Authorization: getToken()
-        },
-        url,
-        params: obj,
-        responseType: "blob"
-      };
-
-      this.$confirm("您确定导出列表?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      })
-        .then(() => {
-          axios(options).then(res => {
-            let blob = new Blob([res.data], {
-              // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8',
-              type: "application/vnd.ms-excel;charset=utf-8"
-              // word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
-            });
-            let objectUrl = URL.createObjectURL(blob);
-            let link = document.createElement("a");
-            let nowTime = new Date();
-            let ymd =
-              nowTime.getFullYear() +
-              "" +
-              (nowTime.getMonth() + 1) +
-              "" +
-              nowTime.getDate() +
-              "" +
-              nowTime.getHours() +
-              "" +
-              nowTime.getMinutes();
-            let fname = ymd + "课外训练(学员).xls";
-            link.href = objectUrl;
-            link.setAttribute("download", fname);
-            document.body.appendChild(link);
-            link.click();
-          });
-        })
-        .catch(() => { });
+      console.log(obj)
+      await Export(this, {
+        url: '/api-web/export/extraExercisesReplys',
+        fileName: '课外训练(学员).xlsx',
+        method: 'get',
+        params: obj
+      }, '您确定导出列表?')
     },
     getDate () {
       let obj = {};

+ 1 - 1
src/views/teamDetail/components/baseInfo.vue

@@ -193,7 +193,7 @@ export default {
               let ymd = nowTime.getFullYear() + '' + (nowTime.getMonth() + 1) + '' + nowTime.getDate() + '' +
                 nowTime.getHours() +
                 '' + nowTime.getMinutes()
-              let fname = this.$route.query.id + '-' + ymd + '订货清单' //下载文件的名字
+              let fname = this.$route.query.id + '-' + ymd + '订货清单.xls' //下载文件的名字
               link.href = objectUrl
               link.setAttribute("download", fname)
               document.body.appendChild(link)