Przeglądaj źródła

Merge branch 'master' of https://git.agilestar.cn/spfm-group/spfm-market-front

noob 3 lat temu
rodzic
commit
df54894d8a
1 zmienionych plików z 27 dodań i 26 usunięć
  1. 27 26
      src/pages/main/performance/reply.vue

+ 27 - 26
src/pages/main/performance/reply.vue

@@ -145,23 +145,23 @@ export default {
     handleDownload() {
       this.$http({
         url: "/market/CMKIssued/exportCMKIssuedReplyStatistics",
-        method: "get",
+        method: "post",
         headers: {
           "Content-Type": "application/json",
         },
         responseType: "blob",
         data: {
           ...this.table_search,
-          time: this.table_search.time ? this.table_search.time : "",
+          time: this.table_search.time ? this.$formatDate(this.table_search.time, "YYYY-MM") : '',
         },
       }).then((response) => {
         if (window.navigator && window.navigator.msSaveOrOpenBlob) {
           let blob = new Blob([response.data], {
             type: "application/vnd.ms-excel",
           });
+          let month = this.table_search.time ? this.$formatDate(this.table_search.time, "YYYY年MM月") : ''
           window.navigator.msSaveOrOpenBlob(
-            blob,
-            this.dataBody.table.tabName + ".xlsx"
+            blob,`${month}回复统计.xlsx`
           );
         } else {
           /* 火狐谷歌的文件下载方式 */
@@ -169,42 +169,43 @@ export default {
           var downloadElement = document.createElement("a");
           var href = window.URL.createObjectURL(blob);
           downloadElement.href = href;
-          downloadElement.download = this.dataBody.table.tabName + ".xlsx";
+          let month = this.table_search.time ? this.$formatDate(this.table_search.time, "YYYY年MM月") : ''
+          downloadElement.download =  `${month}回复统计.xlsx`;
           document.body.appendChild(downloadElement);
           downloadElement.click();
           document.body.removeChild(downloadElement);
           window.URL.revokeObjectURL(href);
         }
       });
-
-      //   this.$http({
-      //     url: "/CMKIssued/exportCMKIssuedReplyStatistics",
-      //     method: "post",
-      //     headers: {
-      //       "Content-Type": "application/json",
-      //     },
-      //     data: {
-      //       ...this.table_search,
-      //       time: this.table_search.time ? this.table_search.time : "",
-      //     },
-      //     responseType: "blob", // 解决下载的文件乱码空白等问题
-      //   }).then(({ data }) => {
-      //     console.log(data,'data');
-      //     let url = window.URL.createObjectURL(new Blob([data]));
-      //     let a = document.createElement("a");
-      //     a.setAttribute("href", url);
-      //     //   a.setAttribute('download', scope.row.fileName)
-      //     a.click();
-      //   });
+        // this.$http({
+        //   url: "/CMKIssued/exportCMKIssuedReplyStatistics",
+        //   method: "post",
+        //   headers: {
+        //     "Content-Type": "application/json",
+        //   },
+        //   data: {
+        //     ...this.table_search,
+        //     time: this.table_search.time ? this.table_search.time : "",
+        //   },
+        //   responseType: "blob", // 解决下载的文件乱码空白等问题
+        // }).then(({ data }) => {
+        //   console.log(data,'data');
+        //   let url = window.URL.createObjectURL(new Blob([data]));
+        //   let a = document.createElement("a");
+        //   a.setAttribute("href", url);
+        //   //   a.setAttribute('download', scope.row.fileName)
+        //   a.click();
+        // });
       console.log("我下载了");
     },
     handleSearch(data) {
       let obj = {
         ...data,
         time: data.time
-          ? this.$formatDate(this.table_search.time, "YYYY-MM")
+          ? this.$formatDate(data.time, "YYYY-MM")
           : "",
       };
+      console.log(obj,'obj');
       this.table_search = data;
       this.handleReset();
       this.handleInit({ ...obj });