소스 검색

导入清单nextSibling没有截断问题

zhongzewei 7 년 전
부모
커밋
824cc57183
1개의 변경된 파일13개의 추가작업 그리고 5개의 파일을 삭제
  1. 13 5
      web/building_saas/main/js/views/importBills.js

+ 13 - 5
web/building_saas/main/js/views/importBills.js

@@ -361,16 +361,20 @@ const importBills = (function(){
                 let newID = uuid.v1();
                 let pID = -1;
                 let preBill = null;
+                let preRoot = null,
+                    preLeaf = null;
                 let nodeType = 'root';//后端以此标记来设置ParentID
+                let preSerialBill = billIdx[preID];
                 if(isRoot(rData)){
-
                     //pID = 'fixedBillID';
                     preBill = billIdx[preRootID];
+                    preRoot = billIdx[preRootID];
                 }
                 else if(isLeaf(rData)){
                     nodeType = 'leaf';
                     //pID = preRootID !== -1 ? preRootID : fixedBill.ID;
                     preBill = billIdx[preLeafID];
+                    preLeaf = billIdx[preLeafID];
                 }
                 //set bill data
                 billIdx[newID] = {
@@ -391,12 +395,16 @@ const importBills = (function(){
                     fees: [],
                     projectID: projectID,
                     type: getBillType(rData, flag)};
-                //match stdBill and reset programID、jobContent、itemCharacter
-                //matchStdBill(billIdx[newID], stdData);
                 //update preBill NextSibling
-                if(preBill){
-                    preBill.NextSiblingID = newID;
+                if(nodeType === 'root' && preRoot){
+                    preRoot.NextSiblingID = newID;
                 }
+                else if(nodeType === 'leaf' && preLeaf && preSerialBill && preSerialBill.nodeType === preLeaf.nodeType){
+                    preLeaf.NextSiblingID = newID;
+                }
+               /* if(preBill){
+                    preBill.NextSiblingID = newID;
+                }*/
                 //set new preID
                 preID = newID;
                 preRootID = isRoot(rData) ? newID : preRootID;