Pārlūkot izejas kodu

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

zhongzewei 7 gadi atpakaļ
vecāks
revīzija
5a0bc60439

+ 1 - 1
modules/all_models/project_glj.js

@@ -14,7 +14,7 @@ let Schema = mongoose.Schema;
 let collectionName = 'glj_list';
 let modelSchema = {
     // 自增id
-    id: Number,
+    id: {type:Number,unique: true},
     // 工料机总库ID
     glj_id: Number,
     // 标段ID

+ 1 - 1
modules/all_models/unit_price.js

@@ -11,7 +11,7 @@ let Schema = mongoose.Schema;
 let collectionName = 'unit_price';
 let modelSchema = {
     // 自增ID
-    id: Number,
+    id: {type:Number,unique: true},
     // 基价单价
     base_price: String,
     // 市场单价

+ 2 - 2
modules/glj/models/unit_price_model.js

@@ -253,7 +253,7 @@ class UnitPriceModel extends BaseModel {
         let doc={},newValueMap={};
         doc[data.field]=data.newval;
         newValueMap[data.id]=doc;
-        let unitPrice = await this.db.findAndModify({id:data.id},doc);
+        let unitPrice = await this.db.findAndModify({id:data.id,unit_price_file_id:data.unit_price_file_id},doc);
         if(!unitPrice){
             throw "没有找到对应的单价";
         }
@@ -284,7 +284,7 @@ class UnitPriceModel extends BaseModel {
         let parentTask = [];
         let newValueMap = {};
         for(let d of data){//第一次循环生成更新提交的记录,并生成一个新值的映射表,为更新父节点使用
-            let condition = {id:d.unit_price.id};
+            let condition = {id:d.unit_price.id,unit_price_file_id:d.unit_price.unit_price_file_id};
             let doc = {};
             doc[d.field]=d.newval;
             newValueMap[d.unit_price.id] = doc;

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

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

+ 19 - 31
web/building_saas/main/js/models/calc_program.js

@@ -643,7 +643,7 @@ let calcTools = {
             summaryFees: treeNode.data.summaryFees,
             name:treeNode.data.name,
             rationQuantityCoe: treeNode.data.rationQuantityCoe,
-            quantityCoe: treeNode.data.quantityCoe,
+            quantityCoe: treeNode.data.quantityCoe == null ? {} : treeNode.data.quantityCoe,
             targetUnitFee: treeNode.data.targetUnitFee,
             targetTotalFee: treeNode.data.targetTotalFee
         };
@@ -674,6 +674,7 @@ let calcTools = {
     calcNodeTenderQty: function (treeNode){
         let qCoe = (treeNode.data.rationQuantityCoe == undefined) ? 1 : treeNode.data.rationQuantityCoe;
         treeNode.data.tenderQuantity = (this.uiNodeQty(treeNode) * qCoe).toDecimal(decimalObj.decimal("quantity", treeNode));
+        return treeNode.data.tenderQuantity;
     },
     calcGLJTenderQty: function (treeNode, glj){
         if (treeNode.data.quantityCoe == undefined){
@@ -1506,8 +1507,8 @@ class CalcProgram {
                             rttf = parseFloatPlus(node.data.feesIndex[ft.type].tenderTotalFee).toDecimal(decimalObj.bills.totalPrice);
                         };
                         if (me.project.property.billsCalcMode === leafBillGetFeeType.rationContent) {
-                            buf = (buf + (ruf * parseFloatPlus(node.data.contain)).toDecimal(decimalObj.bills.unitPrice)).toDecimal(decimalObj.process);
-                            btuf = (btuf + (rtuf * parseFloatPlus(node.data.contain)).toDecimal(decimalObj.bills.unitPrice)).toDecimal(decimalObj.process);
+                            buf = (buf + (ruf * parseFloatPlus(node.data.quantity)).toDecimal(decimalObj.bills.unitPrice)).toDecimal(decimalObj.process);
+                            btuf = (btuf + (rtuf * parseFloatPlus(node.data.tenderQuantity)).toDecimal(decimalObj.bills.unitPrice)).toDecimal(decimalObj.process);
                         };
                         sum_rtf = (sum_rtf + rtf).toDecimal(decimalObj.process);
                         sum_rttf = (sum_rttf + rttf).toDecimal(decimalObj.process);
@@ -1571,8 +1572,7 @@ class CalcProgram {
                     let ftObj = {};
                     ftObj.fieldName = 'common';
                     ftObj.unitFee = parseFloatPlus(treeNode.data.feesIndex.common.unitFee);
-                    let q = parseFloatPlus(treeNode.data.quantity);
-                    ftObj.totalFee = (ftObj.unitFee * q).toDecimal(decimalObj.bills.totalPrice);
+                    ftObj.totalFee = (ftObj.unitFee * nQ).toDecimal(decimalObj.bills.totalPrice);
                     calcTools.checkFeeField(treeNode, ftObj);
                 }
             }
@@ -1904,21 +1904,6 @@ class CalcProgram {
         return me.getTotalFee(baseNodes, excludeNodes, tender);
     };
 
-    /*clearTenders(){
-        let nodes = projectObj.project.mainTree.items;
-        for (let node of nodes) {
-            delete node.data.targetTotalFee;
-            delete node.data.targetUnitFee;
-            if (node.data.feesIndex && node.data.feesIndex.common){
-                delete node.data.feesIndex.common.tenderUnitFee;
-                delete node.data.feesIndex.common.tenderTotalFee;
-            };
-            delete node.data.quantityCoe;
-            delete node.data.rationQuantityCoe;
-        };
-        projectObj.project.property.tenderSetting.gljPriceTenderCoe = 1;
-    };*/
-
     // 反向调价
     calcTenderReverse(treeNode, tender){
         if (treeNode.data.feesIndex.common.tenderUnitFee != treeNode.data.feesIndex.common.unitFee){
@@ -1941,32 +1926,35 @@ class CalcProgram {
             coe = (treeNode.data.targetTotalFee / treeNode.data.feesIndex.common.totalFee).toDecimal(2);//(decimalObj.process);
 
         if (tender == tenderTypes.ttReverseRation){
+            treeNode.data.tenderQuantity = (treeNode.data.quantity * coe).toDecimal(decimalObj.decimal("quantity", treeNode));
             if (treeNode.data.rationQuantityCoe != coe){
                 treeNode.data.rationQuantityCoe = coe;
                 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){
-            let coeObj = treeNode.data.quantityCoe;
-            if (!coeObj){
+            treeNode.data.tenderQuantity = treeNode.data.quantity;
+            let qcObj = treeNode.data.quantityCoe;
+            if (!qcObj){
                 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;
+                for (let pn in qcObj){
+                    if (qcObj[pn] != coe){
+                        qcObj[pn] = coe;
                         treeNode.changed = true;
                     }
                 };
             };
+            projectObj.project.calcProgram.calculate(treeNode, false, false, tenderTypes.ttCalc);  // 再正向算
         };
 
-        treeNode.data.tenderQuantity = (treeNode.data.quantity * coe).toDecimal(decimalObj.decimal("quantity", treeNode));
 
-        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;
-        };
     };
 };
 

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

@@ -266,7 +266,7 @@ ProjectGLJ.prototype.updatePrice = function (recode, updateField, newval,from,cb
         if(glj.unit_price[updateField] == newval){
             return;
         }
-        let data = {id: glj.unit_price.id, field: updateField, newval: newval,project_id:glj.project_id};
+        let data = {id: glj.unit_price.id, field: updateField, newval: newval,project_id:glj.project_id,unit_price_file_id:glj.unit_price.unit_price_file_id};
         let callback = function (data) {
             if (updateField == 'base_price') {
                 glj.unit_price.base_price = newval;

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

@@ -358,9 +358,9 @@ projectGljObject={
             projectGljSheetData.push(this.getSheetDataByGLJ(glj));
         }
         this.projectGljSheetData = projectGljSheetData;
-        this.projectGljSheet.setRowCount(0);
-        sheetCommonObj.showData(this.projectGljSheet, this.projectGljSetting,this.projectGljSheetData);
         this.projectGljSheet.setRowCount(this.projectGljSheetData.length);
+        sheetCommonObj.showData(this.projectGljSheet, this.projectGljSetting,this.projectGljSheetData);
+        //this.projectGljSheet.setRowCount(this.projectGljSheetData.length);
         sel.row = oldData?_.findIndex(this.projectGljSheetData,{'id':oldData.id}):'';
         this.projectGljSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
     },
@@ -700,7 +700,7 @@ projectGljObject={
         let parentBasePrice = 0;
         for(let i = 0;i < me.mixRatioData.length;i++){
             let ratio = me.mixRatioData[i];
-            let marketPrice = ratio.unit_price.marketPrice;
+            let marketPrice = ratio.unit_price.market_price;
             let basePrice = ratio.unit_price.base_price;
             // 如果是删除则忽略即将被删除的行数据
             if (scene === 'delete' && affectRow === i) {
@@ -725,9 +725,7 @@ projectGljObject={
             return;
         }
         if (value&&!me.checkData(col,setting,value)) {
-            setTimeout(function () {//为了不与click事件冲突
-                alert('输入的数据类型不对,请重新输入!');
-            },200);
+            alert('输入的数据类型不对,请重新输入!');
             info.sheetName =="materialTreeSheet"?me.materialTreeController.refreshTreeNode([me.materialTree.selected]):me.refreshProjectGljRow(row);
             return ;
         }

+ 4 - 0
web/building_saas/main/js/views/sub_view.js

@@ -11,6 +11,8 @@ characterOprObj.buildSheet($("#itemSpread")[0]);
 $("#tzjnrCon").hide();
 $("#subSpread").show();
 var subSpread = sheetCommonObj.createSpread($("#subSpread")[0], 4);
+subSpread.options.allowUserDragDrop = false;
+subSpread.options.allowUserDragFill = false;
 subSpread.getSheet(2).name('JSCX');
 
 pageCCOprObj.active = false;
@@ -36,6 +38,7 @@ $("#linkGLJ").click(function(){
     $("#subItems").children().hide();//控制显示subSpread,隐藏特征及内容spread
     $("#subSpread").show();
     pageCCOprObj.active = false;
+    subSpread.options.allowUserDragFill = false;
     refreshSubSpread();
     subSpread.setActiveSheetIndex(0);
     gljOprObj.activeTab='#linkGLJ';
@@ -57,6 +60,7 @@ $("#linkAZZJF").click(function(){
 $("#linkGCLMX").click(function(){
     $("#subItems").children().hide();
     $("#subSpread").show();
+    subSpread.options.allowUserDragFill = true;
     pageCCOprObj.active = false;
     refreshSubSpread();
     subSpread.setActiveSheetIndex(1);

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

@@ -181,7 +181,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;
+            let qcObj = node.data.quantityCoe;
+            if (qcObj){
+                for (let pn in qcObj){
+                    qcObj[pn] = null;
+                };
+            };
         };
     },