|
@@ -503,6 +503,7 @@ const projTreeObj = {
|
|
|
}
|
|
}
|
|
|
projTreeObj.moveTo(selected, null, parent, next, null, action);
|
|
projTreeObj.moveTo(selected, null, parent, next, null, action);
|
|
|
$.bootstrapLoading.end();
|
|
$.bootstrapLoading.end();
|
|
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
//升级后选中节点的后兄弟节点不成为其子节点,因为有层级类型限制(相当于选中节点移动到父项后成为其后兄弟)
|
|
//升级后选中节点的后兄弟节点不成为其子节点,因为有层级类型限制(相当于选中节点移动到父项后成为其后兄弟)
|
|
@@ -1623,6 +1624,40 @@ const projTreeObj = {
|
|
|
let result =await ajaxGet("/pm/api/getUploadToken");
|
|
let result =await ajaxGet("/pm/api/getUploadToken");
|
|
|
$("#confirm-import").show();
|
|
$("#confirm-import").show();
|
|
|
projTreeObj.uptoken=result.uptoken;
|
|
projTreeObj.uptoken=result.uptoken;
|
|
|
|
|
+ },
|
|
|
|
|
+ // 树数据发生变化,触发推送
|
|
|
|
|
+ emitTreeChange: function () {
|
|
|
|
|
+ const compilationID = compilationData._id;
|
|
|
|
|
+ // 获取当前树节点展开状态和焦点行
|
|
|
|
|
+ const isActive = $('#tab_pm_all').hasClass('active');
|
|
|
|
|
+ const expandState = isActive ? this.tree.getExpState(this.tree.items) : null;
|
|
|
|
|
+ const selection = isActive && this.tree.selected ? { row: this.tree.selected.serialNo(), rowCount: 1 } : null;
|
|
|
|
|
+ socket.emit('pmTreeChange', { userID, compilationID, expandState, selection });
|
|
|
|
|
+ },
|
|
|
|
|
+ initTree: function (refresh = false, callback, expandCallback) {
|
|
|
|
|
+ if (gcTreeObj.workBook) {
|
|
|
|
|
+ gcTreeObj.workBook.destroy();
|
|
|
|
|
+ gcTreeObj.workBook = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ gcTreeObj.tree = null;
|
|
|
|
|
+ init(refresh, callback, expandCallback);
|
|
|
|
|
+ },
|
|
|
|
|
+ handleNotifyClick: function (expandState, selection) {
|
|
|
|
|
+ $('#notify').hide();
|
|
|
|
|
+ const callback = () => {
|
|
|
|
|
+ const sheet = this.workBook.getSheet(0);
|
|
|
|
|
+ if (selection && this.tree.items[selection.row]) {
|
|
|
|
|
+ this.initSelection(selection, { row: 0, rowCount: 1 }, sheet);
|
|
|
|
|
+ const col = sheet.getActiveColumnIndex();
|
|
|
|
|
+ sheet.setSelection(selection.row, col, 1, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ const expandCallback = () => {
|
|
|
|
|
+ if (expandState) {
|
|
|
|
|
+ this.tree.setExpandedByState(this.tree.items, expandState);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ this.initTree(true, callback, expandCallback);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
};
|
|
};
|
|
@@ -1651,15 +1686,8 @@ $(document).ready(function() {
|
|
|
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- init();
|
|
|
|
|
- $('#tab_pm_all').on('show.bs.tab', function () {
|
|
|
|
|
- if(gcTreeObj.workBook){
|
|
|
|
|
- gcTreeObj.workBook.destroy();
|
|
|
|
|
- gcTreeObj.workBook = null;
|
|
|
|
|
- }
|
|
|
|
|
- gcTreeObj.tree = null;
|
|
|
|
|
- init();
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ projTreeObj.initTree();
|
|
|
|
|
+ $('#tab_pm_all').on('show.bs.tab', () => projTreeObj.initTree(true));
|
|
|
|
|
|
|
|
// 侧滑数据
|
|
// 侧滑数据
|
|
|
/* $(".poj-list").on('click', ".open-sidebar", function() {
|
|
/* $(".poj-list").on('click', ".open-sidebar", function() {
|
|
@@ -1952,6 +1980,7 @@ $(document).ready(function() {
|
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
|
STATE.deleting = false;
|
|
STATE.deleting = false;
|
|
|
}, 500);
|
|
}, 500);
|
|
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
}, function () {
|
|
}, function () {
|
|
|
$.bootstrapLoading.end();
|
|
$.bootstrapLoading.end();
|
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
@@ -1986,6 +2015,7 @@ $(document).ready(function() {
|
|
|
select.data.name = newName;
|
|
select.data.name = newName;
|
|
|
let sheet = projTreeObj.workBook.getActiveSheet();
|
|
let sheet = projTreeObj.workBook.getActiveSheet();
|
|
|
projTreeObj.setCellValue({ row: sheet.getActiveRowIndex(), col: 0 }, select, sheet, projTreeObj.setting);
|
|
projTreeObj.setCellValue({ row: sheet.getActiveRowIndex(), col: 0 }, select, sheet, projTreeObj.setting);
|
|
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -2269,7 +2299,7 @@ function initNodesVisibility(nodes, visible) {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function initProjects(callback) {
|
|
|
|
|
|
|
+function initProjects(callback, expandCallback) {
|
|
|
GetAllProjectData(function (datas) {
|
|
GetAllProjectData(function (datas) {
|
|
|
//设置项目类别
|
|
//设置项目类别
|
|
|
for (let data of datas) {
|
|
for (let data of datas) {
|
|
@@ -2288,7 +2318,11 @@ function initProjects(callback) {
|
|
|
sheet.name('projectSheet');
|
|
sheet.name('projectSheet');
|
|
|
sheetCommonObj.spreadDefaultStyle(projTreeObj.workBook);
|
|
sheetCommonObj.spreadDefaultStyle(projTreeObj.workBook);
|
|
|
projTreeObj.sumEngineeringCost();
|
|
projTreeObj.sumEngineeringCost();
|
|
|
- initNodesVisibility(projTreeObj.tree.items, false);
|
|
|
|
|
|
|
+ if (expandCallback) {
|
|
|
|
|
+ expandCallback();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ initNodesVisibility(projTreeObj.tree.items, false);
|
|
|
|
|
+ }
|
|
|
projTreeObj.showTreeData(projTreeObj.tree.items, projTreeObj.setting, sheet);
|
|
projTreeObj.showTreeData(projTreeObj.tree.items, projTreeObj.setting, sheet);
|
|
|
//初始选择
|
|
//初始选择
|
|
|
const initSel = sheet.getSelections()[0] ? sheet.getSelections()[0] : {row: 0, rowCount: 1};
|
|
const initSel = sheet.getSelections()[0] ? sheet.getSelections()[0] : {row: 0, rowCount: 1};
|
|
@@ -2307,7 +2341,7 @@ function initProjects(callback) {
|
|
|
/**
|
|
/**
|
|
|
* 初始化数据
|
|
* 初始化数据
|
|
|
* @return {void} */
|
|
* @return {void} */
|
|
|
-async function init(refresh = false) {//refresh是刷新页面时才使用的
|
|
|
|
|
|
|
+async function init(refresh = false, callback, expandCallback) {//refresh是刷新页面时才使用的
|
|
|
try {
|
|
try {
|
|
|
billValuation = billValuation.replace(/\n/g, '\\n');
|
|
billValuation = billValuation.replace(/\n/g, '\\n');
|
|
|
rationValuation = rationValuation.replace(/\n/g, '\\n');
|
|
rationValuation = rationValuation.replace(/\n/g, '\\n');
|
|
@@ -2319,7 +2353,12 @@ async function init(refresh = false) {//refresh是刷新页面时才使用的
|
|
|
$("#progress_modal_body").text('首次加载例题,请稍候……');
|
|
$("#progress_modal_body").text('首次加载例题,请稍候……');
|
|
|
await ajaxPost('/pm/api/prepareInitialData', { user_id: userID });
|
|
await ajaxPost('/pm/api/prepareInitialData', { user_id: userID });
|
|
|
await importProcessChecking(null, null, () => {
|
|
await importProcessChecking(null, null, () => {
|
|
|
- initProjects(() => $.bootstrapLoading.progressEnd());
|
|
|
|
|
|
|
+ initProjects(() => {
|
|
|
|
|
+ $.bootstrapLoading.progressEnd();
|
|
|
|
|
+ if (callback) {
|
|
|
|
|
+ callback();
|
|
|
|
|
+ }
|
|
|
|
|
+ }, expandCallback);
|
|
|
}, true);
|
|
}, true);
|
|
|
} else {
|
|
} else {
|
|
|
await importProcessChecking(null, ({ content }) => {
|
|
await importProcessChecking(null, ({ content }) => {
|
|
@@ -2327,7 +2366,12 @@ async function init(refresh = false) {//refresh是刷新页面时才使用的
|
|
|
$("#progress_modal_body").text(content);
|
|
$("#progress_modal_body").text(content);
|
|
|
}, () => {
|
|
}, () => {
|
|
|
$.bootstrapLoading.start();
|
|
$.bootstrapLoading.start();
|
|
|
- initProjects(() => $.bootstrapLoading.end());
|
|
|
|
|
|
|
+ initProjects(() => {
|
|
|
|
|
+ $.bootstrapLoading.end();
|
|
|
|
|
+ if (callback) {
|
|
|
|
|
+ callback();
|
|
|
|
|
+ }
|
|
|
|
|
+ }, expandCallback);
|
|
|
}, true);
|
|
}, true);
|
|
|
}
|
|
}
|
|
|
engineering = engineeringList !== null && engineeringList !== undefined ? JSON.parse(engineeringList) : [];
|
|
engineering = engineeringList !== null && engineeringList !== undefined ? JSON.parse(engineeringList) : [];
|
|
@@ -2371,6 +2415,7 @@ function AddProject() {
|
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
|
STATE.addingProject = false;
|
|
STATE.addingProject = false;
|
|
|
}, 500);
|
|
}, 500);
|
|
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
};
|
|
};
|
|
|
let errCB = function () {
|
|
let errCB = function () {
|
|
|
$.bootstrapLoading.end();
|
|
$.bootstrapLoading.end();
|
|
@@ -2957,6 +3002,7 @@ function AddTender() {
|
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
|
STATE.addingTender = false;
|
|
STATE.addingTender = false;
|
|
|
}, 500);
|
|
}, 500);
|
|
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
};
|
|
};
|
|
|
let errCB = function () {
|
|
let errCB = function () {
|
|
|
$.bootstrapLoading.end();
|
|
$.bootstrapLoading.end();
|
|
@@ -3053,6 +3099,7 @@ function AddFolder() {
|
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
|
STATE.addingFolder = false;
|
|
STATE.addingFolder = false;
|
|
|
}, 500);
|
|
}, 500);
|
|
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
};
|
|
};
|
|
|
let errCB = function () {
|
|
let errCB = function () {
|
|
|
$.bootstrapLoading.end();
|
|
$.bootstrapLoading.end();
|
|
@@ -3819,6 +3866,7 @@ function handleProjectAfterChecking(projectData) {
|
|
|
const rootData = projectData.find(item => item.projType === projectType.project);
|
|
const rootData = projectData.find(item => item.projType === projectType.project);
|
|
|
const sorted = commonUtil.getSortedTreeData(rootData.ParentID, projectData);
|
|
const sorted = commonUtil.getSortedTreeData(rootData.ParentID, projectData);
|
|
|
doAfterImport(sorted);
|
|
doAfterImport(sorted);
|
|
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
}
|
|
}
|
|
|
// 导入检查完成时,对新增单位工程的处理
|
|
// 导入检查完成时,对新增单位工程的处理
|
|
|
function handleTenderAfterChecking(projectData, orgTender) {
|
|
function handleTenderAfterChecking(projectData, orgTender) {
|
|
@@ -3831,6 +3879,7 @@ function handleTenderAfterChecking(projectData, orgTender) {
|
|
|
const newNode = projTreeObj.insert(tenderData, parent, next);
|
|
const newNode = projTreeObj.insert(tenderData, parent, next);
|
|
|
const refreshNodes = projTreeObj.calEngineeringCost(newNode);
|
|
const refreshNodes = projTreeObj.calEngineeringCost(newNode);
|
|
|
projTreeObj.refreshNodeData(refreshNodes);
|
|
projTreeObj.refreshNodeData(refreshNodes);
|
|
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function importProcessChecking(key, processingFunc = null, completeFunc = null, immediately = false) {
|
|
async function importProcessChecking(key, processingFunc = null, completeFunc = null, immediately = false) {
|