|
@@ -1251,7 +1251,7 @@ module.exports = app => {
|
|
|
async saveAudit(cid, times, data) {
|
|
|
const transaction = await this.db.beginTransaction();
|
|
|
try {
|
|
|
- const auditors = await this.getListGroupByWithoutYB(cid, times);
|
|
|
+ const auditors = await this.getAuditGroupByList(cid, times);
|
|
|
const now_audit = this._.find(auditors, { uid: data.old_aid });
|
|
|
if (data.operate !== 'del') {
|
|
|
const exist = await this.getDataByCondition({ cid, times, uid: data.new_aid });
|
|
@@ -1263,18 +1263,11 @@ module.exports = app => {
|
|
|
}
|
|
|
const nowAuditInfo = await this.ctx.service.projectAccount.getDataById(data.new_aid);
|
|
|
const newAudit = {
|
|
|
- tid: this.ctx.tender.id,
|
|
|
- cid,
|
|
|
- uid: data.new_aid,
|
|
|
- name: nowAuditInfo.name,
|
|
|
- company: nowAuditInfo.company,
|
|
|
- jobs: nowAuditInfo.role,
|
|
|
- usort: now_audit.usort + 1,
|
|
|
- usite: now_audit.usite + 1,
|
|
|
- audit_order: now_audit.audit_order + 1,
|
|
|
- audit_type: auditType.key.common,
|
|
|
- times: times,
|
|
|
- status: auditConst.status.uncheck,
|
|
|
+ tid: this.ctx.tender.id, cid, uid: data.new_aid,
|
|
|
+ name: nowAuditInfo.name, company: nowAuditInfo.company, jobs: nowAuditInfo.role,
|
|
|
+ usort: now_audit.usort + 1, usite: now_audit.usite + 1,
|
|
|
+ audit_order: now_audit.audit_order + 1, audit_type: auditType.key.common,
|
|
|
+ times: times, status: auditConst.status.uncheck,
|
|
|
};
|
|
|
// order+1
|
|
|
await this._syncOrderByDelete(transaction, cid, now_audit.usite + 1, now_audit.usort + 1, times, '+');
|
|
@@ -1286,16 +1279,10 @@ module.exports = app => {
|
|
|
}
|
|
|
const nowAuditInfo = await this.ctx.service.projectAccount.getDataById(data.new_aid);
|
|
|
const newAudit = {
|
|
|
- tid: this.ctx.tender.id,
|
|
|
- cid,
|
|
|
- uid: data.new_aid,
|
|
|
- name: nowAuditInfo.name,
|
|
|
- company: nowAuditInfo.company,
|
|
|
- jobs: nowAuditInfo.role,
|
|
|
- usort: now_audit.usort,
|
|
|
- usite: now_audit.usite,
|
|
|
- audit_order: now_audit.audit_order,
|
|
|
- audit_type: now_audit.audit_type,
|
|
|
+ tid: this.ctx.tender.id, cid, uid: data.new_aid,
|
|
|
+ name: nowAuditInfo.name, company: nowAuditInfo.company, jobs: nowAuditInfo.role,
|
|
|
+ usort: now_audit.usort, usite: now_audit.usite,
|
|
|
+ audit_order: now_audit.audit_order, audit_type: now_audit.audit_type,
|
|
|
times: times,
|
|
|
status: auditConst.status.uncheck,
|
|
|
};
|
|
@@ -1304,7 +1291,7 @@ module.exports = app => {
|
|
|
if (now_audit.status !== auditConst.status.uncheck) {
|
|
|
throw '当前人无法操作删除';
|
|
|
}
|
|
|
- const flowAuditors = auditors.filter(x => { return x.order === now_audit.order; });
|
|
|
+ const flowAuditors = auditors.filter(x => { return x.audit_order === now_audit.audit_order; });
|
|
|
await transaction.delete(this.tableName, { cid, times, uid: now_audit.uid, usite: now_audit.usite });
|
|
|
if (flowAuditors.length === 1) await this._syncOrderByDelete(transaction, cid, now_audit.usite, now_audit.usort, times);
|
|
|
// 旧的更新为is_old为1
|