|
@@ -1472,6 +1472,15 @@ module.exports = app => {
|
|
|
name: stdNode.name,
|
|
|
}) || await this.ctx.service.ledger.getDataByCondition({tender_id: tenderId, ledger_pid: parent ? parent.ledger_id : rootId, code: stdNode.code, name: stdNode.name });
|
|
|
if (!node) {
|
|
|
+ let children = await this.getChildrenByParentId(this.tableName, tenderId, parent.ledger_id);
|
|
|
+ if (!this.newBills) {
|
|
|
+ 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 '原台账节点为子项时不能添加它的子项';
|
|
|
+ }
|
|
|
+ // console.log(parent);
|
|
|
isNew = true;
|
|
|
const newData = this._filterStdData(stdNode);
|
|
|
newData.is_leaf = (i === len - 1);
|