Sfoglia il codice sorgente

指标接口系数为0和空的计算处理

zhangweicheng 6 anni fa
parent
commit
2f520d3b94

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

@@ -78,7 +78,7 @@ let exportUtil = {
         }else {
             total = scMathUtil.roundForObj(total/building,6);
         }
-        coe = coe?coe:1;
+        coe = gljUtil.isDef(coe)?coe:1;
         return scMathUtil.roundForObj(total*coe,decimal);
     },
     calUnitWidthCoe:function (total,noNeedCoe) {

+ 10 - 5
web/building_saas/main/js/views/index_view.js

@@ -305,7 +305,7 @@ let indexObj= {
         function setQuantities(items,data) {
             let quantity = 0;
             for (let i of items){
-                let coe = i.quantityIndexCoe && i.quantityIndexCoe!=""?parseFloat(i.quantityIndexCoe):1;
+                let coe = i.quantityIndexCoe && i.quantityIndexCoe!=""?parseFloat(i.quantityIndexCoe):0;
                 i.quantity = scMathUtil.roundForObj(parseFloat(i.quantity)*coe,getDecimal("process"));
                 quantity = scMathUtil.roundForObj(quantity +  i.quantity,getDecimal("process"));
             }
@@ -365,7 +365,7 @@ let indexObj= {
             for(let g of gljs){
                 if(!g.quantity || g.quantity=="") continue;
                 let marketPrice = gljUtil.getMarketPrice(g,projectGLJData,calcOptions,decimalObj,false,_,scMathUtil); // gljOprObj.setGLJPrice(tem,g);
-                let materialIndexCoe = g.materialIndexCoe?scMathUtil.roundForObj(g.materialIndexCoe,getDecimal("process")):1;
+                let materialIndexCoe = g.materialIndexCoe?scMathUtil.roundForObj(g.materialIndexCoe,getDecimal("process")):0;
                 let t_quantity = scMathUtil.roundForObj(g.quantity * materialIndexCoe,getDecimal("process"));
                 quantity = scMathUtil.roundForObj(t_quantity + quantity,getDecimal("process"));
                 let temPrice = scMathUtil.roundForObj(g.quantity * marketPrice,getDecimal("process"));
@@ -494,7 +494,7 @@ let indexObj= {
     onEcoQuantityValueChange:function (sender,info) {
         let value = info.newValue;
         let dataCode = indexObj.ecoQuantitySetting.header[info.col].dataCode;
-        if(!info.newValue){
+        if(!gljUtil.isDef(info.newValue)){
             return;
         }
         if (value&&!sheetCommonObj.checkData(info.col,indexObj.ecoQuantitySetting, value)) {
@@ -580,7 +580,7 @@ let indexObj= {
     onMaterialChange:function (sender,info) {
         let value = info.newValue,updateMap = {};
         let dataCode = indexObj.materialSetting.header[info.col].dataCode;
-        if(!info.newValue){
+        if(!gljUtil.isDef(info.newValue)){
             return;
         }
         if (value&&!sheetCommonObj.checkData(info.col,indexObj.materialSetting, value)) {
@@ -614,8 +614,13 @@ let indexObj= {
         let updateMap = {};
         for(let c of info.changedCells){
             let value=  info.sheet.getCell(c.row, c.col).text();
+            let dataCode = indexObj.materialSetting.header[c.col].dataCode;
             let recode = indexObj.materialDatas[c.row];
-            let tem = indexObj.getMaterialUpdateData(recode,value);
+            if (value&&!sheetCommonObj.checkData(c.col,indexObj.materialSetting, value)) {
+                alert('输入的数据类型不对,请重新输入!');
+                return indexObj.showDatas();
+            }
+            let tem = indexObj.getMaterialUpdateData(recode,dataCode,value);
             if(tem) updateMap[recode.id] = tem;
         }
         if(_.isEmpty(updateMap)) return indexObj.showDatas();