|
|
@@ -552,7 +552,7 @@ const projTreeObj = {
|
|
|
callback: function (key, opt) {
|
|
|
// 有新需求,无缝批量导出
|
|
|
const nodeSelections = projTreeObj.workBook.getSheet(0).getSelections();
|
|
|
- if (nodeSelections.length > 1) {
|
|
|
+ if (nodeSelections.length > 1 || nodeSelections[0].rowCount > 1) {
|
|
|
// 多选情况
|
|
|
// a. 收集所有顶节点(即建设项目)的row序号
|
|
|
const rootRows = [0];
|
|
|
@@ -567,23 +567,37 @@ const projTreeObj = {
|
|
|
for (let nsIdx = 0; nsIdx < nodeSelections.length; nsIdx++) {
|
|
|
const selection = nodeSelections[nsIdx];
|
|
|
for (let idx = 0; idx < rootRows.length - 1; idx++) {
|
|
|
- if (selection.row === rootRows[idx]) {
|
|
|
- if (!prjSelections.includes(projTreeObj.tree._root.children[idx])) {
|
|
|
- prjSelections.push(projTreeObj.tree._root.children[idx]);
|
|
|
+ // 还要考虑rowCount(连续选择情况)
|
|
|
+ for (let rIdx = 0; rIdx < selection.rowCount; rIdx++) {
|
|
|
+ if (selection.row + rIdx === rootRows[idx]) {
|
|
|
+ if (!prjSelections.includes(projTreeObj.tree._root.children[idx])) {
|
|
|
+ prjSelections.push(projTreeObj.tree._root.children[idx]);
|
|
|
+ }
|
|
|
break;
|
|
|
- }
|
|
|
- } else if (selection.row > rootRows[idx] && selection.row < rootRows[idx + 1]) {
|
|
|
- if (!prjSelections.includes(projTreeObj.tree._root.children[idx])) {
|
|
|
- prjSelections.push(projTreeObj.tree._root.children[idx]);
|
|
|
+ } else if (selection.row + rIdx > rootRows[idx] && selection.row + rIdx < rootRows[idx + 1]) {
|
|
|
+ if (!prjSelections.includes(projTreeObj.tree._root.children[idx])) {
|
|
|
+ prjSelections.push(projTreeObj.tree._root.children[idx]);
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
+ //
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- // 并发导出
|
|
|
- for (const pSelection of prjSelections) {
|
|
|
- projTreeObj.exportProject(pSelection.data.ID, pSelection.data.name);
|
|
|
- }
|
|
|
+ // 间歇(2秒)并发导出
|
|
|
+ const allSelectCnt = prjSelections.length;
|
|
|
+ let curIdx = 0;
|
|
|
+ const exportPrjFunc = (timeInterval = 0) => {
|
|
|
+ setTimeout(function () {
|
|
|
+ const pSelection = prjSelections[curIdx];
|
|
|
+ curIdx++;
|
|
|
+ projTreeObj.exportProject(pSelection.data.ID, pSelection.data.name);
|
|
|
+ if (curIdx < allSelectCnt) {
|
|
|
+ exportPrjFunc(2000);
|
|
|
+ }
|
|
|
+ }, timeInterval);
|
|
|
+ };
|
|
|
+ exportPrjFunc();
|
|
|
} else {
|
|
|
// 非多选,旧流程
|
|
|
let selectedItem = projTreeObj.tree.selected;
|