Browse Source

导入Excel调整

maixinrong 5 years ago
parent
commit
e3c56b5485
1 changed files with 8 additions and 1 deletions
  1. 8 1
      app/lib/analysis_excel.js

+ 8 - 1
app/lib/analysis_excel.js

@@ -60,14 +60,18 @@ class ImportBaseTree {
      * @private
      */
     _loadTemplateTree(data) {
+        let loadCodeNodes = true;
         for (const node of data) {
             node.ledger_id = node.template_id;
             node.ledger_pid = node.pid;
             node.id = this.ctx.app.uuid.v4();
             delete node.pid;
-            if (node.code) {
+            if (node.code && loadCodeNodes) {
                 this.codeNodes[node.code] = node;
             }
+            if (node.code === '3') {
+                loadCodeNodes = false;
+            }
             this.items.push(node);
             if (node.ledger_pid === -1) {
                 this.roots.push(node);
@@ -228,6 +232,9 @@ class ImportBaseTree {
             const numB = _.toNumber(codeB[codeB.length -1]);
             return numA - numB;
         });
+        for (const [i, c] of firstPart.children.entries()) {
+            c.order = i + 1;
+        }
     }
 
     calculateLeafWithPos () {