Ver código fonte

字体加粗调整

zhongzewei 7 anos atrás
pai
commit
2b2166b1cd

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

@@ -110,7 +110,10 @@ var TREE_SHEET_HELPER = {
             //test
             setting.cols.forEach(function (colSetting, iCol) {
                 var cell = sheet.getCell(iRow, iCol, GC.Spread.Sheets.SheetArea.viewport);
-
+                let boldFontStyle = projectObj.getBoldFontStyle(node, colSetting);
+                if(boldFontStyle){
+                    sheet.setStyle(iRow, iCol, boldFontStyle);
+                }
                 // var getFieldText = function () {
                 //     var fields = colSetting.data.field.split('.');
                 //     var validField = fields.reduce(function (field1, field2) {

+ 1 - 6
web/building_saas/main/js/models/calc_base.js

@@ -23,12 +23,7 @@ let cbTools = {
         return r;
     },
     findBill: function (fixedFlag) {
-        let bills = projectObj.project.Bills.datas;
-        for(let i = 0, len = bills.length; i < len; i++){
-            if(bills[i].flagsIndex && bills[i].flagsIndex.fixed && bills[i].flagsIndex.fixed.flag && bills[i].flagsIndex.fixed.flag === fixedFlag){
-                return bills[i];
-            }
-        }
+        return this.isDef(calcBase.project.fixedBills[fixedFlag]) ? calcBase.project.fixedBills[fixedFlag]['bill'] : null;
     },
     //通过行获取根节点清单
     getBillByRow: function (items, row) {

+ 36 - 24
web/building_saas/main/js/views/project_view.js

@@ -469,7 +469,6 @@ var projectObj = {
                 that.mainSpread.bind(GC.Spread.Sheets.Events.SelectionChanged, that.amountAreaNumber);
                 that.loadMainSpreadContextMenu();
                 that.loadFocusLocation();
-                that.setRootsStyle();
                 let endTime = +new Date();
                 console.log("加载完成-----"+endTime);
             }
@@ -803,29 +802,15 @@ var projectObj = {
             }, 200);
         };
  },
-    setRootsStyle: function  () {
-        let me = this;
-        let style = new GC.Spread.Sheets.Style();
-        // style.backColor = "#d5e8ee";
-        style.font = 'bold 15px Arial';
-        let count = me.project.mainTree.items.length;
-        for (var i = 0; i < count; i++) {
-            if (!me.project.mainTree.items[i].parent)
-                me.mainSpread.getActiveSheet().setStyle(i, -1, style, GC.Spread.Sheets.SheetArea.viewport);
-        }
-},
+
  //根据节点获取行style(颜色、字体加粗)
     getNodeColorStyle: function (node) {
-        let type, backColor = null, font = null;
+        let type, backColor = null, foreColor = null;
         if(!isDef(node)){
             return null;
         }
         //清单大类
         if(node.sourceType === this.project.Bills.getSourceType()){
-            //大项费用
-            if(node.data.type === billType.DXFY){
-                type = 0;
-            }
             //分部
             if(node.data.type === billType.FB){
                 type = 1;
@@ -855,18 +840,18 @@ var projectObj = {
             type = 4;
         }
         switch (type){
-            case 0: font = 'bold 15px "Arial"'; break;
+            //case 0: font = 'bold 13px "Arial"'; break;
             case 1: backColor = '#c1d3e3'; break;
             case 2: backColor = '#dae5ee'; break;
             case 3: backColor = '#e5f3f2';  break;
-            case 4: backColor = '#4DBCFB';   break;
+            case 4: foreColor = '#4D7BFF';   break;
         }
-        if(!font && !backColor){
+        if(!backColor && !foreColor){
             return null;
         }
         let style = new GC.Spread.Sheets.Style();
-        if(font){
-            style.font = 'bold 15px "Arial"';
+        if(foreColor){
+            style.foreColor = foreColor;
         }
         if(backColor){
             style.backColor = backColor;
@@ -875,8 +860,35 @@ var projectObj = {
             style.borderRight = new GC.Spread.Sheets.LineBorder("#D4D4D4", GC.Spread.Sheets.LineStyle.thin);
             style.borderBottom = new GC.Spread.Sheets.LineBorder("#D4D4D4", GC.Spread.Sheets.LineStyle.thin);
         }
-        return style;    
-}
+        return style;
+    },
+    //大项费用则字体加粗,String 15px, Number 13px
+    getBoldFontStyle: function (node, colSetting) {
+        if(node.sourceType !== this.project.Bills.getSourceType() || node.data.type !== billType.DXFY){
+            return null;
+        }
+        let style = new GC.Spread.Sheets.Style();
+        //备注暂无字段
+        let stringFields = [
+            'code',
+            'subType',
+            'name',
+            'unit',
+            'itemCharacterText',
+            'jobContentText',
+            'adjustState',
+            'calcBase',
+            'programID',
+            'ruleText'
+        ];
+        if(stringFields.indexOf(colSetting.data.field) > 0){
+            style.font = 'bold 15px Arial';
+        }
+        else {
+            style.font = 'bold 13px Arial';
+        }
+        return style;
+    }
 };
 // 点击合计框中的复制
 $("body").on("click", "#total-tips a", function() {