|
|
@@ -207,6 +207,7 @@ module.exports = app => {
|
|
|
}
|
|
|
|
|
|
async copyAudit2otherTender(data, tid = this.ctx.tender.id) {
|
|
|
+ const sp_type = shenpiConst.sp_type[data.code] || shenpiConst.sp_other_type[data.code] || shenpiConst.cost_sp_type[data.code];
|
|
|
const transaction = await this.db.beginTransaction();
|
|
|
try {
|
|
|
const shenpi_status = parseInt(data.status);
|
|
|
@@ -235,11 +236,11 @@ module.exports = app => {
|
|
|
let is_group = false;
|
|
|
let groupList = [];
|
|
|
if (shenpi_status === shenpiConst.sp_status.gdspl) {
|
|
|
- groupList = await this.ctx.service.shenpiGroup.getGroupList(tid, shenpiConst.sp_type[data.code]);
|
|
|
+ groupList = await this.ctx.service.shenpiGroup.getGroupList(tid, sp_type);
|
|
|
if (groupList.length > 0) {
|
|
|
is_group = true;
|
|
|
for (const g of groupList) {
|
|
|
- g.auditList = await this.getAllDataByCondition({ where: { tid, sp_type: shenpiConst.sp_type[data.code], sp_status: shenpi_status, sp_group: g.id } });
|
|
|
+ g.auditList = await this.getAllDataByCondition({ where: { tid, sp_type, sp_status: shenpi_status, sp_group: g.id } });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -247,15 +248,15 @@ module.exports = app => {
|
|
|
if (shenpi_status !== shenpiConst.sp_status.sqspr) {
|
|
|
if (shenpi_status === shenpiConst.sp_status.gdspl) {
|
|
|
await transaction.delete(this.ctx.service.shenpiGroup.tableName, {
|
|
|
- tid: t.id, sp_type: shenpiConst.sp_type[data.code],
|
|
|
+ tid: t.id, sp_type,
|
|
|
});
|
|
|
}
|
|
|
- await transaction.delete(this.tableName, { tid: t.id, sp_type: shenpiConst.sp_type[data.code] || shenpiConst.sp_other_type[data.code], sp_status: shenpi_status });
|
|
|
+ await transaction.delete(this.tableName, { tid: t.id, sp_type, sp_status: shenpi_status });
|
|
|
if (is_group) {
|
|
|
for (const g of groupList) {
|
|
|
const result = await transaction.insert(this.ctx.service.shenpiGroup.tableName, {
|
|
|
tid: t.id,
|
|
|
- sp_type: shenpiConst.sp_type[data.code],
|
|
|
+ sp_type,
|
|
|
name: g.name,
|
|
|
is_select: g.is_select,
|
|
|
change_type: g.change_type,
|
|
|
@@ -264,7 +265,7 @@ module.exports = app => {
|
|
|
for (const s of g.auditList) {
|
|
|
insertList.push({
|
|
|
tid: t.id,
|
|
|
- sp_type: shenpiConst.sp_type[data.code],
|
|
|
+ sp_type,
|
|
|
sp_status: shenpi_status,
|
|
|
audit_id: s.audit_id,
|
|
|
audit_type: s.audit_type,
|
|
|
@@ -289,7 +290,7 @@ module.exports = app => {
|
|
|
}
|
|
|
insertList.push({
|
|
|
tid: t.id,
|
|
|
- sp_type: shenpiConst.sp_type[data.code] || shenpiConst.sp_other_type[data.code],
|
|
|
+ sp_type,
|
|
|
sp_status: shenpi_status,
|
|
|
audit_id: s.audit_id,
|
|
|
audit_type: s.audit_type,
|
|
|
@@ -316,6 +317,7 @@ module.exports = app => {
|
|
|
}
|
|
|
|
|
|
async copyAudit2otherShenpi(data) {
|
|
|
+ const sp_type = shenpiConst.sp_type[data.code] || shenpiConst.sp_other_type[data.code] || shenpiConst.cost_sp_type[data.code];
|
|
|
const transaction = await this.db.beginTransaction();
|
|
|
try {
|
|
|
const shenpi_status = parseInt(data.status);
|
|
|
@@ -332,12 +334,12 @@ module.exports = app => {
|
|
|
}
|
|
|
if (shenpiInfo[code] !== shenpiConst.sp_status.sqspr) {
|
|
|
if (shenpiInfo[code] === shenpiConst.sp_status.gdspl) {
|
|
|
- const group = await this.ctx.service.shenpiGroup.getAllDataByCondition({ where: { tid: this.ctx.tender.id, sp_type: shenpiConst.sp_type[code] } });
|
|
|
+ const group = await this.ctx.service.shenpiGroup.getAllDataByCondition({ where: { tid: this.ctx.tender.id, sp_type } });
|
|
|
if (group && group.length > 0) {
|
|
|
throw '选择同步的流程中存在审批组,无法设置同步';
|
|
|
}
|
|
|
}
|
|
|
- await transaction.delete(this.tableName, { tid: this.ctx.tender.id, sp_type: shenpiConst.sp_type[code], sp_status: shenpiInfo[code] });
|
|
|
+ await transaction.delete(this.tableName, { tid: this.ctx.tender.id, sp_type, sp_status: shenpiInfo[code] });
|
|
|
const flows = data.flowList.split(';');
|
|
|
let audit_order = 1;
|
|
|
for (const f of flows) {
|
|
|
@@ -349,7 +351,7 @@ module.exports = app => {
|
|
|
if (aid !== this.ctx.tender.data.user_id || needYB.indexOf(code) >= 0) {
|
|
|
insertList.push({
|
|
|
tid: this.ctx.tender.id,
|
|
|
- sp_type: shenpiConst.sp_type[code], sp_status: shenpi_status,
|
|
|
+ sp_type, sp_status: shenpi_status,
|
|
|
audit_id: aid,
|
|
|
audit_type: auditTypeValid ? audit_type : auditType.key.common,
|
|
|
audit_order: audit_order,
|