'use client'; import PanelCodeHighlight from '@/components/panel-code-highlight' import React, { Fragment, useEffect, useState } from 'react'; import { Tab } from '@headlessui/react'; import IconHome from '@/components/icon/icon-home'; import IconUser from '@/components/icon/icon-user'; import IconPhone from '@/components/icon/icon-phone'; import { useRouter } from 'next/router'; import { useParams } from 'next/navigation'; import axios from 'axios'; type Props = {} const InverterViewPage = (props: Props) => { const [isMounted, setIsMounted] = useState(false) const [loading, setLoading] = useState(true) const params = useParams() const [inverter, setInverter] = useState({}) useEffect(() => { setIsMounted(true); fetchData() }, []) const fetchData = async () => { try { const res = await axios.get(`https://api-a.fomware.com.cn/asset/v1/list?type=2&key=${params.id.toString()}`, { headers: { "Authorization": "Bearer " + process.env.NEXT_PUBLIC_CHINT_TOKEN } }) console.log("res", res.data.data.devices[0]) setInverter(res.data.data.devices[0]) } catch (error) { console.error("Error fetching data:", error); } finally { setLoading(false); } }; return ( <> {loading ?

Loading...

: ( <>
{isMounted && ( {({ selected }) => ( )} {({ selected }) => ( )} {({ selected }) => ( )} {({ selected }) => ( )} {({ selected }) => ( )} {({ selected }) => ( )}

Last Updated ( 2025-02-24 16:03:10 +0800 )

Basic Information

Model: {inverter.model}

SN: {inverter.sn}

Total Energy: {inverter.eTotalWithUnit}

Today Energy: {inverter.eTodayWithUnit}

Reactive Power: {inverter.lastRTP["Reactive Power"].value} var

Active Power: {inverter.activePowerWithUnit}

Inverter Mode: {inverter.lastRTP["Inverter Mode"].value}

Inner Temperature: {inverter.lastRTP["Inner Temperature"].value} °C

Create Time: {inverter.createdAtStr}

Modules: {inverter.moduleFw.map((item: {module:string, value:string}) => `${item.module}: ${item.value}`.trim()) // Map to "module: value" format .join(", ")}

img
Media heading

Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Disabled
)}
{isMounted && ( {({ selected }) => ( )} {({ selected }) => ( )} {({ selected }) => ( )} {({ selected }) => ( )}
{[ { pv: "PV1/PV1", voltage: 362.1, current: 7.5, power: 2717.5 }, { pv: "PV2/PV2", voltage: 347.0, current: 9.16, power: 3181.9 }, { pv: "PV3/PV3", voltage: 0.0, current: 0.0, power: 0.0 }, { pv: "PV4/PV4", voltage: 0.0, current: 0.0, power: 0.0 }, ].map((row, index) => ( ))}
Voltage(V) Current(A) Power(W)
{row.pv} {row.voltage} {row.current} {row.power}
{[ { pv: "A", voltage: 362.1, current: 7.5, power: 2717.5, frequency: 1 }, { pv: "B", voltage: 347.0, current: 9.16, power: 3181.9, frequency: 1 }, { pv: "C", voltage: 0.0, current: 0.0, power: 0.0, frequency: 1 }, ].map((row, index) => ( ))}
Voltage(V) Current(A) Power(W) Frequency(Hz)
{row.pv} {row.voltage} {row.current} {row.power} {row.frequency}
Disabled Disabled
)}
)} ) } export default InverterViewPage