瀏覽代碼

金额概况bug

MaiXinRong 3 月之前
父節點
當前提交
f48dbab3ed
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      app/public/js/sub_project_info.js

+ 6 - 2
app/public/js/sub_project_info.js

@@ -11,11 +11,11 @@ $(document).ready(function() {
             calculateFolder: function(node) {
             calculateFolder: function(node) {
                 node.tp_cache = {};
                 node.tp_cache = {};
                 for (const c of node.children) {
                 for (const c of node.children) {
+                    if (!c.tp_cache) continue;
                     for (const prop in c.tp_cache) {
                     for (const prop in c.tp_cache) {
                         node.tp_cache[prop] = ZhCalc.add(node.tp_cache[prop], c.tp_cache[prop]);
                         node.tp_cache[prop] = ZhCalc.add(node.tp_cache[prop], c.tp_cache[prop]);
                     }
                     }
                 }
                 }
-                console.log(node.name, node.tp_cache);
             },
             },
             calculateSubProject: function(node) {
             calculateSubProject: function(node) {
                 node.tp_cache.gather_tp = ZhCalc.sum([node.tp_cache.contract_tp, node.tp_cache.qc_tp, node.tp_cache.pc_tp]);
                 node.tp_cache.gather_tp = ZhCalc.sum([node.tp_cache.contract_tp, node.tp_cache.qc_tp, node.tp_cache.pc_tp]);
@@ -34,7 +34,11 @@ $(document).ready(function() {
                     }
                     }
                     this.calculateFolder(node);
                     this.calculateFolder(node);
                 } else {
                 } else {
-                    this.calculateSubProject(node);
+                    if (node.is_folder) {
+                        this.calculateFolder(node)
+                    } else {
+                        this.calculateSubProject(node);
+                    }
                 }
                 }
             },
             },
             calculateAll: function() {
             calculateAll: function() {