Sfoglia il codice sorgente

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/ConstructionCost

# Conflicts:
#	web/building_saas/css/custom.css
vian 5 anni fa
parent
commit
b6e67ac0ff

+ 9 - 2
modules/all_models/welcome_setting.js

@@ -13,7 +13,14 @@ let modelSchema = {
         index: true
     },
     compilationId: String,
-    showType:{type:Number,default:0},// 1 每天一次 2 每次登录显示,0 关闭
-    context:String
+    normal:{
+      showType:{type:Number,default:0},// 1 每天一次 2 每次登录显示,0 关闭
+      context:String
+    },
+    // 专业用户
+    professional: {
+       showType:{type:Number,default:0},// 1 每天一次 2 每次登录显示,0 关闭
+       context:String
+    }
 };
 mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));

+ 1 - 1
modules/pm/controllers/pm_controller.js

@@ -332,7 +332,7 @@ module.exports = {
         let absoluteUrl = compilationData.overWriteUrl ? request.app.locals.rootDir + compilationData.overWriteUrl : request.app.locals.rootDir;
         let overWriteUrl = fs.existsSync(absoluteUrl) && fs.statSync(absoluteUrl).isFile()? compilationData.overWriteUrl : null;
         //欢迎页显示控制
-        let [isShow,context] = await pm_facade.getWelcomeInfo(sessionCompilation._id,request.session.sessionUser);
+        let [isShow,context] = await pm_facade.getWelcomeInfo(sessionCompilation._id,request.session.sessionUser,request.session.compilationVersion.includes('免费'));
         let renderData = {
             isFirst: isFirst,
             isShow:isShow,

+ 7 - 2
modules/pm/facade/pm_facade.js

@@ -2659,10 +2659,15 @@ async function isTenderOverrun(tenderCount, session) {
     return tenderCount + curTenderCount > limit;
 }
 
-async function getWelcomeInfo(compilationId,sessionUser) {
-    let setting = await welcomeModel.findOne({compilationId:compilationId});
+async function getWelcomeInfo(compilationId,sessionUser,isFree=true) {
+    let welcom_setting = await welcomeModel.findOne({compilationId:compilationId});
     let isShow = false;
     let context = "";
+    let setting = null
+    if(welcom_setting){
+      setting = isFree? welcom_setting.normal:welcom_setting.professional;//区分专业版和免费版
+    }
+
     if(setting){
         if(setting.showType == 0) return [false,""];//关闭
         context = setting.context;

+ 4 - 2
public/web/gljUtil.js

@@ -215,8 +215,10 @@ let gljUtil = {
                 });
                 if(tem){
                     let tem_marketPrice = this.getMarketPrice(tem,projectGLJDatas,calcOptions,decimalObj,true,_,scMathUtil);  //let priceData=this.getGLJPrice(tem,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,true,_,scMathUtil);
-                    let temP = scMathUtil.roundForObj(tem_marketPrice * priceCoe * scMathUtil.roundForObj(ratio.consumption,quantity_decimal),process_decimal);
-                    p = scMathUtil.roundForObj(temP + p,process_decimal);
+                    let temP = scMathUtil.roundForObj(
+                        scMathUtil.roundForObj(tem_marketPrice * priceCoe, price_decimal) *
+                        scMathUtil.roundForObj(ratio.consumption,quantity_decimal), process_decimal);
+                    p = scMathUtil.roundForObj(temP + p, process_decimal);
                 }
             }
             return scMathUtil.roundForObj(p,price_hasM_decimal);

+ 5 - 0
web/building_saas/css/custom.css

@@ -463,6 +463,11 @@ input.text-right{
         height: 350px;
     }
 }
+.textarea-inherit {
+    width: 100%;
+    overflow: auto;
+    word-break: break-all;
+}
 /* 初始样式,防止projspread初始化完后背景从白突然变灰 */
 .poj-list {
     height: 1000px; 

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

@@ -485,10 +485,10 @@
                                               <div class="tab-content">
                                                   <div class="tab-pane" id="xmtz_tab" style="padding:10px">
                                                      <input id="xmtz_billID" type="hidden">
-                                                     <!-- <textarea class="form-control" name="" id="" style="width: 90% ; height:90%;"></textarea> -->
-                                                      <div class="main-data-bottom" tabindex="0"  hidefocus="true"  contenteditable="true" id="tzCharacterText" >
-                                                          项目特征 内容
-                                                      </div>
+                                                     <textarea v-model="body" :placeholder="placeholder" class="textarea-inherit" id="tzCharacterText" autoHeight="true"></textarea>
+                                                      <!-- <div class="main-data-bottom" tabindex="0"  hidefocus="true"  contenteditable="plaintext-only" id="tzCharacterText" >
+                                                          项目特征 内容  这种方式谷歌不兼容
+                                                      </div> -->
                                                   </div>
                                               </div>
                                           </div>

+ 3 - 26
web/building_saas/main/html/tender_price.html

@@ -1,44 +1,21 @@
 
 <div class="toolsbar px-1">
     <div class="btn-toolbar py-1">
-        <!--<div class="input-group input-group-sm mr-2" style="margin-left:10px; margin-top:4px;">-->
         <div class="input-group input-group-sm mr-2">
             <select class="form-control form-control-sm" style="width: auto; font-size: .875rem" id="calcPriceOption">
                 <option value="coeBase">按调价系数计算</option>
                 <option value="priceBase_RCJ" >按目标价调整人材机消耗</option>
                 <option value="priceBase_ZM" >按目标价调整子目工程量</option>
             </select>
-<!--            <div class="form-check">
-                <label class="form-check-label">
-                    <input class="form-check-input" name="tenderCalcType" id="tenderCalcByXS" value="0" type="radio">
-                    按调价系数正算 
-                </label>
-            </div>
-            <div class="form-check">
-                <label class="form-check-label">
-                    <input class="form-check-input" name="tenderCalcType" id="tenderCalcByTargetRCJ" value="1" type="radio">
-                    按目标价反算人材机消耗 
-                </label>
-            </div>
-            <div class="form-check">
-                <label class="form-check-label">
-                    <input class="form-check-input" name="tenderCalcType" id="tenderCalcByTargetZM" value="2" type="radio">
-                    按目标价反算子目工程量 
-                </label>
-            </div>-->
         </div>
-        <div class="input-group input-group-sm mr-2" style="width:200px">
+
+        <div class="input-group input-group-sm mr-2" style="width:230px">
             <div class="input-group-prepend">
                 <span class="input-group-text" id="inputGroup-sizing-sm">人材机单价调整系数</span>
             </div>
             <input id = 'gljPriceTenderCoe' type="number" step="0.1" class="form-control" placeholder="请输入系数" value="1">
         </div>
-        <!--<div class="btn-group mr-2">-->
-            <!--<button type="button" class="btn btn-outline-primary btn-sm" id = "tenderGLJQuantity">调整人材机消耗</button>-->
-            <!--<button type="button" class="btn btn-outline-primary btn-sm" id = "tenderRationQuantity">调整子目工程量</button>-->
-           <!--&lt;!&ndash; <button type="button" class="btn btn-outline-primary btn-sm">反调单价</button>&ndash;&gt;-->
-            <!--<button type="button" class="btn btn-outline-primary btn-sm" id = "tenderPrice">调价计算2</button>-->
-        <!--</div>-->
+
         <button type="button" class="btn btn-outline-primary btn-sm" id = "tenderPrice">调价计算</button>
         <span>&nbsp</span>
         <button type="button" class="btn btn-outline-danger btn-sm" id = "cleanTender">清空调价</button>

+ 12 - 5
web/building_saas/main/js/controllers/material_controller.js

@@ -223,10 +223,17 @@ let MaterialController = {
             parent = selected
             $("#xmtz_billID").val(selected.data.ID);
         }
-        if(selected&&parent){
-            text = parent.data.itemCharacterText?parent.data.itemCharacterText.replace(/\n/g,"<br>"):"";
-            text = text.replace(/\s/g,"&nbsp;");
-        }
+        if(selected&&parent) text = parent.data.itemCharacterText;
+        
+        if(eleID != 'itemCharacterText'){
+          $("#"+eleID).val(text);
+        }else{
+          text = parent.data.itemCharacterText?parent.data.itemCharacterText.replace(/\n/g,"<br>"):"";
+          text = text.replace(/\s/g,"&nbsp;");
+          $("#"+eleID).html(text);
+        }  
+      
+
        /* if(text == "") {//为空的时候不显示
             $("#replaceM").hide();
             $("#subSpread").removeClass("ration_glj_spread");
@@ -235,7 +242,7 @@ let MaterialController = {
         }*/
         //$('#replaceM').css('margin-top',0);
         //this.toggleItemInit();
-        $("#"+eleID).html(text);
+       
     },
     //初始化人材机和项目特征文本两个区域的宽度,改变窗口大小时调用此方法,实时刷新
     initItemWidth: function () {

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

@@ -36,6 +36,7 @@ $(function () {
         projectObj.mainSpread.refresh();
         refreshSubSpread();
         $('#comments').find('textarea').height($('#comments').height() - 25);
+        $("#tzCharacterText").height($("#tzSubDiv").height()-30);
     });
     const projectId = scUrlUtil.GetQueryString('project');
     // 绑定点击事件
@@ -80,6 +81,7 @@ function loadMainSize() {//加载造价书页面各高度
     SlideResize.loadVerticalHeight(mainResizeEles.eleObj.module, mainResizeEles.eleObj, mainResizeEles.limit, function () {
         refreshSubSpread();
         zmhs_obj.refresh();
+        $("#tzCharacterText").height($("#tzSubDiv").height()-30);
     });
 }
 

+ 22 - 11
web/building_saas/main/js/models/calc_program.js

@@ -949,17 +949,21 @@ let calcTools = {
             let qCoe = 1;
             /* 量价、工料机类型的定额,在反向调价之调整人材机消耗量系数时,因为他们没有工料机可调,调价结果没变,影响汇总后的父结点金额。
             所以要特殊处理:此种情况下仍然要调量价的消耗量,即还是要像"子目工程量调整系数"方式那样调,但系数又不能在"子目工程量调整系数"
-            中显示出来,所以可以改变tenderQuantity达到同样的效果以瞒天过海。所以在取系数时,无论什么系数,只要能取到就算正确。 */
-            if (treeNode.data.type == rationType.volumePrice || treeNode.data.type == rationType.gljRation){
-                if (treeNode.data.rationQuantityCoe)
-                    qCoe = treeNode.data.rationQuantityCoe
-                else if (treeNode.data.quantityCoe && treeNode.data.quantityCoe.labour)
-                    qCoe = treeNode.data.quantityCoe.labour;
-            }
-            else {
+            中显示出来(明明是调工料机,你却调到树结点上,这比较搞笑啊),所以可以改变tenderQuantity达到同样的效果以瞒天过海。所以在取系数时,
+            无论什么系数,只要能取到就算正确。
+            2020-04-05 注: 以上是老黄历。新思路是量价只作为定额调整,不作为工料机调整。两种反调模式下,统一都只调子目消耗量系数。
+            为避免歧义,量价的工料机调整系数不允许输入。
+            */
+            // if (treeNode.data.type == rationType.volumePrice || treeNode.data.type == rationType.gljRation){
+            //     if (treeNode.data.rationQuantityCoe)
+            //         qCoe = treeNode.data.rationQuantityCoe
+            //     else if (treeNode.data.quantityCoe && treeNode.data.quantityCoe.labour)
+            //         qCoe = treeNode.data.quantityCoe.labour;
+            // }
+            // else {
                 if (treeNode.data.rationQuantityCoe)
                     qCoe = treeNode.data.rationQuantityCoe;
-            };
+            // };
             if (qCoe == '0' || qCoe == 0) qCoe = 1;
             treeNode.data.tenderQuantity = (this.uiNodeQty(treeNode) * qCoe).toDecimal(decimalObj.decimal("quantity", treeNode));
             return treeNode.data.tenderQuantity;
@@ -2330,20 +2334,27 @@ class CalcProgram {
         if (treeNode.data.feesIndex.common.totalFee != 0)
             coe = (treeNode.data.targetUnitFee / treeNode.data.feesIndex.common.unitFee).toDecimal(decimalObj.process);
 
-        if (tender == tenderTypes.ttReverseRation){
+        // 调价情况之————量价反调工料机(量价无工料机可调,还是按定额来调,即直接调树结点的消耗量)
+        let isVP_RevGLJ =(tender == tenderTypes.ttReverseGLJ) && (treeNode.data.type == rationType.volumePrice || treeNode.data.type == rationType.gljRation);
+
+        if ((tender == tenderTypes.ttReverseRation) || isVP_RevGLJ){
             treeNode.data.tenderQuantity = (treeNode.data.quantity * coe).toDecimal(decimalObj.decimal("quantity", treeNode));
             if (treeNode.data.rationQuantityCoe != coe){
                 treeNode.data.rationQuantityCoe = coe;
                 treeNode.changed = true;
             };
 
+            if (isVP_RevGLJ){
+                treeNode.data.quantityCoe = {labour: 0, material: 0, machine: 0, main: 0, equipment: 0};
+                treeNode.changed = true;
+            };
+
             let ttf = (treeNode.data.tenderQuantity * treeNode.data.feesIndex.common.tenderUnitFee).toDecimal(decimalObj.decimal('totalPrice', treeNode));
             if (treeNode.data.feesIndex.common.tenderTotalFee != ttf){
                 treeNode.data.feesIndex.common.tenderTotalFee = ttf;
                 treeNode.changed = true;
             };
         }else if (tender == tenderTypes.ttReverseGLJ){
-            //     treeNode.data.tenderQuantity = treeNode.data.quantity;   // 这句好像多余,因为调用calculate()时里面会重新计算tenderQuantity,有问题再放开AAAAA
             let qcObj = treeNode.data.quantityCoe;
             if (!qcObj || calcTools.isEmptyObject(qcObj)){
                 treeNode.data.quantityCoe = {labour: coe, material: coe, machine: coe, main: coe, equipment: coe};

+ 15 - 14
web/building_saas/main/js/views/sub_view.js

@@ -910,20 +910,21 @@ $('.gljSubTab ul li a').on('shown.bs.tab', function () {
 //显示格式
 $('#tzCharacterText').blur(async function () {
   let billID = $("#xmtz_billID").val();
-  let htmlString = $(this).html();
-  let value = htmlString.replace(/&nbsp;/g," ");
-  if(value.indexOf("<div>")!= -1){
-      let preString = value.substring(0,value.indexOf("<div>"));
-      let arrayText =[];
-      let divArray = value.match(/<div>(.*?)<\/div>/g);
-      for(let d of divArray){
-          t = d.match(/<div>(\S*)<\/div>/)[1];
-          if(t == "<br>") t="";
-          arrayText.push(t)
-      }
-      value = preString +"\n"+ arrayText.join("\n");
-  }
-  value = value.replace(/<br>/g,"\n");
+  let value = $(this).val();
+  //let htmlString = $(this).html();
+  // let value = htmlString.replace(/&nbsp;/g," ");
+  // if(value.indexOf("<div>")!= -1){
+  //     let preString = value.substring(0,value.indexOf("<div>"));
+  //     let arrayText =[];
+  //     let divArray = value.match(/<div>(.*?)<\/div>/g);
+  //     for(let d of divArray){
+  //         t = d.match(/<div>(\S*)<\/div>/)[1];
+  //         if(t == "<br>") t="";
+  //         arrayText.push(t)
+  //     }
+  //     value = preString +"\n"+ arrayText.join("\n");
+  // } 
+  // value = value.replace(/<br>/g,"\n");
 
   let billNode = projectObj.project.mainTree.getNodeByID(billID);
   if(billNode && value == billNode.data.itemCharacterText) return;

+ 12 - 5
web/building_saas/main/js/views/tender_price_view.js

@@ -215,15 +215,17 @@ let tender_obj={
     onEnterCell : function (sender,args) {
         let me = tender_obj, row = args.row, col = args.col;
         if ([7, 8].includes(col)){                                  // 目标单价、目标合价
-            let node = me.tenderTree.items[row];
-            if (calcTools.isCalcBaseBill(node)){                    // 公式结点只读
+            let treeNode = me.tenderTree.items[row];
+            if (calcTools.isCalcBaseBill(treeNode)){                    // 公式结点只读
                 me.tenderSheet.getCell(row, col).locked(true);
-            }
+            };
         }
     },
     updateChildrenValue:function (node,dataCode,value,datas,nodes) {
          if(node.children.length > 0){
             for(let c of node.children){
+                if ((dataCode.indexOf("quantityCoe.") != -1) && (c.data.type == rationType.volumePrice || c.data.type == rationType.gljRation))
+                    value = 0;
                 this.updateChildrenValue(c,dataCode,value,datas,nodes);
                 let updateData = {type:c.sourceType,data:{'ID' : c.data.ID}};
                 updateData.data[dataCode] = value;
@@ -359,8 +361,7 @@ let tender_obj={
         let me = tender_obj, row = args.row, col = args.col;
         if(me.editChecking(row,col) == false){
             args.cancel = true;
-        }
-
+        };
     },
     editChecking:function (row,col,isPaste = false) {//return false表示不能编辑
         let me = tender_obj;
@@ -390,6 +391,12 @@ let tender_obj={
                 return false;
             }
         }
+        // 量价类,工料机消耗量调整系数不允许输入
+        let treeNode = me.tenderTree.items[row];
+        if (treeNode.data.type == rationType.volumePrice || treeNode.data.type == rationType.gljRation){
+            if ([11,12,13,14,15].includes(col))
+                return false;
+        };
         return true;
     },
     initPageContent: function () {

+ 15 - 15
web/common/html/header.html

@@ -17,21 +17,21 @@
     <div class="navbar-text p-0 navbar-expand-sm">
         <!--大屏菜单-->
         <ul class="nav navbar-nav" id="fluid-menu">
-            <li class="nav-item" >
-                <a class="nav-link" href="#send2friends" data-toggle="modal" data-target="#send2friends" ><i class="fa fa-share-alt"></i> 推荐给朋友</a>
-            </li>
-            <li class="nav-item dropdown" id="showqqgroup" >
-                <a class="nav-link" href="#"><i class="fa fa-qq" ></i> 群</a>
-                <div class="dropdown-menu p-3 dropdown-menu-right" id="qqgroup" style="width: 200px;top:36px">
-                    <p class="text-center">
-                        <a href="https://jq.qq.com/?_wv=1027&k=5XivMJY" target="_blank" class="btn btn-sm btn-outline-primary">点击加入QQ交流群</a>
-                    </p>
-                    <p class="mb-0 text-center text-muted">
-                        <img src="/web/building_saas/img/qqgroupqrcode.png">
-                        扫码加QQ交流群
-                    </p>
-                </div>
-            </li>
+            <!--<li class="nav-item" >-->
+                <!--<a class="nav-link" href="#send2friends" data-toggle="modal" data-target="#send2friends" ><i class="fa fa-share-alt"></i> 推荐给朋友</a>-->
+            <!--</li>-->
+            <!--<li class="nav-item dropdown" id="showqqgroup" >-->
+                <!--<a class="nav-link" href="#"><i class="fa fa-qq" ></i> 群</a>-->
+                <!--<div class="dropdown-menu p-3 dropdown-menu-right" id="qqgroup" style="width: 200px;top:36px">-->
+                    <!--<p class="text-center">-->
+                        <!--<a href="https://jq.qq.com/?_wv=1027&k=5XivMJY" target="_blank" class="btn btn-sm btn-outline-primary">点击加入QQ交流群</a>-->
+                    <!--</p>-->
+                    <!--<p class="mb-0 text-center text-muted">-->
+                        <!--<img src="/web/building_saas/img/qqgroupqrcode.png">-->
+                        <!--扫码加QQ交流群-->
+                    <!--</p>-->
+                <!--</div>-->
+            <!--</li>-->
             <li class="nav-item dropdown">
                 <a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" id="link_userName"><%= (sessionUser.company && sessionUser.real_name) ? (sessionUser.company + '(' + sessionUser.real_name + ')') : sessionUser.company ? sessionUser.company : sessionUser.real_name ? sessionUser.real_name : sessionUser.mobile %></a>
                 <div class="dropdown-menu dropdown-menu-right">