|
|
@@ -73,7 +73,7 @@ module.exports = app => {
|
|
|
for (const g of group) {
|
|
|
const his = {
|
|
|
auditYear: '', auditDate: '', auditTime: '', audit_time: null,
|
|
|
- audit_type: g[0].audit_type, audit_order: g[0].audit_order,
|
|
|
+ audit_type: g[0].audit_type, audit_order: g[0].audit_order, audit_times: g[0].audit_times, active_order: g[0].active_order,
|
|
|
auditors: g
|
|
|
};
|
|
|
his.is_final = his.audit_order === max_order;
|
|
|
@@ -114,6 +114,22 @@ module.exports = app => {
|
|
|
const sqlParam = [tenderId];
|
|
|
return this.db.query(sql, sqlParam);
|
|
|
}
|
|
|
+ // 获取审核比较 可查看的列表,它用不可修改
|
|
|
+ async getViewFlow(safeStage) {
|
|
|
+ const result = [];
|
|
|
+ if (safeStage.audit_status === auditConst.common.status.uncheck) return result;
|
|
|
+
|
|
|
+ const group = await this.getAuditorHistory(safeStage.id, safeStage.curTimes);
|
|
|
+ const latestGroup = group[group.length - 1];
|
|
|
+ latestGroup.forEach(x => {
|
|
|
+ if (x.audit_status === auditConst.common.status.checked) result.push(x);
|
|
|
+ if (x.audit_status === auditConst.common.status.checking && !safeStage.readOnly) {
|
|
|
+ x.latest = true;
|
|
|
+ result.push(x);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return result;
|
|
|
+ }
|
|
|
// ***** 查询审批人相关
|
|
|
|
|
|
// ***** 修改审批人相关
|
|
|
@@ -202,13 +218,13 @@ module.exports = app => {
|
|
|
return true;
|
|
|
}
|
|
|
// 拷贝上一期审批流程
|
|
|
- async copyPreAuditors(transaction, prePhasePay, newPhasePay) {
|
|
|
- const auditors = prePhasePay ? await this.getUniqAuditors(prePhasePay) : [];
|
|
|
+ async copyPreAuditors(transaction, preSafeStage, newSafeStage) {
|
|
|
+ const auditors = preSafeStage ? await this.getUniqAuditors(preSafeStage) : [];
|
|
|
const newAuditors = [];
|
|
|
// 添加原报
|
|
|
const user = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId);
|
|
|
newAuditors.push({
|
|
|
- tid: newPhasePay.tid, stage_id: newPhasePay.id,
|
|
|
+ tid: newSafeStage.tid, stage_id: newSafeStage.id,
|
|
|
audit_id: this.ctx.session.sessionUser.accountId,
|
|
|
audit_times: 1, audit_order: 0, audit_type: auditConst.auditType.key.common,
|
|
|
active_order: 0, audit_status: auditConst.safeStage.status.uncheck,
|
|
|
@@ -218,7 +234,7 @@ module.exports = app => {
|
|
|
for (const a of auditors) {
|
|
|
if (a.audit_order === 0) continue;
|
|
|
newAuditors.push({
|
|
|
- tid: newPhasePay.tid, stage_id: newPhasePay.id,
|
|
|
+ tid: newSafeStage.tid, stage_id: newSafeStage.id,
|
|
|
audit_id: a.audit_id,
|
|
|
audit_times: 1, audit_order: a.audit_order, audit_type: a.audit_type,
|
|
|
active_order: a.audit_order, audit_status: auditConst.safeStage.status.uncheck,
|
|
|
@@ -497,7 +513,7 @@ module.exports = app => {
|
|
|
// await this.ctx.service.specMsg.addSafeStageMsg(transaction, this.ctx.session.sessionProject.id, safeStage, pushOperate.safeStage.flow);
|
|
|
} else {
|
|
|
// 同步 期信息
|
|
|
- await transaction.update(this.ctx.service.safeStage.tableName, { id: safeStage.id, audit_status: auditConst.safeStage.status.checking, ...paySum });
|
|
|
+ await transaction.update(this.ctx.service.safeStage.tableName, { id: safeStage.id, audit_status: auditConst.safeStage.status.checking, ...billsSum });
|
|
|
}
|
|
|
await transaction.commit();
|
|
|
} catch (err) {
|
|
|
@@ -994,6 +1010,8 @@ module.exports = app => {
|
|
|
id: safeStage.id, audit_times: safeStage.audit_times - 1, audit_status: auditConst.safeStage.status.checking,
|
|
|
});
|
|
|
// todo 修改安全生产费数据
|
|
|
+ await this._cacheAuditData(transaction, safeStage,
|
|
|
+ { audit_id: selfAuditor.audit_id, audit_times: selfAuditor.audit_times, audit_order: selfAuditor.audit_order, active_order: selfAuditor.active_order + 1});
|
|
|
// await this.ctx.service.safeStageBills.initPhaseDataByAuditCancel(transaction, safeStage, selfAuditor.audit_times, selfAuditor.active_order, selfAuditor.audit_times, selfAuditor.active_order + 1);
|
|
|
// await transaction.update(this.ctx.service.safeStageBills.tableName,
|
|
|
// { audit_times: selfAuditor.audit_times, audit_sort: selfAuditor.active_order + 2, master_id: `${safeStage.id}-${selfAuditor.audit_times}-${selfAuditor.active_order + 2}` },
|