Ver código fonte

表格download问题

Karsa 1 ano atrás
pai
commit
612754fff1
1 arquivos alterados com 9 adições e 14 exclusões
  1. 9 14
      src/views/datasheet_manage/sheetList.vue

+ 9 - 14
src/views/datasheet_manage/sheetList.vue

@@ -649,23 +649,18 @@ export default {
       let value = "";
       if (Source === 1) {
         value = FileUrl;
+        this.downLoad(value, ExcelName);
       } else if ([2, 3].includes(Source)) {
         value = `${this.downExcelFileUrl}&ExcelInfoId=${ExcelInfoId}`;
-      }
-
-      if (!value) return;
-
-      this.downLoad(value, ExcelName);
 
-      // let downDom = document.getElementById("sheet-download");
-      // if(!downDom){
-      // 	downDom = document.createElement("iframe");
-      // 	downDom.style.display = "none";
-      // 	downDom.id = "sheet-download";
-      // 	downDom.name = this.sheetDetailInfo.ExcelName;
-      // 	document.body.appendChild(downDom);
-      // }
-      // downDom.src = value;
+        const a = document.createElement("a");
+        a.href = value;
+        a.target = "_blank";
+        a.download = ExcelName;
+        a.style.display = "none";
+        document.body.append(a);
+        a.click();
+      }
     },
 
     downLoad(url, filename) {