Ver código fonte

Merge branch '1.0.0_online' of http://192.168.1.12:3000/SmartCost/ConstructionCost into 1.0.0_online

TonyKang 7 anos atrás
pai
commit
8de0178ed0

+ 3 - 1
public/web/tree_sheet/tree_sheet_helper.js

@@ -469,7 +469,9 @@ var TREE_SHEET_HELPER = {
             if (!node || node.children.length === 0) { return; }
             let centerX = hitinfo.cellRect.x + offset + node.depth() * indent + node.depth() * levelIndent + indent / 2;
             let centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2;
-            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);
                 let sheetName = hitinfo.sheet.name();
                 if(sheetName === 'stdBillsLib_bills'){

+ 3 - 1
web/building_saas/main/js/views/block_lib.js

@@ -299,7 +299,9 @@ var blockLibObj = {
                 return hitinfo.x > centerX + halfBoxLength && hitinfo.x < centerX + halfBoxLength + imgWidth + indent/2+3 + textLength;
             }
 
-            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;

+ 2 - 1
web/building_saas/main/js/views/fee_rate_view.js

@@ -303,7 +303,8 @@ var feeRateObject={
             };
         }
         TreeNodeCellType.prototype.processMouseDown = function (hitinfo) {
-            if (!_.isEmpty(this.rectInfo)&&hitinfo.x < this.rectInfo.x+this.rectInfo.rectW && hitinfo.x > this.rectInfo.x) {
+            ////方框外1像素内都有效
+            if (!_.isEmpty(this.rectInfo)&&Math.floor(hitinfo.x) <= this.rectInfo.x+this.rectInfo.rectW+2 && Math.floor(hitinfo.x) >= this.rectInfo.x-2) {
                 this.collapsed = !this.collapsed;
                 this.refreshChildrenVisible(hitinfo.sheet);
                 hitinfo.sheet.invalidateLayout();

+ 9 - 2
web/building_saas/main/js/views/project_property_basicInfo.js

@@ -398,9 +398,16 @@ let basicInfoView = {
         }
         TreeNodeCellType.prototype.processMouseDown = function (hitinfo) {
             var recode = data[hitinfo.row];
+            let offset = -1,
+                indent = 20,
+                halfBoxLength = 5;
+            let centerX = hitinfo.cellRect.x + offset + indent / 2;
+            let centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2
             if(recode&&recode.hasOwnProperty('items')){
-                var hoffset= hitinfo.cellRect.x+3;
-                if (hitinfo.x > hoffset && hitinfo.x < hoffset + 10){
+                //方框外1像素内都有效
+                const boxLengh = 10;
+                if (hitinfo.x >= centerX - halfBoxLength - 1 && hitinfo.x <= centerX + halfBoxLength + 1 &&
+                    hitinfo.y >= centerY - halfBoxLength - 1 && hitinfo.y <= centerY + halfBoxLength + 1) {
                     var collapsed = recode.collapsed==undefined?true:recode.collapsed;
                     collapsed = !collapsed
                     recode.collapsed=collapsed;

+ 9 - 2
web/building_saas/main/js/views/project_property_projFeature.js

@@ -379,9 +379,16 @@ let projFeatureView = {
         }
         TreeNodeCellType.prototype.processMouseDown = function (hitinfo) {
             var recode = data[hitinfo.row];
+            let offset = -1,
+                indent = 20,
+                halfBoxLength = 5;
+            let centerX = hitinfo.cellRect.x + offset + indent / 2;
+            let centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2
             if(recode&&recode.hasOwnProperty('items')){
-                var hoffset= hitinfo.cellRect.x+3;
-                if (hitinfo.x > hoffset && hitinfo.x < hoffset + 10){
+                //方框外1像素内都有效
+                const boxLengh = 10;
+                if (hitinfo.x >= centerX - halfBoxLength - 1 && hitinfo.x <= centerX + halfBoxLength + 1 &&
+                    hitinfo.y >= centerY - halfBoxLength - 1 && hitinfo.y <= centerY + halfBoxLength + 1) {
                     var collapsed = recode.collapsed==undefined?true:recode.collapsed;
                     collapsed = !collapsed
                     recode.collapsed=collapsed;

+ 2 - 2
web/building_saas/main/js/views/quantity_edit_view.js

@@ -102,10 +102,10 @@ let quantityEditObj = {
 
         QuantityEditCellType.prototype.processMouseDown = function (hitinfo) {
             let me=quantityEditObj;
-            if(isDoubleClick(this) == true && !projectReadOnly){//如果是双击,直接显示
+            /*if(isDoubleClick(this) == true && !projectReadOnly){//如果是双击,直接显示 2019-1-17 需求更改,取消双击弹出
                 me.showSelectModal(hitinfo);
                 return ;
-            }
+            }*/
            if(me.editingCell && hitinfo.row==me.editingCell.row){
                if(me.editingCell.isBtn == false){//是第一次点击,刷新显示按钮
                    me.editingCell.isBtn = true;

+ 6 - 2
web/building_saas/main/js/views/zmhs_view.js

@@ -11,7 +11,7 @@ let zmhs_obj = {
         header: [
             {headerName: "调整", headerWidth: 35, dataCode: "isAdjust", dataType: "String", cellType: "checkBox"},
             {headerName: "条件", headerWidth: 180, dataCode: "name", dataType: "String", cellType: "button",getText:'forName'},
-            {headerName: "内容", headerWidth: 70, dataCode: "content", dataType: "String", hAlign: "left",getText:'forContent'}
+            {headerName: "内容", headerWidth: 70, dataCode: "content", dataType: "String", hAlign: "left",getText:'forContent',cellType:'tipsCell'}
         ],
         view: {
             lockColumns:[0,1,2],
@@ -36,7 +36,7 @@ let zmhs_obj = {
         },
         emptyRowHeader: true,
         autoFit:true,
-        fitRow:['name','content']
+        fitRow:['name']
     },
     cusSpread:null,
     cusSheet:null,
@@ -112,6 +112,7 @@ let zmhs_obj = {
         }
     },
     showCoeData:function (node) {
+        let preSelections = this.coeSheet.getSelections();
         let selected = node?node:projectObj.project.mainTree.selected;
         let ration_coe = projectObj.project.ration_coe;
         let coeList = [];
@@ -141,6 +142,9 @@ let zmhs_obj = {
         if(projectReadOnly){
             disableSpread(zmhs_obj.coeSpread);
         }
+        if(preSelections){//定位光标到之前的位置
+            this.coeSheet.setSelection(preSelections[0].row,preSelections[0].col,preSelections[0].rowCount,preSelections[0].colCount);
+        }
     },
     showCusData:function (node) {
         let selected = node?node:projectObj.project.mainTree.selected;

+ 7 - 7
web/building_saas/pm/html/project-management.html

@@ -99,13 +99,13 @@
                 <div class="tab-content">
                     <div class="tab-pane active" id="pm_all" role="tabpanel">
                         <div class="toolsbar">
-                            <legend class="m-0 px-4 pb-1">全部
-                                <div class="tools-btn btn-group align-top px-3 ">
-                                    <div class="dropdown">
-                                        <a id="startA" class="btn btn-sm" href="javascript:void(0);" role="button" data-toggle="modal" aria-haspopup="true" aria-expanded="false">
-                                            新建
-                                        </a>
-                                    </div>
+                            <legend class="m-0 px-4">项目管理
+                                <div class="tools-btn btn-group align-top px-3 mt-2">
+                                    <a id="startA" href="javascript:void(0);" data-toggle="modal" data-target="#addPoj3" class="btn btn-sm"><i class="fa fa-sticky-note-o"></i> 新建</a>
+                                    <a id="upLevel" href="javascript:void(0);" class="btn btn-light btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="升级"><i class="fa fa-arrow-left" aria-hidden="true"></i></a>
+                                    <a id="downLevel" href="javascript:void(0);" class="btn btn-light btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="降级"><i class="fa fa-arrow-right" aria-hidden="true"></i></a>
+                                    <a id="upMove" href="javascript:void(0);" class="btn btn-light btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="上移"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
+                                    <a id="downMove" href="javascript:void(0);" class="btn btn-light btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="下移"><i class="fa fa-arrow-down" aria-hidden="true"></i></a>
                                 </div>
                             </legend>
                         </div>

+ 2 - 1
web/building_saas/pm/js/pm_gc.js

@@ -331,7 +331,8 @@ const gcTreeObj = {
             let centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2;;
             if (!node || node.children.length === 0) { return; }
 
-            if (hitinfo.x > centerX - halfBoxLength && hitinfo.x < centerX + halfBoxLength && hitinfo.y > centerY - halfBoxLength && hitinfo.y < centerY + halfBoxLength) {
+            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;

+ 141 - 1
web/building_saas/pm/js/pm_newMain.js

@@ -193,6 +193,7 @@ const projTreeObj = {
             this.bindEvent(newWorkBook);
             this.loadContextMenu();
             this.loadStartMenu();
+            this.loadBtn();
         }
         return newWorkBook;
     },
@@ -407,6 +408,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;
@@ -433,6 +570,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);
@@ -886,7 +1024,9 @@ const projTreeObj = {
                 }
                 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;

+ 2 - 1
web/building_saas/pm/js/pm_share.js

@@ -380,7 +380,8 @@ const pmShare = (function () {
                 });
             }
             if (!node || node.children.length === 0) { return; }
-            if (hitinfo.x > centerX - halfBoxLength && hitinfo.x < centerX + halfBoxLength && hitinfo.y > centerY - halfBoxLength && hitinfo.y < centerY + halfBoxLength) {
+            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;