|
@@ -180,7 +180,6 @@ class BillsPosConvert {
|
|
this._loadField(curXmj, node, this.tpFields);
|
|
this._loadField(curXmj, node, this.tpFields);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -259,16 +258,13 @@ class BillsPosConvert {
|
|
for (const node of nodes) {
|
|
for (const node of nodes) {
|
|
this._recursiveCalculateAndSort(node.children);
|
|
this._recursiveCalculateAndSort(node.children);
|
|
if (node.unitTree) {
|
|
if (node.unitTree) {
|
|
- node.unitTree.sortTreeNodeCustom('b_code', function (a, b) {
|
|
|
|
- const numReg = /^[0-9]+$/;
|
|
|
|
- const aCodes = a ? a.split('-') : [], bCodes = b ? b.split('-') : [];
|
|
|
|
- for (let i = 0, iLength = Math.min(aCodes.length, bCodes.length); i < iLength; ++i) {
|
|
|
|
- const iCompare = self.ctx.helper.compareCode(aCodes[i], bCodes[i]);
|
|
|
|
- if (iCompare !== 0) {
|
|
|
|
- return iCompare;
|
|
|
|
- }
|
|
|
|
|
|
+ node.unitTree.sortTreeNodeCustom(function (a, b) {
|
|
|
|
+ if (a.b_code && a.b_code !== '') {
|
|
|
|
+ return b.b_code && b.b_code !== '' ? self.ctx.helper.compareCode(a.b_code, b.b_code) : 1;
|
|
|
|
+ } else {
|
|
|
|
+ return b.b_code && b.b_code !== '' ? -1 : a.order - b.order;
|
|
}
|
|
}
|
|
- }, false);
|
|
|
|
|
|
+ });
|
|
this._recursiveCalcUnitNodes(node.unitTree.children);
|
|
this._recursiveCalcUnitNodes(node.unitTree.children);
|
|
this._calculateNode(node, node.unitTree.children, this.tpFields);
|
|
this._calculateNode(node, node.unitTree.children, this.tpFields);
|
|
} else if (node.children && node.children.length > 0) {
|
|
} else if (node.children && node.children.length > 0) {
|