maixinrong před 5 roky
rodič
revize
e3c56b5485
1 změnil soubory, kde provedl 8 přidání a 1 odebrání
  1. 8 1
      app/lib/analysis_excel.js

+ 8 - 1
app/lib/analysis_excel.js

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