liujiejie 3 mēneši atpakaļ
vecāks
revīzija
045a3509de

+ 1 - 2
src/views/performance/components/custonAsCom/dataTable.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2024-10-28 16:46:38
- * @LastEditTime: 2025-09-01 10:26:56
+ * @LastEditTime: 2025-09-11 14:37:30
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/views/performance/components/custonAsCom/dataTable.vue
@@ -117,7 +117,6 @@ export default {
       this.activeName = jsonData && jsonData[0] && String(jsonData[0].fileId);
       this.loading = false;
     },
-
     // 删除 tab 方法
     removeTab(targetName) {
       // 1. 在 tabData 中删除对应的 tab

+ 1 - 19
src/views/performance/components/custonAsCom/luckySheet.vue

@@ -35,7 +35,6 @@ import {
   initDatabase,
 } from "@/utils/indexedDb";
 import { format } from "date-fns";
-
 export default {
   name: "UniverSheetDemo",
   data() {
@@ -54,7 +53,6 @@ export default {
       this.univer.dispose();
     }
   },
-
   methods: {
     /** 初始化表格数据 */
     async initSheetData() {
@@ -64,7 +62,6 @@ export default {
         this.$router.push("/home/performance/customAnalysis");
         return;
       }
-
       const targetFile = jsonData.find(
         (item) => item.fileId == this.$route.query.id
       );
@@ -73,18 +70,14 @@ export default {
         this.$router.push("/home/performance/customAnalysis");
         return;
       }
-
       this.sheetName = await this.truncateString(targetFile.fileOldName);
-
       const headers = Object.keys(targetFile.fileData[0]);
       const formattedData = targetFile.fileData.map((row) =>
         headers.map((h) => row[h])
       );
       formattedData.unshift(headers);
-
       this.initUniverSheet(formattedData);
     },
-
     /** 初始化 UniverSheet */
     initUniverSheet(formattedData) {
       // 1. 创建 Univer 实例(返回 univer + univerAPI)
@@ -99,19 +92,15 @@ export default {
           }),
         ],
       });
-
       this.univer = univer;
       this.univerAPI = univerAPI;
-
       // 2. 创建 Workbook(新版 API)
       const fWorkbook = univerAPI.createWorkbook({
         name: this.sheetName || "数据表",
       });
       this.workbook = fWorkbook;
-
       // 3. 获取当前工作表
       const fSheet = fWorkbook.getActiveSheet();
-
       // 4. 写入数据
       const rows = formattedData.length;
       const cols = formattedData[0]?.length || 0;
@@ -122,8 +111,6 @@ export default {
       if (fSheet && typeof fSheet.setName === "function") {
         fSheet.setName(this.sheetName);
       }
-
-      console.log("✅ Univer 初始化完成,数据已填充");
     },
     // 剪掉底部和右侧全空的行/列
     trimEmptyRowsCols(values) {
@@ -226,7 +213,6 @@ export default {
         } catch (e) {
           console.warn("取 snapshot 失败,稍后使用回退读取。", e);
         }
-
         // 3) 读取值(优先用精确 rowCount/colCount,否则回退到安全的区域)
         let values = [];
         try {
@@ -264,7 +250,6 @@ export default {
           console.warn("读取表格值失败,返回空数组作为回退", e);
           values = [];
         }
-
         // 4) 裁剪空行空列并按你的格式转成对象数组
         const trimmed = this.trimEmptyRowsCols(values);
         if (!trimmed || trimmed.length <= 1) {
@@ -284,9 +269,7 @@ export default {
             });
             return obj;
           });
-
         if (!formatted.length) continue;
-
         const fileData = {
           filename:
             format(new Date(), "yyyyMMdd-HH:mm:ss") + "_" + index + name,
@@ -296,7 +279,7 @@ export default {
         };
 
         allFileData.push(fileData);
-      } // for sheets
+      }
 
       // 存 DB
       try {
@@ -317,7 +300,6 @@ export default {
       this.$router.push("/home/performance/customAnalysis");
     },
     // /** 保存数据 */
-
     // /** 截断 Sheet 名称 */
     truncateString(str) {
       return new Promise((resolve) => {