Browse Source

汇总信息加上暂估合价

zhongzewei 7 years atrás
parent
commit
db771d0d9f

+ 23 - 9
modules/pm/facade/pm_facade.js

@@ -593,7 +593,7 @@ function isDef(v){
     return typeof v !== 'undefined' && v !== null;
 }
 
-function getCommonTotalFee(bills) {
+function getTotalFee(bills, feeName) {
     if(!isDef(bills)){
         return 0;
     }
@@ -601,7 +601,7 @@ function getCommonTotalFee(bills) {
         return 0;
     }
     for(let fee of bills.fees){
-        if(isDef(fee.fieldName) && fee.fieldName === 'common'){
+        if(isDef(fee.fieldName) && fee.fieldName === feeName){
             return isDef(fee.totalFee) ? fee.totalFee : 0;
         }
     }
@@ -610,13 +610,18 @@ function getCommonTotalFee(bills) {
 
 function summarizeToParent(parent, child) {
     const decimal = -2;
+    let costFields = ['engineeringCost', 'subEngineering', 'measure', 'safetyConstruction', 'other', 'charge', 'tax', 'estimate'];
+    for (let field of costFields) {
+        parent[field] = scMathUtil.roundTo(parseFloat(parent[field]) + parseFloat(child[field]), decimal);
+    }
+   /* const decimal = -2;
     parent.engineeringCost = scMathUtil.roundTo(parseFloat(parent.engineeringCost) + parseFloat(child.engineeringCost), decimal);
     parent.subEngineering = scMathUtil.roundTo(parseFloat(parent.subEngineering) + parseFloat(child.subEngineering), decimal);
     parent.measure = scMathUtil.roundTo(parseFloat(parent.measure) + parseFloat(child.measure), decimal);
     parent.safetyConstruction = scMathUtil.roundTo(parseFloat(parent.safetyConstruction) + parseFloat(child.safetyConstruction), decimal);
     parent.other = scMathUtil.roundTo(parseFloat(parent.other) + parseFloat(child.other), decimal);
     parent.charge = scMathUtil.roundTo(parseFloat(parent.charge) + parseFloat(child.charge), decimal);
-    parent.tax = scMathUtil.roundTo(parseFloat(parent.tax) + parseFloat(child.tax), decimal);
+    parent.tax = scMathUtil.roundTo(parseFloat(parent.tax) + parseFloat(child.tax), decimal);*/
 }
 
 function getBuildingArea(projFeature){
@@ -689,7 +694,7 @@ async function getTendersFeeInfo(tenders) {
     if(tenders.length > 0){
         for(let tender of tenders){
             tenderIDs.push(tender.ID);
-            IDMapping[tender.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, rate: 0, buildingArea: '', perCost: ''};
+            IDMapping[tender.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, estimate: 0, rate: 0, buildingArea: '', perCost: ''};
             IDMapping[tender.ID]['buildingArea'] = '';
         }
         //需要获取的清单固定类别综合合价:工程造价、分部分项、措施项目、安全文明施工专项、规费、其他项目、税金
@@ -702,7 +707,11 @@ async function getTendersFeeInfo(tenders) {
         for(let bills of allBills){
             let billsFlag = bills.flags[0]['flag'];
             let costField = flagFieldMapping[billsFlag];
-            IDMapping[bills.projectID][costField] = getCommonTotalFee(bills);
+            IDMapping[bills.projectID][costField] = getTotalFee(bills, 'common');
+            //暂估合价(工程造价暂估合价)
+            if (billsFlag === billsFlags.ENGINEERINGCOST){
+                IDMapping[bills.projectID]['estimate'] = getTotalFee(bills, 'estimate');
+            }
         }
         //占造价比例、单方造价
         for(let tender of tenders){
@@ -742,7 +751,7 @@ async function getSummaryInfo(projectIDs){
                 }
             }
         }
-        IDMapping[project.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, rate: 0, buildingArea: grossArea, perCost: ''};
+        IDMapping[project.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, estimate: 0, rate: 0, buildingArea: grossArea, perCost: ''};
     }
 
     //单项工程
@@ -752,7 +761,7 @@ async function getSummaryInfo(projectIDs){
     let engIDs = [];
     for(let eng of engineerings){
         engIDs.push(eng.ID);
-        IDMapping[eng.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, rate: 0, buildingArea: '', perCost: ''};
+        IDMapping[eng.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, estimate: 0, rate: 0, buildingArea: '', perCost: ''};
     }
     if(engIDs.length > 0){
         tenders = await projectModel.find({ParentID: {$in : engIDs}, projType: projectType.tender, $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}]});
@@ -761,7 +770,8 @@ async function getSummaryInfo(projectIDs){
     if(tenders.length > 0){
         for(let tender of tenders){
             tenderIDs.push(tender.ID);
-            IDMapping[tender.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, rate: 0, buildingArea: '', perCost: '',changeMark:tender.changeMark,property:tender.property};
+            IDMapping[tender.ID] = {engineeringCost: 0, subEngineering: 0, measure: 0, safetyConstruction: 0, other: 0, charge: 0, tax: 0, rate: 0, estimate: 0,
+                buildingArea: '', perCost: '',changeMark:tender.changeMark,property:tender.property};
             let buildingArea = getBuildingArea(tender.property.projectFeature);
             if(buildingArea){
                 IDMapping[tender.ID]['buildingArea'] = buildingArea;
@@ -777,7 +787,11 @@ async function getSummaryInfo(projectIDs){
         for(let bills of allBills){
             let billsFlag = bills.flags[0]['flag'];
             let costField = flagFieldMapping[billsFlag];
-            IDMapping[bills.projectID][costField] = getCommonTotalFee(bills);
+            IDMapping[bills.projectID][costField] = getTotalFee(bills, 'common');
+            //暂估合价(工程造价暂估合价)
+            if (billsFlag === billsFlags.ENGINEERINGCOST){
+                IDMapping[bills.projectID]['estimate'] = getTotalFee(bills, 'estimate');
+            }
         }
         //进行单项工程级别的汇总
         for(let tender of tenders){

+ 4 - 4
web/building_saas/main/html/main.html

@@ -84,11 +84,11 @@
                     <!--<a href="javascript:void(0)" class="btn btn-sm" title="复制" ><i class="fa fa-files-o" aria-hidden="true"></i></a>
                     <a href="javascript:void(0)" class="btn btn-sm" title="剪切"><i class="fa fa-scissors" aria-hidden="true"></i></a>
                     <a href="javascript:void(0)" class="btn btn-sm" title="粘贴"><i class="fa fa-clipboard" aria-hidden="true"></i></a>-->
-                      <span class="btn btn-light btn-sm" data-toggle="tooltip" data-original-title="项目属性" data-placement="bottom">
-                        <a href="javascript:void(0);" id="openProjSet"><i class="fa fa-cog"></i></a>
+                      <span id="openProjSet" class="btn btn-light btn-sm" data-toggle="tooltip" data-original-title="项目属性" data-placement="bottom">
+                        <a href="javascript:void(0);"><i class="fa fa-cog"></i></a>
                     </span>
-                    <span class="btn btn-light btn-sm" id="importSpan" data-toggle="tooltip" data-original-title="导入" data-placement="bottom">
-                        <a class="dropdown-toggle" href="#" data-toggle="dropdown"><i class="fa fa-cloud-upload"></i></a>
+                      <span class="btn btn-light btn-sm" id="importSpan" data-toggle="tooltip" data-original-title="导入" data-placement="bottom">
+                        <a id="importDropDown" class="dropdown-toggle" href="#"><i class="fa fa-cloud-upload"></i></a>
                         <div class="dropdown-menu">
                             <a id="uploadLj" class="dropdown-item" href="#import" data-toggle="modal" data-target="#import">导入报表Excel清单</a>
                             <a id="uploadGld" class="dropdown-item" href="#import" data-toggle="modal" data-target="#import">导入广联达算量Excel清单</a>

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

@@ -2238,6 +2238,21 @@ let displayLevel = function(nodes, depth, type){
         TREE_SHEET_HELPER.refreshNodesVisible(refreshNodes, projectObj.mainSpread.getActiveSheet(), true)
     });
 };
+//导入下拉
+$('#importSpan').click(function () {
+    $('[data-toggle="tooltip"]').tooltip('hide');
+    let toggle = $('#importDropDown').attr('data-toggle');
+    if (toggle) {
+        $('#importDropDown').removeAttr('data-toggle');
+    }
+    $('#importDropDown').dropdown('toggle');
+    setTimeout(function () {
+        $('#importDropDown').attr('data-toggle', 'dropdown');
+    }, 100);
+});
+$('#importDropDown').click(function () {
+    $('[data-toggle="tooltip"]').tooltip('hide');
+});
 $('body').click(function () {
     //点击完后隐藏子菜单
    if ($('#subDisplay').is(':visible')) {

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

@@ -63,15 +63,15 @@
         <div class="poj-manage container-fluid p-0">
             <div class="pm-side">
                 <div class="poj-cate">
-                    <div class="dropdown">
-                        <a class="btn dropdown-toggle" data-toggle="dropdown">
+                    <div class="dropdown" style="height: 38px">
+                        <!--<a class="btn dropdown-toggle" data-toggle="dropdown">
                             <i class="fa fa-search"></i>
                         </a>
                         <div class="dropdown-menu p-3" aria-labelledby="dropdownMenuButton">
                             <div class="form-group m-0">
                                 <input type="text" class="form-control form-control-sm" placeholder="搜索所有工程"style="width:300px">
                             </div>
-                        </div>
+                        </div>-->
                     </div>
                     <ul class="nav nav-pills flex-column" id="sideTab">
                         <li class="nav-item" data-original-title="全部" data-placement="right" data-toggle="tooltip">