|
@@ -457,7 +457,7 @@ module.exports = app => {
|
|
|
if (selfAudit.audit_type === auditType.key.or) {
|
|
|
const updateOther = [];
|
|
|
for (const audit of audits) {
|
|
|
- if (audit.aid === selfAudit) continue;
|
|
|
+ if (audit.aid === selfAudit.aid) continue;
|
|
|
updateOther.push({
|
|
|
id: audit.id,
|
|
|
status: auditConst.status.checkSkip,
|
|
@@ -465,7 +465,7 @@ module.exports = app => {
|
|
|
end_time: time,
|
|
|
});
|
|
|
}
|
|
|
- if (updateOther.length > 0) transaction.updateRows(this.table, updateOther);
|
|
|
+ if (updateOther.length > 0) transaction.updateRows(this.tableName, updateOther);
|
|
|
}
|
|
|
// 无下一审核人表示,审核结束
|
|
|
if (nextAudits.length > 0) {
|
|
@@ -487,7 +487,7 @@ module.exports = app => {
|
|
|
tp_history: JSON.stringify(this.ctx.stage.tp_history),
|
|
|
cache_time_r: this.ctx.stage.cache_time_l,
|
|
|
});
|
|
|
- await this.ctx.service.tenderCache.updateStageCache4Flow(transaction, this.ctx.stage, auditConst.status.checking, [], flowAudits, ledgerTp, stageTp);
|
|
|
+ await this.ctx.service.tenderCache.updateStageCache4Flow(transaction, this.ctx.stage, auditConst.status.checking, nextAudits, flowAudits, ledgerTp, stageTp);
|
|
|
// 多人协同,取消下一审批人存在的锁定
|
|
|
await this.ctx.service.stageAuditAss.cancelLock(this.ctx.stage, nextAudits.map(x => { return x.aid; }), transaction);
|
|
|
|
|
@@ -1629,6 +1629,41 @@ module.exports = app => {
|
|
|
return auditor;
|
|
|
}
|
|
|
|
|
|
+ async getAuditorsByStatus(stageId, status, times = 1) {
|
|
|
+ let auditor = [];
|
|
|
+ let sql = '';
|
|
|
+ let sqlParam = '';
|
|
|
+ let cur;
|
|
|
+ switch (status) {
|
|
|
+ case auditConst.status.checking:
|
|
|
+ case auditConst.status.checked:
|
|
|
+ case auditConst.status.checkNoPre:
|
|
|
+ cur = await this.db.queryOne(`SELECT * From ${this.tableName} where sid = ? AND times = ? AND status = ? ORDER By times DESC, ` + '`order` DESC', [stageId, times, status]);
|
|
|
+ if (!cur) return [];
|
|
|
+
|
|
|
+ sql = 'SELECT la.`aid`, pa.`name`, pa.`company`, pa.`role`, la.`times`, la.`sid`, la.`order`, la.audit_order ' +
|
|
|
+ ' FROM ?? AS la Left Join ?? AS pa On la.`aid` = pa.`id` ' +
|
|
|
+ ' WHERE la.`sid` = ? and la.`order` = ?';
|
|
|
+ sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, stageId, cur.order];
|
|
|
+ auditor = await this.db.query(sql, sqlParam);
|
|
|
+ break;
|
|
|
+ case auditConst.status.checkNo:
|
|
|
+ cur = await this.db.queryOne(`SELECT * From ${this.tableName} where sid = ? AND times = ? AND status = ? ORDER By times DESC, ` + '`order` DESC', [stageId, parseInt(times) - 1, status]);
|
|
|
+ if (!cur) return [];
|
|
|
+
|
|
|
+ sql = 'SELECT la.`aid`, pa.`name`, pa.`company`, pa.`role`, la.`times`, la.`sid`, la.`order`, la.audit_order ' +
|
|
|
+ ' FROM ?? AS la Left Join ?? AS pa On la.`aid` = pa.`id` ' +
|
|
|
+ ' WHERE la.`sid` = ? and la.`order` = ? and la.`times` = ?';
|
|
|
+ sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, stageId, cur.order, parseInt(times) - 1];
|
|
|
+ auditor = await this.db.queryOne(sql, sqlParam);
|
|
|
+ break;
|
|
|
+ case auditConst.status.uncheck:
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return auditor;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 取某一期已批准审核信息(报表用)
|
|
|
*
|