Parcourir la source

cid 重复时处理

xjj il y a 2 ans
Parent
commit
1b6d8cb603
1 fichiers modifiés avec 9 ajouts et 3 suppressions
  1. 9 3
      src/pages/Detail/LuckySheet.js

+ 9 - 3
src/pages/Detail/LuckySheet.js

@@ -98,11 +98,12 @@ class LuckySheet extends React.Component {
               _this.currentSheetIndex = operate.sheetIndex;
               _this.currentSheetIndex = operate.sheetIndex;
               return;
               return;
             }
             }
+            // 延迟1秒
             clearTimeout(_this.updateTimer);
             clearTimeout(_this.updateTimer);
             _this.updateTimer = setTimeout(() => {
             _this.updateTimer = setTimeout(() => {
               onUpdate.bind(_this);
               onUpdate.bind(_this);
               onUpdate();
               onUpdate();
-            }, 3000);
+            }, 1000);
           }
           }
         },
         },
         // 修改批注后保存sheet
         // 修改批注后保存sheet
@@ -111,7 +112,7 @@ class LuckySheet extends React.Component {
           _this.updateTimer = setTimeout(() => {
           _this.updateTimer = setTimeout(() => {
             onUpdate.bind(_this);
             onUpdate.bind(_this);
             onUpdate(true);
             onUpdate(true);
-          }, 3000);
+          }, 1000);
         },
         },
         sheetActivate: sheet => {
         sheetActivate: sheet => {
           console.log(sheet);
           console.log(sheet);
@@ -284,8 +285,13 @@ class LuckySheet extends React.Component {
       (sheet.celldata || []).forEach(cell => {
       (sheet.celldata || []).forEach(cell => {
         if (!cell.v.cid) {
         if (!cell.v.cid) {
           unknowCid.push(cell);
           unknowCid.push(cell);
-        } else {
+        } else if (!allCell[cell.v.cid]) {
           allCell[cell.v.cid] = cell;
           allCell[cell.v.cid] = cell;
+        } else {
+          // 当存在相同cid时
+          // 做异常处理
+          delete cell.v.cid;
+          unknowCid.push(cell);
         }
         }
         if (cell.v.tb) cell.v.tb = Number(cell.v.tb);
         if (cell.v.tb) cell.v.tb = Number(cell.v.tb);
         // 清除比对样式
         // 清除比对样式