|
|
@@ -550,13 +550,49 @@ const projTreeObj = {
|
|
|
return true;
|
|
|
},
|
|
|
callback: function (key, opt) {
|
|
|
- //获取当前节点的建设项目ID
|
|
|
- let selectedItem = projTreeObj.tree.selected;
|
|
|
- let projectNode = selectedItem; //取建设项目节点
|
|
|
- if (selectedItem.data.projType === projectType.tender) {
|
|
|
- projectNode = selectedItem.parent;
|
|
|
+ // 有新需求,无缝批量导出
|
|
|
+ const nodeSelections = projTreeObj.workBook.getSheet(0).getSelections();
|
|
|
+ if (nodeSelections.length > 1) {
|
|
|
+ // 多选情况
|
|
|
+ // a. 收集所有顶节点(即建设项目)的row序号
|
|
|
+ const rootRows = [0];
|
|
|
+ const prjSelections = [];
|
|
|
+ let cnt = 0;
|
|
|
+ for (let nIdx = 0; nIdx < projTreeObj.tree._root.children.length; nIdx++) {
|
|
|
+ const rNode = projTreeObj.tree._root.children[nIdx];
|
|
|
+ cnt += rNode.children.length + 1; // 要加上顶节点
|
|
|
+ rootRows.push(cnt);
|
|
|
+ }
|
|
|
+ // b. 判断所选节点所属建设项目并记录
|
|
|
+ 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]);
|
|
|
+ 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]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 并发导出
|
|
|
+ for (const pSelection of prjSelections) {
|
|
|
+ projTreeObj.exportProject(pSelection.data.ID, pSelection.data.name);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 非多选,旧流程
|
|
|
+ let selectedItem = projTreeObj.tree.selected;
|
|
|
+ let projectNode = selectedItem; //取建设项目节点
|
|
|
+ if (selectedItem.data.projType === projectType.tender) {
|
|
|
+ projectNode = selectedItem.parent;
|
|
|
+ }
|
|
|
+ projTreeObj.exportProject(projectNode.data.ID, projectNode.data.name);
|
|
|
}
|
|
|
- projTreeObj.exportProject(projectNode.data.ID, projectNode.data.name);
|
|
|
},
|
|
|
},
|
|
|
importProject: {
|