瀏覽代碼

Merge remote-tracking branch 'origin/stable' into stable

xuzhancheng 1 月之前
父節點
當前提交
f5f5e23ef2
共有 1 個文件被更改,包括 1 次插入67 次删除
  1. 1 67
      yudao-ui-admin-vue3/src/components/DynamicReport/SpreadViewer.vue

+ 1 - 67
yudao-ui-admin-vue3/src/components/DynamicReport/SpreadViewer.vue

@@ -343,70 +343,6 @@ const handleSpreadPrint = () => {
   previewSpread.print()
 }
 
-/**
- * 将 OADate 格式转换为标准日期格式
- * @param value 需要转换的值
- * @returns 转换后的日期字符串(YYYY-MM-DD)或原值
- */
-const convertOADate = (value: any): any => {
-  if (typeof value !== 'string') return value;
-  
-  // 匹配 /OADate(数字)/ 格式
-  const oaDatePattern = /^\/OADate\(([^)]+)\)\/$/;
-  const match = value.match(oaDatePattern);
-  
-  if (!match) return value;
-  
-  try {
-    const oaDateValue = parseFloat(match[1]);
-    // OADate 是从 1899-12-30 开始的天数(包含小数部分表示时间)
-    const excelEpoch = new Date(1899, 11, 30); // 1899-12-30
-    const convertedDate = new Date(excelEpoch.getTime() + oaDateValue * 24 * 60 * 60 * 1000);
-    
-    // 格式化为 YYYY-MM-DD
-    const year = convertedDate.getFullYear();
-    const month = String(convertedDate.getMonth() + 1).padStart(2, '0');
-    const day = String(convertedDate.getDate()).padStart(2, '0');
-    
-    return `${year}-${month}-${day}`;
-  } catch (error) {
-    console.warn('OADate 转换失败:', value, error);
-    return value;
-  }
-};
-
-/**
- * 递归处理对象中的所有 OADate 格式字段
- * @param obj 需要处理的对象
- * @returns 处理后的对象
- */
-const processOADateFields = (obj: any): any => {
-  if (obj === null || obj === undefined) return obj;
-  
-  // 处理数组
-  if (Array.isArray(obj)) {
-    return obj.map(item => processOADateFields(item));
-  }
-  
-  // 处理对象
-  if (typeof obj === 'object') {
-    const result: any = {};
-    for (const key in obj) {
-      if (obj.hasOwnProperty(key)) {
-        result[key] = processOADateFields(obj[key]);
-      }
-    }
-    return result;
-  }
-  
-  // 处理字符串(检查是否为 OADate 格式)
-  if (typeof obj === 'string') {
-    return convertOADate(obj);
-  }
-  
-  return obj;
-};
-
 /**
  * 打开 Wingdings 符号选择弹窗
  */
@@ -502,9 +438,7 @@ const handleSave = () => {
   //let dataSource = previewSpread.getActiveSheet().getDataSource().rT;
 
   if (dataSource) {
-    // 处理 OADate 格式的日期字段
-    dataSource = processOADateFields(dataSource);
-    
+
     DynamicTbValApi.saveAllColValue(insId.value, dataSource).then(res => {
       if (res) {
         ElMessage.success('保存成功')