Bläddra i källkod

更新固定终审状态判断和变更添加审批人功能

laiguoran 4 år sedan
förälder
incheckning
72ba5c70db

+ 2 - 1
app/controller/advance_controller.js

@@ -241,7 +241,8 @@ module.exports = app => {
                 if (exist) {
                     throw '该审核人已存在,请勿重复添加';
                 }
-                const is_gdzs = ctx.tender.info.shenpi.advance === shenpiConst.sp_status.gdzs ? 1 : 0;
+                const shenpiInfo = await ctx.service.shenpiAudit.getDataByCondition({ tid: ctx.tender.id, sp_type: shenpiConst.sp_type.advance, sp_status: shenpiConst.sp_status.gdzs });
+                const is_gdzs = shenpiInfo && ctx.tender.info.shenpi.advance === shenpiConst.sp_status.gdzs ? 1 : 0;
                 const result = await ctx.service.advanceAudit.addAuditor(ctx.tender.id, ctx.advance.id, audit_id, ctx.advance.times, is_gdzs);
                 if (!result) {
                     throw '添加审核人失败';

+ 2 - 1
app/controller/change_controller.js

@@ -848,7 +848,8 @@ module.exports = app => {
                 if (exist) {
                     throw '该审核人已存在,请勿重复添加';
                 }
-                const is_gdzs = ctx.tender.info.shenpi.change === shenpiConst.sp_status.gdzs ? 1 : 0;
+                const shenpiInfo = await ctx.service.shenpiAudit.getDataByCondition({ tid: ctx.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpiConst.sp_status.gdzs });
+                const is_gdzs = shenpiInfo && ctx.tender.info.shenpi.change === shenpiConst.sp_status.gdzs ? 1 : 0;
                 const result = await ctx.service.changeAudit.addAuditor(ctx.change.cid, id, ctx.change.times, is_gdzs);
                 if (!result) {
                     throw '添加审核人失败';

+ 2 - 1
app/controller/ledger_audit_controller.js

@@ -138,7 +138,8 @@ module.exports = app => {
                 if (exist) {
                     throw '该审核人已存在,请勿重复添加';
                 }
-                const is_gdzs = ctx.tender.info.shenpi.ledger === shenpiConst.sp_status.gdzs ? 1 : 0;
+                const shenpiInfo = await ctx.service.shenpiAudit.getDataByCondition({ tid: ctx.tender.id, sp_type: shenpiConst.sp_type.ledger, sp_status: shenpiConst.sp_status.gdzs });
+                const is_gdzs = shenpiInfo && ctx.tender.info.shenpi.ledger === shenpiConst.sp_status.gdzs ? 1 : 0;
                 const result = await ctx.service.ledgerAudit.addAuditor(ctx.tender.id, id, ctx.tender.data.ledger_times, is_gdzs);
                 if (!result) {
                     throw '添加审核人失败';

+ 2 - 1
app/controller/material_controller.js

@@ -743,7 +743,8 @@ module.exports = app => {
                 if (exist) {
                     throw '该审核人已存在,请勿重复添加';
                 }
-                const is_gdzs = ctx.tender.info.shenpi.material === shenpiConst.sp_status.gdzs ? 1 : 0;
+                const shenpiInfo = await ctx.service.shenpiAudit.getDataByCondition({ tid: ctx.tender.id, sp_type: shenpiConst.sp_type.material, sp_status: shenpiConst.sp_status.gdzs });
+                const is_gdzs = shenpiInfo && ctx.tender.info.shenpi.material === shenpiConst.sp_status.gdzs ? 1 : 0;
                 const result = await ctx.service.materialAudit.addAuditor(ctx.material.id, id, ctx.material.times, is_gdzs);
                 if (!result) {
                     throw '添加审核人失败';

+ 2 - 2
app/controller/revise_controller.js

@@ -799,8 +799,8 @@ module.exports = app => {
                 // 检查审核人是否已存在
                 const exist = await ctx.service.reviseAudit.getAuditor(revise.id, id, revise.times);
                 if (exist) throw '该审核人已存在,请勿重复添加';
-
-                const is_gdzs = ctx.tender.info.shenpi.revise === shenpiConst.sp_status.gdzs ? 1 : 0;
+                const shenpiInfo = await ctx.service.shenpiAudit.getDataByCondition({ tid: ctx.tender.id, sp_type: shenpiConst.sp_type.revise, sp_status: shenpiConst.sp_status.gdzs });
+                const is_gdzs = shenpiInfo && ctx.tender.info.shenpi.revise === shenpiConst.sp_status.gdzs ? 1 : 0;
                 const result = await ctx.service.reviseAudit.addAuditor(revise, id, is_gdzs);
                 if (!result) throw '添加审核人失败';
 

+ 2 - 1
app/controller/stage_controller.js

@@ -979,7 +979,8 @@ module.exports = app => {
                 if (exist) {
                     throw '该审核人已存在,请勿重复添加';
                 }
-                const is_gdzs = ctx.tender.info.shenpi.stage === shenpiConst.sp_status.gdzs ? 1 : 0;
+                const shenpiInfo = await ctx.service.shenpiAudit.getDataByCondition({ tid: ctx.tender.id, sp_type: shenpiConst.sp_type.stage, sp_status: shenpiConst.sp_status.gdzs });
+                const is_gdzs = shenpiInfo && ctx.tender.info.shenpi.stage === shenpiConst.sp_status.gdzs ? 1 : 0;
                 const result = await ctx.service.stageAudit.addAuditor(ctx.stage.id, id, ctx.stage.times, is_gdzs);
                 if (!result) {
                     throw '添加审核人失败';

+ 2 - 4
app/service/change_audit.js

@@ -492,13 +492,11 @@ module.exports = app => {
         async addAuditor(cid, auditorId, times = 1, is_gdzs = 0) {
             const transaction = await this.db.beginTransaction();
             try {
-                const auditList = await this.getAllDataByCondition({ where: { cid, times } });
-                const idList = this._.map(auditList, 'uid');
-                let newOrder = idList.length + 1;
+                let newOrder = await transaction.count(this.tableName, { cid, times });
                 let uSort = await transaction.count(this.tableName, { cid });
                 // 判断是否存在固定终审,存在则newOrder - 1并使终审order+1
                 newOrder = is_gdzs === 1 ? newOrder - 1 : newOrder;
-                uSort = is_gdzs === 1 ? uSort : uSort + 1;
+                uSort = is_gdzs === 1 ? uSort - 1 : uSort;
                 if (is_gdzs) await this._syncOrderByDelete(transaction, cid, newOrder, uSort, times, '+');
                 const userInfo = await this.ctx.service.projectAccount.getDataById(auditorId);
                 const newAuditor = {

+ 1 - 1
app/view/change/information_modal.ejs

@@ -283,7 +283,7 @@
                 <div class="modal-footer">
                     <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
                     <button type="button" data-sumbit="sumbit_change" data-category="up_change" class="btn btn-primary btn-sm up-change">确认上报</button>
-                    <button type="button" data-sumbit="sumbit_change" data-category="save_change" class="btn btn-success btn-sm save-change">保存修改</button>
+                    <!--<button type="button" data-sumbit="sumbit_change" data-category="save_change" class="btn btn-success btn-sm save-change">保存修改</button>-->
                 </div>
             </div>
         </div>