|
@@ -2740,7 +2740,7 @@ $(document).ready(function() {
|
|
|
$.bootstrapLoading.progressStart('拷贝项目', true);
|
|
|
$("#progress_modal_body").text('正在拷贝项目,请稍候……');
|
|
|
await ajaxPost('/pm/api/copyProjects', {projectMap:projectMap,user_id: userID, tenderCount: 1});
|
|
|
- await importProcessChecking(null, null, (newProjectData) => handleTenderAfterChecking(newProjectData[0], projectData));
|
|
|
+ await importProcessChecking(null, null, (newProjectData) => handleTenderAfterChecking(newProjectData, projectData));
|
|
|
} catch (err) {
|
|
|
alert(err);
|
|
|
}
|
|
@@ -3027,7 +3027,7 @@ async function init(refresh = false) {
|
|
|
await ajaxPost('/pm/api/prepareInitialData', {user_id: userID});
|
|
|
await importProcessChecking(null, null, () => {
|
|
|
initProjects(() => $.bootstrapLoading.progressEnd());
|
|
|
- });
|
|
|
+ }, true);
|
|
|
} else {
|
|
|
await importProcessChecking(null, ({ content }) => {
|
|
|
$.bootstrapLoading.progressStart('欢迎使用大司空计价', true);
|
|
@@ -3035,7 +3035,7 @@ async function init(refresh = false) {
|
|
|
}, () => {
|
|
|
$.bootstrapLoading.start();
|
|
|
initProjects(() => $.bootstrapLoading.end());
|
|
|
- });
|
|
|
+ }, true);
|
|
|
}
|
|
|
engineering = engineeringList !== null && engineeringList !== undefined ? JSON.parse(engineeringList) : [];
|
|
|
} catch (error) {
|
|
@@ -5099,13 +5099,19 @@ $(function () {
|
|
|
|
|
|
// 导入检查完成时,对新增建设项目的处理
|
|
|
function handleProjectAfterChecking(projectData) {
|
|
|
+ if (!projectData) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
const rootData = projectData.find(item => item.projType === projectType.project);
|
|
|
const sorted = commonUtil.getSortedTreeData(rootData.ParentID, projectData);
|
|
|
importView.doAfterImport(sorted);
|
|
|
}
|
|
|
// 导入检查完成时,对新增单位工程的处理
|
|
|
-function handleTenderAfterChecking(newTender, orgTender) {
|
|
|
- const tenderData = {...orgTender, ...newTender};
|
|
|
+function handleTenderAfterChecking(projectData, orgTender) {
|
|
|
+ if (!projectData) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const tenderData = {...orgTender, ...projectData[0]};
|
|
|
const parent = projTreeObj.tree.findNode(tenderData.ParentID);
|
|
|
const next = projTreeObj.tree.findNode(tenderData.NextSiblingID);
|
|
|
const newNode = projTreeObj.insert(tenderData, parent, next);
|
|
@@ -5113,41 +5119,35 @@ function handleTenderAfterChecking(newTender, orgTender) {
|
|
|
projTreeObj.refreshNodeData(refreshNodes);
|
|
|
}
|
|
|
|
|
|
-async function importProcessChecking(key, processingFunc = null, completeFunc = null) {
|
|
|
+async function importProcessChecking(key, processingFunc = null, completeFunc = null, immediately = false) {
|
|
|
let count = 0;
|
|
|
- setTimeout(checking,2000)
|
|
|
+ immediately ? checking() : setTimeout(checking, 2000);
|
|
|
async function checking() {
|
|
|
- let result = await ajaxPost("/pm/api/importProcessChecking",{key:key,user_id:userID});
|
|
|
- if(result.error == 1){
|
|
|
- let message = result.msg?result.msg:result.message;
|
|
|
+ let result = await ajaxPost("/pm/api/importProcessChecking", { key: key, user_id: userID });
|
|
|
+ if (result.error == 1) {
|
|
|
+ let message = result.msg ? result.msg : result.message;
|
|
|
setTimeout(function () {
|
|
|
$.bootstrapLoading.progressEnd();//不做这个的话太快,页面不会自动关闭
|
|
|
- },500);
|
|
|
+ }, 500);
|
|
|
alert(message);
|
|
|
if (completeFunc) {
|
|
|
- completeFunc();
|
|
|
+ completeFunc(result.data);
|
|
|
}
|
|
|
- }else if(result.error == 0){
|
|
|
- if(result.status == "processing"){
|
|
|
+ } else if (result.error == 0) {
|
|
|
+ if (result.status == "processing") {
|
|
|
// 只调用一次
|
|
|
if (processingFunc && count === 0) {
|
|
|
processingFunc(result);
|
|
|
}
|
|
|
count++;
|
|
|
- setTimeout(checking,2000);
|
|
|
- }else if(result.status == "complete"){
|
|
|
+ setTimeout(checking, 2000);
|
|
|
+ } else if (result.status == "complete") {
|
|
|
if (completeFunc) {
|
|
|
completeFunc(result.data);
|
|
|
- }/* else if (result.data && result.data.type === projectType.project) {
|
|
|
- handleProjectAfterChecking(result.data.projectData);
|
|
|
- } else if (result.data && result.data.type === projectType.tender) {
|
|
|
- handleTenderAfterChecking(result.data.projectData);
|
|
|
- } */
|
|
|
+ }
|
|
|
$.bootstrapLoading.progressEnd();
|
|
|
//refreshAllPage();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|