Browse Source

fix(bug): dataVerification and sheet move and delete cell bug

master
wpxp123456 5 years ago
parent
commit
4815d86ce5
  1. 29
      src/controllers/dataVerificationCtrl.js
  2. 18
      src/controllers/sheetmanage.js
  3. 3
      src/global/api.js
  4. 40
      src/global/extend.js

29
src/controllers/dataVerificationCtrl.js

@ -573,6 +573,28 @@ const dataVerificationCtrl = {
return; return;
} }
let str = range[range.length - 1].row[0],
edr = range[range.length - 1].row[1],
stc = range[range.length - 1].column[0],
edc = range[range.length - 1].column[1];
let d = editor.deepCopyFlowData(Store.flowdata);
if(str < 0){
str = 0;
}
if(edr > d.length - 1){
edr = d.length - 1;
}
if(stc < 0){
stc = 0;
}
if(edc > d[0].length - 1){
edc = d[0].length - 1;
}
let type = $("#luckysheet-dataVerification-dialog #data-verification-type-select").val(); let type = $("#luckysheet-dataVerification-dialog #data-verification-type-select").val();
let type2 = null, value1 = "", value2 = ""; let type2 = null, value1 = "", value2 = "";
@ -699,13 +721,6 @@ const dataVerificationCtrl = {
let historyDataVerification = $.extend(true, {}, _this.dataVerification); let historyDataVerification = $.extend(true, {}, _this.dataVerification);
let currentDataVerification = $.extend(true, {}, _this.dataVerification); let currentDataVerification = $.extend(true, {}, _this.dataVerification);
let str = range[range.length - 1].row[0],
edr = range[range.length - 1].row[1],
stc = range[range.length - 1].column[0],
edc = range[range.length - 1].column[1];
let d = editor.deepCopyFlowData(Store.flowdata);
for(let r = str; r <= edr; r++){ for(let r = str; r <= edr; r++){
for(let c = stc; c <= edc; c++){ for(let c = stc; c <= edc; c++){
currentDataVerification[r + '_' + c] = item; currentDataVerification[r + '_' + c] = item;

18
src/controllers/sheetmanage.js

@ -314,6 +314,24 @@ const sheetmanage = {
}); });
server.saveParam("shr", null, orders); server.saveParam("shr", null, orders);
Store.luckysheetfile.sort((x, y) => {
let order_x = x.order;
let order_y = y.order;
if(order_x != null && order_y != null){
return order_x - order_y;
}
else if(order_x != null){
return -1;
}
else if(order_y != null){
return 1;
}
else{
return 1;
}
})
}, },
createSheet: function() { //修复拖动sheet更新后台后,重新打开显示错误 createSheet: function() { //修复拖动sheet更新后台后,重新打开显示错误
let _this = this; let _this = this;

3
src/global/api.js

@ -4709,6 +4709,9 @@ export function setSheetActive(order, options = {}) {
success success
} = {...options} } = {...options}
$("#luckysheet-sheet-area div.luckysheet-sheets-item").removeClass("luckysheet-sheets-item-active");
$("#luckysheet-sheets-item" + file.index).addClass("luckysheet-sheets-item-active");
sheetmanage.changeSheet(file.index); sheetmanage.changeSheet(file.index);
setTimeout(() => { setTimeout(() => {

40
src/global/extend.js

@ -482,9 +482,17 @@ function luckysheetextendtable(type, index, value, direction, sheetIndex) {
else if(index == r){ else if(index == r){
if(direction == "lefttop"){ if(direction == "lefttop"){
newDataVerification[(r + value) + "_" + c] = item; newDataVerification[(r + value) + "_" + c] = item;
for(let i = 0; i < value; i++){
newDataVerification[(r + i) + "_" + c] = item;
}
} }
else{ else{
newDataVerification[r + "_" + c] = item; newDataVerification[r + "_" + c] = item;
for(let i = 0; i < value; i++){
newDataVerification[(r + i + 1) + "_" + c] = item;
}
} }
} }
else{ else{
@ -498,9 +506,17 @@ function luckysheetextendtable(type, index, value, direction, sheetIndex) {
else if(index == c){ else if(index == c){
if(direction == "lefttop"){ if(direction == "lefttop"){
newDataVerification[r + "_" + (c + value)] = item; newDataVerification[r + "_" + (c + value)] = item;
for(let i = 0; i < value; i++){
newDataVerification[r + "_" + (c + i)] = item;
}
} }
else{ else{
newDataVerification[r + "_" + c] = item; newDataVerification[r + "_" + c] = item;
for(let i = 0; i < value; i++){
newDataVerification[r + "_" + (c + i + 1)] = item;
}
} }
} }
else{ else{
@ -2112,20 +2128,20 @@ function luckysheetDeleteCell(type, str, edr, stc, edc, sheetIndex) {
let row_index = cfg["borderInfo"][i].value.row_index; let row_index = cfg["borderInfo"][i].value.row_index;
let col_index = cfg["borderInfo"][i].value.col_index; let col_index = cfg["borderInfo"][i].value.col_index;
if(row_index < str || col_index < stc){ if(row_index < str || row_index > edr || col_index < stc || col_index > edc){
borderInfo.push(cfg["borderInfo"][i]); if(type == 'moveLeft'){
} if(col_index > edc && row_index >= str && row_index <= edr){
else if(row_index > edr || col_index > edc){ col_index -= clen;
if(row_index > edr){ cfg["borderInfo"][i].value.col_index = col_index;
row_index -= rlen; }
cfg["borderInfo"][i].value.row_index = row_index;
} }
else if(type == 'moveUp'){
if(col_index > edc){ if(row_index > edr && col_index >= stc && col_index <= edc){
col_index -= clen; row_index -= rlen;
cfg["borderInfo"][i].value.col_index = col_index; cfg["borderInfo"][i].value.row_index = row_index;
}
} }
borderInfo.push(cfg["borderInfo"][i]); borderInfo.push(cfg["borderInfo"][i]);
} }
} }

Loading…
Cancel
Save