|
@@ -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;
|