Explorar el Código

导入11格式清单,错误节点处理方式调整

MaiXinRong hace 4 años
padre
commit
ac73357194
Se han modificado 1 ficheros con 19 adiciones y 6 borrados
  1. 19 6
      app/lib/analysis_excel.js

+ 19 - 6
app/lib/analysis_excel.js

@@ -232,7 +232,14 @@ class ImportBaseTree {
                 return temp;
             } else {
                 const parent = this.findXmjParent(node.code);
-                return this.addNodeWithParent(node, parent);
+                if (parent) {
+                    return this.addNodeWithParent(node, parent);
+                } else {
+                    const newNode = this.addNodeWithParent(node, this.codeNodes['1']);
+                    newNode.error = 1;
+                    return null;
+                }
+
             }
         } else {
             const n = this.codeNodes[node.code];
@@ -296,11 +303,17 @@ class ImportBaseTree {
             } else if (!b.code) {
                 return -1;
             }
-            const codeA = a.code.split(splitChar);
-            const numA = _.toNumber(codeA[codeA.length -1]);
-            const codeB = b.code.split(splitChar);
-            const numB = _.toNumber(codeB[codeB.length -1]);
-            return numA - numB;
+            if (a.error === b.error) {
+                const codeA = a.code.split(splitChar);
+                const numA = _.toNumber(codeA[codeA.length -1]);
+                const codeB = b.code.split(splitChar);
+                const numB = _.toNumber(codeB[codeB.length -1]);
+                return numA - numB;
+            } else if (a.error) {
+                return 1
+            } else if (b.error) {
+                return -1;
+            }
         });
         for (const [i, c] of firstPart.children.entries()) {
             c.order = i + 1;