Browse Source

修改bugs

zhangweicheng 6 years ago
parent
commit
deccc87f31

+ 2 - 1
modules/ration_glj/facade/glj_calculate_facade.js

@@ -13,6 +13,7 @@ let std_glj_lib_gljList_model = mongoose.model('std_glj_lib_gljList');
 let glj_type_util = require('../../../public/cache/std_glj_type_util');
 let glj_type_util = require('../../../public/cache/std_glj_type_util');
 const scMathUtil = require('../../../public/scMathUtil').getUtil();
 const scMathUtil = require('../../../public/scMathUtil').getUtil();
 let decimal_facade = require('../../main/facade/decimal_facade');
 let decimal_facade = require('../../main/facade/decimal_facade');
+let gljUtil = require('../../../public/gljUtil');
 
 
 module.exports={
 module.exports={
     calculateQuantity:calculateQuantity,
     calculateQuantity:calculateQuantity,
@@ -131,7 +132,7 @@ function generateUpdateTasks(result) {
 
 
 function sortRationGLJ(list) {
 function sortRationGLJ(list) {
     list = _.sortByAll(list, [function (item) {
     list = _.sortByAll(list, [function (item) {
-        return item.type + "";
+        return _.indexOf(gljUtil.getGljTypeSeq(),item.type);
     }, "code"])
     }, "code"])
     return list;
     return list;
 }
 }

+ 6 - 1
public/gljUtil.js

@@ -15,7 +15,8 @@ module.exports = {
     calcPriceDiff:calcPriceDiff,
     calcPriceDiff:calcPriceDiff,
     getMarketPrice:getMarketPrice,
     getMarketPrice:getMarketPrice,
     getBasePrice:getBasePrice,
     getBasePrice:getBasePrice,
-    getAdjustPrice:getAdjustPrice
+    getAdjustPrice:getAdjustPrice,
+    getGljTypeSeq:getGljTypeSeq
 };
 };
 
 
 function calcProjectGLJQuantity(projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal) {
 function calcProjectGLJQuantity(projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal) {
@@ -40,4 +41,8 @@ function getAdjustPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalOb
 
 
 function calcPriceDiff(glj,calcOptions) {
 function calcPriceDiff(glj,calcOptions) {
     gljNodeUtil.calcPriceDiff(glj,calcOptions);
     gljNodeUtil.calcPriceDiff(glj,calcOptions);
+}
+
+function getGljTypeSeq() {
+    return gljNodeUtil.getGljTypeSeq();
 }
 }

+ 7 - 0
public/web/gljUtil.js

@@ -295,6 +295,13 @@ let gljUtil = {
         t_index = k_arr.join("|-|");
         t_index = k_arr.join("|-|");
         return t_index;
         return t_index;
     },
     },
+    getGljTypeSeq:function () {
+        let gljType = this.gljType;
+        return   [gljType.LABOUR,gljType.MAIN_MATERIAL,gljType.CONCRETE,gljType.MORTAR,gljType.MIX_RATIO,gljType.COMMERCIAL_CONCRETE,
+                gljType.COMMERCIAL_MORTAR,gljType.GENERAL_MATERIAL,gljType.OTHER_MATERIAL,gljType.GENERAL_MACHINE,gljType.INSTRUMENT,gljType.OTHER_MACHINE_USED,
+                gljType.MACHINE_COMPOSITION,gljType.MACHINE_LABOUR,gljType.FUEL_POWER_FEE,gljType.DEPRECIATION_FEE,gljType.INSPECTION_FEE,gljType.MAINTENANCE,
+                gljType.DISMANTLING_FREIGHT_FEE,gljType.VERIFICATION_FEE,gljType.OTHER_FEE,gljType.EQUIPMENT,gljType.MANAGEMENT_FEE,gljType.PROFIT,gljType.GENERAL_RISK_FEE]
+    },
     fixedFlag : {
     fixedFlag : {
         // 分部分项工程
         // 分部分项工程
         SUB_ENGINERRING: 1,
         SUB_ENGINERRING: 1,

+ 78 - 2
public/web/sheet/sheet_common.js

@@ -366,7 +366,7 @@ var sheetCommonObj = {
 
 
     },
     },
     setSelectButton(row,col,sheet,header){
     setSelectButton(row,col,sheet,header){
-        let getSelectButton = function (cellWidth=100) {
+      /*  let getSelectButton = function (cellWidth=100) {
             function moreButton() {
             function moreButton() {
 
 
             }
             }
@@ -439,8 +439,84 @@ var sheetCommonObj = {
                 }
                 }
             };
             };
             return new selectButton();
             return new selectButton();
+        };*/
+        sheet.setCellType(row, col,this.getSelectButton(header.headerWidth),GC.Spread.Sheets.SheetArea.viewport);
+    },
+    getSelectButton(cellWidth=100){
+
+        function moreButton() {
+
+        }
+        moreButton.prototype = new GC.Spread.Sheets.CellTypes.Button();
+        moreButton.prototype.paint = function (ctx, value, x, y, w, h, style, options){
+            GC.Spread.Sheets.CellTypes.Button.prototype.paint.call(this, ctx, value, x, y, w, h, style, options);
+            ctx.font = '14px Calibri';
+            let buttonW = cellWidth/5;
+            let endX = x+w-2;
+            if(value){
+                let textWidth = ctx.measureText(value).width;
+                let spaceWidth = cellWidth - buttonW;
+                let textEndX = x+textWidth+2;
+                if(spaceWidth<textWidth){
+                    for(let i = value.length-1;i>1;i--){
+                        let newValue = value.substr(0,i);
+                        let newTestWidth =  ctx.measureText(newValue).width;
+                        if(spaceWidth>newTestWidth){
+                            value = newValue;
+                            textEndX = x+newTestWidth+2;
+                            break;
+                        }
+                    }
+                }
+                ctx.fillText(value,textEndX,y+h-6);
+            }
+
+            //画三个点
+            ctx.save();
+            ctx.beginPath();
+            ctx.arc(endX-buttonW/2,y+h/2,1,0,360,false);
+            ctx.arc(endX-buttonW/2-4,y+h/2,1,0,360,false);
+            ctx.arc(endX-buttonW/2+4,y+h/2,1,0,360,false);
+            ctx.fillStyle="black";//填充颜色,默认是黑色
+            ctx.fill();//画实心圆
+            ctx.closePath();
+            ctx.restore();
+        };
+
+        moreButton.prototype.processMouseLeave= function (hitinfo) {
+            let newCell = new selectButton();
+            hitinfo.sheet.setCellType(hitinfo.row, hitinfo.col, newCell, GC.Spread.Sheets.SheetArea.viewport);
+            hitinfo.sheet.getCell(hitinfo.row, hitinfo.col).locked(false);
+        };
+
+        function selectButton() {
+        }
+
+        selectButton.prototype = new GC.Spread.Sheets.CellTypes.Text();
+
+        selectButton.prototype.paint = function (ctx, value, x, y, w, h, style, options){
+            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this,arguments);
+        };
+        selectButton.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
+            return {
+                x: x,
+                y: y,
+                row: context.row,
+                col: context.col,
+                cellStyle: cellStyle,
+                cellRect: cellRect,
+                sheetArea: context.sheetArea
+            };
+        };
+        selectButton.prototype.processMouseDown = function (hitinfo){
+            if(hitinfo.sheet.getCell(hitinfo.row,hitinfo.col).locked()!=true){
+                let b1 = new moreButton();
+                b1.marginLeft(cellWidth*4/5);
+                hitinfo.sheet.setCellType(hitinfo.row, hitinfo.col, b1, GC.Spread.Sheets.SheetArea.viewport);
+                hitinfo.sheet.getCell(hitinfo.row, hitinfo.col).locked(true);
+            }
         };
         };
-        sheet.setCellType(row, col,getSelectButton(header.headerWidth),GC.Spread.Sheets.SheetArea.viewport);
+        return new selectButton();
     },
     },
     setReplaceButton(row,col,sheet){
     setReplaceButton(row,col,sheet){
         let replaceButton = function(){
         let replaceButton = function(){

+ 1 - 1
web/building_saas/fee_rates/fee_rate.html

@@ -3,7 +3,7 @@
 <div >
 <div >
 <div class="toolsbar_feeRate px-1 ">
 <div class="toolsbar_feeRate px-1 ">
     <div class="form-inline py-1">
     <div class="form-inline py-1">
-        <label  class="mx-2" >当前使用:<span id="feeRateFileName">费率1</span>(<label class="a_color" id="pop-lv"><span id="projectCount">3</span> 个单位工程使用</label>)
+        <label  class="mx-2" >使用费率文件:<span id="feeRateFileName">费率1</span>(<label class="a_color" id="pop-lv"><span id="projectCount">3</span> 个单位工程使用</label>)
             <a class="btn btn-sm ml-1" href="#" data-toggle="modal" data-target="#change-lv" id="changFeeRateFile"><i class="fa fa-exchange"></i> 选择其他</a>
             <a class="btn btn-sm ml-1" href="#" data-toggle="modal" data-target="#change-lv" id="changFeeRateFile"><i class="fa fa-exchange"></i> 选择其他</a>
             <a class="btn btn-sm ml-1" href="#" data-toggle="modal" id="saveAs" data-target="#copy-lv"><i class="fa fa-files-o"></i> 另存单独用</a></label>
             <a class="btn btn-sm ml-1" href="#" data-toggle="modal" id="saveAs" data-target="#copy-lv"><i class="fa fa-files-o"></i> 另存单独用</a></label>
     </div>
     </div>

+ 1 - 1
web/building_saas/glj/html/project_glj.html

@@ -5,7 +5,7 @@
 </style>
 </style>
 <div class="toolsbar px-1" id="projectGljToolsBar">
 <div class="toolsbar px-1" id="projectGljToolsBar">
     <div class="form-inline py-1">
     <div class="form-inline py-1">
-        <label class="mx-2">当前使用:<span id="current-name"></span>(<label class="a_color" id="pop-used-list" data-original-title="" title=""><span id="used-project-count">0</span>个单位工程使用</label>)
+        <label class="mx-2">使用单价文件:<span id="current-name"></span>(<label class="a_color" id="pop-used-list" data-original-title="" title=""><span id="used-project-count">0</span>个单位工程使用</label>)
             <a class="btn btn-sm ml-1" href="#" data-toggle="modal" data-target="#change-unitFile"><i class="fa fa-exchange"></i> 选择其他</a>
             <a class="btn btn-sm ml-1" href="#" data-toggle="modal" data-target="#change-unitFile"><i class="fa fa-exchange"></i> 选择其他</a>
             <a class="btn btn-sm ml-1" href="#" data-toggle="modal" data-target="#unitFile-save-as"><i class="fa fa-files-o"></i> 另存单独用</a></label>
             <a class="btn btn-sm ml-1" href="#" data-toggle="modal" data-target="#unitFile-save-as"><i class="fa fa-files-o"></i> 另存单独用</a></label>
     </div>
     </div>

+ 1 - 1
web/building_saas/glj/js/project_glj.js

@@ -344,7 +344,7 @@ function filterProjectGLJ(jsonData) {
 function sortProjectGLJ(jsonData) {
 function sortProjectGLJ(jsonData) {
     if (jsonData.length > 0) {
     if (jsonData.length > 0) {
         jsonData = _.sortByAll(jsonData, [function (item) {
         jsonData = _.sortByAll(jsonData, [function (item) {
-            return item.unit_price.type + "";
+            return _.indexOf(gljTypeSeq,item.unit_price.type);
         }, 'code']);
         }, 'code']);
     }
     }
     return jsonData
     return jsonData

+ 5 - 0
web/building_saas/main/js/models/main_consts.js

@@ -20,6 +20,11 @@ const ModuleNames = {
 };
 };
 
 
 let gljType = gljUtil.gljType;
 let gljType = gljUtil.gljType;
+let gljTypeSeq =gljUtil.getGljTypeSeq(); /*[gljType.LABOUR,gljType.MAIN_MATERIAL,gljType.CONCRETE,gljType.MORTAR,gljType.MIX_RATIO,gljType.COMMERCIAL_CONCRETE,
+    gljType.COMMERCIAL_MORTAR,gljType.GENERAL_MATERIAL,gljType.OTHER_MATERIAL,gljType.GENERAL_MACHINE,gljType.INSTRUMENT,gljType.OTHER_MACHINE_USED,
+    gljType.MACHINE_COMPOSITION,gljType.MACHINE_LABOUR,gljType.FUEL_POWER_FEE,gljType.DEPRECIATION_FEE,gljType.INSPECTION_FEE,gljType.MAINTENANCE,
+    gljType.DISMANTLING_FREIGHT_FEE,gljType.VERIFICATION_FEE,gljType.OTHER_FEE,gljType.EQUIPMENT,gljType.MANAGEMENT_FEE,gljType.PROFIT,gljType.GENERAL_RISK_FEE];*/
+
 // 计算基数 [定额基价材料费] 要用到的材料类型。
 // 计算基数 [定额基价材料费] 要用到的材料类型。
 const baseMaterialTypes = [
 const baseMaterialTypes = [
     gljType.GENERAL_MATERIAL,
     gljType.GENERAL_MATERIAL,

+ 4 - 3
web/building_saas/main/js/views/glj_col.js

@@ -10,15 +10,15 @@ let gljCol = {
             {headerName: "单位", headerWidth: 45, dataCode: "unit", dataType: "String", hAlign: "center"},
             {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: "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: "adjustPrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"1
-            {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: 65, dataCode: "customQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
             {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: "quantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
+            {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: 80, dataCode: "totalQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
             {headerName: "暂估", headerWidth: 45, dataCode: "isEstimate", dataType: "String", hAlign: "center", vAlign: "center", cellType: "checkBox"}
             {headerName: "暂估", headerWidth: 45, dataCode: "isEstimate", dataType: "String", hAlign: "center", vAlign: "center", cellType: "checkBox"}
         ],
         ],
         view: {
         view: {
-            lockColumns: [ 5, 7, 9, 10, 11],//这里以后改成dataCode好一点
+            lockColumns: [ "adjustPrice", "rationItemQuantity", "quantity", "totalQuantity", "isEstimate"],//这里以后改成dataCode好一点
             rowHeaderWidth:25
             rowHeaderWidth:25
         },
         },
         getStyle:function (data) {
         getStyle:function (data) {
@@ -80,6 +80,7 @@ let gljCol = {
             setting.header.splice(colIndex,1);//去掉列;
             setting.header.splice(colIndex,1);//去掉列;
             let newArray = [];
             let newArray = [];
             for(let l of setting.view.lockColumns){
             for(let l of setting.view.lockColumns){
+                if(_.isString(l)) return;//如果是用dataCode表示的,不用处理
                 if(l == colIndex)  continue;
                 if(l == colIndex)  continue;
                 if(l > colIndex)  l = l -1;
                 if(l > colIndex)  l = l -1;
                 newArray.push(l);
                 newArray.push(l);

+ 1 - 1
web/building_saas/main/js/views/glj_view.js

@@ -1651,7 +1651,7 @@ function getDecimal(fieldID, node) {
 
 
 function sortRationGLJ(list) {
 function sortRationGLJ(list) {
     list = _.sortByAll(list, [function (item) {
     list = _.sortByAll(list, [function (item) {
-        return item.type + "";
+        return _.indexOf(gljTypeSeq,item.type)
     }, "code"])
     }, "code"])
     return list;
     return list;
 }
 }

+ 9 - 1
web/building_saas/main/js/views/project_view.js

@@ -1583,8 +1583,16 @@ var projectObj = {
         let row = getLocalCache('lastRow:' + projectId);
         let row = getLocalCache('lastRow:' + projectId);
         let col = getLocalCache('lastCol:' + projectId);
         let col = getLocalCache('lastCol:' + projectId);
         if(row == null || col == null){
         if(row == null || col == null){
+            //默认焦点定位到造价书的第一行“分项”。
+            col = 1;
             row = 0;
             row = 0;
-            col = 0;
+            for(let i =0;i<this.mainController.tree.items.length;i++){
+                let node = this.mainController.tree.items[i];
+                if(node &&  node.sourceType == ModuleNames.bills && (node.data.type === billType.FX ||node.data.type === billType.BX )){//默认字位到第一条分项或补项
+                    row = i;
+                    break;
+                }
+            }
        }
        }
         row = parseInt(row);
         row = parseInt(row);
         col = parseInt(col);
         col = parseInt(col);

+ 1 - 0
web/building_saas/main/js/views/side_tools.js

@@ -2,6 +2,7 @@
  * Created by Mai on 2017/6/16.
  * Created by Mai on 2017/6/16.
  */
  */
 $(window).resize(function() {
 $(window).resize(function() {
+    autoFlashHeight();
     sheetCommonObj.setColumnWidthByRate($('#stdRationChapter').width() - 40, rationLibObj.rationChapterSpread, rationLibObj.rationChapterTreeSetting.cols);
     sheetCommonObj.setColumnWidthByRate($('#stdRationChapter').width() - 40, rationLibObj.rationChapterSpread, rationLibObj.rationChapterTreeSetting.cols);
     billsGuidance.setColumnWidthByRate(billsGuidance.elfItem.workBook, $('#zy').width(), billsGuidance.elfItem.headers);
     billsGuidance.setColumnWidthByRate(billsGuidance.elfItem.workBook, $('#zy').width(), billsGuidance.elfItem.headers);
     billsGuidance.refreshWorkBook();
     billsGuidance.refreshWorkBook();