xieyonghong 3 лет назад
Родитель
Сommit
10e63e770a
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      src/pages/iot-card/CardManagement/Detail/index.tsx

+ 3 - 3
src/pages/iot-card/CardManagement/Detail/index.tsx

@@ -103,7 +103,7 @@ const CardDetail = () => {
       bottom: 0,
     };
     getData(dTime[0], dTime[1]).then((resp) => {
-      const _total = resp.data.reduce((r, n) => r + n, 0);
+      const _total = resp.data.reduce((r, n) => r + Number(n), 0);
       setTotal(_total ? _total.toFixed(2) : 0);
       setDayOptions({
         ...DefaultEchartsOptions,
@@ -145,7 +145,7 @@ const CardDetail = () => {
       });
     });
     getData(mTime[0], mTime[1]).then((resp) => {
-      const _total = resp.data.reduce((r, n) => r + n, 0);
+      const _total = resp.data.reduce((r, n) => r + Number(n), 0);
       setMonthTotal(_total ? _total.toFixed(2) : 0);
       setMonthOptions({
         ...DefaultEchartsOptions,
@@ -187,7 +187,7 @@ const CardDetail = () => {
       });
     });
     getData(yTime[0], yTime[1]).then((resp) => {
-      const _total = resp.data.reduce((r, n) => r + n, 0);
+      const _total = resp.data.reduce((r, n) => r + Number(n), 0);
       setYearTotal(_total ? _total.toFixed(2) : 0);
       setYearOptions({
         ...DefaultEchartsOptions,