Browse Source

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

zhongzewei 7 years ago
parent
commit
de84194c64

+ 4 - 0
lib/ztree/css/zTreeStyle.css

@@ -70,12 +70,16 @@ website:	http://code.google.com/p/jquerytree/
 .ztree li span.button.bottom_docu{background-position:-56px -36px}
 .ztree li span.button.noline_docu{ background:none;}
 
+.ztree li span.button.star {margin-right:2px; background-position:-126px -64px; vertical-align:top; *vertical-align:middle}
+.ztree li span.button.blue_core {margin-right:2px; background-position:-126px -16px; vertical-align:top; *vertical-align:middle}
+
 .ztree li span.button.ico_open{margin-right:2px; background-position:-110px -16px; vertical-align:top; *vertical-align:middle}
 .ztree li span.button.ico_close{margin-right:2px; background-position:-110px 0; vertical-align:top; *vertical-align:middle}
 .ztree li span.button.ico_docu{margin-right:2px; background-position:-110px -32px; vertical-align:top; *vertical-align:middle}
 .ztree li span.button.edit {margin-right:2px; background-position:-110px -48px; vertical-align:top; *vertical-align:middle}
 .ztree li span.button.remove {margin-right:2px; background-position:-110px -64px; vertical-align:top; *vertical-align:middle}
 
+
 .ztree li span.button.ico_loading{margin-right:2px; background:url(img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
 
 ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}

+ 13 - 5
modules/reports/controllers/rpt_tpl_controller.js

@@ -95,13 +95,21 @@ let mExport = {
         let params = JSON.parse(req.body.params),
             compilationId = params.compilationId,
             userId = params.userId,
+            sessionUserId = null,
             engineerId = params.engineerId;
-        if (req.session.sessionUser && req.session.sessionUser.id) userId = req.session.sessionUser.id;
-        let userIds = [];
-        userIds.push(userId);
-        if (userId != "-100") {
-            userIds.push("-100");
+        let userIds = ["-100"];
+        if (req.session.sessionUser && req.session.sessionUser.id) sessionUserId = req.session.sessionUser.id;
+        if (userId !== null) {
+            if (typeof userId === "string") {
+                if (userIds.indexOf(userId) < 0) userIds.push(userId);
+            } else if (userId instanceof Array) {
+                for (let uid of userId) {
+                    userIds.push(uid);
+                }
+            }
+        } else {
         }
+        if (sessionUserId && userIds.indexOf(sessionUserId) < 0) userIds.push(sessionUserId);
         if (!compilationId) {
             compilationId = req.session.sessionCompilation._id;
         }

+ 5 - 2
public/scHintBox.html

@@ -12,7 +12,7 @@
         <div class="modal-content">
             <div class="modal-header">
                 <h5 id="hintBox_title" class="modal-title">标题</h5>
-                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close" id="hintBox_btn_cross">
                     <span aria-hidden="true">&times;</span>
                 </button>
             </div>
@@ -68,6 +68,7 @@
             $('#hintBox_btn_yes').hide();
             $('#hintBox_btn_no').hide();
             $('#hintBox_btn_cancel').hide();
+            $('#hintBox_btn_cross').show();
         },
         font: function(str){
             return `<span style='color:red;font-weight:bold;font-size:15px'> ${str} </span>`;
@@ -78,8 +79,10 @@
             $("#hintBox_value").focus();
             $("#hintBox_value").select();
         },
-        infoBox: function (title, caption, btnType, doYes, doNo, btnTextArr) {
+        infoBox: function (title, caption, btnType, doYes, doNo, btnTextArr, showCrossBtn = true) {
             this.init();
+            if (!showCrossBtn)
+                $('#hintBox_btn_cross').hide();
             $('#hintBox_title').text(title);
             $('#hintBox_caption').html(caption);
             $('#hintBox_caption').show();

+ 4 - 3
public/web/gljUtil.js

@@ -181,10 +181,11 @@ let gljUtil = {
         }
         return result;
     },
-    getMarketPrice:function (glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil) {
+    getMarketPrice:function (glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil,tenderCoe) {
         let price_decimal = decimalObj.glj.unitPrice;
         let quantity_decimal = decimalObj.glj.quantity;
         let process_decimal = decimalObj.process;
+        let priceCoe = this.isDef(tenderCoe)?tenderCoe:1;
         if (this.notEditType.indexOf(glj.unit_price.type)!=-1&&glj.ratio_data.length>0) {//对于混凝土、配合比、砂浆、机械台班等有组成物的材料,价格需根据组成物计算得出。
             let p =0;
             for(let ratio of glj.ratio_data){
@@ -197,13 +198,13 @@ let gljUtil = {
                 });
                 if(tem){
                     let priceData=this.getGLJPrice(tem,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,true,_,scMathUtil);
-                    p+=scMathUtil.roundForObj(priceData.marketPrice*scMathUtil.roundForObj(ratio.consumption,quantity_decimal),process_decimal);
+                    p+=scMathUtil.roundForObj(priceData.marketPrice* priceCoe * scMathUtil.roundForObj(ratio.consumption,quantity_decimal),process_decimal);
                 }
             }
             return scMathUtil.roundForObj(p,price_decimal);
         }else {
             let tem_decimal = isRadio==true?process_decimal:price_decimal;
-            return scMathUtil.roundForObj(glj.unit_price.market_price,tem_decimal);
+            return scMathUtil.roundForObj(parseFloat(glj.unit_price.market_price)*priceCoe,tem_decimal);
         }
     },
     getBasePrice:function (glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil) {

+ 1 - 0
public/web/sheet/sheet_common.js

@@ -14,6 +14,7 @@ var sheetCommonObj = {
         spreadBook.options.allowUserDragDrop = true;
         spreadBook.options.allowContextMenu = false;
         spreadBook.options.allowUserEditFormula = false;
+        spreadBook.options.showDragFillSmartTag = false;
         return spreadBook;
     },
 

+ 1 - 0
public/web/sheet/sheet_data_helper.js

@@ -56,6 +56,7 @@ var SheetDataHelper = {
         spread.options.allowUserDragDrop = false;
         spread.options.allowUndo = false;//that.mainSpread.commandManager().setShortcutKey(undefined, GC.Spread.Commands.Key.z, true, false, false, false); 屏蔽undo
         spread.options. allowUserEditFormula = false;
+        spread.options.showDragFillSmartTag = false;
         spread.getActiveSheet().setRowCount(3);
         return spread;
     },

+ 2 - 0
test/unit/reports/test_tpl_09.js

@@ -61,6 +61,8 @@ test('测试 - 测试模板啦: ', function (t) {
                 try {
                     // fsUtil.writeObjToFile(rawDataObj, "D:/GitHome/ConstructionCost/tmp/rptTplRawDataObject_建筑09表.jsp");
                     let tplData = rptDataUtil.assembleData(rawDataObj);
+                    // fsUtil.writeObjToFile(rawDataObj, "D:/GitHome/ConstructionCost/tmp/rptTplRawDataAfterCacl_09.jsp");
+                    // fsUtil.writeObjToFile(tplData, "D:/GitHome/ConstructionCost/tmp/rptTplAssembledData_09.jsp");
                     //it's time to build the report!!!
                     let printCom = JpcEx.createNew();
                     rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = pagesize;

+ 10 - 1
web/building_saas/main/html/tender_price.html

@@ -1,3 +1,12 @@
+<style>
+    input::-webkit-outer-spin-button,
+    input::-webkit-inner-spin-button {
+        -webkit-appearance: none;
+    }
+    input[type="number"]{
+        -moz-appearance: textfield;
+    }
+</style>
 <div class="toolsbar px-1">
     <div class="btn-toolbar py-1">
         <div class="input-group input-group-sm mr-2">
@@ -6,7 +15,7 @@
                 <option value="priceBase" >根据报价计算调整系数</option>
             </select>
         </div>
-        <div class="input-group input-group-sm mr-2" style="width:240px">
+        <div class="input-group input-group-sm mr-2" style="width:200px">
             <div class="input-group-prepend">
                 <span class="input-group-text" id="inputGroup-sizing-sm">人材机单价调整系数</span>
             </div>

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

@@ -228,6 +228,33 @@ function setDefaultSize(tag,eles,type) {
     }
 }
 
+function disableRightMenu(id,spread,rowChangeFunction) {
+    let me = this;
+    $.contextMenu({
+        selector: '#'+id,
+        build: function ($trigger, e) {
+            let oldRow = spread.getActiveSheet().getSelections()[0].row;
+            var target = SheetDataHelper.safeRightClickSelection($trigger, e, spread);
+            if(rowChangeFunction){
+                if(oldRow != target.row){
+                    rowChangeFunction(target.row)
+                }
+            }
+            return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
+        },
+        items: {
+            "disable": {
+                name: "",
+                visible: function () {
+                    return false;
+                },
+                callback: function (key, opt) {
+                }
+            },
+        }
+    });
+}
+
 /*window.onunload=show;  页面唯一性可以用session storage 来做
 
 function show()

+ 23 - 4
web/building_saas/main/js/models/calc_program.js

@@ -643,6 +643,7 @@ let calcTools = {
             summaryFees: treeNode.data.summaryFees,
             name:treeNode.data.name,
             rationQuantityCoe: treeNode.data.rationQuantityCoe,
+            quantityCoe: treeNode.data.quantityCoe,
             targetUnitFee: treeNode.data.targetUnitFee,
             targetTotalFee: treeNode.data.targetTotalFee
         };
@@ -1935,10 +1936,28 @@ class CalcProgram {
             }
         };
 
-        let coe = (treeNode.data.targetTotalFee / treeNode.data.feesIndex.common.totalFee).toDecimal(decimalObj.process);
-        if (treeNode.data.rationQuantityCoe != coe){
-            treeNode.data.rationQuantityCoe = coe;
-            treeNode.changed = true;
+        let coe = 1;
+        if (treeNode.data.feesIndex.common.totalFee != 0)
+            coe = (treeNode.data.targetTotalFee / treeNode.data.feesIndex.common.totalFee).toDecimal(2);//(decimalObj.process);
+
+        if (tender == tenderTypes.ttReverseRation){
+            if (treeNode.data.rationQuantityCoe != coe){
+                treeNode.data.rationQuantityCoe = coe;
+                treeNode.changed = true;
+            };
+        }else if (tender == tenderTypes.ttReverseGLJ){
+            let coeObj = treeNode.data.quantityCoe;
+            if (!coeObj){
+                treeNode.data.quantityCoe = {labour: coe, material: coe, machine: coe, main: coe, equipment: coe};
+                treeNode.changed = true;
+            }else{
+                for (let pn in coeObj){
+                    if (coeObj[pn] != coe){
+                        coeObj[pn] = coe;
+                        treeNode.changed = true;
+                    }
+                };
+            };
         };
 
         treeNode.data.tenderQuantity = (treeNode.data.quantity * coe).toDecimal(decimalObj.decimal("quantity", treeNode));

+ 12 - 0
web/building_saas/main/js/models/project_glj.js

@@ -681,6 +681,18 @@ ProjectGLJ.prototype.getMarketPrice = function (glj,isRadio) {
     return gljUtil.getMarketPrice(glj,proGLJ.datas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
 };
 
+ProjectGLJ.prototype.getTenderMarketPrice = function (glj,isRadio) {
+    let proGLJ =  projectObj.project.projectGLJ;
+    let calcOptions=projectInfoObj.projectInfo.property.calcOptions;
+    let decimalObj = projectInfoObj.projectInfo.property.decimal;
+    let labourCoeDatas =  projectObj.project.labourCoe.datas;
+    let tenderCoe = 1;
+    if (projectObj.project.property.tenderSetting && gljUtil.isDef(projectObj.project.property.tenderSetting.gljPriceTenderCoe) ){
+        tenderCoe = parseFloat(projectObj.project.property.tenderSetting.gljPriceTenderCoe);
+    }
+    return gljUtil.getMarketPrice(glj,proGLJ.datas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil,tenderCoe);
+};
+
 ProjectGLJ.prototype.isEstimateType = function(type){
     let typeString = type + "";
     if (typeString.startsWith("2")||typeString=='4'||typeString=='5') {//只有材料、主材、设备类型才显示是否暂估

+ 4 - 4
web/building_saas/main/js/models/quantity_detail.js

@@ -145,7 +145,7 @@ var quantity_detail = {
                         }, function () {
                             doc.refreshQuantity=false;
                             me.doSaveAction(doc,args,batchCallback);
-                        },['确定','取消']);
+                        },['确定','取消'],false);
                         return;
                     }
                 }
@@ -304,7 +304,7 @@ var quantity_detail = {
                             me.updateQuantityRegex(query,doc,args,batchCallback)
                         }, function () {
                             me.cleanQuantityDetail(selected,true);
-                        },['确定','取消']);
+                        },['确定','取消'],false);
                         return;
                     }
                 }
@@ -346,7 +346,7 @@ var quantity_detail = {
                 }, function () {
                     query.refreshQuantity=false;
                     summationUpdate(args,detailList,newval,query);
-                },['确定','取消']);
+                },['确定','取消'],false);
                 return;
             }
             summationUpdate(args,detailList,newval,query);
@@ -612,7 +612,7 @@ var quantity_detail = {
                         me.updateMainTreeNodeQuantity(value,node,editingText);
                     }, function () {
                         projectObj.mainController.refreshTreeNode([node]);
-                    },['确定','取消']);
+                    },['确定','取消'],false);
                     return;
                 }
                 me.updateMainTreeNodeQuantity(value,node,editingText);

+ 1 - 1
web/building_saas/main/js/models/ration.js

@@ -667,7 +667,7 @@ var Ration = {
                     me.doContainUpdate(value,node);
                 }, function () {
                     projectObj.mainController.refreshTreeNode([node]);
-                },['确定','取消']);
+                },['确定','取消'],false);
             }else {
                 me.doContainUpdate(value,node);
             }

+ 9 - 0
web/building_saas/main/js/views/fee_rate_view.js

@@ -396,6 +396,11 @@ var feeRateObject={
             }
         });
         this.mainFeeRateSheet.name('mainFeeRateSheet');
+        disableRightMenu("divFee",this.mainFeeRateSpread,this.rightClickCallback);
+    },
+    rightClickCallback:function (row) {
+        let me = feeRateObject;
+        me.onMainFeeRateSelect(row);
     },
     showMainFeeRateData:function () {
         let me = this;
@@ -517,6 +522,10 @@ var feeRateObject={
     onMainFeeRateSelectChanged:function (e, info) {
         let me = feeRateObject;
         let row = info.newSelections[0].row;
+        me.onMainFeeRateSelect(row);
+    },
+    onMainFeeRateSelect:function (row) {
+        let me = this;
         if(row!=-1){
             subRateObject.initSubRateSpread(me.mainFeeRateData[row]);
         }

+ 1 - 1
web/building_saas/main/js/views/installation_fee_view.js

@@ -1426,7 +1426,7 @@ $(function () {
             });
         }, function () {
 
-        },['确定','取消']);
+        },['确定','取消'],false);
     });
 
     $("input[name='install_setting_radios']").each(function(){

+ 19 - 4
web/building_saas/main/js/views/project_glj_view.js

@@ -90,6 +90,7 @@ projectGljObject={
         this.projectGljSpread.bind(GC.Spread.Sheets.Events.RangeChanged, this.onProjectGljRangeChange);
         this.initProjectGljSheet();
         this.initMaterialTreeSheet();
+        disableRightMenu("project_glj_sheet",this.projectGljSpread,this.rightClickCallback);
     },
     initProjectGljSheet:function () {
         this.projectGljSheet = this.projectGljSpread .getSheet(0);
@@ -189,7 +190,7 @@ projectGljObject={
                 gljId = me.projectGljSheetData[srow].id;
                 gljType = me.projectGljSheetData[srow].type;
             }
-        }else if(sheet.name() == 'materialTreeSheet' ){
+        }else if(sheet.name() == 'materialTreeSheet'){
             if(this.materialTree.selected){
                 gljId = this.materialTree.selected.data.id;
                 gljType = this.materialTree.selected.data.type;
@@ -281,7 +282,7 @@ projectGljObject={
     },
     onSelectionChange:function (){
         let me = projectGljObject;
-        me.showMixRatioData();
+        me.projectGljRowChang();
         me.materialTreeSheet.repaint();
     },
     onProjectGljSelectionChange:function (sender, args) {
@@ -289,11 +290,24 @@ projectGljObject={
         let newSel = args.newSelections[0];
         let oldSel = args.oldSelections?args.oldSelections[0]:{};
         if(newSel.row != oldSel.row){
-            me.mixRatioSheet.getSelections()[0].row = -1;
-            me.showMixRatioData();
+           me.projectGljRowChang();
         }
         me.projectGljSheet.repaint();
     },
+    projectGljRowChang:function(row){
+        let me = projectGljObject;
+        me.mixRatioSheet.getSelections()[0].row = -1;
+        me.showMixRatioData();
+    },
+    rightClickCallback:function (row) {
+        let me = projectGljObject;
+        let sheet =  me.projectGljSpread.getActiveSheet();
+        if(sheet.name() == 'projectGljSheet'){
+            me.projectGljRowChang(row);
+        }else if(sheet.name() == 'materialTreeSheet'){
+            me.materialTreeController.setTreeSelected(me.materialTreeController.tree.items[row]);
+        }
+    },
     onProjectGljRangeChange:function (sender,info) {
         let me = projectGljObject;
         let changeInfo=[];
@@ -533,6 +547,7 @@ projectGljObject={
             remark:glj.remark
         };
         gljOprObj.setGLJPrice(data,glj);
+
         data.is_main_material = glj.is_main_material == 1?1:0;
         //供货方式为完全甲供时设置甲供数量为总消耗量
         if (data.supply == 2) {

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

@@ -96,6 +96,7 @@ var subRateObject={
         console.log(subRateObject.datas);
         console.log(subRateObject.valueMap);
         subRateObject.showSubRateData();
+        disableRightMenu("subRate",this.subRateSpread);
     },
     showSubRateData:function () {
         this.subRateSheet.setRowCount(0);

+ 26 - 6
web/building_saas/main/js/views/tender_price_view.js

@@ -13,7 +13,7 @@ let tender_obj={
             {headerName: "类别", headerWidth: 50, dataCode: "subType", hAlign: "center", dataType: "String",spanRows: [2],getText:'getText.subType'},
             {headerName: "项目名称", headerWidth: 200, dataCode: "name",showHint:true, hAlign: "left", dataType: "String",spanRows: [2]},
             {headerName: "计量\n单位", headerWidth: 60, dataCode: "unit", hAlign: "center", dataType: "String",spanRows: [2]},
-            {headerName: "工程量", headerWidth: 120, dataCode: "quantity", hAlign: "right", dataType: "Number",validator:"number",spanRows: [2],getText:'getText.quantity'},
+            {headerName: "工程量", headerWidth: 70, dataCode: "quantity", hAlign: "right", dataType: "Number",validator:"number",spanRows: [2],getText:'getText.quantity'},
             {headerName: "不调价", headerWidth: 55, dataCode: "is_adjust_price", hAlign: "center", cellType : "checkBox",dataType: "Number",spanRows: [2]},
             {headerName: ["初始报价","综合单价"], headerWidth: 80, dataCode: "feesIndex.common.unitFee", hAlign: "right", dataType: "Number",validator:"number",spanCols : [2,1]},
             {headerName: ["","综合合价"], headerWidth: 80, dataCode: "feesIndex.common.totalFee", hAlign: "right", dataType: "Number",validator:"number",spanCols : [0,1]},
@@ -26,7 +26,7 @@ let tender_obj={
             {headerName: ["","机械"], headerWidth: 80, dataCode: "quantityCoe.machine", hAlign: "right", dataType: "Number",validator:"number",spanCols : [0,1]},
             {headerName: ["","主材"], headerWidth: 80, dataCode: "quantityCoe.main", hAlign: "right", dataType: "Number",validator:"number",spanCols : [0,1]},
             {headerName: ["","设备"], headerWidth: 80, dataCode: "quantityCoe.equipment", hAlign: "right", dataType: "Number",validator:"number",spanCols : [0,1]},
-            {headerName: "子目工程量\n调整系数", headerWidth: 100, dataCode: "rationQuantityCoe", hAlign: "center", dataType: "Number",spanRows: [2],validator:"number"}
+            {headerName: "子目工程量\n调整系数", headerWidth: 80, dataCode: "rationQuantityCoe", hAlign: "right", dataType: "Number",spanRows: [2],validator:"number"}
         ],
         view: {
             lockColumns: [0,1,2,3,4,6,7,10,11]
@@ -53,6 +53,11 @@ let tender_obj={
         this.tenderSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onEditStarting);
         this.tenderController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, this.treeSelectedChanged);
        // this.tenderController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, this.onSelectionChange);
+        disableRightMenu("tenderSpread", this.tenderSpread,this.rightClickCallback);
+    },
+    rightClickCallback:function (row) {
+        let me = tender_obj;
+        me.tenderController.setTreeSelected(me.tenderController.tree.items[row]);
     },
     createTenderTreeSetting:function () {
        return sheetCommonObj.transferToTreeSetting(this.tenderSetting,this.tenderTreeSetting,MainTreeCol);
@@ -173,6 +178,12 @@ let tender_obj={
             }
         }
     },
+    cleanCacheCoes: function (){
+        for(let node of tender_obj.tenderTree.items){
+            if (node.data.rationQuantityCoe) node.data.rationQuantityCoe = null;
+            if (node.data.quantityCoe) node.data.quantityCoe = null;
+        };
+    },
 
     calcOptionsChecking:function (option) {//调整选项检查,返回需要更新的数组
         let datas = [];
@@ -317,6 +328,12 @@ let tender_obj={
             $('#tenderRationQuantity').removeAttr("disabled");
         }
         //gljPriceTenderCoe
+    },
+    doTenderCalc: function(tender){
+        if (tender != tenderTypes.ttCalc)
+            tender_obj.cleanCacheCoes();
+        let callback = function () { tender_obj.showTenderData() };
+        projectObj.project.calcProgram.calcAllNodesAndSave(calcAllType.catAll, callback, tender);
     }
 };
 
@@ -378,12 +395,15 @@ $(function () {
     });
 
     $('#tenderPrice').on('click', function () {
-        let callback = function () {tender_obj.showTenderData()};
-        projectObj.project.calcProgram.calcAllNodesAndSave(calcAllType.catAll, callback, tenderTypes.ttCalc);
+        tender_obj.doTenderCalc(tenderTypes.ttCalc);
+    });
+
+    $('#tenderGLJQuantity').on('click', function () {
+        tender_obj.doTenderCalc(tenderTypes.ttReverseGLJ);
     });
 
     $('#tenderRationQuantity').on('click', function () {
-        let callback = function () {tender_obj.showTenderData()};
-        projectObj.project.calcProgram.calcAllNodesAndSave(calcAllType.catAll, callback, tenderTypes.ttReverseRation);
+        tender_obj.doTenderCalc(tenderTypes.ttReverseRation);
     });
+
 });