|
@@ -840,9 +840,10 @@ module.exports = app => {
|
|
|
|
|
|
async _generateChangeApply(tid) {
|
|
|
if (!!this.changeApplyData) return;
|
|
|
+ this.changeApplyData = {};
|
|
|
const where = { tid };
|
|
|
if (this.ctx.session.sessionProject.page_show.isOnlyChecked) where.status = audit.changeApply.status.checked;
|
|
|
- this.changeApplyData.data = await this.ctx.service.changeApply.getAllDataByCondition({ where });
|
|
|
+ this.changeApplyData = { data: await this.ctx.service.changeApply.getAllDataByCondition({ where }) };
|
|
|
}
|
|
|
|
|
|
async _generateChangeApplyAudit() {
|
|
@@ -852,7 +853,7 @@ module.exports = app => {
|
|
|
for (const c of this.changeApplyData.data) {
|
|
|
const changeAudit = await this.ctx.service.changeApplyAudit.getAllDataByCondition({ where: { caid: c.id, times: c.times }});
|
|
|
const changeAuditFilter = this.ctx.helper.filterLastestData(changeAudit, ['aid']);
|
|
|
- this.changeData.audit.push(...changeAuditFilter);
|
|
|
+ this.changeApplyData.audit.push(...changeAuditFilter);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -865,12 +866,6 @@ module.exports = app => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async _generateChangeProject(tid) {
|
|
|
- if (!!this.changeProjectData) return;
|
|
|
- const where = { tid };
|
|
|
- if (this.ctx.session.sessionProject.page_show.isOnlyChecked) where.status = audit.changeProject.status.checked;
|
|
|
- this.changeProjectData.data = await this.ctx.service.changeProject.getAllDataByCondition({ where });
|
|
|
- }
|
|
|
|
|
|
async getChangeApplyAuditData(tid, sid, fields) {
|
|
|
try {
|
|
@@ -878,10 +873,18 @@ module.exports = app => {
|
|
|
await this._generateChangeApplyAudit();
|
|
|
return this.changeApplyData.audit;
|
|
|
} catch (err) {
|
|
|
+ this.ctx.log(err);
|
|
|
return [];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ async _generateChangeProject(tid) {
|
|
|
+ if (!!this.changeProjectData) return;
|
|
|
+ const where = { tid };
|
|
|
+ if (this.ctx.session.sessionProject.page_show.isOnlyChecked) where.status = audit.changeProject.status.checked;
|
|
|
+ this.changeProjectData = { data: await this.ctx.service.changeProject.getAllDataByCondition({ where }) };
|
|
|
+ }
|
|
|
+
|
|
|
async _generateChangeProjectAudit() {
|
|
|
if (!!this.changeProjectData.audit) return;
|
|
|
|
|
@@ -898,6 +901,7 @@ module.exports = app => {
|
|
|
await this._generateChangeProject(tid);
|
|
|
return this.changeProjectData.data;
|
|
|
} catch (err) {
|
|
|
+ this.ctx.log(err);
|
|
|
return [];
|
|
|
}
|
|
|
}
|