Переглянути джерело

关联台账,不允许重复关联同一标段

MaiXinRong 3 роки тому
батько
коміт
0ef3d62d94
1 змінених файлів з 2 додано та 0 видалено
  1. 2 0
      app/controller/stage_rela_controller.js

+ 2 - 0
app/controller/stage_rela_controller.js

@@ -50,6 +50,8 @@ module.exports = app => {
                 if (!tid || !sorder) throw '参数错误';
                 const stage = await this.ctx.service.stage.getDataByCondition({ tid, order: sorder});
                 if (!stage) throw '关联标段/期不存在';
+                const exist = await this.ctx.service.stageRela.getDataByCondition({ sid: this.ctx.stage.id, rela_tid: tid});
+                if (exist) throw '已关联该标段,请勿重复关联';
                 const trid = await this.ctx.service.stageRela.addStageRela(stage);
                 ctx.redirect(ctx.request.header.referer + '/detail/' + trid);
             } catch (err) {