Browse Source

feat: 混凝土bug,工程量编辑新需求

zhangweicheng 4 years ago
parent
commit
df9c22fc7f

+ 2 - 2
modules/ration_glj/facade/ration_glj_facade.js

@@ -783,9 +783,9 @@ async  function replaceGLJByData(data,compilation) {
     if (typeString.startsWith("2")||typeString=='4'||typeString=='5') {//只有材料类型才显示是否暂估
         data.isEstimate = result.is_evaluate;
     }
-    if (result.hasOwnProperty('subList') && result.subList.length > 0) {
+    /* if (result.hasOwnProperty('subList') && result.subList.length > 0) {
         data.subList = getMixRatioShowDatas(result.subList);
-    }
+    } */
     return [data,result];
 }
 

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

@@ -384,5 +384,41 @@ 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

@@ -248,6 +248,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

@@ -12,14 +12,14 @@ let gljCol = {
             {headerName: "单位", headerWidth: 45, dataCode: "unit", dataType: "String", hAlign: "center"},
             {headerName: "市场价", headerWidth: 65, dataCode: "marketPrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"
             {headerName: "调整价", headerWidth: 65, dataCode: "adjustPrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"1
-            {headerName: "自定消耗", headerWidth: 65, dataCode: "customQuantity", dataType: "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", 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", "quantity", "totalQuantity", "isEstimate",

+ 10 - 5
web/building_saas/main/js/views/glj_view.js

@@ -2,6 +2,8 @@
  * Created by CSL on 2017-05-12.
  */
 
+
+
 var gljOprObj = {
     sheet: null,
     libID: null,
@@ -782,9 +784,12 @@ var gljOprObj = {
                     ration_gljs[i].isAdd = glj.unit_price.is_add;
                     ration_gljs[i]=this.setGLJPrice(ration_gljs[i],glj);//设置工料机价格
                     let connect_index = this.getIndex(glj, gljKeyArray);
-                    if (needRatio==true&&mixRatioMap.hasOwnProperty(connect_index)) {
-                        let mixRatios = this.getMixRationShowDatas(mixRatioMap[connect_index], projectGljs,glj);
-                        ration_gljs[i].subList = mixRatios;
+                    if (needRatio==true) {
+                        delete ration_gljs[i].subList;//先清空,再赋值
+                        if(mixRatioMap.hasOwnProperty(connect_index)){
+                            let mixRatios = this.getMixRationShowDatas(mixRatioMap[connect_index], projectGljs,glj);
+                            ration_gljs[i].subList = mixRatios;
+                        }
                     }
                     if(ration) gljOprObj.getTotalQuantity(ration_gljs[i], ration);
                 }else {
@@ -1434,7 +1439,7 @@ var gljOprObj = {
                 gljOprObj.sheetData[index] = data;
                 glj_list[list_index] = data;
                 project.projectGLJ.loadNewProjectGLJToCaches([result.projectGLJ],true);
-                gljOprObj.showRationGLJSheetData();
+                gljOprObj.refreshView();
                 let node = project.ration_glj.updateGLJNodeAfterReplace(data);
                 if(node) nodes.push(node);
                 /*if (project.ration_glj.needShowToTree(data)) {//当替换的是主材或设备时,刷新对应的树节点
@@ -1485,7 +1490,7 @@ var gljOprObj = {
                 }
             })
             project.projectGLJ.loadNewProjectGLJToCaches([result.projectGLJ],true);
-            me.showRationGLJSheetData();
+            me.refreshView();
             var rationNodes = me.refreshStateAfterMreplace(stateList, nodes);
             project.calcProgram.calcNodesAndSave(rationNodes, async function () {
                 await OVER_HEIGHT.reCalcOverHeightFee();

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

@@ -560,7 +560,19 @@ 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()
+        }  
     },
+    //滚动造价书鼠标时,工程量的更多按钮跟着移动
+    TopRowChanged:function(type,info){
+        let colSetting = projectObj.mainController.setting.cols[info.sheet.getActiveColumnIndex()];
+        if(colSetting.data.field === 'quantity'){
+            SheetDataHelper.moveMoreButton(info.sheet)
+        }
+        
+    },
+
     //repaint 动态下拉框
     mainSpreadEnterCell: function (sender, info) {
         let colSetting = projectObj.mainController.setting.cols[info.col];
@@ -998,6 +1010,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