Bläddra i källkod

feat: 工程量编辑新需求

zhangweicheng 4 år sedan
förälder
incheckning
465ad74d29

+ 1 - 1
modules/main/facade/ration_facade.js

@@ -684,7 +684,7 @@ async function getProjectGLJinfo(projectID,t_newRationGLJList,gljKeyMap,gljCodes
   let newRationGLJList=[];
 
   let gljListModel = new GLJListModel();
-  let t_projectGLJList = await projectGLJModel.find({'project_id':projectID,'code':{'$in':gljCodes}}).lean();
+  let t_projectGLJList = await projectGLJModel.find({'project_id':projectID}).lean();
   for(let pg of t_projectGLJList){
      let pindex = getIndex(pg);  
      projectGLJMap[pindex] = pg;

+ 35 - 0
public/web/sheet/sheet_data_helper.js

@@ -384,5 +384,40 @@ var SheetDataHelper = {
                 }
             }
         }
+    },
+    setMoreButtonPos:function(button,sheet,cellRect){
+        let pos = SheetDataHelper.getObjPos(sheet.getParent().qo);
+        let headerHeight = sheet.getRowHeight(0,GC.Spread.Sheets.SheetArea.colHeader)
+        if(cellRect.y === undefined){//如果没有即滚动到超出了视图范围,设置到看不见的位置
+            button.css("top", -1000)
+        }else{
+            button.css("top", pos.y+cellRect.y-headerHeight-15).css("left", pos.x+cellRect.x+cellRect.width);
+        }
+        
+    },
+
+    showMoreButton:function(hitinfo,callback){
+        let sheet = hitinfo.sheet;
+        if(sheet && sheet.getParent().qo){
+            let button = $('.moreButton');
+            button.unbind('click');
+            button.bind('click',function(){
+                callback(hitinfo.row);
+            })
+            this.setMoreButtonPos(button,sheet,hitinfo.cellRect);
+            button.show();
+        }
+    },
+
+    hideMoreButton:function(){
+        $('.moreButton').hide();
+    },
+    moveMoreButton:function(sheet,newTopRow){
+        let button = $('.moreButton');
+        if(button.is(':visible')){
+            let cellRect = sheet.getCellRect(sheet.getActiveRowIndex(), sheet.getActiveColumnIndex());
+            this.setMoreButtonPos(button,sheet,cellRect)
+        }
+       
     }
 };

+ 8 - 0
web/building_saas/css/main.css

@@ -824,4 +824,12 @@ color:#666;
 font-size: 16px;
 margin-bottom:0;
 color:#333;
+}
+
+.moreButton{
+  position: absolute;
+}
+.moreImg{
+  width: 15px;
+  height: 15px;
 }

+ 3 - 0
web/building_saas/main/html/main.html

@@ -186,6 +186,9 @@
                       <div class="main-content" style="width: 100%; display: inline-block" id="main">
                           <div class="top-content" id="top_div" style="overflow:hidden;">
                               <div class="main-data-top" id="billsSpread"></div>
+                              <div class="moreButton" style="display: none">
+                                <img src="/web/dest/css/img/more.png" class="moreImg"></img>
+                              </div>
                           </div>
                           <div class="resize-y" id="mainVerticalResize"></div>
                           <div class="bottom-content" id="bottom_div">

+ 5 - 5
web/building_saas/main/js/views/glj_col.js

@@ -10,14 +10,14 @@ let gljCol = {
             {headerName: "单位", headerWidth: 45, dataCode: "unit", dataType: "String", hAlign: "center"},
             {headerName: "预算价", headerWidth: 65, dataCode: "marketPrice", dataType: "Number", validator:"number",hAlign: "right"},//, decimalField: "glj.unitPrice"
             {headerName: "调整价", headerWidth: 65, dataCode: "adjustPrice", dataType: "Number",validator:"number", hAlign: "right"},//, decimalField: "glj.unitPrice"1
-            {headerName: "自定消耗", headerWidth: 65, dataCode: "customQuantity", dataType: "Number",validator:"number", hAlign: "right", decimalField: "glj.quantity"},
-            {headerName: "消耗量", headerWidth: 65, dataCode: "quantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
+            {headerName: "自定消耗", headerWidth: 65, dataCode: "customQuantity", dataType: "Number",validator:"number", hAlign: "right"},
+            {headerName: "消耗量", headerWidth: 65, dataCode: "quantity", dataType: "Number", hAlign: "right"},
             {headerName: "定额价", headerWidth: 65, dataCode: "basePrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"
-            {headerName: "定额消耗", headerWidth: 65, dataCode: "rationItemQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},   // dataType: "Number", formatter: "0.00"
-            {headerName: "总消耗量", headerWidth: 80, dataCode: "totalQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
+            {headerName: "定额消耗", headerWidth: 65, dataCode: "rationItemQuantity", dataType: "Number", hAlign: "right"},   // dataType: "Number", formatter: "0.00"
+            {headerName: "总消耗量", headerWidth: 80, dataCode: "totalQuantity", dataType: "Number", hAlign: "right"},
             // {headerName: "暂估", headerWidth: 45, dataCode: "isEstimate", dataType: "String", hAlign: "center", vAlign: "center", cellType: "checkBox"},
             {headerName: "调后预算价", headerWidth: 80, dataCode: "tenderPrice", dataType: "Number", hAlign: "right", visible: false},
-            {headerName: "调后消耗量", headerWidth: 80, dataCode: "tenderQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity", visible: false}
+            {headerName: "调后消耗量", headerWidth: 80, dataCode: "tenderQuantity", dataType: "Number", hAlign: "right", visible: false}
         ],
         view: {
             lockColumns: [ "adjustPrice", "rationItemQuantity", "quantity", "totalQuantity", "isEstimate", "tenderPrice", "tenderQuantity"],

+ 14 - 0
web/building_saas/main/js/views/project_view.js

@@ -557,6 +557,9 @@ var projectObj = {
         let colSetting = projectObj.mainController.setting.cols[info.col];
         projectObj.lastCol = colSetting;
         projectObj.lastCell = {row: info.row, col: info.col};
+        if(colSetting.data.field === 'quantity'){
+            SheetDataHelper.hideMoreButton()
+        }  
     },
     //repaint 动态下拉框
     mainSpreadEnterCell: function (sender, info) {
@@ -573,6 +576,13 @@ var projectObj = {
             }
         }
     },
+      //滚动造价书鼠标时,工程量的更多按钮跟着移动
+    TopRowChanged:function(type,info){
+        let colSetting = projectObj.mainController.setting.cols[info.sheet.getActiveColumnIndex()];
+        if(colSetting.data.field === 'quantity'){
+            SheetDataHelper.moveMoreButton(info.sheet)
+        }    
+    },
     mainSpreadEditStarting: function (sender, info) {
         let project = projectObj.project;
         let node = project.mainTree.items[info.row];
@@ -981,6 +991,10 @@ var projectObj = {
                 that.mainSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, that.onCellDoubleClick);
                 that.mainSpread.bind(GC.Spread.Sheets.Events.ColumnWidthChanged, that.onColumnWidthChanged);
                 that.mainSpread.bind(GC.Spread.Sheets.Events.ClipboardPasting, that.onClipboardPasting);
+
+
+                //工程量悬浮窗移动事件
+                that.mainSpread.bind(GC.Spread.Sheets.Events.TopRowChanged, that.TopRowChanged);    
                 //let loadOtherStartTime = +new Date();
                 //if(!projectReadOnly){
                     that.loadMainSpreadContextMenu();

+ 18 - 10
web/building_saas/main/js/views/quantity_edit_view.js

@@ -62,9 +62,10 @@ let quantityEditObj = {
         }
         QuantityEditCellType.prototype = new ns.CellTypes.Text();
         QuantityEditCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
+            let me=quantityEditObj;
             if(!projectReadOnly){
                 if(options.sheet.getActiveRowIndex()==options.row&&options.sheet.getActiveColumnIndex()==options.col){
-                    var image = document.getElementById('f_btn'),imageMagin = 3;
+                  /*   var image = document.getElementById('f_btn'),imageMagin = 3;
                     var imageHeight = 15;
                     var imageWidth = 25;
                     var imageX = x + w - imageWidth- imageMagin, imageY = y + h / 2 - imageHeight / 2;
@@ -80,12 +81,18 @@ let quantityEditObj = {
                     ctx.fill();//画实心圆
                     ctx.closePath();
                     ctx.restore();
-                    w = w - imageWidth - imageMagin;
+                    w = w - imageWidth - imageMagin; */
+                    if(options.sheet.getCell(options.row,options.col).locked() != true){
+                        SheetDataHelper.showMoreButton({sheet:options.sheet,cellRect:{x,y,width: w,height:h},row:options.row },function(row){
+                            me.showSelectModal(row);
+                        })
+                     }
+
                 }
             }
             GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
         };
-        QuantityEditCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
+      /*   QuantityEditCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
             return {
                 x: x,
                 y: y,
@@ -96,9 +103,10 @@ let quantityEditObj = {
                 sheetArea: context.sheetArea
             };
         };
-
+ */
         //2018 -09 -26  修改工程量这个输入控件,删除悬浮提示注释,还原时通过git 历史
-        QuantityEditCellType.prototype.processMouseDown = function (hitinfo) {
+        //2021 -04 -16  悬浮提示到表格外面
+      /*   QuantityEditCellType.prototype.processMouseDown = function (hitinfo) {
             let me=quantityEditObj;
             if(hitinfo.sheet.getActiveRowIndex()==hitinfo.row&&hitinfo.sheet.getActiveColumnIndex()==hitinfo.col){
                 var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
@@ -109,21 +117,21 @@ let quantityEditObj = {
                     }
                 }
             }
-        };
+        }; */
         return new QuantityEditCellType();
     },
-    showSelectModal:function (hitinfo) {
+    showSelectModal:function (row) {
         //锁定的清单不显示
         let project = projectObj.project;
         if(project.mainTree.selected.sourceType == ModuleNames.bills && project.isBillsLocked() && project.withinBillsLocked(project.mainTree.selected)){
             return;
         }
-        this.initModalContent(hitinfo);
+        this.initModalContent(row);
         $("#quantityEXPEdit").modal({show:true});
     },
-    initModalContent:function (hitinfo) {
+    initModalContent:function (row) {
         //现在改成有可能点击时,还没选中节点,所以要靠row来判断
-        let selected = projectObj.project.mainTree.items[hitinfo.row];
+        let selected = projectObj.project.mainTree.items[row];
         if(selected.sourceType == ModuleNames.ration){//暂时只有定额才有基数选择,所以其它的先隐藏表格
             $("#quantityEditSpread").show();//quantityEditSpread
         }else {

BIN
web/dest/css/img/more.png