Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
fix(bug): data verification range select
Browse files Browse the repository at this point in the history
  • Loading branch information
wpxp123456 committed Dec 10, 2020
1 parent 16131b2 commit 6d60679
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 17 deletions.
32 changes: 31 additions & 1 deletion src/controllers/dataVerificationCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { modelHTML } from './constant';
import { selectionCopyShow } from './select';
import server from './server';
import menuButton from './menuButton';
import sheetmanage from './sheetmanage';
import { getSheetIndex, getRangetxt } from '../methods/get';
import locale from '../locale/locale';
import Store from '../store';
Expand Down Expand Up @@ -281,6 +282,13 @@ const dataVerificationCtrl = {
_this.selectRange = [];

let range = _this.getRangeByTxt(txt);

formula.rangetosheet = Store.currentSheetIndex;

if(range[0].sheetIndex != Store.currentSheetIndex){
sheetmanage.changeSheetExec(range[0].sheetIndex);
}

if(range.length > 0){
for(let s = 0; s < range.length; s++){
let r1 = range[s].row[0], r2 = range[s].row[1];
Expand Down Expand Up @@ -321,6 +329,13 @@ const dataVerificationCtrl = {
_this.selectRange = [];

let range = _this.getRangeByTxt(txt);

formula.rangetosheet = Store.currentSheetIndex;

if(range[0].sheetIndex != Store.currentSheetIndex){
sheetmanage.changeSheetExec(range[0].sheetIndex);
}

if(range.length > 0){
for(let s = 0; s < range.length; s++){
let r1 = range[s].row[0], r2 = range[s].row[1];
Expand Down Expand Up @@ -370,6 +385,11 @@ const dataVerificationCtrl = {
$("#luckysheet-modal-dialog-mask").show();
$("#luckysheet-dataVerification-dialog").show();

if(formula.rangetosheet != null && formula.rangetosheet != Store.currentSheetIndex){
sheetmanage.changeSheetExec(formula.rangetosheet);
formula.rangetosheet = null;
}

let range = [];
selectionCopyShow(range);
});
Expand All @@ -378,6 +398,11 @@ const dataVerificationCtrl = {
$("#luckysheet-modal-dialog-mask").show();
$("#luckysheet-dataVerification-dialog").show();

if(formula.rangetosheet != null && formula.rangetosheet != Store.currentSheetIndex){
sheetmanage.changeSheetExec(formula.rangetosheet);
formula.rangetosheet = null;
}

let range = [];
selectionCopyShow(range);
});
Expand All @@ -386,6 +411,11 @@ const dataVerificationCtrl = {
$("#luckysheet-modal-dialog-mask").show();
$("#luckysheet-dataVerification-dialog").show();

if(formula.rangetosheet != null && formula.rangetosheet != Store.currentSheetIndex){
sheetmanage.changeSheetExec(formula.rangetosheet);
formula.rangetosheet = null;
}

let range = [];
selectionCopyShow(range);
})
Expand Down Expand Up @@ -564,7 +594,7 @@ const dataVerificationCtrl = {
});

//确认按钮
$(document).off("click.confirm").on("click.confirm", "#luckysheet-dataVerification-dialog-confirm", function(e) {
$(document).off("click.dvSaveConfirm").on("click.dvSaveConfirm", "#luckysheet-dataVerification-dialog-confirm", function(e) {
let rangeTxt = $("#luckysheet-dataVerification-dialog #data-verification-range input").val().trim();
let range = _this.getRangeByTxt(rangeTxt);

Expand Down
22 changes: 6 additions & 16 deletions src/controllers/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -843,22 +843,6 @@ export default function luckysheetHandler() {

dataVerificationCtrl.selectRange[dataVerificationCtrl.selectRange.length - 1] = last;
}
else if (event.ctrlKey) {
dataVerificationCtrl.selectRange.push({
"left": col_pre,
"width": col - col_pre - 1,
"top": row_pre,
"height": row - row_pre - 1,
"left_move": col_pre,
"width_move": col - col_pre - 1,
"top_move": row_pre,
"height_move": row - row_pre - 1,
"row": [row_index, row_index_ed],
"column": [col_index, col_index_ed],
"row_focus": row_index,
"column_focus": col_index
});
}
else {
dataVerificationCtrl.selectRange = [];
dataVerificationCtrl.selectRange.push({
Expand All @@ -880,6 +864,9 @@ export default function luckysheetHandler() {
selectionCopyShow(dataVerificationCtrl.selectRange);

let range = dataVerificationCtrl.getTxtByRange(dataVerificationCtrl.selectRange);
if(formula.rangetosheet != Store.currentSheetIndex){
range = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)].name + '!' + range;
}
$("#luckysheet-dataVerificationRange-dialog input").val(range);

return;
Expand Down Expand Up @@ -2075,6 +2062,9 @@ export default function luckysheetHandler() {
selectionCopyShow(dataVerificationCtrl.selectRange);

let range = dataVerificationCtrl.getTxtByRange(dataVerificationCtrl.selectRange);
if(formula.rangetosheet != Store.currentSheetIndex){
range = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)].name + '!' + range;
}
$("#luckysheet-dataVerificationRange-dialog input").val(range);
}
else if (formula.rangestart) {
Expand Down

0 comments on commit 6d60679

Please sign in to comment.