Bladeren bron

NaN 值 错误修改

huangxingxing 9 maanden geleden
bovenliggende
commit
b1023606d1
1 gewijzigde bestanden met toevoegingen van 15 en 1 verwijderingen
  1. 15 1
      src/control/fireControl.js

+ 15 - 1
src/control/fireControl.js

@@ -46,15 +46,29 @@ export class fireControl {
     //获取第几步标量数据
     async getScalrsByStep(step) {
         this.step = step;
-        // console.log(this.scalars.get(step));
+       
         if (this.scalars.get(step)) {
             this.scalar = this.scalars.get(step);
         } else {
             const url = this._url + this.aid + "&transCode=D00009&step=" + this.step;
             await this.reader.setUrl(url).then(() => {
                 const scalarMap = this.reader.getOutputData(1);
+                scalarMap.forEach(function(scalarVarry, skey) {
+                    const replacedNumbers = scalarVarry.map(
+                        value => {
+                                if(isNaN(value)){
+                                    return 0;
+                                }else{
+                                    return value 
+                                }
+                            }
+                    );
+                    scalarMap.set(skey,replacedNumbers);
+
+                });
                 this.scalar = scalarMap;
                 this.scalars.set(step, scalarMap);
+                // console.log("获取"+ this.scalar);
             });
         }
     }