|
@@ -242,9 +242,19 @@ module.exports = app => {
|
|
{ data: settleStatusPos, fields: ['settle_status'], prefix: '', relaId: 'pid' },
|
|
{ data: settleStatusPos, fields: ['settle_status'], prefix: '', relaId: 'pid' },
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
+ const billsIndex = {};
|
|
|
|
+ for (const b of bills) {
|
|
|
|
+ billsIndex[b.id] = b;
|
|
|
|
+ }
|
|
|
|
+ for (const p of pos) {
|
|
|
|
+ if (!billsIndex[p.lid]) continue;
|
|
|
|
+ if (!billsIndex[p.lid].pos) billsIndex[p.lid].pos = [];
|
|
|
|
+ billsIndex[p.lid].pos.push(p);
|
|
|
|
+ }
|
|
|
|
+
|
|
const said = this.ctx.session.sessionUser.accountId;
|
|
const said = this.ctx.session.sessionUser.accountId;
|
|
for (const d of data) {
|
|
for (const d of data) {
|
|
- const b = bills.find(x => { return x.id === d.lid });
|
|
|
|
|
|
+ const b = billsIndex[d.lid]; //bills.find(x => { return x.id === d.lid });
|
|
if (!b || b.settle_status === settleStatus.finish) continue;
|
|
if (!b || b.settle_status === settleStatus.finish) continue;
|
|
|
|
|
|
const nbs = {
|
|
const nbs = {
|
|
@@ -254,7 +264,7 @@ module.exports = app => {
|
|
};
|
|
};
|
|
if (d.pos) {
|
|
if (d.pos) {
|
|
for (const bp of d.pos) {
|
|
for (const bp of d.pos) {
|
|
- const p = pos.find(x => { return x.id === bp.pid});
|
|
|
|
|
|
+ const p = b.pos.find(x => { return x.id === bp.pid});
|
|
if (!p || p.settle_status === settleStatus.finish) continue;
|
|
if (!p || p.settle_status === settleStatus.finish) continue;
|
|
|
|
|
|
const nps = { tid: stage.tid, sid: stage.id, said, lid: b.id, pid: p.id, times: 1, order: 0 };
|
|
const nps = { tid: stage.tid, sid: stage.id, said, lid: b.id, pid: p.id, times: 1, order: 0 };
|