|  | @@ -817,7 +817,8 @@ module.exports = app => {
 | 
	
		
			
				|  |  |              try {
 | 
	
		
			
				|  |  |                  const result = await this.transaction.insert(this.tableName, data);
 | 
	
		
			
				|  |  |                  if (children.length === 0) {
 | 
	
		
			
				|  |  | -                    await this.transaction.update(this.tableName, {is_leaf: false},
 | 
	
		
			
				|  |  | +                    await this.transaction.update(this.tableName,
 | 
	
		
			
				|  |  | +                        {is_leaf: false, quantity: null, unit_price: null, total_price: null, deal_qty: null, deal_tp: null},
 | 
	
		
			
				|  |  |                          { where: {tender_id: tenderId, ledger_id: selectData.ledger_id} });
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  await this.transaction.commit();
 | 
	
	
		
			
				|  | @@ -896,7 +897,8 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                              newData.is_leaf = (i === len - 1);
 | 
	
		
			
				|  |  |                              [addResult, node] = await this._addChildAutoOrder(tenderId, parent, newData);
 | 
	
		
			
				|  |  |                              if (parent && parent.is_leaf) {
 | 
	
		
			
				|  |  | -                                await this.transaction.update(this.tableName, { id: parent.id, is_leaf: false });
 | 
	
		
			
				|  |  | +                                await this.transaction.update(this.tableName, { id: parent.id, is_leaf: false,
 | 
	
		
			
				|  |  | +                                    unit_price: null, quantity: null, total_price: null, deal_qty: null, deal_tp: null});
 | 
	
		
			
				|  |  |                                  updateParent = parent;
 | 
	
		
			
				|  |  |                              }
 | 
	
		
			
				|  |  |                              firstNew = node;
 | 
	
	
		
			
				|  | @@ -1199,8 +1201,9 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  // 选中节点--父节点--全部后兄弟节点 order+1
 | 
	
		
			
				|  |  |                  await this._updateSelectNextsOrder(parentData);
 | 
	
		
			
				|  |  | -                // 选中节点 修改pid, order, full_path
 | 
	
		
			
				|  |  | -                const updateData = { id: selectData.id,
 | 
	
		
			
				|  |  | +                // 选中节点 修改pid, order, full_path, level, is_leaf, 清空计算项
 | 
	
		
			
				|  |  | +                const updateData = {
 | 
	
		
			
				|  |  | +                    id: selectData.id,
 | 
	
		
			
				|  |  |                      ledger_pid: parentData.ledger_pid,
 | 
	
		
			
				|  |  |                      order: parentData.order + 1,
 | 
	
		
			
				|  |  |                      level: selectData.level - 1,
 | 
	
	
		
			
				|  | @@ -1208,6 +1211,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  };
 | 
	
		
			
				|  |  |                  const nexts = await this.getNextsData(tenderId, parentData.ledger_id, selectData.order);
 | 
	
		
			
				|  |  |                  if (nexts.length > 0) {
 | 
	
		
			
				|  |  | +                    updateData.is_leaf = true;
 | 
	
		
			
				|  |  |                      updateData.unit_price = null;
 | 
	
		
			
				|  |  |                      updateData.quantity = null;
 | 
	
		
			
				|  |  |                      updateData.total_price = null;
 | 
	
	
		
			
				|  | @@ -1779,6 +1783,11 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                      await this.transaction.update(this.tableName, {
 | 
	
		
			
				|  |  |                          id: selectData.id,
 | 
	
		
			
				|  |  |                          is_leaf: false,
 | 
	
		
			
				|  |  | +                        unit_price: null,
 | 
	
		
			
				|  |  | +                        quantity: null,
 | 
	
		
			
				|  |  | +                        total_price: null,
 | 
	
		
			
				|  |  | +                        deal_qty: null,
 | 
	
		
			
				|  |  | +                        deal_tp: null,
 | 
	
		
			
				|  |  |                      });
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  const order = lastChild ? lastChild.order : 0;
 |