Browse Source

检查所属项目是否存在

MaiXinRong 1 year ago
parent
commit
4e63a2d064
3 changed files with 4 additions and 2 deletions
  1. 2 0
      app/service/sub_project.js
  2. 1 1
      app/service/tender.js
  3. 1 1
      app/view/tender/manage_modal.ejs

+ 2 - 0
app/service/sub_project.js

@@ -372,6 +372,7 @@ module.exports = app => {
             if (!transaction) throw '未定义事务';
 
             const subProject = await this.getDataById(spid);
+            if (!subProject) throw '所属项目不存在';
             const rela = subProject.rela_tender.split(',');
             if (rela.indexOf(tid + '') >= 0) return;
 
@@ -385,6 +386,7 @@ module.exports = app => {
             if (!transaction) throw '未定义事务';
 
             const subProject = await this.getDataById(spid);
+            if (!subProject) throw '所属项目不存在';
             const rela = subProject.rela_tender.split(',');
             if (rela.indexOf(tid + '') < 0) return;
 

+ 1 - 1
app/service/tender.js

@@ -280,7 +280,7 @@ module.exports = app => {
                     throw '新增标段数据失败';
                 }
                 await this.ctx.service.tenderCache.insertTenderCache(this.transaction, operate.insertId, sessionUser.accountId);
-                if (data.spid) await ctx.service.subProject.addRelaTender(this.transaction, data.spid, operate.insertId);
+                if (data.spid) await this.ctx.service.subProject.addRelaTender(this.transaction, data.spid, operate.insertId);
 
 
                 // 获取合同支付模板 并添加到标段

+ 1 - 1
app/view/tender/manage_modal.ejs

@@ -15,7 +15,7 @@
                     <select class="form-control form-control-sm" name="spid">
                         <option value="">无</option>
                         <% for (const sp of subProject) { %>
-                        <option name="<%- sp.id %>"><%- sp.name %></option>
+                        <option value="<%- sp.id %>"><%- sp.name %></option>
                         <% } %>
                     </select>
                 </div>