Enhance Telemetria component: add reativa consumption data handling and update table structure for new data fields
This commit is contained in:
parent
811f40002b
commit
0f06a32235
@ -157,6 +157,10 @@ export default function Telemetria({ userName, clients }: any) {
|
|||||||
const [fatorPotenciaData, setFatorPotenciaData] = useState([])
|
const [fatorPotenciaData, setFatorPotenciaData] = useState([])
|
||||||
const [demRegXDemCon, setDemRegXDemCon] = useState([])
|
const [demRegXDemCon, setDemRegXDemCon] = useState([])
|
||||||
const [discretizedConsumptionData, setDiscretizedConsumptionData] = useState([])
|
const [discretizedConsumptionData, setDiscretizedConsumptionData] = useState([])
|
||||||
|
const [discretizedConsumptionDataReativa, setDiscretizedConsumptionDataReativa] = useState([])
|
||||||
|
|
||||||
|
// Get the selected unity name for display
|
||||||
|
const selectedUnityName = clients.find((client) => client.codigo_scde === unity)?.unidade || ""
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSend(false)
|
setSend(false)
|
||||||
@ -168,7 +172,7 @@ export default function Telemetria({ userName, clients }: any) {
|
|||||||
setLoader(true)
|
setLoader(true)
|
||||||
getDiscretization(unity, startDate, endDate, discretization)
|
getDiscretization(unity, startDate, endDate, discretization)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
setDiscretizedConsumptionData(result)
|
setDiscretizedConsumptionData(result);
|
||||||
setSend(false)
|
setSend(false)
|
||||||
setLoader(false)
|
setLoader(false)
|
||||||
setTableData(result)
|
setTableData(result)
|
||||||
@ -187,7 +191,7 @@ export default function Telemetria({ userName, clients }: any) {
|
|||||||
setLoader(true)
|
setLoader(true)
|
||||||
getDemand(unity, startDate, endDate, discretization)
|
getDemand(unity, startDate, endDate, discretization)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
setDemRegXDemCon(result)
|
setDemRegXDemCon(result);
|
||||||
setSend(false)
|
setSend(false)
|
||||||
setLoader(false)
|
setLoader(false)
|
||||||
setTableData(result)
|
setTableData(result)
|
||||||
@ -206,10 +210,11 @@ export default function Telemetria({ userName, clients }: any) {
|
|||||||
setLoader(true)
|
setLoader(true)
|
||||||
getPowerFactorData(unity, startDate, endDate, discretization)
|
getPowerFactorData(unity, startDate, endDate, discretization)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
setFatorPotenciaData(result)
|
setDiscretizedConsumptionDataReativa(result);
|
||||||
setTableData(result)
|
setFatorPotenciaData(result);
|
||||||
setSend(false)
|
setSend(false)
|
||||||
setLoader(false)
|
setLoader(false)
|
||||||
|
setTableData(result)
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
setSend(false)
|
setSend(false)
|
||||||
@ -754,7 +759,9 @@ export default function Telemetria({ userName, clients }: any) {
|
|||||||
<th className="tg-8oo6">Minuto</th>
|
<th className="tg-8oo6">Minuto</th>
|
||||||
<th className="tg-8oo6">f_ref</th>
|
<th className="tg-8oo6">f_ref</th>
|
||||||
<th className="tg-8oo6">Consumo</th>
|
<th className="tg-8oo6">Consumo</th>
|
||||||
<th className="tg-8oo6">Reativa</th>
|
<th className="tg-8oo6">Geracao</th>
|
||||||
|
<th className="tg-8oo6">Reativa Capacitiva</th>
|
||||||
|
<th className="tg-8oo6">Reativa Indutiva</th>
|
||||||
<th className="tg-8oo6">fp</th>
|
<th className="tg-8oo6">fp</th>
|
||||||
<th className="tg-8oo6">dem contratada</th>
|
<th className="tg-8oo6">dem contratada</th>
|
||||||
<th className="tg-8oo6">dem registrada</th>
|
<th className="tg-8oo6">dem registrada</th>
|
||||||
@ -765,7 +772,7 @@ export default function Telemetria({ userName, clients }: any) {
|
|||||||
{Array.isArray(tableData) && tableData.length > 0 ? (
|
{Array.isArray(tableData) && tableData.length > 0 ? (
|
||||||
tableData.map((value, index) => (
|
tableData.map((value, index) => (
|
||||||
<tr key={index}>
|
<tr key={index}>
|
||||||
<td className="tg-gceh">{unity}</td>
|
<td className="tg-gceh">{selectedUnityName}</td>
|
||||||
<td className="tg-gceh">{value?.ponto}</td>
|
<td className="tg-gceh">{value?.ponto}</td>
|
||||||
<td className="tg-gceh">{Number(value?.dia_num)}</td>
|
<td className="tg-gceh">{Number(value?.dia_num)}</td>
|
||||||
<td className="tg-uulg">{value?.day_formatted}</td>
|
<td className="tg-uulg">{value?.day_formatted}</td>
|
||||||
@ -776,7 +783,13 @@ export default function Telemetria({ userName, clients }: any) {
|
|||||||
{numberBR(value?.consumo, 2, 5)}
|
{numberBR(value?.consumo, 2, 5)}
|
||||||
</td>
|
</td>
|
||||||
<td className="tg-gceh">
|
<td className="tg-gceh">
|
||||||
{numberBR(value?.reativa, 2, 5)}
|
{numberBR(value?.geracao, 2, 5)}
|
||||||
|
</td>
|
||||||
|
<td className="tg-gceh">
|
||||||
|
{numberBR(value?.reativa_capacitiva, 2, 5)}
|
||||||
|
</td>
|
||||||
|
<td className="tg-gceh">
|
||||||
|
{numberBR(value?.reativa_indutiva, 2, 5)}
|
||||||
</td>
|
</td>
|
||||||
<td className="tg-gceh">{numberBR(value?.fp, 0, 5)}</td>
|
<td className="tg-gceh">{numberBR(value?.fp, 0, 5)}</td>
|
||||||
<td className="tg-gceh">
|
<td className="tg-gceh">
|
||||||
@ -792,7 +805,7 @@ export default function Telemetria({ userName, clients }: any) {
|
|||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<tr>
|
<tr>
|
||||||
<td className="tg-gceh" colSpan={13}>
|
<td className="tg-gceh" colSpan={15}>
|
||||||
Sem dados no período selecionado.
|
Sem dados no período selecionado.
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user