zhangweicheng 6 years ago
parent
commit
196bb0cb06

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

@@ -355,6 +355,7 @@ function getCoeSelectedGLJ(gljList,rcode,code) {
 
 function getCalculateResult(quantify,c,coe,gljList,decimal) {
     let q = quantify;
+    let o_glj = null;
     switch (c.operator){
         case '+' :
             q = q + c.amount;
@@ -369,11 +370,17 @@ function getCalculateResult(quantify,c,coe,gljList,decimal) {
             q = q / c.amount;
             break;
         case '+*' :
-            let o_glj = getCoeSelectedGLJ(gljList,coe.original_code,coe.select_code);
+            o_glj = getCoeSelectedGLJ(gljList,coe.original_code,coe.select_code);
             if(o_glj){
               q = q +  c.amount * scMathUtil.roundForObj(o_glj.quantity,decimal);
             }
             break;
+        case '-*' :
+            o_glj = getCoeSelectedGLJ(gljList,coe.original_code,coe.select_code);
+            if(o_glj){
+                q = q -  c.amount * scMathUtil.roundForObj(o_glj.quantity,decimal);
+            }
+            break;
         case '=' :
              q = c.amount;
             break;

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

@@ -228,8 +228,8 @@
                                           <div class="resize-x main-data-bottom ovf-hidden" id="rgResize" style="display: none"></div>
                                           <div class="item_spread main-data-bottom ovf-hidden " id="gljSubDiv" style="width: 99%;">
                                               <div class="tab-content">
-                                                  <div class="tab-pane" id="rnc-xm" >
-                                                      <div class="main-data-bottom ovf-hidden" id="itemCharacterText">
+                                                  <div class="tab-pane" id="rnc-xm" style="margin-top:-2px">
+                                                      <div class="main-data-bottom" id="itemCharacterText" >
                                                           项目特征 内容
                                                       </div>
                                                   </div>
@@ -259,6 +259,7 @@
                                                   <div id="zmhs_toogle">
                                                       <div class="tn-nav d-flex align-items-start flex-column" data-toggle="tooltip" data-placement="left" title="" data-original-title="打开子目换算">
                                                           <span class="mt-3 ml-2 text-primary">子目换算</span>
+                                                          <i class="fa fa-arrow-left mt-auto mb-3 text-primary ml-2"></i>
                                                       </div>
                                                   </div>
                                                   <!--<a  role="tab" class="zmhs-link nav-link">子目换算</a>-->

+ 1 - 1
web/building_saas/main/js/controllers/material_controller.js

@@ -228,7 +228,7 @@ let MaterialController = {
         }*/
         //$('#replaceM').css('margin-top',0);
         //this.toggleItemInit();
-        $("#itemCharacterText").html("<br>"+text);
+        $("#itemCharacterText").html(text);
     },
     //初始化人材机和项目特征文本两个区域的宽度,改变窗口大小时调用此方法,实时刷新
     initItemWidth: function () {

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

@@ -4,7 +4,7 @@
 let gljCol = {
     ration_glj_setting: {
         header: [
-            {headerName: "编码", headerWidth: 130, dataCode: "code", dataType: "String", formatter: "@"},
+            {headerName: "编码", headerWidth: 110, dataCode: "code", dataType: "String", formatter: "@"},
             {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String",cellType:'tipsCell'},
             {headerName: "规格型号", headerWidth: 120, dataCode: "specs", dataType: "String", hAlign: "left",cellType:'tipsCell'},
             {headerName: "单位", headerWidth: 45, dataCode: "unit", dataType: "String", hAlign: "center"},

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

@@ -359,14 +359,8 @@ var gljOprObj = {
         if(gljOprObj.isInstallationNode(selected)==true){
             return;
         }
-        let newval = 0;
-        if (checkboxValue) {
-            newval = 0;
-            args.sheet.getCell(args.row, args.col).value(newval);
-        } else {
-            newval = 1;
-            args.sheet.getCell(args.row, args.col).value(newval);
-        }
+        let newval = checkboxValue? 0:1;
+        args.sheet.getCell(args.row, args.col).value(newval);
         if (args.sheetName == 'ration_glj') {
             gljOprObj.updateIsEstimate(args,newval);
         }  else if (args.sheetName == 'quantity_detail') {

+ 5 - 3
web/building_saas/main/js/views/sub_view.js

@@ -97,10 +97,11 @@ let subObj = {
         let totalWidth = $('#subItems').width();
         //人材机和项目特征文本比例
         const openWidth = 30;//打开项目特征工具条
+        const tab_tem = (305+openWidth+10+30)/totalWidth;//tab显示框默认宽度:305(表格宽度) + 30(工具条宽度)+10(resize div 宽度)+30(序号列宽度)
         let textVisible = $('#replaceText').is(':visible'),
             //默认比例
-            textPercent = '15%',
-            rcjPercent = '85%';
+            textPercent = tab_tem * 100 + '%',//'15%',
+            rcjPercent = (1 - tab_tem)* 100 + '%';//85
         //文本没显示,则打开工具条固定30px转换百分比
         if (!subObj.showGljSubTab) {
             textPercent = openWidth / totalWidth;
@@ -745,7 +746,8 @@ $('.gljSubTab ul li a').bind('click',function () {
 
 $('.gljSubTab ul li a').on('shown.bs.tab', function () {
     if(this.hash == "#rnc-xm"){
-        MaterialController.showItemCharacterText();
+        //初始化项目特征表格位置,如果以后需要的话,showdata 统一移动至zmhs_obj中
+       //todo
     }else if(this.hash == "#rnc-zm"){
         zmhs_obj.initCoeSpread();
     }else if(this.hash == "#rnc-fz"){

+ 19 - 13
web/building_saas/main/js/views/zmhs_view.js

@@ -10,22 +10,28 @@ let zmhs_obj = {
     coeSetting: {
         header: [
             {headerName: "调整", headerWidth: 35, dataCode: "isAdjust", dataType: "String", cellType: "checkBox"},
-            {headerName: "条件", headerWidth: 250, dataCode: "name", dataType: "String", cellType: "button"},
-            {headerName: "内容", headerWidth: 160, dataCode: "content", dataType: "String", hAlign: "left",getText:'forContent'}
+            {headerName: "条件", headerWidth: 180, dataCode: "name", dataType: "String", cellType: "button",getText:'forName'},
+            {headerName: "内容", headerWidth: 70, dataCode: "content", dataType: "String", hAlign: "left",getText:'forContent'}
         ],
         view: {
             lockColumns:[0,1,2],
             rowHeaderWidth:25
         },
         getText:{
-            forContent:function (item) {
+            forContent:function (item) {//所选人材机,内容和条件互换位置
                if(gljUtil.isDef(item.select_code)&&item.select_code!=""){
-                   let option = _.find(item.option_list,{"value":item.select_code})
-                   return option?option.text:item.select_code;
+                   return item.name;
                }else {
                    return item.content;
                }
-
+            },
+            forName:function (item) {
+                if(gljUtil.isDef(item.select_code)&&item.select_code!=""){
+                    let option = _.find(item.option_list,{"value":item.select_code})
+                    return option?option.text:item.select_code;
+                }else {
+                    return item.name;
+                }
             }
         },
         autoFit:true,
@@ -36,8 +42,8 @@ let zmhs_obj = {
     cusSheetData:null,
     cusSetting:{
         header: [
-            {headerName: "类型", headerWidth: 250, dataCode: "coeType", dataType: "String",hAlign: "left"},
-            {headerName: "系数", headerWidth: 160, dataCode: "amount", dataType: "String", hAlign: "right",validator:"number"}
+            {headerName: "类型", headerWidth: 100, dataCode: "coeType", dataType: "String",hAlign: "left"},
+            {headerName: "系数", headerWidth: 80, dataCode: "amount", dataType: "String", hAlign: "right",validator:"number"}
         ],
         view: {
             lockColumns:["coeType"],
@@ -151,15 +157,14 @@ let zmhs_obj = {
     },
 
     getComboBoxForCodes:function (coe,i) {
-        this.coeSheet.getCell(i, 2, GC.Spread.Sheets.SheetArea.viewport).locked(false);
+        this.coeSheet.getCell(i, 1, GC.Spread.Sheets.SheetArea.viewport).locked(false);
         let options = coe.option_list; //coe.option_codes.split("|");
         let combo = sheetCommonObj.getDynamicCombo(true);
         let buttonRow =  this.coeSheet.getViewportBottomRow(1);
-        console.log(buttonRow);
         combo.editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.value);
         combo.items(options).maxDropDownItems(buttonRow - i -1 < 3 ?3:buttonRow - i -1 );//itemHeight(options.length).
-        this.coeSheet.setCellType(i, 2, combo, GC.Spread.Sheets.SheetArea.viewport);
-        this.coeSheet.setValue(i, 2, coe.select_code);
+        this.coeSheet.setCellType(i, 1, combo, GC.Spread.Sheets.SheetArea.viewport);
+        this.coeSheet.setValue(i, 1, coe.select_code);
 
     },
     showAssData:function (node) {
@@ -239,6 +244,7 @@ let zmhs_obj = {
         $('#assSpread').is(':visible')&&this.assSpread?this.assSpread.refresh():'';
     },
     showDatas:function () {
+        if($('#itemCharacterText').is(':visible'))MaterialController.showItemCharacterText()
         if($('#coeSpread').is(':visible')) this.showCoeData();
         if($('#cusSpread').is(':visible')) this.showCusData();
         if($('#assSpread').is(':visible')) this.showAssData();
@@ -397,7 +403,7 @@ let zmhs_obj = {
     onCoeValueChange:function (e,args) {
         let fieldID =  zmhs_obj.coeSetting.header[args.col].dataCode;
         let recode = zmhs_obj.coeSheetData[args.row];
-        if(gljUtil.isDef(recode.option_codes)&&recode.option_codes!=""&& fieldID == 'content'){//说明是选择了下拉框
+        if(gljUtil.isDef(recode.option_codes)&&recode.option_codes!=""&& fieldID == 'name'){//说明是选择了下拉框
             projectObj.project.ration_coe.adjustCoeClick(recode, 1,{'select_code':args.newValue});
         }
     },

+ 3 - 3
web/building_saas/pm/html/project-management.html

@@ -634,8 +634,8 @@
                             <div id="replaceSpread" style="height: 100%"></div>
                         </div>
                         <div class="custom-control custom-checkbox">
-                            <input type="checkbox" class="custom-control-input" id="customCheck1">
-                            <label class="custom-control-label" for="customCheck1">自动勾选同专业工程</label>
+                            <input type="checkbox" class="custom-control-input" id="selectSameTypeProject">
+                            <label class="custom-control-label" for="selectSameTypeProject">自动勾选同专业工程</label>
                         </div>
                     </div>
                     <div class="col-6">
@@ -678,7 +678,7 @@
             </div>
             <div class="modal-footer">
                 <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
-                <a href="" class="btn btn-primary mr-3">确定</a>
+                <button type="button" class="btn btn-primary mr-3" data-dismiss="modal" id="changeFileConfirm">确定</button>
             </div>
         </div>
     </div>

+ 78 - 9
web/building_saas/pm/js/pm_newMain.js

@@ -458,6 +458,8 @@ const projTreeObj = {
             }
             canCopy == true?$("#copy-to-confirm").removeClass("disabled"):$("#copy-to-confirm").addClass("disabled");
             return;//如果是复制到表,不用做后面的操作
+        }else if(sheet.name() == "replaceSheet"){//如果是替换文件,不用做后面的操作
+            return;
         }
         me.tree.selected = node;
         shareSeleted = node;
@@ -502,6 +504,11 @@ const projTreeObj = {
             $("#mr_from").val(projTreeObj.setting.header[args.col].dataCode);
             $("#project_name").text(projTreeObj.tree.selected.data.name);
             $('#m_replace_file').modal('show');
+        }else if(args.sheet.name() == "replaceSheet"){
+            let cellType = args.sheet.getCellType(args.row, args.col);
+            if(cellType instanceof GC.Spread.Sheets.CellTypes.CheckBox){
+                projTreeObj.onReplaceNodeCheck(sender,args);
+            }
         }
     },
     onDragDropBlock : function (sender,args) {//拖动移动项目位置
@@ -978,7 +985,7 @@ const projTreeObj = {
                 for(let j = 0; j < headers.length; j++){
                     sheet.getRange(-1, j, -1, 1).hAlign(GC.Spread.Sheets.HorizontalAlign[headers[j]['hAlign']]);
                     sheet.getRange(-1, j, -1, 1).vAlign(GC.Spread.Sheets.VerticalAlign[headers[j]['vAlign']]);
-                    if(headers[j].cellType == "checkBox"){
+                    if(headers[j].cellType == "checkBox" && nodes[i].data.canSelect === true){
                         sheet.setCellType(i, j,new GC.Spread.Sheets.CellTypes.CheckBox(),GC.Spread.Sheets.SheetArea.viewport);
                         sheet.getCell(i, j).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
                     }
@@ -1084,7 +1091,6 @@ const projTreeObj = {
         let data ={"project_id":node.data.ID,"rootProjectID":node.data.property.rootProjectID};
         let result = await ajaxPost("/glj/get-project-info",data);
         this.getFileListWithPath(result.other);
-        console.log(result);
         //数据结构不一样,这里做一下转换
         let t_result = {
             currentProject:{
@@ -1094,12 +1100,8 @@ const projTreeObj = {
             others:result.other
         }
         return t_result;
-
-
     },
 
-
-
     getFileListWithPath:function (list) {
         for(let n of list){
             let node = projTreeObj.tree.findNode(n.ID);
@@ -1172,15 +1174,73 @@ const projTreeObj = {
         sheet.options.isProtected = true;
         sheet.name('replaceSheet');
         let datas = [];
-        for(let i of me.tree.items){
-            datas.push(i.data);
+        for(let i of me.tree.items){//要挑出同个建设项目的节点
+            if(me.isReplaceNode(i) == true){
+                let tem = _.cloneDeep(i.data);
+                if(tem.projType == "Tender") tem.canSelect = true;
+                if(i == me.tree.selected) tem.selected = 1;
+                datas.push(tem);
+            }
         }
         me.replaceTree  = pmTree.createNew(projTreeObj.setting, datas);
         me.showTreeData(me.replaceTree.items, me.replaceSetting, sheet);
-
     },
+    isReplaceNode:function (node) {//只加载本建设项目的节点
+        let isReplaceNode = false;
+        let selected = this.tree.selected;
+        let rootProjectID = selected.data.property.rootProjectID;
+        let rootNode = this.tree.findNode(rootProjectID)
+        if(rootNode){
+            let IDMap = this.getAllParentNodeID(selected);
+            isReplaceNode = IDMap[node.data.ID]!==undefined ||node.data.ID == rootProjectID ||  node.data.ParentID == rootProjectID || (node.data.property &&node.data.property.rootProjectID == rootProjectID);
+        }
+        return isReplaceNode
+    },
+    getAllParentNodeID:function (node) {
+       let IDMap = {};
+       getPID(node,IDMap);
+       return IDMap;
+        function getPID(node,map) {
+            if(node.parent && node.data.ParentID != -1){
+                map[node.data.ParentID] = true;
+                getPID(node.parent,map);
+            }
+        }
+    },
+    onReplaceNodeCheck:function(sender,args){
+        let checkboxValue = args.sheet.getCell(args.row, args.col).value();
+        let newval = checkboxValue?0:1;
+        let node = projTreeObj.replaceTree.items[args.row];
+        if(node.data.ID  === projTreeObj.tree.selected.data.ID) return; //如果是项目管理界面选中的节点,不给取消
+        projTreeObj.setReplaceSelection(node,newval,args.row,args.col,args.sheet);
+    },
+    setReplaceSelection:function (node,value,row,col,sheet) {
+        sheet.getCell(row, col).value(value);
+        node.data.selected = value;
+    },
+    selectSameTypeProject:function (value) {
+        let node = this.tree.selected;
+        let engineering_id = node.data.property.engineering_id;
+        for(let i=0 ;i< this.replaceTree.items.length ; i++){
+            let tnode = this.replaceTree.items[i];
+            if(tnode.data.ID == node.data.ID) continue;
+            if(tnode && tnode.data.property && tnode.data.property.engineering_id == engineering_id){
+                this.setReplaceSelection(tnode,value,i,1,this.replaceWorkBook.getActiveSheet());
+            }
+        }
+    },
+    confirmFileChange : function(){
+        let selectProjects =[];
+        for(let i of this.replaceTree.items){
+            if(i.data.selected === 1) selectProjects.push(i)
+        }
+        console.log(selectProjects);
+        if(selectProjects.length > 0){
+
+        }
 
 
+    },
     insert: function (data, parent, next) {
         let preNode = this.tree.items[this.preSelection.row];
         let node = this.tree.addNodeData(data, parent, next);
@@ -1741,6 +1801,15 @@ $(document).ready(function() {
         })
 
     });
+    $('#selectSameTypeProject').click(function(){
+        let value = $(this).prop('checked') == true?1:0;
+            projTreeObj.selectSameTypeProject(value);
+    });
+
+    $('#changeFileConfirm').click(function(){
+        projTreeObj.confirmFileChange();
+    });
+
     function changeEngineering(){
         $('#engineering-info').hide();
         initFeeStandardSel();