dong 1年前
コミット
a288a370cd
1個のファイルの変更25行の追加11行の削除
  1. 25
    11
      src/views/nationwide.vue

+ 25
- 11
src/views/nationwide.vue ファイルの表示

@@ -11,13 +11,13 @@
11 11
           <div class="left_top1img">
12 12
             <div class="left_top1img1 TiF_font">累计收益</div>
13 13
             <div class="left_top1img2 custom-font">
14
-              {{ (characteristic.money/10000).toFixed(2) }}<span class="left_top21img1">亿元</span>
14
+              {{ formatAmount1(characteristic.money) }}<span class="left_top21img1">亿元</span>
15 15
             </div>
16 16
           </div>
17 17
           <div class="left_top1img">
18 18
             <div class="left_top1img1 TiF_font">今日收益</div>
19 19
             <div class="left_top1img2 custom-font">
20
-              {{ (characteristic.moneyDaily*1).toFixed(2) }}<span class="left_top21img1">万元</span>
20
+              {{ formatAmounts2(characteristic.moneyDaily) }}<span class="left_top21img1">万元</span>
21 21
             </div>
22 22
           </div>
23 23
         </div>
@@ -25,7 +25,7 @@
25 25
           <div class="left_top21">
26 26
             <div class="left_top21img">
27 27
               <div class="left_top21imgfont custom-font18">
28
-                {{characteristic.chargeEnergyDaily==0?0:(characteristic.chargeEnergyDaily/1000).toFixed(2)
28
+                {{formatAmount1(characteristic.chargeEnergyDaily)
29 29
                 }}<span class="left_top21img1">GWh</span>
30 30
               </div>
31 31
             </div>
@@ -34,7 +34,7 @@
34 34
           <div class="left_top21">
35 35
             <div class="left_top21img">
36 36
               <div class="left_top21imgfont custom-font18">
37
-                {{characteristic.chargeEnergy==0?0:(characteristic.chargeEnergy/1000).toFixed(2) }}<span class="left_top21img1">GWh</span>
37
+                {{formatAmount1(characteristic.chargeEnergy) }}<span class="left_top21img1">GWh</span>
38 38
               </div>
39 39
             </div>
40 40
             <div class="left_top21name TiF_font">累计总充电量</div>
@@ -42,7 +42,7 @@
42 42
           <div class="left_top21">
43 43
             <div class="left_top21img">
44 44
               <div class="left_top21imgfont custom-font18">
45
-                {{characteristic.disChargeEnergyDaily==0?0:(characteristic.disChargeEnergyDaily/1000).toFixed(2)
45
+                {{formatAmount1(characteristic.disChargeEnergyDaily)
46 46
                 }}<span class="left_top21img1">GWh</span>
47 47
               </div>
48 48
             </div>
@@ -51,7 +51,7 @@
51 51
           <div class="left_top21">
52 52
             <div class="left_top21img">
53 53
               <div class="left_top21imgfont custom-font18">
54
-                {{characteristic.disChargeEnergy==0?0:(characteristic.disChargeEnergy/1000).toFixed(2)
54
+                {{formatAmount1(characteristic.disChargeEnergy)
55 55
                 }}<span class="left_top21img1">GWh</span>
56 56
               </div>
57 57
             </div>
@@ -146,13 +146,13 @@
146 146
           <img class="center_top1img22img" src="../assets/svg/center.svg" alt="" />
147 147
           <div class="center_top1img1 TiF_font">总装机容量</div>
148 148
           <div class="center_top1img2 custom-font">
149
-            {{characteristic.ratedCap==0?0:(characteristic.ratedCap/1000).toFixed(2)}}<span class="left_top21img2">GWh</span>
149
+            {{formatAmount1(characteristic.ratedCap)}}<span class="left_top21img2">GWh</span>
150 150
           </div>
151 151
         </div>
152 152
         <div class="center_top1img33">
153 153
           <div class="center_top1img1 TiF_font">总装机功率</div>
154 154
           <div class="center_top1img2 custom-font">
155
-            {{characteristic.ratedPower==0?0:(characteristic.ratedPower/1000).toFixed(2) }}<span class="left_top21img2">GW</span>
155
+            {{formatAmount1(characteristic.ratedPower) }}<span class="left_top21img2">GW</span>
156 156
           </div>
157 157
         </div>
158 158
       </div>
@@ -410,7 +410,7 @@ const convertImageToBase64 = async () => {
410 410
       
411 411
       domImg.value = imgDara2;
412 412
     }
413
-    await gatstations(0, 100000);
413
+    // await gatstations(0, 100000);  // 获取全国站点数据
414 414
     await chartMap();
415 415
   } catch (err) {}
416 416
 };
@@ -1870,15 +1870,29 @@ const tableData =ref([
1870 1870
     state:'正常'
1871 1871
   }
1872 1872
 ])
1873
+ // 处理数据
1874
+const formatAmount1 = (amount) => {
1875
+  if (amount == undefined||amount == null) {
1876
+    return "0";
1877
+  }else{
1878
+    return (amount / 1000).toFixed(2);
1879
+  }
1873 1880
  
1874
- 
1881
+};
1882
+const formatAmounts2 = (amount) => {
1883
+  if (amount == undefined||amount == null) {
1884
+    return "0";
1885
+  }else{
1886
+    return amount.toFixed(2);
1887
+  }
1888
+};
1875 1889
 onMounted(() => {
1876 1890
   // const loading = inject('loading'); // 通过 inject 访问 layoutTitle 变量
1877 1891
   // loading.close();
1878 1892
   gatstationstest(); // 天气
1879 1893
 
1880 1894
   showOverlay(false);
1881
-  convertImageToBase64(); //
1895
+  convertImageToBase64(); // 登录
1882 1896
   let times = daysDifference() + "";
1883 1897
   daysandtime.value = times.split("");
1884 1898
   updateTime(); // 初始更新时间

読み込み中…
キャンセル
保存