Browse Source

修改提示

lex-xin 4 years ago
parent
commit
bdb10c3b1e

+ 26 - 24
src/views/businessManager/orderManager/financeManager.vue

@@ -883,7 +883,7 @@ export default {
         },
         data: qs.stringify(cleanDeep(data)),
         url,
-        responseType: "blob",
+        responseType: "json",
       };
       this.$confirm("您确定导出报表", "提示", {
         confirmButtonText: "确定",
@@ -893,30 +893,32 @@ export default {
         .then(() => {
           load.startLoading();
           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 = "报表导出" + new Date().getTime() + ".xls"; //下载文件的名字
-            link.href = objectUrl;
-            link.setAttribute("download", fname);
-            document.body.appendChild(link);
-            link.click();
             load.endLoading();
+            this.$message.info(res.data.data);
+            // 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 = "报表导出" + new Date().getTime() + ".xls"; //下载文件的名字
+            // link.href = objectUrl;
+            // link.setAttribute("download", fname);
+            // document.body.appendChild(link);
+            // link.click();
+            // load.endLoading();
           });
         })
         .catch(() => {});

+ 11 - 34
src/views/businessManager/orderManager/income.vue

@@ -442,7 +442,7 @@ export default {
         },
         data: qs.stringify(cleanDeep(data)),
         url,
-        responseType: "blob",
+        responseType: "json",
       };
       this.$confirm("您确定导出报表", "提示", {
         confirmButtonText: "确定",
@@ -453,40 +453,17 @@ export default {
           load.startLoading();
           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 text = new Response(blob).text();
-              text.then((res) => {
-                // 判断是否报错
-                if (res.indexOf("code") != -1) {
-                  let json = JSON.parse(res);
-                  this.$message.error(json.msg);
-                } else {
-                  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 = "报表导出" + new Date().getTime()+'.xls'; //下载文件的名字
-                  link.href = objectUrl;
-                  link.setAttribute("download", fname);
-                  document.body.appendChild(link);
-                  link.click();
-                }
-              });
-
               load.endLoading();
+              this.$message.info(res.data.data);
+              // this.$confirm(res.data.data, "提示", {
+              //   confirmButtonText: "确定",
+              //   cancelButtonText: "取消",
+              //   type: "warning",
+              // }).then(() => {
+
+              // }).catch(err => {
+
+              // })
             })
             .catch((error) => {
               this.$message.error("导出数据失败,请联系管理员");