Browse Source

导入,续数据被截断的问题

zhongzewei 6 năm trước cách đây
mục cha
commit
b8c141643c

+ 4 - 44
web/building_saas/main/js/views/importBills.js

@@ -330,50 +330,9 @@ const importBills = (function(){
             }
             return null;
         }
-        //excel数据与标准库数据匹配,根据清单前九位编码匹配,匹配成功则获取标准清单对应的工程专业、特征及内容
-        /*function matchStdBill(excelBill, stdData){
-            let isMatch = false;
-            let regExp = /^\d{12}$/g;
-            if(regExp.test(excelBill.code)){
-                let nineCode = excelBill.code.substr(0, 9);
-                for(let stdBill of stdData.stdBills){
-                    //set programID
-                    if(nineCode == stdBill.code){
-                        isMatch = true;
-                        excelBill.programID = stdBill.engineering ? stdBill.engineering : null;
-                        excelBill.billsLibId = stdBill.billsLibId ? stdBill.billsLibId : null;
-                        //set jobContent and itemCharacter
-                        let tempJob = [], tempCharacter = [];
-                        for(let billJob of stdBill.jobs){
-                            for(let stdJob of stdData.stdJobs) {
-                                if (billJob.id == stdJob.id) {
-                                    tempJob.push({isChecked: false, serialNo: billJob.serialNo, content: stdJob.content});
-                                }
-                            }
-                        }
-                        for(let billCharacter of stdBill.items){
-                            for(let stdCharacter of stdData.stdCharacters){
-                                if(billCharacter.id == stdCharacter.id){
-                                    let eigenvalue = [];
-                                    for(let eValue of stdCharacter.itemValue){
-                                        eigenvalue.push({isSelected: false, value: eValue.value});
-                                    }
-                                    tempCharacter.push({isChecked: false, serialNo: billCharacter.serialNo, character: stdCharacter.content, eigenvalue: eigenvalue});
-                                }
-                            }
-                        }
-                        excelBill.jobContent = tempJob;
-                        excelBill.itemCharacter = tempCharacter;
-                    }
-                }
-            }
-            if(!isMatch && excelBill.type === billType.FX){//分项不为空,同时在标准清单中不匹配,则识别为补项
-                excelBill.type = billType.BX;
-            }
-        }*/
+        let preData = null;
         for(let r = 0; r < validData.length; r++){
-            let preData = validData[r-1],
-                rData = validData[r];
+            let rData = validData[r];
             if(flag == fixedFlag.CONSTRUCTION_TECH && rData[colMapping.name] && rData[colMapping.name]['value'] === '施工技术措施项目'
                 || flag == fixedFlag.CONSTRUCTION_ORGANIZATION && rData[colMapping.name] && rData[colMapping.name]['value'] === '施工组织措施项目'){
                 continue;
@@ -388,7 +347,7 @@ const importBills = (function(){
                     //合并续数据
                     preBill.code += rData[colMapping.code] && rData[colMapping.code]['value'] ? rData[colMapping.code]['value'] : '';
                     preBill.name += rData[colMapping.name] && rData[colMapping.name]['value'] ? rData[colMapping.name]['value'] : '';
-                    preBill.itemCharacterText += rData[colMapping.itemCharacterText] && rData[colMapping.itemCharacterText]['value'] ? rData[colMapping.itemCharacterText]['value'] : '';
+                    preBill.itemCharacterText += rData[colMapping.itemCharacterText] && rData[colMapping.itemCharacterText]['value'] ? '\n' + rData[colMapping.itemCharacterText]['value'] : '';
                     preBill.unit += rData[colMapping.unit] && rData[colMapping.unit]['value'] ? rData[colMapping.unit]['value'] : '';
                     preBill.quantity += rData[colMapping.quantity] && rData[colMapping.quantity]['value'] ? rData[colMapping.quantity]['value'] : '';
                 }
@@ -438,6 +397,7 @@ const importBills = (function(){
                 preRootID = isRoot(rData) ? newID : preRootID;
                 preLeafID = isLeaf(rData) ? newID : preLeafID;
             }
+            preData = rData;
         }
         for(let i in billIdx){
             rst.push(billIdx[i]);

+ 1 - 0
web/building_saas/main/js/views/project_view.js

@@ -2509,6 +2509,7 @@ $('#customFile').change(function () {
        let sDate = +new Date();
        excelIo.open(excelFile, function (json) {
            importJson = json;
+           console.log(json);
            //读取各个表及表名
            importBills.setImportSheetsInfo(importJson.sheets);
            console.log(`解析Excel文件时间:${+new Date() - sDate}`);