|
|
@@ -16,16 +16,23 @@ class FinalTree extends BillsTree {
|
|
|
constructor(ctx, setting) {
|
|
|
super(ctx, setting);
|
|
|
this._newId = 1;
|
|
|
+ this.checkField = ['code', 'name'];
|
|
|
}
|
|
|
+
|
|
|
get newId() {
|
|
|
return this._newId++;
|
|
|
}
|
|
|
|
|
|
loadNode(node, parent, loadFun) {
|
|
|
if (node.b_code) return;
|
|
|
+ const checkField = this.checkField;
|
|
|
const siblings = parent ? parent.children : this.children;
|
|
|
let cur = siblings.find(function (x) {
|
|
|
- return x.code === node.code && x.name === node.name;
|
|
|
+ for (const cf of checkField) {
|
|
|
+ if (x[cf] !== node[cf]) return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ // return x.code === node.code && x.name === node.name;
|
|
|
});
|
|
|
if (!cur) {
|
|
|
cur = { children: [], code: node.code || '', name: node.name || '', unit: node.unit || '' };
|
|
|
@@ -293,6 +300,7 @@ class BudgetFinal {
|
|
|
async doFinal(budget, final) {
|
|
|
this.budget = budget;
|
|
|
this.final = final;
|
|
|
+ this.finalTree.checkField = budget.final_type.split('_');
|
|
|
|
|
|
await this._loadGai(budget);
|
|
|
await this._loadGu(budget);
|