|
@@ -580,6 +580,25 @@ module.exports = app => {
|
|
|
await transaction.delete(this.ctx.service.scheduleStage.tableName, { tid: stageInfo.tid, order: stageInfo.order });
|
|
|
// 重算进度计量总金额
|
|
|
await this.ctx.service.scheduleStage.calcStageSjTp(transaction, stageInfo.tid);
|
|
|
+ // 删除收方单及附件
|
|
|
+ const shoufangAttList = await this.ctx.service.stageShoufangAtt.getAllDataByCondition({ where: { sid: id } });
|
|
|
+ if (shoufangAttList.length !== 0) {
|
|
|
+ for (const att of shoufangAttList) {
|
|
|
+ if (fs.existsSync(path.join(this.app.baseDir, att.filepath))) {
|
|
|
+ await fs.unlinkSync(path.join(this.app.baseDir, att.filepath));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ await transaction.delete(this.ctx.service.stageShoufangAtt.tableName, { sid: id });
|
|
|
+ const shoufangList = await this.ctx.service.stageShoufang.getAllDataByCondition({ where: { sid: id } });
|
|
|
+ if (shoufangList.length !== 0) {
|
|
|
+ for (const att of shoufangList) {
|
|
|
+ if (fs.existsSync(path.join(this.app.baseDir, 'app/' + att.qrcode))) {
|
|
|
+ await fs.unlinkSync(path.join(this.app.baseDir, 'app/' + att.qrcode));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ await transaction.delete(this.ctx.service.stageShoufang.tableName, { sid: id });
|
|
|
// 记录删除日志
|
|
|
await this.ctx.service.projectLog.addProjectLog(transaction, projectLogConst.type.stage, projectLogConst.status.delete, '第' + stageInfo.order + '期');
|
|
|
await transaction.commit();
|