Pārlūkot izejas kodu

字符串判断0逻辑改进

TonyKang 4 gadi atpakaļ
vecāks
revīzija
788adab777

+ 10 - 1
modules/reports/rpt_component/helper/jpc_helper_field.js

@@ -70,7 +70,16 @@ let JpcFieldHelper = {
             if (showZero && showZero === 'F') {
                 const val = parseFloat(cell[JV.PROP_VALUE]);
                 if (val === 0) {
-                    cell[JV.PROP_VALUE] = '';
+                    let chkRst = true;
+                    if (typeof cell[JV.PROP_VALUE] === 'string' && cell[JV.PROP_VALUE].length > 1) {
+                        for (let idx = 0; idx < cell[JV.PROP_VALUE].length; idx++) {
+                            if (cell[JV.PROP_VALUE][idx] !== '0' && cell[JV.PROP_VALUE][idx] !== '.') {
+                                chkRst = false;
+                                break;
+                            }
+                        }
+                    }
+                    if (chkRst) cell[JV.PROP_VALUE] = '';
                 }
             }
         }