Browse Source

动态精度

TonyKang 5 years ago
parent
commit
747efdd9c0
1 changed files with 10 additions and 1 deletions
  1. 10 1
      app/reports/util/rpt_calculation_data_util.js

+ 10 - 1
app/reports/util/rpt_calculation_data_util.js

@@ -746,9 +746,18 @@ function assembleFields(fieldList, rstDataArr, $PROJECT) {
                         vrst.splice(0,1);
                     }
                 } else if (field.Precision.type === 'flexible') {
+                    console.log('field.Precision.flexibleMapExpression: ' + field.Precision.flexibleMapExpression);
                     const vrst = eval(field.Precision.flexibleMapExpression);
                     if (vrst && vrst.length === 1) {
-                        field.flexiblePrecisionRefObj = vrst[0];
+                        const tmpFlexObj = []; // 计量的动态精度对象与建筑/养护有所不同,需要重新生成
+                        for (const uKey in vrst[0]) {
+                            const tmpFObj = { unit: vrst[0][uKey].unit, decimal: vrst[0][uKey].value };
+                            if (uKey === 'other') {
+                                tmpFObj.unit = '其他未列单位';
+                            }
+                            tmpFlexObj.push(tmpFObj);
+                        }
+                        field.flexiblePrecisionRefObj = tmpFlexObj;
                         vrst.splice(0, 1);
                     }
                 }