浏览代码

字符串判断0逻辑改进

TonyKang 4 年之前
父节点
当前提交
788adab777
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      modules/reports/rpt_component/helper/jpc_helper_field.js

+ 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] = '';
                 }
             }
         }