|
@@ -9,6 +9,7 @@ import * as sheetInterface from '@/api/modules/sheetApi.js';
|
|
|
import { Message } from 'element-ui';
|
|
|
|
|
|
export function initSheet(container,options={},sheetInfo={},limit,callbackItems) {
|
|
|
+ console.log(limit);
|
|
|
const configOpt = {
|
|
|
container,
|
|
|
lang: 'zh', // 设定表格语言
|
|
@@ -50,9 +51,32 @@ export function initSheet(container,options={},sheetInfo={},limit,callbackItems)
|
|
|
// console.log(range,data,'range,data','rangeCopyAfter');
|
|
|
// },
|
|
|
updated: (a,b,c,d,e)=> {
|
|
|
+ /**
|
|
|
+ * lucksheet 本身没有完美的禁止用户编辑的功能,只能自己控制了,用户操作后撤销,用户撤销后重做
|
|
|
+ * stopUndo -- 阻止撤销 由于撤销会触发updated,又再进行撤销,直接撤销到最初状态了,我们只需要撤销一次
|
|
|
+ * withdrawUndo -- 撤销用户撤销的操作 即重做
|
|
|
+ */
|
|
|
if(limit.disabled){
|
|
|
- Message.warning("当前不可编辑")
|
|
|
- luckysheet.undo()
|
|
|
+ if((!luckysheet.stopUndo)){
|
|
|
+ setTimeout(()=>{
|
|
|
+ Message.warning("当前不可编辑")
|
|
|
+ if(luckysheet.withdrawUndo) {
|
|
|
+ // 重做用户撤销的操作,我们自己的重做操作,不能再撤销
|
|
|
+ luckysheet.stopUndo=false
|
|
|
+ luckysheet.withdrawUndo=false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let result=luckysheet.undo()
|
|
|
+ luckysheet.stopUndo=false
|
|
|
+ if(Object.keys(result).length==0){
|
|
|
+ requestAnimationFrame(()=>{
|
|
|
+ luckysheet.redo()
|
|
|
+ luckysheet.withdrawUndo=true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },0)
|
|
|
+ luckysheet.stopUndo=true
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
// console.log(callbackItems);
|