|
|
@@ -86,7 +86,7 @@ const projTreeObj = {
|
|
|
allowContextMenu: false,
|
|
|
allowCopyPasteExcelStyle : false,
|
|
|
allowExtendPasteRange: false,
|
|
|
- allowUserDragDrop : true,
|
|
|
+ allowUserDragDrop : false,
|
|
|
allowUserDragFill: false,
|
|
|
scrollbarMaxAlign : true,
|
|
|
showDragDropTip:false
|
|
|
@@ -184,6 +184,7 @@ const projTreeObj = {
|
|
|
this.bindEvent(newWorkBook);
|
|
|
this.loadContextMenu();
|
|
|
this.loadStartMenu();
|
|
|
+ this.loadBtn();
|
|
|
}
|
|
|
return newWorkBook;
|
|
|
},
|
|
|
@@ -371,6 +372,142 @@ const projTreeObj = {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ //刷新按钮有效性(升降级、上下移)
|
|
|
+ refreshBtn: function (selected) {
|
|
|
+ const upLevel = $('#upLevel');
|
|
|
+ const downLevel = $('#downLevel');
|
|
|
+ const upMove = $('#upMove');
|
|
|
+ const downMove = $('#downMove');
|
|
|
+ if (!selected) {
|
|
|
+ upLevel.addClass('disabled');
|
|
|
+ downLevel.addClass('disabled');
|
|
|
+ upMove.addClass('disabled');
|
|
|
+ downMove.addClass('disabled');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ /* 升级有效
|
|
|
+ * 当前选中文件夹,且文件夹有父项,且父项是文件夹
|
|
|
+ * 当前选中建设项目,且建设项目有父项,且父项是文件夹
|
|
|
+ */
|
|
|
+ if ([projectType.project, projectType.folder].includes(selected.data.projType)
|
|
|
+ && selected.parent && selected.parent.data && selected.parent.data.projType === projectType.folder) {
|
|
|
+ upLevel.removeClass('disabled');
|
|
|
+ } else {
|
|
|
+ upLevel.addClass('disabled');
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 降级有效
|
|
|
+ * 当前选中文件夹,且文件夹有前兄弟,且前兄弟是文件夹
|
|
|
+ * 当前选中建设项目,且建设项目有前兄弟,且前兄弟是文件夹
|
|
|
+ * */
|
|
|
+ if ([projectType.project, projectType.folder].includes(selected.data.projType)
|
|
|
+ && selected.preSibling() && selected.preSibling().data.projType === projectType.folder) {
|
|
|
+ downLevel.removeClass('disabled');
|
|
|
+ } else {
|
|
|
+ downLevel.addClass('disabled');
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 上移有效
|
|
|
+ * 当前选中行有前兄弟,不论前兄弟类型
|
|
|
+ * */
|
|
|
+ selected.preSibling() ? upMove.removeClass('disabled') : upMove.addClass('disabled');
|
|
|
+ /*
|
|
|
+ * 后移有效
|
|
|
+ * 当前选中行有后兄弟,不论后兄弟类型
|
|
|
+ * */
|
|
|
+ selected.nextSibling ? downMove.removeClass('disabled') : downMove.addClass('disabled');
|
|
|
+
|
|
|
+ },
|
|
|
+ doAfterTreeOpr: function ({selected, parent, next, projectMap}) {
|
|
|
+ $.bootstrapLoading.start();
|
|
|
+ moveProjects({"user_id": userID, rootProjectID: null, projectMap: projectMap, feeRateMap: {}, unitPriceMap: {}},function (result) {
|
|
|
+ for (let key in result) {//更新前端节点数据
|
|
|
+ let updateData = result[key].update;
|
|
|
+ let node = projTreeObj.tree.findNode(result[key].query.ID);
|
|
|
+ if (node) {
|
|
|
+ for (let ukey in updateData) {
|
|
|
+ _.set(node.data,ukey,updateData[ukey]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ projTreeObj.moveTo(selected, null, parent, next, null);
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //升级后选中节点的后兄弟节点不成为其子节点,因为有层级类型限制(相当于选中节点移动到父项后成为其后兄弟)
|
|
|
+ upLevel: function () {
|
|
|
+ let selected = projTreeObj.tree.selected,
|
|
|
+ parent = selected.parent.parent,
|
|
|
+ next = selected.parent.nextSibling,
|
|
|
+ projectMap = {};
|
|
|
+ //更新父节点
|
|
|
+ projectMap[selected.pid()] = {query: {ID: selected.pid()}, update: {NextSiblingID: selected.id()}};
|
|
|
+ //更新选中节点前兄弟节点
|
|
|
+ let orgPre = selected.preSibling();
|
|
|
+ if (orgPre) {
|
|
|
+ projectMap[orgPre.id()] = {query: {ID: orgPre.id()}, update: {NextSiblingID: selected.nid()}};
|
|
|
+ }
|
|
|
+ //更新选中节点
|
|
|
+ projectMap[selected.id()] = {query: {ID: selected.id()}, update: {ParentID: selected.parent.pid(), NextSiblingID: selected.parent.nid()}};
|
|
|
+ this.doAfterTreeOpr({selected, parent, next, projectMap});
|
|
|
+ },
|
|
|
+ downLevel: function () {
|
|
|
+ let selected = projTreeObj.tree.selected,
|
|
|
+ parent = null,
|
|
|
+ next = null,
|
|
|
+ projectMap = {};
|
|
|
+ //更新前兄弟节点
|
|
|
+ let orgPre = selected.preSibling();
|
|
|
+ parent = orgPre;
|
|
|
+ projectMap[orgPre.id()] = {query: {ID: orgPre.id()}, update: {NextSiblingID: selected.nid()}};
|
|
|
+ //更新前兄弟最后子节点
|
|
|
+ if (orgPre.children.length > 0) {
|
|
|
+ let lastChild = orgPre.lastChild();
|
|
|
+ projectMap[lastChild.id()] = {query: {ID: lastChild.id()}, update: {NextSiblingID: selected.id()}};
|
|
|
+ }
|
|
|
+ //更新选中节点
|
|
|
+ projectMap[selected.id()] = {query: {ID: selected.id()}, update: {ParentID: orgPre.id(), NextSiblingID: -1}};
|
|
|
+ this.doAfterTreeOpr({selected, parent, next, projectMap});
|
|
|
+ },
|
|
|
+ upMove: function () {
|
|
|
+ let selected = projTreeObj.tree.selected,
|
|
|
+ parent = selected.parent,
|
|
|
+ next = selected.preSibling(),
|
|
|
+ projectMap = {};
|
|
|
+ //更新前前兄弟
|
|
|
+ let prepre = selected.preSibling().preSibling();
|
|
|
+ if (prepre) {
|
|
|
+ projectMap[prepre.id()] = {query: {ID: prepre.id()}, update: {NextSiblingID: selected.id()}};
|
|
|
+ }
|
|
|
+ //更新前兄弟
|
|
|
+ let pre = selected.preSibling();
|
|
|
+ projectMap[pre.id()] = {query: {ID: pre.id()}, update: {NextSiblingID: selected.nid()}};
|
|
|
+ //更新选中节点
|
|
|
+ projectMap[selected.id()] = {query: {ID: selected.id()}, update: {NextSiblingID: pre.id()}};
|
|
|
+ this.doAfterTreeOpr({selected, parent, next, projectMap});
|
|
|
+ },
|
|
|
+ downMove: function () {
|
|
|
+ let selected = projTreeObj.tree.selected,
|
|
|
+ parent = selected.parent,
|
|
|
+ next = selected.nextSibling.nextSibling,
|
|
|
+ projectMap = {};
|
|
|
+ //更新前兄弟
|
|
|
+ let pre = selected.preSibling();
|
|
|
+ if (pre) {
|
|
|
+ projectMap[pre.id()] = {query: {ID: pre.id()}, update: {NextSiblingID: selected.nid()}};
|
|
|
+ }
|
|
|
+ //更新后兄弟
|
|
|
+ projectMap[selected.nid()] = {query: {ID: selected.nid()}, update: {NextSiblingID: selected.id()}};
|
|
|
+ //更新选中节点
|
|
|
+ projectMap[selected.id()] = {query: {ID: selected.id()}, update: {NextSiblingID: selected.nextSibling.nid()}};
|
|
|
+ this.doAfterTreeOpr({selected, parent, next, projectMap});
|
|
|
+ },
|
|
|
+ loadBtn: function () {
|
|
|
+ $('#upLevel').click(this.upLevel.bind(this));
|
|
|
+ $('#downLevel').click(this.downLevel.bind(this));
|
|
|
+ $('#upMove').click(this.upMove.bind(this));
|
|
|
+ $('#downMove').click(this.downMove.bind(this));
|
|
|
+ },
|
|
|
getSelStyle: function (backColor) {
|
|
|
let style = new GC.Spread.Sheets.Style();
|
|
|
style.backColor = backColor;
|
|
|
@@ -397,6 +534,7 @@ const projTreeObj = {
|
|
|
let me = this;
|
|
|
let node = me.tree.items[newSel.row];
|
|
|
node = node ? node : null;
|
|
|
+ me.refreshBtn(node);
|
|
|
//恢复底色
|
|
|
if(oldSel){
|
|
|
me.setSelStyle(oldSel, me.setting.style.defalutBackColor,sheet);
|
|
|
@@ -607,6 +745,17 @@ const projTreeObj = {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ openTender: function (node, timeoutTime) {
|
|
|
+ setTimeout(function () {
|
|
|
+ let newTab = window.open('about:blank');
|
|
|
+ BeforeOpenProject(node.data.ID, {'fullFolder': GetFullFolder(node.parent)}, function () {
|
|
|
+ let mainUrl = `/main?project=${node.data.ID}`;
|
|
|
+ CommonAjax.get(mainUrl, [], function () {
|
|
|
+ newTab.location.replace(mainUrl); //不能后退
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }, timeoutTime);
|
|
|
+ },
|
|
|
getTreeNodeCell: function (tree) {
|
|
|
let me = projTreeObj;
|
|
|
let indent = 20;
|
|
|
@@ -784,24 +933,25 @@ const projTreeObj = {
|
|
|
}
|
|
|
if(hitinfo.sheet.name() === "projectSheet"){//只有项目管理界面才执行
|
|
|
//单项文件,进入造价书界面
|
|
|
- if(node.data.projType === projectType.tender && withingClickArea()){
|
|
|
- let timeoutTime = 200;
|
|
|
- if($('.slide-sidebar').hasClass('open')){
|
|
|
- timeoutTime = 500;
|
|
|
- }
|
|
|
- setTimeout(function () {
|
|
|
- let newTab = window.open('about:blank');
|
|
|
- BeforeOpenProject(node.data.ID, {'fullFolder': GetFullFolder(node.parent)}, function () {
|
|
|
- let mainUrl = `/main?project=${node.data.ID}`;
|
|
|
- CommonAjax.get(mainUrl, [], function () {
|
|
|
- newTab.location.replace(mainUrl); //不能后退
|
|
|
- });
|
|
|
- });
|
|
|
- }, timeoutTime);
|
|
|
+ if(node.data.projType === projectType.tender && withingClickArea()){
|
|
|
+ /*let thisClick = Date.now(),
|
|
|
+ open = false;
|
|
|
+ if (this.preNode === node && this.preClick && thisClick - this.preClick <= 300) {
|
|
|
+ open = true;*/
|
|
|
+ let timeoutTime = 200;
|
|
|
+ if($('.slide-sidebar').hasClass('open')){
|
|
|
+ timeoutTime = 500;
|
|
|
+ }
|
|
|
+ projTreeObj.openTender(node, timeoutTime);
|
|
|
+ /*}
|
|
|
+ this.preClick = open ? null : thisClick;
|
|
|
+ this.preNode = open ? null : node;*/
|
|
|
}
|
|
|
if (!node || node.children.length === 0) { return; }
|
|
|
}
|
|
|
- if (hitinfo.x > centerX - halfBoxLength && hitinfo.x < centerX + halfBoxLength && hitinfo.y > centerY - halfBoxLength && hitinfo.y < centerY + halfBoxLength) {
|
|
|
+ //统一改成方框外1像素内都有效
|
|
|
+ if (hitinfo.x >= centerX - halfBoxLength - 2 && hitinfo.x <= centerX + halfBoxLength + 2 &&
|
|
|
+ hitinfo.y >= centerY - halfBoxLength - 2 && hitinfo.y <= centerY + halfBoxLength + 2) {
|
|
|
node.setExpanded(!node.expanded);
|
|
|
TREE_SHEET_HELPER.massOperationSheet(hitinfo.sheet, function () {
|
|
|
let iCount = node.posterityCount(), i, child;
|
|
|
@@ -2039,7 +2189,7 @@ function AddTenderItems(selected, projName, tenderName, property, callback){
|
|
|
}
|
|
|
});
|
|
|
let pojNode = projTreeObj.insert(projData, parent, next);
|
|
|
- projTreeObj.insert(tenderData, pojNode, null);
|
|
|
+ let tenderNode = projTreeObj.insert(tenderData, pojNode, null);
|
|
|
callback();
|
|
|
});
|
|
|
});
|
|
|
@@ -2056,12 +2206,13 @@ function AddTenderItems(selected, projName, tenderName, property, callback){
|
|
|
updateDatas.push({updateType: 'update', updateData: {ID: pre.id(), NextSiblingID: tenderID}});
|
|
|
}
|
|
|
UpdateProjectData(updateDatas, function (datas) {
|
|
|
+ let tenderNode = null;
|
|
|
datas.forEach(function (data) {
|
|
|
if(data.updateType === 'new') {
|
|
|
setInitSummaryData(data.updateData);
|
|
|
data.updateData.feeStandardName = data.updateData.property.feeStandardName || '';
|
|
|
data.updateData.valuationType = data.updateData.property.valuationType === 'bill' ? '预算' : '工程量清单';
|
|
|
- projTreeObj.insert(data.updateData, tempProj, null);
|
|
|
+ tenderNode = projTreeObj.insert(data.updateData, tempProj, null);
|
|
|
}
|
|
|
});
|
|
|
callback();
|
|
|
@@ -2444,8 +2595,8 @@ function AddTender() {
|
|
|
|
|
|
|
|
|
let calcProgramName = $('#tender-calcProgram').children("option:selected").text();
|
|
|
-
|
|
|
- let callback = function() {
|
|
|
+ //let newTab = window.open('about:blank');
|
|
|
+ let callback = function(tenderNode) {
|
|
|
$('#add-tender-confirm').removeClass('disabled');
|
|
|
$("#add-tender-dialog").modal("hide");
|
|
|
$('#tender-name').val('');
|
|
|
@@ -2454,7 +2605,6 @@ function AddTender() {
|
|
|
$("#tender-calcProgram").children("option").removeAttr("selected");
|
|
|
$("#poj-name").val('');
|
|
|
$("#poj-name-info").hide();
|
|
|
-
|
|
|
};
|
|
|
let selectedItem = projTreeObj.tree.selected;
|
|
|
//地区
|