Browse Source

feat: 修改预测取值,最后一位是null的原因

sunxiao 1 month ago
parent
commit
05efa0b8e8
1 changed files with 12 additions and 4 deletions
  1. 12 4
      src/views/business/comparison/index.vue

+ 12 - 4
src/views/business/comparison/index.vue

@@ -248,10 +248,18 @@ export default {
       }
       
       const data = await getEchartData({ category: this.activeItem.value, timeBegin, timeEnd });
- 
-      const reusltData = data.hs.data.splice(data.real.data.length, data.hs.data.length - data.real.data.length);
-      const reusltTime = data.hs.time.splice(data.real.time.length, data.hs.time.length - data.real.time.length);
+      
+      Object.keys(data).forEach(key => {
+        const len = data[key].data.length;
+        console.log( data[key].data[len - 1] );
+        if ( !data[key].data[len - 1] ) {
+          data[key].data.pop()
+        }
+      })
 
+      const reusltData = data.hs.data.splice(data.real.data.length, data.hs.data.length - data.real.data.length);
+      // const reusltTime = data.hs.time.splice(data.real.time.length, data.hs.time.length - data.real.time.length);
+      // console.log( reusltData, reusltTime );
       let xAxisData = [];
       // const realOneList = [];
       // const realTwoList = [];
@@ -282,7 +290,7 @@ export default {
       //   yyForecastThreeList.push(yyForecastThree);
       // })
     
-      xAxisData = [...data.yy.time, ...reusltTime];
+      xAxisData = [...data.yy.time];
 
       const echartData = [
         { name: 'TFT', val: [...data.hs.data, ...reusltData] },