Browse Source

自定义类别bug修复

ellisran 3 months ago
parent
commit
ee3d94f2cf
2 changed files with 4 additions and 3 deletions
  1. 1 1
      app/controller/sub_proj_setting_controller.js
  2. 3 2
      app/service/category_value.js

+ 1 - 1
app/controller/sub_proj_setting_controller.js

@@ -137,7 +137,7 @@ module.exports = app => {
                 if (!data.id) {
                     throw '提交数据错误';
                 }
-                await ctx.service.categoryValue.setCategoryValue(data.id, data.updateValue);
+                await ctx.service.categoryValue.setCategoryValue(ctx.subProject, data.id, data.updateValue);
 
                 responseData.data.category = await ctx.service.category.getCategory(data.id);
                 // todo 查询标段

+ 3 - 2
app/service/category_value.js

@@ -64,7 +64,7 @@ module.exports = app => {
             }
         }
 
-        async setCategoryValue(cid, value) {
+        async setCategoryValue(subProject, cid, value) {
             const tenders = await this.ctx.service.tender.getList('', null, 1);
 
             this.transaction = await this.db.beginTransaction();
@@ -77,13 +77,14 @@ module.exports = app => {
                         const result = await this.transaction.insert(this.tableName, {
                             cid,
                             pid: this.ctx.session.sessionProject.id,
+                            spid: subProject.id,
                             value: v.value,
                             sort,
                         });
                         v.id = result.insertId;
                         sort++;
                     } else {
-                        await this.transaction.update(this.tableName, { id: v.id, value: v.value, sort });
+                        await this.transaction.update(this.tableName, { id: v.id, spid: subProject.id, value: v.value, sort });
                         sort++;
                     }
                     if (!v.newTenders) { continue }