Ver código fonte

切换期时,保留模板的选择

Tony Kang 1 ano atrás
pai
commit
10126b0aea
1 arquivos alterados com 14 adições e 10 exclusões
  1. 14 10
      app/view/report/index.ejs

+ 14 - 10
app/view/report/index.ejs

@@ -856,6 +856,19 @@
         }
     }
 
+    function selectPreRptTpl() {
+        if (zTreeOprObj.currentRptPageRst) {
+            const tplId = zTreeOprObj.currentRptPageRst.id;
+            const allNodes = zTreeOprObj.treeObj.transformToArray(zTreeOprObj.treeObj.getNodes());
+            for (const node of allNodes) {
+                if (node.ID === tplId) {
+                    zTreeOprObj.treeObj.selectNode(node, false);
+                    break;
+                }
+            }
+        }
+    }
+
     function changeCurrentMaterial(ele) {
         // 此方法与changeCurrentStage不同,不需要与后台交互,只需要调整 params: material_id (约定的参数),然后触发一下报表
         $('#optionSelectableMaterials a').show();
@@ -865,9 +878,6 @@
         // 刷新报表模板
         zTreeOprObj.onClick(null, null, zTreeOprObj.currentNode);
         zTreeOprObj.countChkedRptTpl();
-        if (zTreeOprObj.currentNode) {
-            zTreeOprObj.treeObj.selectNode(zTreeOprObj.currentNode, false);
-        }
         getReportArchive();
     }
 
@@ -880,9 +890,6 @@
         // 刷新报表模板
         zTreeOprObj.onClick(null, null, zTreeOprObj.currentNode);
         zTreeOprObj.countChkedRptTpl();
-        if (zTreeOprObj.currentNode) {
-            zTreeOprObj.treeObj.selectNode(zTreeOprObj.currentNode, false);
-        }
         getReportArchive();
     }
 
@@ -920,10 +927,7 @@
                 //还有必要触发报表刷新!???
                 // zTreeOprObj.onClick(null, null, zTreeOprObj.currentNode);
                 zTreeOprObj.countChkedRptTpl();
-                //console.log(ARCHIVE_LIST);
-                // if (zTreeOprObj.currentNode) {
-                //     zTreeOprObj.treeObj.selectNode(zTreeOprObj.currentNode, false);
-                // }
+                selectPreRptTpl();
             }, function(err){
                 $.bootstrapLoading.end();
             }, function(ex){