ソースを参照

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost

zhangweicheng 7 年 前
コミット
ef4decee5a

+ 6 - 0
modules/pm/controllers/pm_controller.js

@@ -3,6 +3,7 @@
  */
 import UnitPriceFileModel from "../../glj/models/unit_price_file_model";
 import moment from 'moment';
+import CompilationModel from "../../users/models/compilation_model";
 let mongoose = require('mongoose');
 let ProjectsData = require('../models/project_model').project;
 let labourCoe = require('../../main/facade/labour_coe_facade');
@@ -185,6 +186,11 @@ module.exports = {
         if (sessionCompilation === undefined) {
             return response.redirect('/logout');
         }
+        let compilationModel = new CompilationModel();
+        //更新编办信息
+        let compilationData = await compilationModel.getCompilationById(sessionCompilation._id);
+        request.session.sessionCompilation = compilationData;
+        sessionCompilation = request.session.sessionCompilation;
 
         // 清单计价
         let billValuation = sessionCompilation.bill_valuation !== undefined ?

+ 6 - 4
modules/users/models/compilation_model.js

@@ -48,21 +48,23 @@ class CompilationModel extends BaseModel {
         }
 
         if (compilationData.bill_valuation.length > 0) {
+            let enableValuation = [];
             for (let index in compilationData.bill_valuation) {
                 if (compilationData.bill_valuation[index].enable) {
-                    continue;
+                    enableValuation.push(compilationData.bill_valuation[index]);
                 }
-                delete compilationData.bill_valuation[index];
             }
+            compilationData.bill_valuation = enableValuation;
         }
 
         if (compilationData.ration_valuation.length > 0) {
+            let enableValuation = [];
             for (let index in compilationData.ration_valuation) {
                 if (compilationData.ration_valuation[index].enable) {
-                    continue;
+                    enableValuation.push(compilationData.bill_valuation[index]);
                 }
-                delete compilationData.ration_valuation[index];
             }
+            compilationData.ration_valuation = enableValuation;
         }
 
         return compilationData;

+ 2 - 2
modules/users/models/engineering_lib_model.js

@@ -47,8 +47,7 @@ class EngineeringLibModel extends BaseModel {
                 engineeringLibIdList.push(engineering.engineering_id);
             }
         }
-        // console.log(data);
-        // console.log(engineeringTemp);
+
 
         // 查找对应的id数据
         let condition = {_id: {"$in": engineeringLibIdList}};
@@ -74,6 +73,7 @@ class EngineeringLibModel extends BaseModel {
 
         // 替换计价规则数据
         let valuationData = JSON.parse(JSON.stringify(data));
+
         for(let valuation of valuationData) {
             if (valuation === null) {
                 continue;

+ 1 - 1
web/building_saas/css/main.css

@@ -23,7 +23,7 @@ body {
     margin-right: 1rem;
     font-size: 1rem;
     height:38px;
-    background:url(logo.png) no-repeat 0 0;
+    background:url("/web/building_saas/css/logo.png") no-repeat 0 0;
     padding-left:40px;
 }
 .header-logo div.v-title{

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

@@ -88,6 +88,7 @@
                       <% } else { %>
                       <a href="javascript:void(0)" class="btn btn-sm" name="lockBills"  title=""> <i class="fa fa-lock" aria-hidden="true"></i> 锁定清单</a>
                       <% } %>
+                      <a id="switchTznr" href="javascript:void(0);" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-eye" aria-hidden="true"></i> 显示特征内容</a>
                   </div>
                   <div class="side-tabs">
                       <ul class="nav nav-tabs" role="tablist">

+ 3 - 3
web/building_saas/main/js/models/calc_base.js

@@ -865,9 +865,9 @@ let baseFigureTemplate = {
         if(cbTools.isUnDef(bill.feesIndex) || Object.keys(bill.feesIndex).length === 0) return 0;
         return cbTools.isDef(bill.feesIndex.estimate) && cbTools.isDef(bill.feesIndex.estimate[totalFeeType]) ? bill.feesIndex.estimate[totalFeeType] : 0;
     },
-    'ZGCLFFGLJ': function () {//暂估材料费(从工料机汇总表汇总)
+   /* 'ZGCLFFGLJ': function () {//暂估材料费(从工料机汇总表汇总)
         return 0;
-    },
+    },*/
     'FBF': function (tender) {//分包费
         const totalFeeType = tender ? 'tenderTotalFee' : 'totalFee';
         let rst = 0;
@@ -1032,7 +1032,7 @@ let baseFigureMap = {
     '甲定主材费': {base: 'JDZCF', class: 'RCJ'},
     '甲定设备费': {base: 'JDSBF', class: 'RCJ'},
     '暂估材料费(从子目汇总)': {base: 'ZGCLFFZM', class: 'RCJ'},
-    '暂估材料费(从工料机汇总表汇总)': {base: 'ZGCLFFGLJ', class: 'RCJ'},
+    /*'暂估材料费(从工料机汇总表汇总)': {base: 'ZGCLFFGLJ', class: 'RCJ'},*/
     '分包费': {base: 'FBF', class: 'FBF'},
     '分包定额基价人工费': {base: 'FBDEJJRGF', class: 'FBF'},
     '分包定额基价材料费': {base: 'FBDEJJCLF', class: 'FBF'},

+ 8 - 2
web/building_saas/main/js/models/calc_program.js

@@ -244,6 +244,12 @@ let calcTools = {
             treeNode.changed = true;
         };
     },
+    hasAdjustPrice: function(){      // 编办是否有材料的调整价发文
+        if (projectObj.project.projSetting.glj_col && projectObj.project.projSetting.glj_col.showAdjustPrice == true)
+            return true
+        else
+            return false;
+    },
     // 参数fieldName值: 'common.totalFee'、'equipment.unitFee'
     getFee: function (treeNode, fieldName) {
         if (!treeNode) return 0;
@@ -267,7 +273,7 @@ let calcTools = {
                 };
                 let qty = isTender ? me.uiGLJQty(glj["tenderQuantity"]) : me.uiGLJQty(glj["quantity"]);
                 let mprice = isTender ? me.uiGLJPrice(glj["tenderPrice"]) : me.uiGLJPrice(glj["marketPrice"]);
-                let aprice = me.uiGLJPrice(glj["adjustPrice"]);
+                let aprice = calcTools.hasAdjustPrice() ? me.uiGLJPrice(glj["adjustPrice"]) : me.uiGLJPrice(glj["basePrice"]);
 
                 if (priceType == priceTypes.ptDiffPrice){
                     if (aprice != mprice){
@@ -496,7 +502,7 @@ let calcTools = {
                 (treeNode.data.subType === gljType.MAIN_MATERIAL && baseName === calcBaseNames.ZCFJC) ||
                 (treeNode.data.subType === gljType.EQUIPMENT && baseName === calcBaseNames.SBFJC))
         ) {
-            let aprice = me.uiGLJPrice(treeNode.data.adjustPrice);
+            let aprice = me.uiGLJPrice(treeNode.data.basePrice);   // 量价虚拟的工料机不可能有发文,这里直接取定额价。
             let mprice = me.uiGLJPrice(treeNode.data.marketUnitFee);
             result = (mprice - aprice).toDecimal(decimalObj.ration.unitPrice);
         }

+ 11 - 6
web/building_saas/main/js/views/calc_base_view.js

@@ -130,9 +130,14 @@ let calcBaseView = {
     isDef: function (v) {
         return v !== undefined && v !== null;
     },
-    ifEdit: function () {
-        var selected = projectObj.project.mainTree.selected;
-        return MainTreeCol.readOnly.forCalcBase(selected)?false:true;
+    ifEdit: function (type) {
+        if (type == 'ration'){
+            return true;
+        }
+        else{
+            var selected = projectObj.project.mainTree.selected;
+            return MainTreeCol.readOnly.forCalcBase(selected)?false:true;
+        }
     },
     bindClassBtn: function () {
         let me = this;
@@ -338,7 +343,7 @@ let calcBaseView = {
             // ctx.fillText(value,x+w-3,y+h-3);
             GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
             // }
-            if(calcBaseView.editingCell && !projectReadOnly){
+            if(calcBaseView.editingCell && !projectReadOnly && calcBaseView.ifEdit(type)){
                 if(calcBaseView.editingCell.row==options.row&&calcBaseView.editingCell.col==options.col){
                     var image = document.getElementById('f_btn'),imageMagin = 3;
                     var imageHeight = h-2*imageMagin;
@@ -374,7 +379,7 @@ let calcBaseView = {
             if(me.editingCell==null){
                 var showSelectBtn = true;
                 if(hitinfo.sheet.name()!='calc_detail'){
-                    showSelectBtn=me.ifEdit();
+                    showSelectBtn=me.ifEdit(type);
                 }
                 if(showSelectBtn){
                     me.editingCell={
@@ -390,7 +395,7 @@ let calcBaseView = {
                 var imageHeight = hitinfo.cellRect.height-2*imageMagin;
                 var imageWidth = hitinfo.cellRect.width*2/7;
                 if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
-                    if(!projectReadOnly){
+                    if(!projectReadOnly && me.ifEdit(type)){
                         calcBaseView.initCalctor(type);
                     }
                 }

+ 4 - 1
web/building_saas/main/js/views/character_content_view.js

@@ -1206,9 +1206,12 @@ let pageCCOprObj = {
             let characterArray = [];
             let count = 1;
             for (const tmp of itemCharacter) {
-                if (tmp.eigenvalue === undefined || tmp.eigenvalue.length <= 0 || !tmp.isChecked) {
+                if (!tmp.isChecked) {
                     continue;
                 }
+                if(tmp.eigenvalue === undefined || tmp.eigenvalue.length <= 0){
+                    tmp.eigenvalue = [];
+                }
                 // 获取选中的特征值
                 let selectedEigen = '';
                 for (const eigen of tmp.eigenvalue) {

+ 99 - 19
web/building_saas/main/js/views/main_tree_col.js

@@ -424,27 +424,99 @@ let colSettingObj = {
         }
         return false;
     },
-    updateColSetting: function () {
-        let sheet = this.settingSpread.getActiveSheet();
-         let mainSheet = projectObj.mainSpread.getActiveSheet();
-         for (let iRow = 0; iRow < sheet.getRowCount(); iRow++) {
-         projectObj.project.projSetting.main_tree_col.cols[iRow].visible = sheet.getValue(iRow, 0);
-         projectObj.project.projSetting.mainGridSetting.cols[iRow].visible = sheet.getValue(iRow, 0);
-         }
-         SheetDataHelper.massOperationSheet(mainSheet, function () {
-         SheetDataHelper.refreshColumnVisible(projectObj.project.projSetting.mainGridSetting, mainSheet);
-         //左右滚动条到最左边
-         mainSheet.showColumn(projectObj.project.projSetting.mainGridSetting.frozenCols, GC.Spread.Sheets.HorizontalPosition.left);
-         });
-         //refresh nodes to autoFitRow
-         projectObj.mainController.refreshTreeNode(projectObj.project.mainTree.roots, true);
-         projectObj.project.pushNow('editColSetting', projectObj.project.projSetting.moduleName, {
-         projectID: projectObj.project.ID(),
-         main_tree_col: projectObj.project.projSetting.main_tree_col
-         });
+    updateColSetting: function (skipSetValue = false) {
+        let mainSheet = projectObj.mainSpread.getActiveSheet();
+        if(!skipSetValue){
+            let sheet = this.settingSpread.getActiveSheet();
+            for (let iRow = 0; iRow < sheet.getRowCount(); iRow++) {
+                projectObj.project.projSetting.main_tree_col.cols[iRow].visible = sheet.getValue(iRow, 0);
+                projectObj.project.projSetting.mainGridSetting.cols[iRow].visible = sheet.getValue(iRow, 0);
+            }
+        }
+        SheetDataHelper.massOperationSheet(mainSheet, function () {
+            SheetDataHelper.refreshColumnVisible(projectObj.project.projSetting.mainGridSetting, mainSheet);
+            //左右滚动条到最左边
+            mainSheet.showColumn(projectObj.project.projSetting.mainGridSetting.frozenCols, GC.Spread.Sheets.HorizontalPosition.left);
+        });
+        //refresh nodes to autoFitRow
+        projectObj.mainController.refreshTreeNode(projectObj.project.mainTree.roots, true);
+        if(!skipSetValue){
+            //列设置将项目特征和工作内容都取消打钩后,更新快速列设置
+            if(!this.getVisible('itemCharacterText') && !this.getVisible('jobContentText')){
+                switchTznrHtml(true);
+            }
+            if(this.getVisible('itemCharacterText') && this.getVisible('jobContentText')){
+                switchTznrHtml(false);
+            }
+        }
+        projectObj.project.pushNow('editColSetting', projectObj.project.projSetting.moduleName, {
+            projectID: projectObj.project.ID(),
+            main_tree_col: projectObj.project.projSetting.main_tree_col
+        });
+    },
+    setVisible: function (field, visible) {
+        let mainTreeCols = projectObj.project.projSetting.main_tree_col.cols;
+        for(let colSetting of mainTreeCols){
+            if(colSetting.data.field === field){
+                colSetting.visible = visible;
+                break;
+            }
+        }
+        let mainGridCols = projectObj.project.projSetting.mainGridSetting.cols;
+        for(let colSetting of mainGridCols){
+            if(colSetting.data.field === field){
+                colSetting.visible = visible;
+                break;
+            }
+        }
+    },
+    getVisible: function(field){
+        let cols = projectObj.project.projSetting.main_tree_col.cols;
+        for(let colSetting of cols){
+            if(colSetting.data.field === field){
+                return colSetting.visible;
+            }
+        }
+        return false;
     }
+
 };
 
+function switchTznrHtml(show) {
+    if(projectReadOnly){
+        return;
+    }
+    if(show){
+        let newHmtl = $('#switchTznr').html().replace('隐藏', '显示');
+        $('#switchTznr').html(newHmtl);
+        $('#switchTznr').find('i').removeClass('fa-eye-slash');
+        $('#switchTznr').find('i').addClass('fa-eye');
+    }
+    else {
+        let newHmtl = $('#switchTznr').html().replace('显示', '隐藏');
+        $('#switchTznr').html(newHmtl);
+        $('#switchTznr').find('i').removeClass('fa-eye');
+        $('#switchTznr').find('i').addClass('fa-eye-slash');
+    }
+}
+
+$('#switchTznr').click(function () {
+    let me = colSettingObj;
+    let cur = $(this).text();
+    if(cur.includes('显示特征内容')){
+        switchTznrHtml(false);
+        me.setVisible('itemCharacterText', true);
+        me.setVisible('jobContentText', true);
+        me.updateColSetting(true);
+    }
+    else {
+        switchTznrHtml(true);
+        me.setVisible('itemCharacterText', false);
+        me.setVisible('jobContentText', false);
+        me.updateColSetting(true);
+    }
+});
+
 $('#poj-set').on('shown.bs.modal', function (e) {
     if (!colSettingObj.settingSpread) {
         colSettingObj.initSettingSpread();
@@ -452,6 +524,15 @@ $('#poj-set').on('shown.bs.modal', function (e) {
             disableSpread(colSettingObj.settingSpread);
         }
     }
+    if($('#tab_display_setting').hasClass('active')){
+        let sheet = colSettingObj.settingSpread.getActiveSheet();
+        SheetDataHelper.massOperationSheet(sheet, function () {
+            for(let row = 0; row < sheet.getRowCount(); row++){
+                let orgData = projectObj.project.projSetting.main_tree_col.cols[row].visible;
+                sheet.setValue(row, 0, orgData);
+            }
+        });
+    }  
 });
 
 $('#poj-set').on('hidden.bs.modal', function (e) {
@@ -467,7 +548,6 @@ $('#poj-set').on('hidden.bs.modal', function (e) {
     }
 });
 
-
 $('#tab_display_setting').on('shown.bs.tab', function () {
     if(colSettingObj.settingSpread){
         colSettingObj.settingSpread.refresh();

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

@@ -41,7 +41,6 @@ var projectInfoObj = {
                 basicInfoView.orgDatas = data.property.basicInformation ? basicInfoView.toViewDatas(data.property.basicInformation) : [];
                 projFeatureView.orgDatas = data.property.projectFeature ? projFeatureView.toViewDatas(data.property.projectFeature) : [];
                 $('#fullpath').html(that.getFullPathHtml(that.projectInfo));
-
             }
         });
     }

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

@@ -601,6 +601,13 @@ var projectObj = {
         this.project.loadDatas(function (err) {
             let mTime = +new Date();
             console.log(`get data时间——${mTime - startTime}`);
+            //快速列设置
+            if(!colSettingObj.getVisible('itemCharacterText') && !colSettingObj.getVisible('jobContentText')){
+                switchTznrHtml(true);
+            }
+            if(colSettingObj.getVisible('itemCharacterText') && colSettingObj.getVisible('jobContentText')){
+                switchTznrHtml(false);
+            }
             if (!err) {
                 that.project.projectGLJ.calcQuantity(true);//计算分部分项和技术措施项目消耗量;
                 gljCol.initGljCol(that.project.projSetting.glj_col?that.project.projSetting.glj_col.showAdjustPrice:false);
@@ -2176,6 +2183,7 @@ function disableTools(){
     $('#upMove').remove();
     $('#downMove').remove();
     $('#ZLFB_btn').remove();
+    $('#switchTznr').remove();
     $('a[name="lockBills"]').remove();
     //关于计算
     $('#poj-settings-4').find('input').prop('disabled', 'disabled');

+ 5 - 2
web/building_saas/pm/js/pm_share.js

@@ -670,7 +670,7 @@ const pmShare = (function () {
         }
         let copyMap = {copy: null, update: null};
         let newName = `${selected.data.name} (${selected.data.userInfo.name}共享)`;
-        //获取单项工程的最末单位工程
+        //获取单项工程的单位工程
         let tenderQuery = {$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], userID: userID, ParentID: engID};
         CommonAjax.post('/pm/api/getProjectsByQuery', {user_id: userID, query: tenderQuery, options: '-_id -property'}, function (rstData) {
             let updateTender = null;
@@ -700,7 +700,7 @@ const pmShare = (function () {
                 createDateTime: selected.data.createDateTime,
                 fileVer: selected.data.fileVer ? selected.data.fileVer : '',
                 projType: selected.data.projType,
-                property: selected.data.property,
+                property: {},
                 recentDateTime: selected.data.recentDateTime,
                 fullFolder: selected.data.fullFolder
             };
@@ -721,6 +721,9 @@ const pmShare = (function () {
     function eventListener(){
         //tab
         $('#tab_pm_share').on('shown.bs.tab', function () {
+            //侧滑隐藏
+            $('.slide-sidebar').removeClass('open');
+            $('.slide-sidebar').css('width', '0');
             projTreeObj.tree = null;
             if(projTreeObj.workBook){
                 projTreeObj.workBook.destroy();