|
@@ -467,6 +467,7 @@ module.exports = app => {
|
|
async deleteStage(id) {
|
|
async deleteStage(id) {
|
|
const transaction = await this.db.beginTransaction();
|
|
const transaction = await this.db.beginTransaction();
|
|
try {
|
|
try {
|
|
|
|
+ const stageInfo = await transaction.getDataById(id);
|
|
await transaction.delete(this.tableName, { id });
|
|
await transaction.delete(this.tableName, { id });
|
|
await transaction.delete(this.ctx.service.stageAudit.tableName, { sid: id });
|
|
await transaction.delete(this.ctx.service.stageAudit.tableName, { sid: id });
|
|
await transaction.delete(this.ctx.service.stageBills.tableName, { sid: id });
|
|
await transaction.delete(this.ctx.service.stageBills.tableName, { sid: id });
|
|
@@ -492,7 +493,7 @@ module.exports = app => {
|
|
await transaction.delete(this.ctx.service.stagePay.tableName, { sid: id });
|
|
await transaction.delete(this.ctx.service.stagePay.tableName, { sid: id });
|
|
await transaction.delete(this.ctx.service.pay.tableName, { csid: id });
|
|
await transaction.delete(this.ctx.service.pay.tableName, { csid: id });
|
|
// 删除计量附件文件
|
|
// 删除计量附件文件
|
|
- const attList = await this.ctx.service.stageAtt.getAllDataByCondition({ where: { sid: id } });
|
|
|
|
|
|
+ const attList = await this.ctx.service.stageAtt.getAllDataByCondition({ where: { tid: stageInfo.tid, sid: stageInfo.order } });
|
|
if (attList.length !== 0) {
|
|
if (attList.length !== 0) {
|
|
for (const att of attList) {
|
|
for (const att of attList) {
|
|
if (fs.existsSync(path.join(this.app.baseDir, att.filepath))) {
|
|
if (fs.existsSync(path.join(this.app.baseDir, att.filepath))) {
|
|
@@ -500,7 +501,7 @@ module.exports = app => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- await transaction.delete(this.ctx.service.stageAtt.tableName, { sid: id });
|
|
|
|
|
|
+ await transaction.delete(this.ctx.service.stageAtt.tableName, { tid: stageInfo.tid, sid: stageInfo.order });
|
|
// 其他台账
|
|
// 其他台账
|
|
await transaction.delete(this.ctx.service.stageJgcl.tableName, { sid: id });
|
|
await transaction.delete(this.ctx.service.stageJgcl.tableName, { sid: id });
|
|
const bonus = await this.ctx.service.stageBonus.getStageData(id);
|
|
const bonus = await this.ctx.service.stageBonus.getStageData(id);
|