|
@@ -13,6 +13,8 @@ class LuckySheet extends React.Component {
|
|
|
super(props);
|
|
|
this.sheetRef = React.createRef();
|
|
|
this.luckysheet = null;
|
|
|
+ this.updateTimer = null;
|
|
|
+ this.currentSheetIndex = null;
|
|
|
this.updateCell = {
|
|
|
add: [],
|
|
|
diff: [],
|
|
@@ -64,6 +66,7 @@ class LuckySheet extends React.Component {
|
|
|
renderSheet(currentData) {
|
|
|
const { onClickCell, version, getUser, onUpdate, templateId, onDelSheet } = this.props;
|
|
|
const data = currentData || this.props.data;
|
|
|
+ const _this = this;
|
|
|
if (!this.luckysheet) {
|
|
|
clearTimeout(this.renderTimer);
|
|
|
this.renderTimer = setTimeout(() => {
|
|
@@ -90,8 +93,17 @@ class LuckySheet extends React.Component {
|
|
|
}
|
|
|
},
|
|
|
updated(operate) {
|
|
|
- console.log(operate);
|
|
|
- onUpdate && onUpdate();
|
|
|
+ if (operate.type == 'datachange') {
|
|
|
+ if(_this.currentSheetIndex != operate.sheetIndex) {
|
|
|
+ _this.currentSheetIndex = operate.sheetIndex
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ clearTimeout(_this.updateTimer);
|
|
|
+ _this.updateTimer = setTimeout(() => {
|
|
|
+ onUpdate.bind(_this)
|
|
|
+ onUpdate();
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
},
|
|
|
sheetActivate: sheet => {
|
|
|
console.log(sheet);
|