|
@@ -2400,6 +2400,8 @@ async function exportMainData(userID,projectID) {
|
|
|
if(s.projType =="Tender") tenderIDs.push(s.ID);
|
|
|
}
|
|
|
}
|
|
|
+ const constructions = result.projects.filter(item => item.projType === projectType.project);
|
|
|
+ resortImportProjectData(result.projects, constructions);
|
|
|
let files = {unitFiles:await exportUnitFiles(projectID),feeRateFiles:await exportFeeRateFiles(projectID)};
|
|
|
result.files = files;
|
|
|
result = cipher.aesEncrypt(JSON.stringify(result));
|
|
@@ -2652,6 +2654,18 @@ async function handleImportInterface(key, session) {
|
|
|
}
|
|
|
} */
|
|
|
|
|
|
+// 为防止导入的ybp源文件的树结构是错误的,进行重排
|
|
|
+function resortImportProjectData(allData, curDepthData) {
|
|
|
+ curDepthData = project_facade.sortChildren(curDepthData);
|
|
|
+ curDepthData.forEach((cur, index) => {
|
|
|
+ cur.NextSiblingID = curDepthData[index + 1] && curDepthData[index + 1].ID || -1;
|
|
|
+ const nextDepthData = allData.filter(item => item.ParentID === cur.ID);
|
|
|
+ if (nextDepthData.length) {
|
|
|
+ resortImportProjectData(allData, nextDepthData);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
async function importProjects(data,req,updateData) {
|
|
|
let result = {error:0};
|
|
|
let stringArr = data.split("|----|");
|
|
@@ -2679,6 +2693,8 @@ async function importProjects(data,req,updateData) {
|
|
|
result.msg = `您创建的项目个数超限,请联系我们的客服人员,或者导出建设项目保存到本地备份,删除云上数据。`;
|
|
|
return result;
|
|
|
}
|
|
|
+ const constructions = mainData.projects.filter(item => item.projType === projectType.project);
|
|
|
+ resortImportProjectData(mainData.projects, constructions);
|
|
|
let [constructionProjectID,projectIDMap,labourCoeFileIDMap,calcProgramFileIDMap] = await handleMainProjectDatas(mainData,updateData,req.session.sessionUser.id);
|
|
|
result.constructionProjectID = constructionProjectID;
|
|
|
if(datas.length > 1 ){
|