Sfoglia il codice sorgente

分享界面,双击进入单位工程

zhongzewei 7 anni fa
parent
commit
eeeb383c98
2 ha cambiato i file con 24 aggiunte e 33 eliminazioni
  1. 8 21
      web/building_saas/pm/js/pm_newMain.js
  2. 16 12
      web/building_saas/pm/js/pm_share.js

+ 8 - 21
web/building_saas/pm/js/pm_newMain.js

@@ -833,11 +833,11 @@ const projTreeObj = {
             }
             }
         }
         }
     },
     },
-    openTender: function (node, timeoutTime) {
+    openTender: function (ID, parent, timeoutTime) {
         setTimeout(function () {
         setTimeout(function () {
             let newTab = window.open('about:blank');
             let newTab = window.open('about:blank');
-            BeforeOpenProject(node.data.ID, {'fullFolder': GetFullFolder(node.parent)}, function () {
-                let mainUrl = `/main?project=${node.data.ID}`;
+            BeforeOpenProject(ID, {'fullFolder': GetFullFolder(parent)}, function () {
+                let mainUrl = `/main?project=${ID}`;
                 CommonAjax.get(mainUrl, [], function () {
                 CommonAjax.get(mainUrl, [], function () {
                     newTab.location.replace(mainUrl); //不能后退
                     newTab.location.replace(mainUrl); //不能后退
                 });
                 });
@@ -980,27 +980,14 @@ const projTreeObj = {
                 ctx.drawImage(shareImg, x + 3, nowY - 7, shareImgWidth,shareImgHeight);
                 ctx.drawImage(shareImg, x + 3, nowY - 7, shareImgWidth,shareImgHeight);
             }
             }
             // Draw Text
             // Draw Text
-            //x = x + (node.depth() + 1) * indent +  node.depth() * levelIndent;
             x = x + (node.depth() + 1) * indent +  node.depth() * levelIndent + imgWidth + 3;
             x = x + (node.depth() + 1) * indent +  node.depth() * levelIndent + imgWidth + 3;
             w = w - (node.depth() + 1) * indent - node.depth() * levelIndent - imgWidth - 3;
             w = w - (node.depth() + 1) * indent - node.depth() * levelIndent - imgWidth - 3;
             GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
             GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
-          /*  if (node.data.shareInfo && node.data.shareInfo.length > 0) {//分享标记在文本后
-                let nowX = Math.floor(x) + w - 20;
-                let nowY = Math.floor((y + (y + h)) / 2);
-                ctx.drawImage(shareImg, nowX + 3, nowY - 7, shareImgWidth,shareImgHeight);
-            }*/
         };
         };
         TreeNodeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
         TreeNodeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
             let info = {x: x, y: y, row: context.row, col: context.col, cellStyle: cellStyle, cellRect: cellRect, sheetArea: context.sheetArea};
             let info = {x: x, y: y, row: context.row, col: context.col, cellStyle: cellStyle, cellRect: cellRect, sheetArea: context.sheetArea};
             let node = tree.items[info.row];
             let node = tree.items[info.row];
-            let offset = -1;
-            let centerX = info.cellRect.x + offset + node.depth() * indent + node.depth() * levelIndent + indent / 2;
-            let text = context.sheet.getText(info.row, info.col);
-            let value = context.sheet.getValue(info.row, info.col);
-            let acStyle = context.sheet.getActualStyle(info.row, info.col),
-                zoom = context.sheet.zoom();
-            let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: context.sheet, row: info.row, col: info.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
-            if(info.x > centerX + halfBoxLength && info.x < centerX + halfBoxLength + imgWidth + indent/2+3 + textLength){
+            if (node && node.data.projType === projectType.tender) {
                 info.isReservedLocation = true;
                 info.isReservedLocation = true;
             }
             }
             return info;
             return info;
@@ -1029,7 +1016,7 @@ const projTreeObj = {
                         if($('.slide-sidebar').hasClass('open')){
                         if($('.slide-sidebar').hasClass('open')){
                             timeoutTime = 500;
                             timeoutTime = 500;
                         }
                         }
-                        projTreeObj.openTender(node, timeoutTime);
+                        projTreeObj.openTender(node.data.ID, node.parent, timeoutTime);
                     }
                     }
                     this.preClick = open ? null : thisClick;
                     this.preClick = open ? null : thisClick;
                     this.preNode = open ? null : node;
                     this.preNode = open ? null : node;
@@ -1053,12 +1040,12 @@ const projTreeObj = {
                 hitinfo.sheet.repaint();
                 hitinfo.sheet.repaint();
             }
             }
         };
         };
-        /*TreeNodeCellType.prototype.processMouseMove = function (hitInfo) {
+        TreeNodeCellType.prototype.processMouseMove = function (hitInfo) {
             let sheet = hitInfo.sheet;
             let sheet = hitInfo.sheet;
-
             let div = sheet.getParent().getHost();
             let div = sheet.getParent().getHost();
             let canvasId = div.id + "vp_vp";
             let canvasId = div.id + "vp_vp";
             let canvas = $(`#${canvasId}`)[0];
             let canvas = $(`#${canvasId}`)[0];
+            let node = tree.items[hitInfo.row];
             //改变鼠标图案
             //改变鼠标图案
             if (sheet && hitInfo.isReservedLocation) {
             if (sheet && hitInfo.isReservedLocation) {
                 canvas.style.cursor='pointer';
                 canvas.style.cursor='pointer';
@@ -1067,7 +1054,7 @@ const projTreeObj = {
                 canvas.style.cursor='default';
                 canvas.style.cursor='default';
             }
             }
             return false;
             return false;
-        };*/
+        };
         TreeNodeCellType.prototype.processMouseEnter = function (hitinfo) {
         TreeNodeCellType.prototype.processMouseEnter = function (hitinfo) {
             let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
             let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
             let value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);
             let value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);

+ 16 - 12
web/building_saas/pm/js/pm_share.js

@@ -342,14 +342,7 @@ const pmShare = (function () {
         TreeNodeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
         TreeNodeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
             let info = {x: x, y: y, row: context.row, col: context.col, cellStyle: cellStyle, cellRect: cellRect, sheetArea: context.sheetArea};
             let info = {x: x, y: y, row: context.row, col: context.col, cellStyle: cellStyle, cellRect: cellRect, sheetArea: context.sheetArea};
             let node = tree.items[info.row];
             let node = tree.items[info.row];
-            let offset = -1;
-            let centerX = info.cellRect.x + offset + node.depth() * indent + node.depth() * levelIndent + indent / 2;
-            let text = context.sheet.getText(info.row, info.col);
-            let value = context.sheet.getValue(info.row, info.col);
-            let acStyle = context.sheet.getActualStyle(info.row, info.col),
-                zoom = context.sheet.zoom();
-            let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: context.sheet, row: info.row, col: info.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
-            if(info.x > centerX + halfBoxLength && info.x < centerX + halfBoxLength + imgWidth + indent/2+3 + textLength){
+            if (node && node.data.projType === projectType.tender) {
                 info.isReservedLocation = true;
                 info.isReservedLocation = true;
             }
             }
             return info;
             return info;
@@ -369,17 +362,28 @@ const pmShare = (function () {
                 return hitinfo.x > centerX + halfBoxLength && hitinfo.x < centerX + halfBoxLength + imgWidth + indent/2+3 + textLength;
                 return hitinfo.x > centerX + halfBoxLength && hitinfo.x < centerX + halfBoxLength + imgWidth + indent/2+3 + textLength;
             }
             }
             //点击单位工程
             //点击单位工程
-            if(node.data.projType === projectType.tender && withingClickArea()){
-                let newTab = window.open('about:blank');
+            if(node.data.projType === projectType.tender){
+                /*let newTab = window.open('about:blank');
                 //打开项目的实际ID
                 //打开项目的实际ID
                 BeforeOpenProject(node.data.actualTreeInfo.ID, {'fullFolder': GetFullFolder(node.parent)}, function () {
                 BeforeOpenProject(node.data.actualTreeInfo.ID, {'fullFolder': GetFullFolder(node.parent)}, function () {
                     let mainUrl = `/main?project=${node.data.actualTreeInfo.ID}`;
                     let mainUrl = `/main?project=${node.data.actualTreeInfo.ID}`;
                     CommonAjax.get(mainUrl, [], function () {
                     CommonAjax.get(mainUrl, [], function () {
                         newTab.location.href = mainUrl;
                         newTab.location.href = mainUrl;
                     });
                     });
-                });
+                });*/
+                let thisClick = Date.now(),
+                    open = false;
+                if (this.preNode === node && this.preClick && thisClick - this.preClick <= 300) {
+                    open = true;
+                    projTreeObj.openTender(node.data.actualTreeInfo.ID, node.parent, 200);
+                }
+                this.preClick = open ? null : thisClick;
+                this.preNode = open ? null : node;
+
+            }
+            if (!node || node.children.length === 0) {
+                return;
             }
             }
-            if (!node || node.children.length === 0) { return; }
             if (hitinfo.x >= centerX - halfBoxLength - 2 && hitinfo.x <= centerX + halfBoxLength + 2 &&
             if (hitinfo.x >= centerX - halfBoxLength - 2 && hitinfo.x <= centerX + halfBoxLength + 2 &&
                 hitinfo.y >= centerY - halfBoxLength - 2 && hitinfo.y <= centerY + halfBoxLength + 2) {
                 hitinfo.y >= centerY - halfBoxLength - 2 && hitinfo.y <= centerY + halfBoxLength + 2) {
                 node.setExpanded(!node.expanded);
                 node.setExpanded(!node.expanded);