ソースを参照

广东费用定额,套用公路定额,一些人材机预算价和定额价为空

vian 5 年 前
コミット
31b24d3e16

+ 1 - 2
modules/main/facade/ration_facade.js

@@ -49,7 +49,6 @@ let chongqingOverWrite = require("../../../web/over_write/js/chongqing_2018.js")
 let _= require('lodash');
 const projectDao = require('../../pm/models/project_model').project;
 let projectModel = mongoose.model('projects');
-const fs = require('fs');
 
 async function addNewRation(data,compilation) {
     let query = data.itemQuery;
@@ -471,7 +470,7 @@ async function addRationGLJ(std,newRation,compilation) {
               newGLJ.from = 'std';
           }
           //多单价情况处理
-          if(ext && ext.priceField && std_glj && std_glj.priceProperty){
+          if(ext && ext.priceField && std_glj && std_glj.priceProperty && std_glj.priceProperty[ext.priceField] !== null && std_glj.priceProperty[ext.priceField] !== undefined){
               std_glj.basePrice =  std_glj.priceProperty[ext.priceField];
           }
           if(std_glj){

+ 1 - 1
modules/ration_glj/facade/ration_glj_facade.js

@@ -905,7 +905,7 @@ async function getGLJDataByCodes(data,compilation) {
          let ext = projectDao.getExtendData(property,compilation);//多单价处理
          for(let s of stdList){
              let tem = JSON.parse(JSON.stringify(s));
-             if(ext && ext.priceField && tem && tem.priceProperty){
+             if(ext && ext.priceField && tem && tem.priceProperty && tem.priceProperty[ext.priceField] !== null && tem.priceProperty[ext.priceField] !== undefined){
                  tem.basePrice =  tem.priceProperty[ext.priceField];
              }
              gljDatas.push(tem);

+ 5 - 0
public/common_util.js

@@ -38,6 +38,10 @@ function deleteEmptyObject(arr) {
     function isNumber(val) {
         return !isEmptyVal(val) && !isNaN(val);
     }
+    // 是否是有值得对象(至少要有一个可枚举属性)
+    function isNotEmptyObject(obj) {
+        return Object.prototype.toString.call(obj) === '[object Object]' && Object.keys(obj).length > 0;
+    }
     // 是否近似相等(null = undefined = '', 1 = '1'...)
     function similarEqual(a, b) {
         // null == '' 为false,所以不能用非严等
@@ -92,5 +96,6 @@ function deleteEmptyObject(arr) {
         similarEqual,
         getRequired,
         getSortedTreeData,
+        isNotEmptyObject
     };
 });