|
|
@@ -190,10 +190,24 @@ class PayCalculate {
|
|
|
}
|
|
|
|
|
|
getLeafOrder(data, pays, parentOrder) {
|
|
|
- if (!data) return [];
|
|
|
- if (!data.expr) return [`f${data.order}`];
|
|
|
+ // if (!data) return [];
|
|
|
+ // if (!data.expr) return [`f${data.order}`];
|
|
|
+ // const orderParam = data.expr.match(this.orderReg);
|
|
|
+ // if (!orderParam || orderParam.length === 0) return [`f${data.order}`];
|
|
|
+ //
|
|
|
+ // const result = [...orderParam];
|
|
|
+ // for (const op of orderParam) {
|
|
|
+ // const order = op.substring(1, op.length);
|
|
|
+ // if (parseInt(order) === data.order || op === parentOrder) {
|
|
|
+ // result.push(op);
|
|
|
+ // } else {
|
|
|
+ // result.push(...this.getLeafOrder(pays[parseInt(order) -1], pays, `f${data.order}`));
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // return this.ctx.helper._.uniq(result);
|
|
|
+ if (!data || !data.expr) return [];
|
|
|
const orderParam = data.expr.match(this.orderReg);
|
|
|
- if (!orderParam || orderParam.length === 0) return [`f${data.order}`];
|
|
|
+ if (!orderParam || orderParam.length === 0) return [];
|
|
|
|
|
|
const result = [...orderParam];
|
|
|
for (const op of orderParam) {
|
|
|
@@ -201,7 +215,12 @@ class PayCalculate {
|
|
|
if (parseInt(order) === data.order || op === parentOrder) {
|
|
|
result.push(op);
|
|
|
} else {
|
|
|
- result.push(...this.getLeafOrder(pays[parseInt(order) -1], pays, `f${data.order}`));
|
|
|
+ const sub = this.getLeafOrder(pays[parseInt(order) -1], pays, `f${data.order}`);
|
|
|
+ if (sub.length > 0) {
|
|
|
+ result.push(...sub);
|
|
|
+ } else {
|
|
|
+ result.push(op);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return this.ctx.helper._.uniq(result);
|