Kaynağa Gözat

金额概况bug

MaiXinRong 2 ay önce
ebeveyn
işleme
f48dbab3ed
1 değiştirilmiş dosya ile 6 ekleme ve 2 silme
  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) {
                 node.tp_cache = {};
                 for (const c of node.children) {
+                    if (!c.tp_cache) continue;
                     for (const prop in c.tp_cache) {
                         node.tp_cache[prop] = ZhCalc.add(node.tp_cache[prop], c.tp_cache[prop]);
                     }
                 }
-                console.log(node.name, node.tp_cache);
             },
             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]);
@@ -34,7 +34,11 @@ $(document).ready(function() {
                     }
                     this.calculateFolder(node);
                 } else {
-                    this.calculateSubProject(node);
+                    if (node.is_folder) {
+                        this.calculateFolder(node)
+                    } else {
+                        this.calculateSubProject(node);
+                    }
                 }
             },
             calculateAll: function() {