Explorar el Código

Merge branch 'master' of http://192.168.1.41:3000/maixinrong/Calculation

MaiXinRong hace 5 años
padre
commit
18f362e70f
Se han modificado 1 ficheros con 21 adiciones y 0 borrados
  1. 21 0
      app/reports/util/rpt_calculation_data_util.js

+ 21 - 0
app/reports/util/rpt_calculation_data_util.js

@@ -770,6 +770,7 @@ function setupFunc(obj, ownRawObj, baseDir) {
     obj.getSplitProperty = ext_getSplitProperty;
     obj.getPicProperty = ext_getPicProperty;
     // obj.getPropertyByForeignId = ext_getPropertyByForeignId;
+    obj.getPreferPrecisionProperty = ext_getPreferPrecisionProperty;
     obj.getArrayProperty = ext_getArrayValues;
     obj.getBlank = ext_getBlank;
 }
@@ -862,6 +863,26 @@ function getDeepProperty(propKey, orgObj, destArr) {
     }
 }
 
+function ext_getPreferPrecisionProperty(dataKey, preferKey, preferPropKey, dftPropKey) {
+    // 通过一个开关(preferKey)来控制精度,如为true,则选择preferPropKey,否则选择dftPropKey
+    const rst = [];
+    const parentObj = this;
+    const dtObj = parentObj.myOwnRawDataObj[dataKey];
+    if (preferKey && preferPropKey && dftPropKey && dtObj) {
+        const da = getActDataArr(dtObj);
+        if (da.length === 1) {
+            const pKey = [];
+            pri_push_property(preferKey, da[0], pKey);
+            if (pKey.length > 0 && pKey[0]) {
+                pri_push_property(preferPropKey, da[0], rst);
+            } else {
+                pri_push_property(dftPropKey, da[0], rst);
+            }
+        }
+    }
+    return rst;
+}
+
 function ext_getProperty(dataKey, propKey) {
     const rst = [];
     const parentObj = this;