瀏覽代碼

删除中间计量附件相关

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

+ 2 - 2
app/service/stage.js

@@ -584,11 +584,11 @@ module.exports = app => {
                 await transaction.delete(this.ctx.service.stageOther.tableName, { sid: id });
                 // 同步删除进度里所选的期
                 await transaction.delete(this.ctx.service.scheduleStage.tableName, { tid: stageInfo.tid, order: stageInfo.order });
-                const detailAtt = await this.ctx.service.stageDetailAtt.getStageData(id);
+                const detailAtt = await this.ctx.service.stageDetailAtt.getAllDataByCondition({ where: { sid: id } });
                 if (detailAtt && detailAtt.length > 0) {
                     for (const da of detailAtt) {
+                        da.attachment = da.attachment ? JSON.parse(da.attachment) : [];
                         for (const daa of da.attachment) {
-                            console.log(daa);
                             if (fs.existsSync(path.join(this.app.baseDir, daa.filepath))) {
                                 await fs.unlinkSync(path.join(this.app.baseDir, daa.filepath));
                             }