Browse Source

变更台账升降级bug修复

laiguoran 3 years ago
parent
commit
d3060cfbd7
1 changed files with 6 additions and 6 deletions
  1. 6 6
      app/service/change_ledger.js

+ 6 - 6
app/service/change_ledger.js

@@ -943,16 +943,16 @@ module.exports = app => {
                     updateData[this.setting.level] = s[this.setting.level] - 1;
                     updateData[this.setting.fullPath] = s[this.setting.fullPath].replace(s[this.setting.pid] + '-', '');
                     newPath.push(updateData[this.setting.fullPath]);
-                    if (s.is_leaf && s.id === last.id) {
+                    if (s.id === last.id) {
                         const nexts = await this.getNextsData(this.tableName, mid, parent[this.setting.kid], last[this.setting.order]);
                         if (!this.newBills) {
                             const ledgerNexts = await this.getNextsData(this.ctx.service.ledger.tableName, mid, parent[this.setting.kid], last[this.setting.order]);
                             if (ledgerNexts.length > 0) {
-                                throw '节点下存在台账节点,不可升级';
+                                throw '节点下存在台账节点,不可升级';
                             }
                             // nexts = this._.orderBy(this._.concat(ledgerNexts, nexts), [this.setting.order], ['asc']);
                         }
-                        if (nexts.length > 0) {
+                        if (s.is_leaf && nexts.length > 0) {
                             updateData.is_leaf = false;
                             this.clearParentingData(updateData);
                         }
@@ -963,9 +963,9 @@ module.exports = app => {
                 }
                 // 选中节点--全部后兄弟节点 收编为子节点 修改pid, order, full_path
                 await this._syncUpLevelNexts(last);
-                // if (selects) {
-                //     throw '阻断';
-                // }
+                if (selects) {
+                    throw '阻断';
+                }
                 await this.transaction.commit();
                 this.transaction = null;
             } catch (err) {