Jelajahi Sumber

变更台账,降级新增相关调整

MaiXinRong 2 tahun lalu
induk
melakukan
30b7d7214a
2 mengubah file dengan 10 tambahan dan 7 penghapusan
  1. 1 0
      app/public/js/path_tree.js
  2. 9 7
      app/service/change_ledger.js

+ 1 - 0
app/public/js/path_tree.js

@@ -406,6 +406,7 @@ const createNewPathTree = function (type, setting) {
             }
             parents.sort((x, y) => { return y.level - x.level});
             for (const parent of parents) {
+                if (!parent.children || parent.children.length === 0) continue;
                 parent.filter = !parent.children.find(x => { return !x.filter });
 
             }

+ 9 - 7
app/service/change_ledger.js

@@ -1129,9 +1129,10 @@ module.exports = app => {
                     this.clearParentingData(updateData2);
                     await this.transaction.update(this.tableName, updateData2);
                     await this._deleteChangeAuditListData(mid, [pre]);
-                } else if (!pre.ccid && pre.is_leaf === 1) {
-                    throw '原台账节点为子项时不能降级成为它的子项';
                 }
+                // else if (!pre.ccid && pre.is_leaf === 1) {
+                //     throw '原台账节点为子项时不能降级成为它的子项';
+                // }
                 await this.transaction.commit();
                 this.transaction = null;
             } catch (err) {
@@ -1372,9 +1373,10 @@ module.exports = app => {
                             quantity: null, unit_price: null, total_price: null, deal_qty: null, deal_tp: null
                         },
                         { where: {tender_id: tenderId, ledger_id: selectData.ledger_id} });
-                } else if (!selectData.ccid && children.length === 0) {
-                    throw '原台账节点为子项时不能添加它的子项';
                 }
+                // else if (!selectData.ccid && children.length === 0) {
+                //     throw '原台账节点为子项时不能添加它的子项';
+                // }
                 await this.transaction.commit();
             } catch (err) {
                 this.transaction.rollback();
@@ -1492,9 +1494,9 @@ module.exports = app => {
                                 const ledgerChildren = await this.getChildrenByParentId(this.ctx.service.ledger.tableName, tenderId, parent.ledger_id);
                                 children = this._.orderBy(this._.concat(ledgerChildren, children), [this.setting.order], ['asc']);
                             }
-                            if (children.length === 0 && !parent.ccid) {
-                                throw '原台账节点为子项时不能添加它的子项';
-                            }
+                            // if (children.length === 0 && !parent.ccid) {
+                            //     throw '原台账节点为子项时不能添加它的子项';
+                            // }
                             isNew = true;
                             const newData = this._filterStdData(stdNode);
                             newData.is_leaf = (i === len - 1);