瀏覽代碼

删除期时,删除甲供材料、奖罚金、其他数据

MaiXinRong 5 年之前
父節點
當前提交
3b4c995085
共有 1 個文件被更改,包括 14 次插入0 次删除
  1. 14 0
      app/service/stage.js

+ 14 - 0
app/service/stage.js

@@ -430,6 +430,20 @@ module.exports = app => {
                     }
                 }
                 await transaction.delete(this.ctx.service.stageAtt.tableName, { sid: id });
+                // 其他台账
+                await transaction.delete(this.ctx.service.stageJgcl.tableName, { sid: id });
+                const bonus = await this.ctx.service.stageBonus.getStageData(id);
+                if (bonus && bonus.length > 0) {
+                    for (const b of bonus) {
+                        for (const f of b.proof_file) {
+                            if (fs.existsSync(path.join(this.app.baseDir, f.filepath))) {
+                                await fs.unlinkSync(path.join(this.app.baseDir, f.filepath));
+                            }
+                        }
+                    }
+                }
+                await transaction.delete(this.ctx.service.stageBonus.tableName, { sid: id });
+                await transaction.delete(this.ctx.service.stageOther.tableName, { sid: id });
                 await transaction.commit();
                 return true;
             } catch (err) {