|
@@ -560,6 +560,7 @@ const projTreeObj = {
|
|
|
}
|
|
|
projTreeObj.moveTo(selected, null, parent, next, null, action);
|
|
|
$.bootstrapLoading.end();
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
});
|
|
|
},
|
|
|
//升级后选中节点的后兄弟节点不成为其子节点,因为有层级类型限制(相当于选中节点移动到父项后成为其后兄弟)
|
|
@@ -1693,9 +1694,41 @@ const projTreeObj = {
|
|
|
let result =await ajaxGet("/pm/api/getUploadToken");
|
|
|
$("#confirm-import").show();
|
|
|
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);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
};
|
|
|
// 新建项目必填项提示框设置“ 比如:注:为响应重庆地区指标采集标准数据要求,以上工程信息及特征必填项为必填项,请正确填写。”
|
|
|
function setupRequiredWarn(compilation) {
|
|
@@ -1736,15 +1769,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));
|
|
|
|
|
|
//单价、费率文件删除确认
|
|
|
$('#fileDelConfirm').click(function () {
|
|
@@ -2522,6 +2548,7 @@ $(document).ready(function() {
|
|
|
setTimeout(function () {
|
|
|
STATE.deleting = false;
|
|
|
}, 500);
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
}, function () {
|
|
|
$.bootstrapLoading.end();
|
|
|
setTimeout(function () {
|
|
@@ -2573,6 +2600,7 @@ $(document).ready(function() {
|
|
|
select.data.name = newName;
|
|
|
let sheet = projTreeObj.workBook.getActiveSheet();
|
|
|
projTreeObj.setCellValue({ row: sheet.getActiveRowIndex(), col: 0 }, select, sheet, projTreeObj.setting);
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -2705,7 +2733,6 @@ function changeFeeRate(engLib) {
|
|
|
|
|
|
//根据文件类型筛选新的基本信息数据
|
|
|
function getNeedfulBasicInfo(info, fileKind) {
|
|
|
- debugger;
|
|
|
/* let strMap = {
|
|
|
1: 'tender', //投标
|
|
|
2: 'bid', //招标
|
|
@@ -2885,7 +2912,7 @@ function initNodesVisibility(nodes, visible) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function initProjects(callback) {
|
|
|
+function initProjects(callback, expandCallback) {
|
|
|
GetAllProjectData(function (datas) {
|
|
|
//设置工程专业
|
|
|
for (let data of datas) {
|
|
@@ -2904,9 +2931,12 @@ function initProjects(callback) {
|
|
|
sheet.name('projectSheet');
|
|
|
sheetCommonObj.spreadDefaultStyle(projTreeObj.workBook);
|
|
|
projTreeObj.sumEngineeringCost();
|
|
|
- initNodesVisibility(projTreeObj.tree.items, false);
|
|
|
+ if (expandCallback) {
|
|
|
+ expandCallback();
|
|
|
+ } else {
|
|
|
+ initNodesVisibility(projTreeObj.tree.items, false);
|
|
|
+ }
|
|
|
projTreeObj.showTreeData(projTreeObj.tree.items, projTreeObj.setting, sheet);
|
|
|
- const rows = projTreeObj.tree.items.map((item, index) => index);
|
|
|
//初始选择
|
|
|
const initSel = sheet.getSelections()[0] ? sheet.getSelections()[0] : { row: 0, rowCount: 1 };
|
|
|
projTreeObj.initSelection(initSel, null, sheet);
|
|
@@ -2924,7 +2954,7 @@ function initProjects(callback) {
|
|
|
/**
|
|
|
* 初始化数据
|
|
|
*/
|
|
|
-async function init(refresh = false) {
|
|
|
+async function init(refresh = false, callback, expandCallback) {
|
|
|
console.log('init');
|
|
|
//init spread and pmTree
|
|
|
try {
|
|
@@ -2935,7 +2965,12 @@ async function init(refresh = false) {
|
|
|
$("#progress_modal_body").text('首次加载例题,请稍候……');
|
|
|
await ajaxPost('/pm/api/prepareInitialData', {user_id: userID});
|
|
|
await importProcessChecking(null, null, () => {
|
|
|
- initProjects(() => $.bootstrapLoading.progressEnd());
|
|
|
+ initProjects(() => {
|
|
|
+ $.bootstrapLoading.progressEnd();
|
|
|
+ if (callback) {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ }, expandCallback);
|
|
|
}, true);
|
|
|
} else {
|
|
|
await importProcessChecking(null, ({ content }) => {
|
|
@@ -2943,7 +2978,12 @@ async function init(refresh = false) {
|
|
|
$("#progress_modal_body").text(content);
|
|
|
}, () => {
|
|
|
$.bootstrapLoading.start();
|
|
|
- initProjects(() => $.bootstrapLoading.end());
|
|
|
+ initProjects(() => {
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ if (callback) {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ }, expandCallback);
|
|
|
}, true);
|
|
|
}
|
|
|
engineering = engineeringList !== null && engineeringList !== undefined ? JSON.parse(engineeringList) : [];
|
|
@@ -3011,6 +3051,7 @@ function AddProject() {
|
|
|
setTimeout(function () {
|
|
|
STATE.addingProject = false;
|
|
|
}, 500);
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
};
|
|
|
let errCB = function () {
|
|
|
$.bootstrapLoading.end();
|
|
@@ -3684,6 +3725,7 @@ function AddEngineering() {
|
|
|
setTimeout(function () {
|
|
|
STATE.addingEng = false;
|
|
|
}, 500);
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
};
|
|
|
let errCB = function () {
|
|
|
$.bootstrapLoading.end();
|
|
@@ -3814,6 +3856,7 @@ function AddTender() {
|
|
|
setTimeout(function () {
|
|
|
STATE.addingTender = false;
|
|
|
}, 500);
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
},
|
|
|
errCB = function () {
|
|
|
$.bootstrapLoading.end();
|
|
@@ -3922,6 +3965,7 @@ function AddFolder() {
|
|
|
setTimeout(function () {
|
|
|
STATE.addingFolder = false;
|
|
|
}, 500);
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
};
|
|
|
let errCB = function () {
|
|
|
$.bootstrapLoading.end();
|
|
@@ -4756,6 +4800,7 @@ function handleProjectAfterChecking(projectData) {
|
|
|
const rootData = projectData.find(item => item.projType === projectType.project);
|
|
|
const sorted = commonUtil.getSortedTreeData(rootData.ParentID, projectData);
|
|
|
importView.doAfterImport(sorted);
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
}
|
|
|
// 导入检查完成时,对新增单位工程的处理
|
|
|
function handleTenderAfterChecking(projectData, orgTender) {
|
|
@@ -4768,6 +4813,7 @@ function handleTenderAfterChecking(projectData, orgTender) {
|
|
|
const newNode = projTreeObj.insert(tenderData, parent, next);
|
|
|
const refreshNodes = projTreeObj.calEngineeringCost(newNode);
|
|
|
projTreeObj.refreshNodeData(refreshNodes);
|
|
|
+ projTreeObj.emitTreeChange();
|
|
|
}
|
|
|
|
|
|
async function importProcessChecking(key, processingFunc = null, completeFunc = null, immediately = false) {
|