Kaynağa Gözat

修改获取文档id和表格名称

zhou1577692533 1 hafta önce
ebeveyn
işleme
78b55ff9c4
1 değiştirilmiş dosya ile 13 ekleme ve 4 silme
  1. 13 4
      src/script/service.ts

+ 13 - 4
src/script/service.ts

@@ -148,15 +148,24 @@ async function callApi(apiItem: Record<string, any>): Promise<ApiResponse> {
 function getDocumentInfo() {
   try {
     const base = DingdocsScript.base;
-    const uuid = base.getDentryUuid();
-    const sheets = base.getSheets();
+    
+    const uuid = base.getDentryUuid?.() || base.getDocUuid?.() || base.getUuid?.() || '';
+    console.log('文档UUID获取结果:', uuid);
+    
+    const sheets = base.getSheets?.() || base.getSheetList?.() || [];
+    console.log('表格列表:', sheets);
+    
+    const activeSheet = base.getActiveSheet?.() || base.getCurrentSheet?.();
+    const currentSheet = activeSheet?.getName?.() || activeSheet?.name || '无';
+    console.log('当前表格:', currentSheet);
     
     return {
-      uuid,
+      uuid: uuid || '未知',
       sheetsCount: sheets.length,
-      currentSheet: base.getActiveSheet()?.getName() || '无'
+      currentSheet
     };
   } catch (error: any) {
+    console.error('获取文档信息失败:', error);
     return {
       uuid: '未知',
       sheetsCount: 0,