Преглед изворни кода

feat: (dashborad) 增加export

gemercheung пре 2 година
родитељ
комит
b7cf35f922
1 измењених фајлова са 13 додато и 1 уклоњено
  1. 13 1
      src/views/dashboard/analysis/index.vue

+ 13 - 1
src/views/dashboard/analysis/index.vue

@@ -166,7 +166,19 @@
   });
 
   async function handleExport() {
-    await bulletChatExportApi(searchInfo);
+    const data = await bulletChatExportApi(searchInfo);
+    const downloadBlob = new Blob([data], {
+      type: 'application/msexcel',
+    });
+    const url = URL.createObjectURL(downloadBlob);
+    const a: HTMLAnchorElement = document.createElement('a');
+    document.body.appendChild(a);
+    a.style.display = 'none';
+    a.href = url;
+    const name = new Date().getTime();
+    a.download = `${name}.csv`;
+    a.click();
+    window.URL.revokeObjectURL(url);
   }
 
   setTimeout(() => {