zhangweicheng пре 5 година
родитељ
комит
fe2a77e730

+ 1 - 1
public/web/sheet/sheet_common.js

@@ -165,7 +165,7 @@ var sheetCommonObj = {
         let ch = GC.Spread.Sheets.SheetArea.viewport;
         for (var col = 0; col < setting.header.length; col++) {
             //var cell = sheet.getCell(row, col, GC.Spread.Sheets.SheetArea.viewport);
-            var val = data[row][setting.header[col].dataCode];
+            var val = _.get(data[row],setting.header[col].dataCode);
             if (val && setting.header[col].dataType === "Number") {
                 if (setting.header[col].hasOwnProperty('tofix')) {
                     val = scMathUtil.roundToString(val, setting.header[col].tofix);

+ 3 - 0
web/building_saas/glj/html/project_glj.html

@@ -47,6 +47,9 @@
                         <a class="nav-link " id="mixRatio-nav" data-toggle="tab" href="#ph_div" role="tab" aria-selected="false">组成物计算</a>
                     </li>
                     <li class="nav-item">
+                      <a class="nav-link " id="ration-nav" data-toggle="tab" href="#ph_div" role="tab" aria-selected="true">相关定额</a>
+                  </li>
+                    <li class="nav-item">
                          <a class="nav-link" href="#" data-toggle="modal" data-target="#calcCoeDiv"></i> 计算系数</a>
                     </li>
                 </ul>

+ 1 - 1
web/building_saas/js/global.js

@@ -17,7 +17,6 @@ function autoFlashHeight(){
     $('.main-content').width($(window).width()-$('.main-nav').width()-$('.main-side').width()-5);
     $('#glj_tree_div .modal-content').width($(window).width() < 1020 + 20 ? $(window).width() - 20 : 1020);
     //$("#main .main-data-top").height($(window).height()-headerHeight-toolsbarHeight-bottomContentHeight-1);
-    typeof(loadMainSize)== 'function' ?loadMainSize():'';//zhang 2018-06-04  统一加载高度方法
     $(".main-data-full").height($(window).height()-headerHeight-toolsbarHeight-1);
     $(".main-data-full-fl").height($(window).height()-headerHeight-toolsbarHeight-37);
     $(".main-data-full-feeRate").height($(window).height()-headerHeight-78);
@@ -34,6 +33,7 @@ function autoFlashHeight(){
     $('#project-glj-main').width($(window).width()-($('.main-nav').width()+ 2));//-($('.filterType').width()+12)-5); //2、12是padding宽度,width 是不算padding宽度的
     $('#project_glj_sheet').width($('#project-glj-main').width()-($('.filterType').width())-1)//1是border宽度,width 是不算padding和border宽度的
     typeof(loadProjectGljSize)== 'function'?loadProjectGljSize():'';
+    typeof(loadMainSize)== 'function' ?loadMainSize():'';//zhang 2018-06-04  统一加载高度方法
     //typeof zmhs_obj === 'object' ? zmhs_obj.loadSideResize() : '';
 };
 

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

@@ -24,7 +24,7 @@ $(function () {
         billsLibObj.refreshBillsRelaSpread();
         rationLibObj.refreshSpread();
         subObj.initGljSubTab();
-        refreshSubSpread();
+        //autoFlashHeight 里已经包含了 refreshSubSpread();
     });
 
     $('#tab_report').on('shown.bs.tab', function(e){
@@ -79,7 +79,7 @@ function loadMainSize() {//加载造价书页面各高度
     let mainResizeEles = getMainResizeEles();
     SlideResize.loadVerticalHeight(mainResizeEles.eleObj.module, mainResizeEles.eleObj, mainResizeEles.limit, function () {
         refreshSubSpread();
-        zmhs_obj.refresh();
+        //zmhs_obj.refresh();
     });
 }
 

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

@@ -13,6 +13,19 @@ projectGljObject={
     materialTreeSheet:null,
     projectGljSheetData:[],
     mixRatioSetting:{},
+    relatedRationSetting:{
+      header:[
+        {headerName: "编码", headerWidth: 100, dataCode: "code", dataType: "String"},
+        {headerName: "名称", headerWidth: 180, dataCode: "name", dataType: "String"},
+        {headerName: "单位", headerWidth: 50, dataCode: "unit", dataType: "String",hAlign: "center"},
+        {headerName: "工程量", headerWidth: 65, dataCode: "quantity", dataType: "Number", hAlign: "right",decimalField: "ration.quantity"},
+        {headerName: "单价", headerWidth: 65, dataCode: "feesIndex.common.unitFee", dataType: "Number", hAlign: "right",decimalField: "ration.unitPrice"}
+    ],
+    view: {
+        lockColumns: [0,1,2,3,4]//,
+        //colHeaderHeight:30
+      }
+    },
     materialTreeSetting:{
         "emptyRows":0,
         "headRows":1,
@@ -90,13 +103,15 @@ projectGljObject={
         }
     },
     initMixRatioSpread:function () {
-        this.mixRatioSpread = SheetDataHelper.createNewSpread($("#mix_ratio_sheet")[0]);
+        this.mixRatioSpread = SheetDataHelper.createNewSpread($("#mix_ratio_sheet")[0],2);
         sheetCommonObj.spreadDefaultStyle(this.mixRatioSpread);
-        this.mixRatioSheet = this.mixRatioSpread .getSheet(0);
+        this.mixRatioSheet = this.mixRatioSpread.getSheet(0);
         this.initSheet(this.mixRatioSheet,this.mixRatioSetting);
         this.mixRatioSheet.name('mixRatioSheet');
         this.mixRatioSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onMixRatioEditStarting);
         this.mixRatioSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onMixRatioRangeChange);
+
+        this.initRelatedRationSheet();
         if(projectReadOnly){
             if(this.mixRatioSetting.view.lockColumns){
                 this.mixRatioSetting.view.lockColumns = null;
@@ -104,6 +119,14 @@ projectGljObject={
             disableSpread(this.mixRatioSpread);
         }
     },
+    initRelatedRationSheet:function(){
+      this.relatedRationSheet = this.mixRatioSpread.getSheet(1); 
+      sheetCommonObj.initSheet(this.relatedRationSheet, this.relatedRationSetting, 30);
+      this.relatedRationSheet.name('relatedRation');
+      this.relatedRationSheet.bind(GC.Spread.Sheets.Events.CellDoubleClick, this.onRelatedRationDoubleClick);
+      //this.mixRatioSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onMixRatioRangeChange);
+    },
+
     initMaterialTreeSheet:function () {
         this.materialTreeSheet = this.projectGljSpread.getSheet(1);
         this.materialTreeSetting = this.createMaterialTreeSheetSetting();
@@ -265,6 +288,8 @@ projectGljObject={
 
     showMixRatioData:function () {
         let me = this,gljId = null,gljType = null;
+        if(!$('#mixRatio-nav').hasClass('active')) return;
+        me.mixRatioSpread.setActiveSheetIndex(0);
         let oldSel = me.mixRatioSheet.getSelections()[0];
         let projectGLJData = me.getSelectedProjectGLJ();
         if(projectGLJData){
@@ -290,6 +315,28 @@ projectGljObject={
             me.mixRatioSheet.setSelection(oldSel.row==-1?0:oldSel.row,oldSel.col,oldSel.rowCount,oldSel.colCount);
         })
     },
+    showRelatedRationDatas:function(){
+      let me = this,gljId = null,gljType = null;
+      if(!$('#ration-nav').hasClass('active')) return;
+      me.mixRatioSpread.setActiveSheetIndex(1);
+      let projectGLJData = me.getSelectedProjectGLJ();
+      let rationIDMap = {};
+      let rations = [];
+      if(projectGLJData){
+         for(let rg of projectObj.project.ration_glj.datas){
+            if(rg.projectGLJID == projectGLJData.id) rationIDMap[rg.rationID] = true;
+         } 
+         for(let r of projectObj.project.Ration.datas){
+            if(rationIDMap[r.ID] || (r.subType == rationType.gljRation && r.projectGLJID== projectGLJData.id)){
+              rations.push(r);
+            }
+         } 
+      }
+      this.relatedRationSheetData = rations;
+      sheetCommonObj.showData(me.relatedRationSheet, me.relatedRationSetting,rations);
+      me.relatedRationSheet.setRowCount(rations.length);
+    },
+
     getMixRatioSheetData:function (glj) {
         let data ={
             id:glj.id,
@@ -377,6 +424,12 @@ projectGljObject={
         let dataCode = me.projectGljSetting.header[args.col].dataCode;
         if(dataCode=='name'&& recode && gljUtil.isMaterialType(recode.type)) projectObj.project.projectGLJ.updateCalcMaterial(recode,'calcMaterial',1);
     },
+    onRelatedRationDoubleClick:function (sender,args) {
+      let me = projectGljObject;
+      let record = me.relatedRationSheetData[args.row];
+      $("#tab_zaojiashu").click();
+      locateObject.locateNode(record.ID);
+    },
     setSelectionWhenMaterialChange:function(material){
       if(material){
         let i = _.findIndex(this.projectGljSheetData,{id:material.id})
@@ -421,6 +474,7 @@ projectGljObject={
         sel.rowCount = 1;
         sel.colCount = 1;
         me.showMixRatioData();
+        me.showRelatedRationDatas();
         if(fromMaterial != true) materialCalcObj.showDatas();
     },
     rightClickCallback:function (row) {
@@ -675,6 +729,7 @@ projectGljObject={
         }else {
             me.showProjectGljData();
             me.showMixRatioData();
+            me.showRelatedRationDatas();
         }
     },
     createMaterialTree:function (gljList) {
@@ -866,6 +921,7 @@ projectGljObject={
             me.projectGljSheetData.splice(row,1);
             me.projectGljSheet.deleteRows(row,1);
             me.showMixRatioData();
+            me.showRelatedRationDatas();
         }
         //me.projectGljSheetData[row] = me.getSheetDataByGLJ(glj);
     },
@@ -1520,7 +1576,13 @@ $(function () {
 
     $("#mixRatio-nav").on('shown.bs.tab', function () {
         projectGljObject.mixRatioSpread.refresh();
+        projectGljObject.showMixRatioData();
     });
+    $("#ration-nav").on('shown.bs.tab', function () {
+      projectGljObject.mixRatioSpread.refresh();
+      projectGljObject.showRelatedRationDatas();
+      console.log('hehe');
+  });
 });
 
 

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

@@ -281,7 +281,6 @@ function refreshSubSpread(){
     if(subSpread) subSpread.refresh();
     if(MaterialController.spread) MaterialController.spread.refresh();
     BillsElf.refreshWorkBook();
-    //if($('#linkZMHS').hasClass('active')) zmhs_obj.refresh();
     if($('#rnc-zm').is(':visible')|| $('#rnc-fz').is(':visible') || $('#rnc-cus') || $('#rnc-stable').is(':visible')) zmhs_obj.refresh();
     if($('#linkMBZM').hasClass('active')) mbzm_obj.refresh();
 }

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

@@ -297,7 +297,6 @@ let zmhs_obj = {
     refresh:function () {
         $('#coeSpread').is(':visible')&&this.coeSpread?this.coeSpread.refresh():'';
         $('#coeSpread').is(':visible')&&this.coeSpread?this.showDatas():'';//这里combobox下拉框要重新加载一下
-        $('#coeSpread').is(':visible')&&this.coeSpread?this.coeSpread.refresh():'';
         $('#cusSpread').is(':visible')&&this.cusSpread?this.cusSpread.refresh():'';
         $('#assSpread').is(':visible')&&this.assSpread?this.assSpread.refresh():'';
         $('#stableSpread').is(':visible')&&this.stableSpread?this.stableSpread.refresh():'';