Переглянути джерело

修改bugs,对补充定额不插入安装增加费

zhangweicheng 6 роки тому
батько
коміт
c53553d6b0

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

@@ -188,7 +188,7 @@ async function addRationSubList(stdRation,newRation,needInstall,compilation) {
     let addRationCoeTime = +new Date();
     console.log("添加定额coe时间-----"+(addRationCoeTime - addRationGLJTime));
     let ration_installs = [];
-    if(needInstall){
+    if(needInstall && stdRation.type == 'std'){//只有标准的定额才有安装增加费,补充的定额没有安装增加费
         ration_installs =  await addRationInstallFee(stdRation,newRation);
     }
     let addRationInstallFeeTime = +new Date();
@@ -200,6 +200,7 @@ async function addRationInstallFee(std,newRation) {
     let install_fee_list = [];
     if(std.hasOwnProperty('rationInstList') && std.rationInstList.length > 0){
         let installFee = await installationFeeModel.findOne({'projectID': newRation.projectID});
+        if(!installFee) return;//如果没有找到项目对应的安装增加费,则不添加
         for(let ri of std.rationInstList){
             let feeItem = _.find(installFee.installFeeItem,{'ID':ri.feeItemId});
             let section = _.find(installFee.installSection,{'ID':ri.sectionId});

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

@@ -176,8 +176,9 @@
                                       <div class="main-data-bottom ovf-hidden" id="subSpread" style="display: none" tabindex="0"></div>
                                       <div class="main-data-bottom ovf-hidden item_spread" id="replaceM" style="display: none" ></div>
                                       <div class="main-data-bottom ovf-hidden" id="tabZMHS" style="display: none">
-                                          <div class=" main-data-bottom ovf-hidden" style="width: 50%; float: left; margin: 0; padding:0;" id="coeSpread"></div>
-                                          <div class=" main-data-bottom ovf-hidden" style="width: 50%; float: left; margin: 0; padding:0;" id="assSpread"></div>
+                                          <div class=" main-data-bottom ovf-hidden" style="width: 60%; float: left; margin: 0; padding:0;" id="coeSpread"></div>
+                                          <div  id="zmhsResize" style="width: 0.2%; height: 100%; resize:horizontal; cursor: w-resize; float: left; background: #F1F1F1"></div>
+                                          <div class=" main-data-bottom ovf-hidden" style="width: 39.8%; float: left; margin: 0; padding:0;" id="assSpread"></div>
                                       </div>
                                       <div class="main-data-bottom ovf-hidden" style="display: none" id="comments">
                                           <textarea style="font-size: 0.9rem" class="form-control" rows="8" readonly=""></textarea>

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

@@ -32,7 +32,7 @@ $(function () {
     slideResize(getMainResizeEles(), {min: 170, max: 700}, 'height', function() {
         projectObj.mainSpread.refresh();
         refreshSubSpread();
-        zmhs_obj.refresh();
+        //zmhs_obj.refresh();
         $('#comments').find('textarea').height($('#comments').height() - 25);
     });
 
@@ -123,13 +123,13 @@ function slideResize(eles, limit, type, callback) {
             nEleChangeSize = nEleSize + moveSize;
             nEleChangeSize = nEleChangeSize < limit.min ? limit.min : nEleChangeSize;
             nEleChangeSize = nEleChangeSize > limit.max ? limit.max + 9 : nEleChangeSize;
-
             fEleChangeSize = fEleSize - moveSize;
             fEleChangeSize = fEleChangeSize < limit.min ? limit.min : fEleChangeSize;
             fEleChangeSize = fEleChangeSize > limit.max ? limit.max + 9 : fEleChangeSize;
 
             if(type === 'width'){
                 let rePercent = getResizeWidthPercent(nEleChangeSize, fEleChangeSize);
+                console.log(rePercent);
                 eles.nearElement.css(type, rePercent.nearPercent);
                 eles.farElement.css(type, rePercent.farPercent);
             }

+ 3 - 0
web/building_saas/main/js/models/installation_fee.js

@@ -669,6 +669,7 @@ var installation_fee = {
                         unit:'元',
                         type:gljType.LABOUR,
                         basePrice:1,
+                        marketPrice:1,
                         adjCoe:null,
                         from:'std',
                         repositoryId:-1,
@@ -688,6 +689,7 @@ var installation_fee = {
                         unit:'元',
                         type:gljType.GENERAL_MATERIAL,
                         basePrice:1,
+                        marketPrice:1,
                         adjCoe:null,
                         from:'std',
                         repositoryId:-1,
@@ -707,6 +709,7 @@ var installation_fee = {
                         unit:'元',
                         type:gljType.GENERAL_MACHINE,
                         basePrice:1,
+                        marketPrice:1,
                         adjCoe:null,
                         from:'std',
                         repositoryId:-1,

+ 12 - 2
web/building_saas/main/js/models/quantity_detail.js

@@ -724,10 +724,15 @@ var quantity_detail = {
 
 
         quantity_detail.prototype.updateBillQuantity=function (value,node,quantityEXP,editingText) {
+            let oldQuantityEXP =  node.data.quantityEXP;
             node.data.quantityEXP = quantityEXP?quantityEXP:editingText;
             value = scMathUtil.roundForObj(value,getDecimal("quantity",node));
-            node.data.quantity = value+"";
-            console.log(value);
+            let newQuantity =  value+"";
+            if(oldQuantityEXP == node.data.quantityEXP && node.data.quantity == newQuantity){ //相当于什么都没改,不用做提交操作
+                projectObj.mainController.refreshTreeNode([node]);//这里要再刷新一下,因为工程量要把手工输入的值刷新为转换后的值再显示
+                return;
+            }
+            node.data.quantity = newQuantity;
             let needUpdateChildren = [];//需更新的子定额
             let gljNodes=[];//当定额工程量改变时需刷新的子工料机
             if(node.children.length>0){//如果有子项
@@ -791,10 +796,15 @@ var quantity_detail = {
             gljOprObj.refreshView();
         };
         quantity_detail.prototype.updateRationQuantity=function(value,node,quantityEXP,editingText){
+            let oldQuantityEXP =  node.data.quantityEXP;
             node.data.quantityEXP = quantityEXP?quantityEXP:editingText;
             //value = scMathUtil.roundForObj(value,getDecimal("ration.quantity"));
             value = project.quantity_detail.autoTransformQuantity(value,node);//先转换再4舍5入
             value = scMathUtil.roundForObj(value,decimalObj.decimal("quantity",node));
+            if(oldQuantityEXP == node.data.quantityEXP && node.data.quantity == value){ //相当于什么都没改,不用做提交操作
+                projectObj.mainController.refreshTreeNode([node]);//这里要再刷新一下,因为工程量要把手工输入的值刷新为转换后的值再显示
+                return;
+            }
             node.data.quantity=value;
             if(node.parent.data.quantity&&node.parent.data.quantity!=0&&node.parent.data.quantity!=""){
                 var billQuantity = scMathUtil.roundForObj(node.parent.data.quantity,getDecimal("quantity",node.parent));

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

@@ -34,8 +34,8 @@ let gljCol = {
     project_glj_setting:{
         header: [
             {headerName: "编码", headerWidth: 80, dataCode: "code", dataType: "String"},
-            {headerName: "名称", headerWidth: 240, dataCode: "name", dataType: "String",cellType:'tipsCell'},
-            {headerName: "规格型号", headerWidth: 190, dataCode: "specs", hAlign: "left", dataType: "String",cellType:'tipsCell'},
+            {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String",cellType:'tipsCell'},
+            {headerName: "规格型号", headerWidth: 160, dataCode: "specs", hAlign: "left", dataType: "String",cellType:'tipsCell'},
             {headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String"},
             {headerName: "类型", headerWidth: 45, dataCode: "short_name", hAlign: "center", dataType: "String"},
             {headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"

+ 11 - 7
web/building_saas/main/js/views/glj_view.js

@@ -718,13 +718,13 @@ var gljOprObj = {
         this.sheetData = newList;
     },
     combineWithProjectGlj: function (ration_gljs,needRatio=true) {
-        var projectGLJData = projectObj.project.projectGLJ.datas;
-        var projectGljs = projectGLJData.gljList;
-        var mixRatioMap = projectGLJData.mixRatioMap;
+        let projectGLJData = projectObj.project.projectGLJ.datas;
+        let projectGljs = projectGLJData.gljList;
+        let mixRatioMap = projectGLJData.mixRatioMap;
         if (ration_gljs && ration_gljs.length > 0 && projectGljs && projectGljs.length > 0) {
 
-            for (var i = 0; i < ration_gljs.length; i++) {
-                var glj = _.find(projectGljs, {'id': ration_gljs[i].projectGLJID});
+            for (let i = 0; i < ration_gljs.length; i++) {
+                let glj = _.find(projectGljs, {'id': ration_gljs[i].projectGLJID});
                 if (glj) {
                     if(projectObj.project.projectGLJ.isEstimateType(ration_gljs[i].type )){
                         ration_gljs[i].isEstimate = glj.is_evaluate;
@@ -732,9 +732,9 @@ var gljOprObj = {
                     ration_gljs[i].shortName =projectObj.project.projectGLJ.getShortNameByID(ration_gljs[i].type);
                     ration_gljs[i].isAdd = glj.unit_price.is_add;
                     ration_gljs[i]=this.setGLJPrice(ration_gljs[i],glj);//设置工料机价格
-                    var connect_index = this.getIndex(glj, gljKeyArray);
+                    let connect_index = this.getIndex(glj, gljKeyArray);
                     if (needRatio==true&&mixRatioMap.hasOwnProperty(connect_index)) {
-                        var mixRatios = this.getMixRationShowDatas(mixRatioMap[connect_index], projectGljs);
+                        let mixRatios = this.getMixRationShowDatas(mixRatioMap[connect_index], projectGljs);
                         ration_gljs[i].subList = mixRatios;
                     }
                 }
@@ -864,6 +864,10 @@ var gljOprObj = {
             recode? me.sheet.getCell(args.row, args.col).value(recode[updateField]): me.sheet.getCell(args.row, args.col).value(null);
             return;
         }
+        if(args.editingText){
+            args.editingText = args.editingText.replace(/[\r\n]/g, "");//去掉回车换行等字符;
+            me.sheet.getCell(args.row, args.col).value(args.editingText);
+        }
         if (updateField == 'marketPrice' || updateField == 'customQuantity' || updateField == 'basePrice') {
             if (args.editingText == null) {
                 updateField == 'marketPrice' ? newval = 0 : newval = "";

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

@@ -24,8 +24,8 @@ projectGljObject={
     materialSetting:{
         header:[
             {headerName: "编码", headerWidth: 200, dataCode: "code", dataType: "String"},
-            {headerName: "名称", headerWidth: 240, dataCode: "name", dataType: "String"},
-            {headerName: "规格型号", headerWidth: 190, dataCode: "specs", hAlign: "left", dataType: "String"},
+            {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String"},
+            {headerName: "规格型号", headerWidth: 160, dataCode: "specs", hAlign: "left", dataType: "String"},
             {headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String"},
             {headerName: "定额价", headerWidth: 70, dataCode: "basePrice", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
             {headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"

+ 8 - 2
web/building_saas/main/js/views/project_view.js

@@ -1184,6 +1184,7 @@ var projectObj = {
                     },
                     callback: function (key, opt) {
                         ProjectController.addFB(project, controller);
+                        projectObj.selectColAndFocus(project.mainTree.selected);
                     },
                     visible: function(key, opt){
                         if(project.mainTree.selected){
@@ -1221,6 +1222,7 @@ var projectObj = {
                     },
                     callback: function (key, opt) {
                         ProjectController.addFX(project, controller);
+                        projectObj.selectColAndFocus(project.mainTree.selected);
                     },
                     visible: function(key, opt){
                         if(project.mainTree.selected){
@@ -1248,6 +1250,7 @@ var projectObj = {
                             }
                         }
                         ProjectController.addBills(project, controller);
+                        projectObj.selectColAndFocus(project.mainTree.selected);
                     },
                      visible: function(key, opt){
                          if(project.mainTree.selected){
@@ -1285,7 +1288,10 @@ var projectObj = {
                         return !project.Ration.canAdd(project.mainTree.selected);
                     },
                     callback: function (key, opt) {
-                        project.Ration.addNewRation(null,rationType.volumePrice,null,true);
+                        project.Ration.addNewRation(null,rationType.volumePrice,function (newNode) {//插入量价不需要自动定位到编号列
+                            projectObj.selectColAndFocus(newNode,null);
+                        },true);
+
                        // ProjectController.addRation(project, controller, rationType.volumePrice);
                     },
                   /*  items:{
@@ -1911,7 +1917,7 @@ var projectObj = {
     },
     selectColAndFocus :function (newNode,field = 'code') {//选中单元格并设置焦点
         if(newNode){
-            projectObj.mainController.sheet.setSelection(newNode.serialNo(), colSettingObj.getColByField(field), 1, 1);  //
+            if(field != null) projectObj.mainController.sheet.setSelection(newNode.serialNo(), colSettingObj.getColByField(field), 1, 1);  //自动定位到编号单元格
             projectObj.mainSpread.focus();
         }
     }

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

@@ -187,10 +187,10 @@ let quantityEditObj = {
     },
     checkingAndUpdate(quantityEXP,node){
         let me = this;
-        if(quantityEXP === node.data.quantityEXP){ //没有变化,不做任何操作
+       /* if(quantityEXP === node.data.quantityEXP){ //没有变化,不做任何操作
             projectObj.mainController.refreshTreeNode([node]);
             return true;
-        }
+        }*/
         quantityEXP = quantityEXP?quantityEXP.toUpperCase():'';//非空判断
         quantityEXP =replaceAll('(','(',quantityEXP);//转换中文左右符号
         quantityEXP =replaceAll(')',')',quantityEXP);

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

@@ -469,11 +469,11 @@ function refreshSubSpread(){
     if(pageCCOprObj.active){
         contentOprObj.workBook.refresh();
         characterOprObj.workBook.refresh();
-    }
-    else{
+    } else{
         if(subSpread) subSpread.refresh();
         if(MaterialController.spread) MaterialController.spread.refresh();
     }
+    if($('#linkZMHS').hasClass('active')) zmhs_obj.refresh();
 }
 
 let subViewObj = {

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

@@ -316,3 +316,17 @@ let zmhs_obj = {
         return true;
     }
 };
+
+let zmhs_sideResizeEles = {};
+zmhs_sideResizeEles.id = 'tabZMHS';
+zmhs_sideResizeEles.resize = $('#zmhsResize');
+zmhs_sideResizeEles.evFixedSize = `$(window).width()-$('.main-nav').width()-5`;
+zmhs_sideResizeEles.nearElement = $('#coeSpread');
+zmhs_sideResizeEles.nearSpread = $('#coeSpread');
+zmhs_sideResizeEles.farElement = $('#assSpread');
+zmhs_sideResizeEles.farSpread = $('#assSpread');
+zmhs_sideResizeEles.nav = null;
+slideResize(zmhs_sideResizeEles, {min: 100, max: $('#tabCon').width()-100}, 'width', function(){
+    zmhs_obj.refresh();
+});
+