Merge branch 'dev' of https://gitlab.com/kluppsoftware/smart-energia-web into dev
This commit is contained in:
commit
88e0dcb717
@ -43,7 +43,7 @@ export function DiscretizedConsumptionChart({ title, subtitle, dataProps, label,
|
||||
},
|
||||
ticks: {
|
||||
font: {
|
||||
size: window.innerWidth/80
|
||||
size: window?.innerWidth/80
|
||||
}
|
||||
},
|
||||
},
|
||||
@ -53,7 +53,7 @@ export function DiscretizedConsumptionChart({ title, subtitle, dataProps, label,
|
||||
},
|
||||
ticks: {
|
||||
font: {
|
||||
size: window.innerWidth/80
|
||||
size: window?.innerWidth/80
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@ -79,9 +79,11 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, dataset1,
|
||||
|
||||
const options: any = config(miniature)
|
||||
|
||||
console.log(chartData?.map(value => value.dad_estimado)?.includes(true))
|
||||
|
||||
const data: any = {
|
||||
labels,
|
||||
datasets: [
|
||||
datasets: chartData?.map(value => value.dad_estimado)?.includes(true) ? [
|
||||
{
|
||||
type: 'line' as const,
|
||||
label: dataset1? dataset1 : 'Dataset 1',
|
||||
@ -102,9 +104,10 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, dataset1,
|
||||
if (!value.dad_estimado)
|
||||
return parseInt(value.custo_cativo)
|
||||
}),
|
||||
skipNull: true,
|
||||
// skipNull: true,
|
||||
borderRadius: 8,
|
||||
backgroundColor: '#C2D5FB',
|
||||
skipNull: chartData?.map(value => value.dad_estimado)?.includes(true)
|
||||
},
|
||||
{
|
||||
type: 'bar' as const,
|
||||
@ -113,9 +116,10 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, dataset1,
|
||||
if (!value.dad_estimado)
|
||||
return parseInt(value.custo_livre)
|
||||
}),
|
||||
skipNull: true,
|
||||
// skipNull: true,
|
||||
borderRadius: 8,
|
||||
backgroundColor: '#255488',
|
||||
skipNull: chartData?.map(value => value.dad_estimado)?.includes(true)
|
||||
},
|
||||
{
|
||||
type: 'bar',
|
||||
@ -124,9 +128,9 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, dataset1,
|
||||
if (value.dad_estimado)
|
||||
return parseInt(value.custo_cativo)
|
||||
}),
|
||||
skipNull: true,
|
||||
borderRadius: 8,
|
||||
backgroundColor: pattern.draw('diagonal', '#C2D5FB'),
|
||||
skipNull: chartData?.map(value => value.dad_estimado)?.includes(true)
|
||||
},
|
||||
{
|
||||
type: 'bar',
|
||||
@ -135,9 +139,47 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, dataset1,
|
||||
if (value.dad_estimado)
|
||||
return parseInt(value.custo_livre)
|
||||
}),
|
||||
skipNull: true,
|
||||
borderRadius: 8,
|
||||
backgroundColor: pattern.draw('diagonal', '#255488'),
|
||||
skipNull: chartData?.map(value => value.dad_estimado)?.includes(true)
|
||||
}
|
||||
] : [
|
||||
{
|
||||
type: 'line' as const,
|
||||
label: dataset1? dataset1 : 'Dataset 1',
|
||||
borderColor: '#0c9200',
|
||||
datalabels: {
|
||||
backgroundColor: 'white',
|
||||
borderRadius: 8,
|
||||
opacity: .8
|
||||
},
|
||||
borderWidth: 2,
|
||||
fill: false,
|
||||
data: chartData?.map(value => parseInt(value.economia_mensal)),
|
||||
},
|
||||
{
|
||||
type: 'bar' as const,
|
||||
label: 'Cativo',
|
||||
data: chartData?.map(value => {
|
||||
if (!value.dad_estimado)
|
||||
return parseInt(value.custo_cativo)
|
||||
}),
|
||||
// skipNull: true,
|
||||
borderRadius: 8,
|
||||
backgroundColor: '#C2D5FB',
|
||||
skipNull: chartData?.map(value => value.dad_estimado)?.includes(true)
|
||||
},
|
||||
{
|
||||
type: 'bar' as const,
|
||||
label: 'Livre',
|
||||
data: chartData?.filter(value => !value.dad_estimad? true : false).map(value => {
|
||||
if (!value.dad_estimado)
|
||||
return parseInt(value.custo_livre)
|
||||
}),
|
||||
// skipNull: true,
|
||||
borderRadius: 8,
|
||||
backgroundColor: '#255488',
|
||||
skipNull: chartData?.map(value => value.dad_estimado)?.includes(true)
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
@ -71,22 +71,27 @@ export default function economy({userName, anual, years, brutaMensal, catLiv, cl
|
||||
setLastDataBruta(`${parseFloat(lastData).toFixed(3)}`)
|
||||
}, [economyMenu])
|
||||
|
||||
useEffect(() => {
|
||||
api.post('/economy/estimates', unity!==''?{
|
||||
async function getChartsWithUnity() {
|
||||
await api.post('/economy/estimates', unity!==''?{
|
||||
"filters": [
|
||||
{"type" : "=", "field":"dados_cadastrais.cod_smart_unidade", "value": unity === "default" ? unity : unity}
|
||||
]
|
||||
}:{}).then(res => {
|
||||
console.log(res.data.data)
|
||||
setCatLivDataState(res.data.data)
|
||||
})
|
||||
|
||||
api.post('/economy/MWh', unity!==''?{
|
||||
await api.post('/economy/MWh', unity!==''?{
|
||||
"filters": [
|
||||
{"type" : "=", "field":"dados_cadastrais.cod_smart_unidade", "value": unity === "default"? unity : unity}
|
||||
]
|
||||
}:{}).then(res => {
|
||||
setIndicatorDataState(res.data.data)
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getChartsWithUnity()
|
||||
}, [unity])
|
||||
|
||||
return (
|
||||
|
||||
@ -168,7 +168,15 @@ export default function Telemetria({userName, clients}: any) {
|
||||
.catch(() => {setSend(false); setOpenSnackFields(true)})
|
||||
|
||||
getDemand(unity, startDate, endDate, discretization)
|
||||
.then(result => {setDemRegXDemCon(result); setSend(false); setTableData(result)})
|
||||
.then(result => {
|
||||
// const html = document.querySelector("table")?.outerHTML;
|
||||
// htmlToCSV(html, "telemetria.csv")
|
||||
|
||||
setDemRegXDemCon(result);
|
||||
setSend(false);
|
||||
console.log(result)
|
||||
setTableData(result)
|
||||
})
|
||||
.catch(() => {setSend(false); setOpenSnackFields(true); setLoader(false)})
|
||||
|
||||
getPowerFactorData(unity, startDate, endDate, discretization)
|
||||
@ -225,6 +233,8 @@ export default function Telemetria({userName, clients}: any) {
|
||||
<Header name={userName}>
|
||||
<PageTitle title ='Telemetria' subtitle='Dados Coletados do Sistema de Coleta de Dados de Energia'/>
|
||||
</Header>
|
||||
{
|
||||
typeof window === 'undefined' || typeof window === undefined? null :
|
||||
<TelemetriaView>
|
||||
{/* <Banner title ='Telemetria' subtitle='Dados Coletados do Sistema de Coleta de Dados de Energia -
|
||||
SCDE da Câmara de Comercialização de Energia Elétrica - CCEE,
|
||||
@ -240,7 +250,7 @@ export default function Telemetria({userName, clients}: any) {
|
||||
discretization==='1_hora'? 'Consumo discretizado em 1 hora' :
|
||||
'Consumo discretizado em 1 dia'}/>
|
||||
<Tab label="Demanda"/>
|
||||
<Tab label="Fator Potencia"/>
|
||||
<Tab label="Fator Potência"/>
|
||||
</Tabs>
|
||||
</TableHeader>
|
||||
|
||||
@ -423,7 +433,7 @@ export default function Telemetria({userName, clients}: any) {
|
||||
<BasicButton title='Selecionar!' onClick={() => {
|
||||
setLoader(true)
|
||||
getDemand(unity, startDate, endDate, discretization)
|
||||
.then(result => {setDemRegXDemCon(result); setSend(false); setLoader(false)})
|
||||
.then(result => {setDemRegXDemCon(result); setSend(false); setLoader(false); setTableData(result)})
|
||||
.catch(exception => {setSend(false); setOpenSnackFields(true); setLoader(false)})
|
||||
}}/>
|
||||
</div>
|
||||
@ -582,14 +592,9 @@ export default function Telemetria({userName, clients}: any) {
|
||||
{/* <GradientButton title='DADOS' description='CLIQUE AQUI PARA GERAR GRÁFICO DO MÊS ATUAL' onClick={() => setShowChart(!showChart)} purple /> */}
|
||||
{/* <GradientButton title='GRÁFICO' description='CLIQUE AQUI PARA GERAR GRÁFICO DO PERÍODO SELECIONADO' onClick={() => handleVerifyFields()} orange /> */}
|
||||
<GradientButton title='DOWNLOADS' description={`CLIQUE AQUI PARA BAIXAR OS DADOS EM FORMATO EXCEL DO PERÍODO SELECIONADO`} green onClick={() => {
|
||||
if (send) {
|
||||
console.log(send)
|
||||
const html = document.querySelector("table")?.outerHTML;
|
||||
htmlToCSV(html, "telemetria.csv");
|
||||
}
|
||||
else {
|
||||
setSend(true)
|
||||
getTableData()
|
||||
}
|
||||
}}/>
|
||||
</Buttons>
|
||||
<p className='paragraph'>
|
||||
@ -601,8 +606,8 @@ export default function Telemetria({userName, clients}: any) {
|
||||
medição - Distribuidora.
|
||||
</i>
|
||||
</p>
|
||||
|
||||
</TelemetriaView>
|
||||
}
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user