瀏覽代碼

插入量价二级菜单,修改综合单价,隐藏删除等菜单,子目换算调整

zhangweicheng 6 年之前
父節點
當前提交
5a6fb7ca67

+ 12 - 3
public/web/sheet/sheet_common.js

@@ -204,8 +204,16 @@ var sheetCommonObj = {
             sheet.setValue(row, col, val, ch);
         }
         this.setRowStyle(row,sheet,data[row].bgColour);
-        if(setting.autoFit==true){
-            sheet.getRange(row, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).wordWrap(true);
+        if(setting.autoFit==true){//设置自动行高
+            if(setting.fitRow && setting.fitRow.length > 0){//如果有设置特定的某些列才需要自动行高就按设置的来,没有设置就默认所有列
+                for(let dataCode of setting.fitRow){
+                  let col =  _.findIndex(setting.header,{dataCode:dataCode})
+                  sheet.getCell(row,col).wordWrap(true);
+                }
+            }else {
+                sheet.getRange(row, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).wordWrap(true);
+            }
+
             sheet.autoFitRow(row);
         }
     },
@@ -306,7 +314,8 @@ var sheetCommonObj = {
                 $editor = $(editorContext);
                 $editor.css("position", "fixed");
                 $editor.css("background", "white");
-                $editor.css("width", cellRect.width);
+                //$editor.css("width", cellRect.width);
+                $editor.css("width", 140);
                 $editor.attr("gcUIElement", "gcEditingInput");
                 if(htmlGenerator) htmlGenerator(context,cellRect,$editor);
             }

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

@@ -270,9 +270,13 @@ var TREE_SHEET_HELPER = {
                 else if(tag !== undefined && tag) {
                     text = tag;
                 }
+                //这里要改成延时显示
+                TREE_SHEET_HELPER.showTipsDiv(text,setting,hitinfo);
+            }else {//非造价书页面还是实时显示
+                TREE_SHEET_HELPER.showTipsDiv(text,setting,hitinfo);
             }
 
-            TREE_SHEET_HELPER.showTipsDiv(text,setting,hitinfo);
+
         };
         TipCellType.prototype.processMouseLeave = function (hitinfo) {
             TREE_SHEET_HELPER.hideTipsDiv();

+ 4 - 1
web/building_saas/css/custom.css

@@ -262,4 +262,7 @@ legend.legend{
     width: 29.8%;
     float: left;
     background: #F1F1F1
-}
+}
+input.text-right{
+    text-align: right;
+}

+ 1 - 1
web/building_saas/main/html/main.html

@@ -89,7 +89,7 @@
                         </div>
                     </span>
                     <a href="javascript:void(0)" class="btn btn-light btn-sm" id="insertRation" data-toggle="tooltip" data-placement="bottom" data-original-title="插入定额"><i class="fa fa-sign-in" aria-hidden="true"></i></a>
-                    <a href="javascript:void(0)" class="btn btn-light btn-sm" id="delete" data-toggle="tooltip" data-placement="bottom" data-original-title="删除"><i class="fa fa-remove" aria-hidden="true"></i></a>
+                    <!--2018-11-15 隐藏删除按钮   <a href="javascript:void(0)" class="btn btn-light btn-sm" id="delete" data-toggle="tooltip" data-placement="bottom" data-original-title="删除"><i class="fa fa-remove" aria-hidden="true"></i></a>-->
                     <a href="javascript:void(0)" class="btn btn-light btn-sm" id="upLevel" data-toggle="tooltip" data-placement="bottom" data-original-title="升级"><i class="fa fa-arrow-left" aria-hidden="true"></i></a>
                     <a href="javascript:void(0)"  class="btn btn-light btn-sm" id="downLevel" data-toggle="tooltip" data-placement="bottom" data-original-title="降级"><i class="fa fa-arrow-right" aria-hidden="true"></i></a>
                       <a href="javascript:void(0)" class="btn btn-light btn-sm" id="upMove" data-toggle="tooltip" data-placement="bottom" data-original-title="上移"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>

+ 3 - 9
web/building_saas/main/js/models/project.js

@@ -409,22 +409,16 @@ var PROJECT = {
 
         project.prototype.updateEvalproject = function (evalProject,data,callback){
             let programID = null;
-            if(evalProject ==1){
+            if(evalProject ==1){//当打勾估价项目选项后,该定额取费专业读取计算程序名称为“估价项目”的计算程序,且为只读状态
                 programID =  this.calcProgram.compiledTemplateMaps["估价项目"];
-                callback(programID)
+                if(callback) callback(programID);
             }else {//如果evalProject==0,则是去掉勾选估价项目选项,需要获取定额默认的取费专业。
                 let libID = data.from == 'cpt'?"compleRationLib":data.libID;
                 let query = {code:data.code,projectID:data.projectID,libID:libID};
                 CommonAjax.post("/ration/getDefaultProgramID",query,function (result) {
-                    if(callback){
-                        callback(result);
-                    }
+                    if(callback) callback(result);
                 })
-
-
-
             }
-
         };
 
         //判断项目是否安装工程

+ 11 - 4
web/building_saas/main/js/models/ration.js

@@ -108,13 +108,13 @@ var Ration = {
             });
             controller.sheet.getCell(selected[0].row,col).value(data[fieldName]);
         };
-        ration.prototype.getTempRationData = function (id, billsID, serialNo, rType) {
+        ration.prototype.getTempRationData = function (id, billsID, serialNo, rType,priceType) {
             let newData = {'ID': id, 'serialNo': serialNo, projectID: this.project.ID()};
             let pEngineer = projectInfoObj.projectInfo.property.projectEngineering;//量价默认使用后台设置的单位工程取费专业
             newData[project.masterField.ration] = billsID;
             newData['type'] = rType;
             if (rType == rationType.volumePrice){
-                newData['subType'] = gljType.GENERAL_MATERIAL;   // 默认的量价类型为材料
+                newData['subType'] =  priceType?priceType:gljType.GENERAL_MATERIAL;   // 如果priceType 没传,默认的量价类型为材料
             };
             if(rType == rationType.ration){//空定额暂时不输入取费专业
                // newData['programID'] = projectInfoObj.projectInfo.property.engineering;
@@ -548,7 +548,14 @@ var Ration = {
                 })
             }
         };
-        ration.prototype.addNewRation = function (itemQuery,rationType,callback=null,isEmpty=false) {
+        ration.prototype.insertVolumePrice = function(type){
+            this.addNewRation(null,rationType.volumePrice,function (newNode) {//插入人工不需要自动定位到编号列
+                projectObj.selectColAndFocus(newNode,null);
+            },true,type);
+        };
+
+
+        ration.prototype.addNewRation = function (itemQuery,rationType,callback=null,isEmpty=false,priceType) {//priceType 是量价类型
             let me = this;
             let project = projectObj.project, sheetController = projectObj.mainController;
             let engineering = projectInfoObj.projectInfo.property.engineering;
@@ -579,7 +586,7 @@ var Ration = {
             };
             if(billItemID){
                 let newID = me.getNewRationID();
-                let newData =  me.getTempRationData(newID, billItemID, serialNo, rationType);
+                let newData =  me.getTempRationData(newID, billItemID, serialNo, rationType,priceType);
                 let calQuantity =  isEmpty===true?false:optionsOprObj.getOption(optionsOprObj.optionsTypes.GENERALOPTS, 'rationQuanACToBillsQuan');
                 let brUpdate = [];
                 //更新兄弟节点的序列号

+ 9 - 6
web/building_saas/main/js/views/main_tree_col.js

@@ -105,16 +105,19 @@ let MainTreeCol = {
             return node.data.subType != 201 && node.data.subType != 4 && node.data.subType != 5
         },
         commonUnitFee: function (node) {
+
+            if(node.data.code =='0005'){
+                console.log("test readonly")
+            }
             // 09-29 zhang
             let Bills =projectObj.project.Bills;
             // 当前属于分部分项、施工技术措施项目,综合单价只读。
-            if(Bills.isFBFX(node)||Bills.isTechMeasure(node)){
-                return true;
-            }
+            if(Bills.isFBFX(node)||Bills.isTechMeasure(node)) return true;
             // 不属于分部分项、施工技术措施项目的部分,如果不是叶子清单,或有基数计算/定额/量价/人材机 只读
-            if(!calcTools.isLeafBill(node)||calcTools.isCalcBaseBill(node)||node.children.length > 0){
-                return true;
-            }
+            if(node.sourceType == ModuleNames.bills && (!calcTools.isLeafBill(node)||calcTools.isCalcBaseBill(node)||node.children.length > 0))return true;
+            //当前是定额,综合单价只读。 2018-11-15
+            if(MainTreeCol.readOnly.ration(node)) return true;
+
             return false;
             //return !(calcTools.isLeafBill(node) && !calcTools.isBill_DXFY(node) && !calcTools.isCalcBaseBill(node) && !calcTools.isInheritFrom(node, [fixedFlag.SUB_ENGINERRING, fixedFlag.MEASURE]));
         },

+ 49 - 11
web/building_saas/main/js/views/project_view.js

@@ -467,7 +467,13 @@ var projectObj = {
                         return
                     }
                     if (value) {
-                        if(fieldName === 'feesIndex.common.unitFee')  value = parseFloat(value).toDecimal(decimalObj.decimal("unitPrice", node));
+                        if(fieldName === 'feesIndex.common.unitFee') {
+                            value = parseFloat(value).toDecimal(decimalObj.decimal("unitPrice", node));
+                            //当前是量价/人材机,综合单价可输入,输入的值读取到市场单价,重算综合单价。
+                            if(node.sourceType == ModuleNames.ration && node.data.type != rationType.ration){
+                                fieldName = 'marketUnitFee';
+                            }
+                        }
                         if(fieldName === 'feesIndex.common.totalFee'){//修改了综合合价后,反算综合单价,然后再由计算程序算个综合合价出来
                             let unitfee = 0;
                             if(node.data.quantity){//如果工程量为0或空,综合合单直接填到综合单价
@@ -1284,7 +1290,7 @@ var projectObj = {
                     }*/
                 },
                 "insertLJ": {
-                    name: "插入量价",
+                    name: "插入量价",//插入量价不需要自动定位到编号列
                     icon: 'fa-sign-in',
                     disabled: function () {
                         // var selected = project.mainTree.selected;
@@ -1292,22 +1298,48 @@ var projectObj = {
                         return !project.Ration.canAdd(project.mainTree.selected);
                     },
                     callback: function (key, opt) {
-                        project.Ration.addNewRation(null,rationType.volumePrice,function (newNode) {//插入量价不需要自动定位到编号列
+                       /* project.Ration.addNewRation(null,rationType.volumePrice,function (newNode) {
                             projectObj.selectColAndFocus(newNode,null);
-                        },true);
-
-                       // ProjectController.addRation(project, controller, rationType.volumePrice);
+                        },true);*/
                     },
-                  /*  items:{
-                        firstCommand:{
-                            name: "插入量价",
+                    items:{
+                        insertLabour:{
+                            name: "人工",
                             icon: 'fa-sign-in',
                             callback:function(key){
-
+                                project.Ration.insertVolumePrice(gljType.LABOUR);
+                            }
+                        },
+                        insertMaterial:{
+                           name:"材料" ,
+                            icon: 'fa-sign-in',
+                            callback:function(key){
+                                project.Ration.insertVolumePrice(gljType.GENERAL_MATERIAL);
+                            }
+                        },
+                        insertMachine:{
+                            name:"机械" ,
+                            icon: 'fa-sign-in',
+                            callback:function(key){
+                                project.Ration.insertVolumePrice(gljType.GENERAL_MACHINE);
+                            }
+                        },
+                        insertMainMaterial:{
+                            name:"主材" ,
+                            icon: 'fa-sign-in',
+                            callback:function(key){
+                                project.Ration.insertVolumePrice(gljType.MAIN_MATERIAL);
+                            }
+                        },
+                        insertEquipment:{
+                            name:"设备" ,
+                            icon: 'fa-sign-in',
+                            callback:function(key){
+                                project.Ration.insertVolumePrice(gljType.EQUIPMENT);
                             }
                         }
 
-                    }*/
+                    }
                 },
                 "insertGLJ": {
                     name: "插入人材机",
@@ -1367,6 +1399,9 @@ var projectObj = {
                     icon: 'fa-calculator',
                     callback: function () {
                         project.calcProgram.calcAllNodesAndSave();
+                    },
+                    visible:function(key, opt){//2018-11-15 新需求隐藏右键“造价计算”。
+                        return false;
                     }
                 },
                 "spr4":'--------',
@@ -1458,6 +1493,9 @@ var projectObj = {
                     },
                     callback:function(){
                         MaterialController.replaceMaterial([project.mainTree.selected]);
+                    },
+                    visible: function(key, opt){//2018-11-15 暂时隐藏
+                        return false
                     }
                 }
             }

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

@@ -290,4 +290,20 @@ function setCursor(elem, index) {
         range.move("character", index); //光标放到index位置
         range.select();
     }
+}
+
+
+function setSelection(elem, leftIndex, rightIndex) {
+    if (elem.selectionStart !== undefined) { //IE 9 ,10,其他浏览器
+        elem.selectionStart = leftIndex;
+        elem.selectionEnd = rightIndex;
+    } else { //IE 6,7,8
+        var range = elem.createTextRange();
+        range.move("character", -elem.value.length); //光标移到0位置。
+        //这里一定是先moveEnd再moveStart
+        //因为如果设置了左边界大于了右边界,那么浏览器会自动让右边界等于左边界。
+        range.moveEnd("character", rightIndex);
+        range.moveStart("character", leftIndex);
+        range.select();
+    }
 }

+ 8 - 10
web/building_saas/main/js/views/zmhs_view.js

@@ -15,7 +15,9 @@ let zmhs_obj = {
         view: {
             lockColumns:[0,1,2],
             rowHeaderWidth:25
-        }
+        },
+        autoFit:true,
+        fitRow:['name']
     },
     assSpread:null,
     assSheet:null,
@@ -149,12 +151,6 @@ let zmhs_obj = {
                     for(let c of coe.coes){
                         $('#'+c.coeType).val(newValue)
                     }
-                    /*$('#coe_ration').val(newValue);
-                    $('#manual').val(newValue);
-                    $('#material').val(newValue);
-                    $('#manchine').val(newValue);
-                    $('#mainM').val(newValue);
-                    $('#equipment').val(newValue);*/
                 } else {
                     $('#' + id).val(newValue);
                 }
@@ -162,7 +158,9 @@ let zmhs_obj = {
                 $('#' + id).val(coe.coes[name].amount);
             }
         }
-
+    },
+    onInputClick(ele){//点中系数单元格,则默认选中系数值
+        setSelection(ele,0,$(ele).val().length)
     },
     checkIfNeedUpdate(){
         let data = _.find(zmhs_obj.coeSheetData, function (c) {
@@ -236,8 +234,8 @@ let zmhs_obj = {
     },
     getOneRow: function (text, name, id,inputHeight) {
         var rowstr = "<tr ><td style='width: 50%'>" + text
-            + ":</td><td style='width: 50%' align='right'><input type='text' value='1' name=" + name
-            + " style='width:40px;border:0;height:"+ inputHeight+"px;' align='right' id=" + id + " onchange='zmhs_obj.onInputChange(this.id,this.name)' autocomplete='off'></td></tr>";
+            + ":</td><td style='width: 50%' align='right'><input class='text-right' type='text' value='1' name=" + name
+            + " style='width:100%;border:0;height:"+ inputHeight+"px;' align='right' id=" + id + " onchange='zmhs_obj.onInputChange(this.id,this.name)' onclick='zmhs_obj.onInputClick(this)' autocomplete='off'></td></tr>";
         return rowstr;
 
     },