Browse Source

自动行高新需求

zhangweicheng 7 years ago
parent
commit
368dc35405

+ 2 - 0
modules/pm/models/project_property_template.js

@@ -13,6 +13,8 @@ const defaultDecimal = {
 };
 const displaySetting = {
     autoHeight:true,
+    billsAutoHeight:true,
+    rationAutoHeight:false,
     disPlayMainMaterial:true
 }
 

+ 8 - 0
public/web/tree_sheet/tree_sheet_helper.js

@@ -156,6 +156,9 @@ var TREE_SHEET_HELPER = {
                 if (colSetting.data.cellType && Object.prototype.toString.apply(colSetting.data.cellType) !== "[object String]") {
                     cell.cellType(colSetting.data.cellType(node));
                 }
+                if(colSetting.data.autoHeight == true){
+                    colSetting.setAutoHeight(cell,node);
+                }
                 if(sheet.name()=='mainSheet'&&gljOprObj.isInstallationNode(node)){//如果是通过安装增加费自动生成的,都是只读类型
                     cell.locked(true);
                 }else if (colSetting.readOnly) {
@@ -343,10 +346,15 @@ var TREE_SHEET_HELPER = {
             let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: hitinfo.sheet, row: hitinfo.row, col: hitinfo.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
             let cellWidth = hitinfo.sheet.getCell(-1, hitinfo.col).width();
             let dataField = setting.cols[hitinfo.col].data.field;
+
+            if(hitinfo.sheet.getCell(hitinfo.row,hitinfo.col).wordWrap()==true){
+                return;
+            }
             if(dataField === 'name' || dataField === 'itemCharacterText' || dataField === 'jobContentText' || dataField === 'adjustState'){
                 if(hitinfo.sheet.getParent() === projectObj.mainSpread && textLength <= cellWidth)
                  return;
             }
+
             if(dataField=="quantity"){
                 text = tag;
             }else if(tag !== undefined && tag) {

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

@@ -480,11 +480,23 @@
                                 <div class="tab-pane fade" id="display-setting" role="tabpanel">
                                     <div class="modal-auto-height" style="overflow: hidden">
                                         <fieldset class="form-group">
-                                            <div class="form-check">
+                                           <!-- <div class="form-check">
                                                 <label class="form-check-label">
                                                     <input class="form-check-input" id="autoHeight" type="checkbox">
                                                     造价书表格自动调整行高
                                                 </label>
+                                            </div>-->
+                                            <div class="form-check">
+                                                <label class="form-check-label">
+                                                    <input class="form-check-input" id="billsAutoHeight" type="checkbox">
+                                                    工程量清单自动调整行高
+                                                </label>
+                                            </div>
+                                            <div class="form-check">
+                                                <label class="form-check-label">
+                                                    <input class="form-check-input" id="rationAutoHeight" type="checkbox">
+                                                    定额子目自动调整行高
+                                                </label>
                                             </div>
                                             <div class="form-check">
                                                 <label class="form-check-label">

+ 2 - 1
web/building_saas/main/js/views/fee_rate_view.js

@@ -422,7 +422,8 @@ var feeRateObject={
         let fieldID = me.mainFeeRateSetting.header[info.col].dataCode;
         let value = info.newValue;
         if(fieldID == 'rate'&&value != null){
-            if(number_util.isNumber(parseFloat(value))){
+            eval('1+a');
+            if(number_util.isNumber(Number(value))){
                 value = scMathUtil.roundForObj(value,getDecimal("feeRate"));
             }else {
                 alert('当前输入的数据类型不正确,请重新输入。');

+ 10 - 0
web/building_saas/main/js/views/main_tree_col.js

@@ -269,6 +269,16 @@ let MainTreeCol = {
                 return new GC.Spread.Sheets.CellTypes.CheckBox();
         }
     },
+    setAutoHeight:function (cell,node) {//设置自动行高
+        let displaySetting = projectObj.project.property.displaySetting;
+        let billsAutoH = displaySetting && displaySetting.billsAutoHeight?displaySetting.billsAutoHeight:false;
+        let rationAutoH = displaySetting && displaySetting.rationAutoHeight?displaySetting.rationAutoHeight:false;
+        if(node.sourceType === projectObj.project.Bills.getSourceType()){
+            cell.wordWrap(billsAutoH);
+        }else {
+            cell.wordWrap(rationAutoH);
+        }
+    },
     getEvent: function (eventName) {
         let names = eventName.split('.');
         let event = this;

+ 9 - 4
web/building_saas/main/js/views/project_property_display_view.js

@@ -6,7 +6,9 @@ let projDisplayView = {
     init: function () {
         this.datas = projectInfoObj.projectInfo.property.displaySetting;
         this.datas = this.datas === undefined ? {autoHeight: true, disPlayMainMaterial: true} : this.datas;
-        $("#autoHeight").prop("checked", this.datas.autoHeight);
+        //$("#autoHeight").prop("checked", this.datas.autoHeight);
+        $("#billsAutoHeight").prop("checked", this.datas.billsAutoHeight);
+        $("#rationAutoHeight").prop("checked", this.datas.rationAutoHeight);
         $("#disPlayMainMaterial").prop("checked", this.datas.disPlayMainMaterial);
         //$('#disPlayMainMateria').prop('checked')
     },
@@ -22,10 +24,13 @@ let projDisplayView = {
         if (this.datas == null) {
             return;
         }
-        let autoHeight = $('#autoHeight').prop('checked');
+       // let autoHeight = $('#autoHeight').prop('checked');
+        let billsAutoHeight =  $("#billsAutoHeight").prop("checked");
+        let rationAutoHeight =  $("#rationAutoHeight").prop("checked");
         let disPlayMainMaterial = $('#disPlayMainMaterial').prop('checked');
-        if (this.datas.autoHeight !== autoHeight || this.datas.disPlayMainMaterial !== disPlayMainMaterial) {
-            this.datas.autoHeight = autoHeight;
+        if (this.datas.rationAutoHeight !== rationAutoHeight || this.datas.billsAutoHeight !== billsAutoHeight || this.datas.disPlayMainMaterial !== disPlayMainMaterial) {
+            this.datas.billsAutoHeight = billsAutoHeight;
+            this.datas.rationAutoHeight = rationAutoHeight;
             this.datas.disPlayMainMaterial = disPlayMainMaterial;
             // let updateData = {sourceType: 'properties', updateType: 'update', updateData: {ID: projectID, 'property.displaySetting':this.datas}};
             properties['property.displaySetting'] = this.datas;

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

@@ -509,6 +509,8 @@ var projectObj = {
         let startTime = +new Date();
         console.log("开始加载-----"+startTime);
         this.project.loadDatas(function (err) {
+            let mTime = +new Date();
+            console.log(`get data时间——${mTime - startTime}`);
             if (!err) {
                 that.project.projectGLJ.calcQuantity();//计算分部分项和技术措施项目消耗量;
                 that.project.property = projectInfoObj.projectInfo.property;
@@ -520,8 +522,6 @@ var projectObj = {
                 that.project.projSetting.mainGridSetting = JSON.parse(str);
                 that.project.projSetting.mainGridSetting.frozenCols = 4;
                 TREE_SHEET_HELPER.initSetting($('#billsSpread')[0], that.project.projSetting.mainGridSetting);
-                const autoHeight = that.project.property.displaySetting !== undefined ?
-                    that.project.property.displaySetting.autoHeight : false;
                 that.project.projSetting.mainGridSetting.cols.forEach(function (col) {
                     col.data.splitFields = col.data.field.split('.');
                     if (col.data.getText && Object.prototype.toString.apply(col.data.getText) === "[object String]") {
@@ -541,17 +541,12 @@ var projectObj = {
                     if (col.data.field === 'code') {
                         col.data.formatter = '@';
                     }
-
-                    // 根据配置设置自动行高
+                    col.setAutoHeight = MainTreeCol.getEvent("setAutoHeight");
+                    // 根据配置设置自动行高,在这里先做个标记,然后对每个单元格单独配置
                     if (col.data.field === 'name' || col.data.field === 'itemCharacterText' ||
                         col.data.field === 'jobContentText' || col.data.field === 'adjustState') {
-                        if (!autoHeight) {
-                            col.showHint = true;
-                            col.data.wordWrap = false;
-                        } else {
-                            col.showHint = false;
-                            col.data.wordWrap = true;
-                        }
+                        col.data.autoHeight = true;
+                        col.showHint = true;
                     }
                     if(col.data.field ==='quantity'){
                         col.showHint = true;
@@ -566,9 +561,11 @@ var projectObj = {
                     // }
 
                 });
-
+                let startShowTime = +new Date();
                 that.mainController = TREE_SHEET_CONTROLLER.createNew(that.project.mainTree, that.mainSpread.getActiveSheet(), that.project.projSetting.mainGridSetting);
                 that.mainController.showTreeData();
+                let endShowTime = +new Date();
+                console.log(`show data时间——${endShowTime - startShowTime}`);
                 that.mainController.bind('refreshBaseActn', that.refreshBaseActn);
                 that.mainController.bind(TREE_SHEET_CONTROLLER.eventName.beforeTreeSelectedChange, that.beforeMainTreeSelectedChange);
                 that.mainController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, that.treeSelectedChanged);
@@ -584,9 +581,11 @@ var projectObj = {
                 that.mainSpread.bind(GC.Spread.Sheets.Events.ClipboardChanged, that.msClipboardChanged);
                 that.mainSpread.bind(GC.Spread.Sheets.Events.ButtonClicked, that.onButtonClick);
                 that.mainSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, that.onCellDoubleClick);
+                let loadOtherStartTime = +new Date();
                 that.loadMainSpreadContextMenu();
                 that.loadFocusLocation();
                 let endTime = +new Date();
+                console.log(`其它时间——${endTime - loadOtherStartTime}`);
                 socketObject.connect();//连接socket服务器
                 console.log("加载完成-----"+endTime);
                 console.log(`时间——${endTime - startTime}`);