|
@@ -842,23 +842,23 @@ module.exports = app => {
|
|
|
|
|
|
async _generateChangeApply(tid) {
|
|
|
if (!!this.changeApplyData) return;
|
|
|
- this.changeApplyData = {};
|
|
|
+ const helper = this.ctx.helper;
|
|
|
const where = { tid };
|
|
|
if (this.ctx.session.sessionProject.page_show.isOnlyChecked) where.status = audit.changeApply.status.checked;
|
|
|
- const data = await this.ctx.service.changeApply.getAllDataByCondition({ where });
|
|
|
+ const apply = await this.ctx.service.changeApply.getAllDataByCondition({ where });
|
|
|
const bills = await this.ctx.service.changeApplyList.getChangeBills(tid, this.ctx.session.sessionProject.page_show.isOnlyChecked);
|
|
|
bills.sort(function(a, b ) {
|
|
|
- const aCIndex = data.findIndex(function (c) {
|
|
|
+ const aCIndex = apply.findIndex(function (c) {
|
|
|
return c.cid === a.cid;
|
|
|
});
|
|
|
- const bCIndex = data.findIndex(function (c) {
|
|
|
+ const bCIndex = apply.findIndex(function (c) {
|
|
|
return c.cid === b.cid;
|
|
|
});
|
|
|
return aCIndex === bCIndex
|
|
|
- ? ctx.helper.compareCode(a.code, b.code)
|
|
|
+ ? helper.compareCode(a.code, b.code)
|
|
|
: aCIndex - bCIndex;
|
|
|
});
|
|
|
- this.changeApplyData = { data, bills };
|
|
|
+ this.changeApplyData = { data: apply, bills };
|
|
|
}
|
|
|
|
|
|
async _generateChangeApplyAudit() {
|
|
@@ -903,6 +903,7 @@ module.exports = app => {
|
|
|
|
|
|
async _generateChangePlan(tid) {
|
|
|
if (!!this.changePlanData) return;
|
|
|
+ const helper = this.ctx.helper;
|
|
|
this.changePlanData = {};
|
|
|
const where = { tid };
|
|
|
if (this.ctx.session.sessionProject.page_show.isOnlyChecked) where.status = audit.changeApply.status.checked;
|
|
@@ -916,7 +917,7 @@ module.exports = app => {
|
|
|
return c.cid === b.cid;
|
|
|
});
|
|
|
return aCIndex === bCIndex
|
|
|
- ? ctx.helper.compareCode(a.code, b.code)
|
|
|
+ ? helper.compareCode(a.code, b.code)
|
|
|
: aCIndex - bCIndex;
|
|
|
});
|
|
|
this.changePlanData = { data, bills };
|
|
@@ -927,7 +928,7 @@ module.exports = app => {
|
|
|
|
|
|
this.changePlanData.audit = [];
|
|
|
for (const c of this.changePlanData.data) {
|
|
|
- const changeAudit = await this.ctx.service.changePlanAudit.getAllDataByCondition({ where: { caid: c.id, times: c.times }});
|
|
|
+ const changeAudit = await this.ctx.service.changePlanAudit.getAllDataByCondition({ where: { cpid: c.id, times: c.times }});
|
|
|
const changeAuditFilter = this.ctx.helper.filterLastestData(changeAudit, ['aid']);
|
|
|
this.changePlanData.audit.push(...changeAuditFilter);
|
|
|
}
|