Quellcode durchsuchen

1. 台账分解,台账修订,重复项目节检查取消顶层节点类型限制
2. 高级会签、分组审批,撤回时,取消跳过的审批人状态

MaiXinRong vor 3 Stunden
Ursprung
Commit
9421067de1
3 geänderte Dateien mit 33 neuen und 6 gelöschten Zeilen
  1. 16 3
      app/public/js/cost_stage_analysis.js
  2. 1 2
      app/public/js/ledger_check.js
  3. 16 1
      app/service/stage_audit.js

+ 16 - 3
app/public/js/cost_stage_analysis.js

@@ -26,10 +26,11 @@ $(document).ready(function() {
                 keys: ['id', 'stage_id', 'tree_id'],
                 calcFun: function(node) {
                     node.sf_percent = node.yf_excl_tax_tp ? ZhCalc.mul(ZhCalc.div(node.sf_excl_tax_tp, node.yf_excl_tax_tp), 100 , 2) : 0;
-                }
+                },
             };
             this.tree = createNewPathTree('ledger', this.treeSetting);
             this.spreadSetting = bllsSpreadSetting;
+            this.spreadSetting.readOnly = readOnly;
             sjsSettingObj.setFxTreeStyle(this.spreadSetting, sjsSettingObj.FxTreeStyle.phasePay);
 
             this.ckBillsSpread = window.location.pathname + '-billsSelect';
@@ -319,10 +320,20 @@ $(document).ready(function() {
             switch (col.field) {
                 case 'code':
                 case 'name':
-                case 'yf_excl_tax_tp':
+                    info.cancel = node.tree_level === 1 || node.node_type > 0 || node.calc_type === 2;
+                    break;
                 case 'in_excl_tax_tp':
+                    info.cancel = node.children && node.children.length > 0;
+                    if (!info.cancel) {
+                        info.cancel = node.tree_level === 1 || node.node_type > 1  || topParent.node_type === 2;
+                    }
+                    break;
+                case 'yf_excl_tax_tp':
                 case 'sf_excl_tax_tp':
-                    info.cancel = node.tree_level === 1 || node.node_type > 0  || [2,3,4].indexOf(topParent.node_type) >= 0;
+                    info.cancel = node.children && node.children.length > 0;
+                    if (!info.cancel) {
+                        info.cancel = node.tree_level === 1 || node.node_type > 0  || topParent.node_type === 2;
+                    }
                     break;
                 case 'num_a':
                 case 'num_b':
@@ -469,7 +480,9 @@ $(document).ready(function() {
             this.sheet = this.spread.getActiveSheet();
             this.data = createAncillaryGcl({ id: 'id', masterId: 'ledger_id', sort: [['d_order', 'asc']] });
             this.dealSpreadSetting = dealSpreadSetting;
+            this.dealSpreadSetting.readOnly = readOnly;
             this.commonSpreadSetting = commonSpreadSetting;
+            this.commonSpreadSetting.readOnly = readOnly;
 
             this.initSpread();
         }

+ 1 - 2
app/public/js/ledger_check.js

@@ -171,8 +171,7 @@ const ledgerCheckUtil = {
             }
         };
         for (const topLevel of ledgerTree.children) {
-            if ([1, 2, 3, 4].indexOf(topLevel.node_type) < 0) continue;
-
+            // if ([1, 2, 3, 4].indexOf(topLevel.node_type) < 0) continue;
             addXmjCheck(topLevel);
         }
         const xmjPart = {}, xmjIndex = [];

+ 16 - 1
app/service/stage_audit.js

@@ -1555,13 +1555,28 @@ module.exports = app => {
         async _auditCheckCancelAnd(stage) {
             const accountId = this.ctx.session.sessionUser.accountId;
             const selfAuditor = stage.flowAuditors.find(x => { return x.aid === accountId; });
-            if (!selfAuditor || selfAuditor.status !== auditConst.status.checked) throw '不可撤回';
+            const nextChecked = selfAuditor && selfAuditor.audit_group_order ? stage.flowAuditors.find(x => { return x.audit_group_order > selfAuditor.audit_group_order && x.status === auditConst.status.checked; }) : null;
+            if (!selfAuditor || selfAuditor.status !== auditConst.status.checked || nextChecked) throw '不可撤回';
+            const skipUpdateData = [];
+            if (selfAuditor.audit_group_order) {
+                const preChecked = stage.flowAuditors.filter(x => { return x.audit_group_order < selfAuditor.audit_group_order && x.status === auditConst.status.checked; }).sort((a, b) => { return a.audit_group_order - b.audit_group_order});
+                const minCancelOrder = preChecked.length > 0 ? preChecked[preChecked.length - 1].audit_group_order + 1 : 0;
+                for (const a of stage.flowAuditors) {
+                    if (a.status !== auditConst.status.checkSkip) continue;
+                    if (a.aid === accountId) continue;
+                    if (a.audit_group_order > selfAuditor.audit_group_order || a.audit_group_order < minCancelOrder) continue;
+                    skipUpdateData.push({ id: a.id, status: auditConst.status.checking, opinion: '', end_time: null });
+                }
+            }
 
             const transaction = await this.db.beginTransaction();
             try {
                 await transaction.update(this.tableName, {
                     id: selfAuditor.id, status: auditConst.status.checking, opinion: '', end_time: null,
                 });
+                if (skipUpdateData.length > 0) await transaction.updateRows(this.tableName, skipUpdateData);
+                // 2026-02-09,需求要求仅该撤回情况触发inner_flow
+                await this.ctx.service.specMsg.addStageMsg(transaction, this.ctx.session.sessionProject.id, stage, pushOperate.stage.inner_flow);
                 await transaction.commit();
             } catch(err) {
                 await transaction.rollback();