add download telemetry
This commit is contained in:
parent
230f6b0f1a
commit
4e7c4934a5
@ -121,6 +121,10 @@ export default function Telemetria({userName, clients}: any) {
|
|||||||
setEndDate(newValue)
|
setEndDate(newValue)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log(currentDate.slice(0, 8) + '01')
|
||||||
|
|
||||||
|
const [demRegXDemCon2, setDemRegXDemCon2] = useState([]);
|
||||||
|
|
||||||
async function getTableData() {
|
async function getTableData() {
|
||||||
const html = document.querySelector("table")?.outerHTML;
|
const html = document.querySelector("table")?.outerHTML;
|
||||||
if (startDate.toLocaleDateString()!=='' && endDate.toLocaleDateString()!=='' && send)
|
if (startDate.toLocaleDateString()!=='' && endDate.toLocaleDateString()!=='' && send)
|
||||||
@ -129,7 +133,7 @@ export default function Telemetria({userName, clients}: any) {
|
|||||||
"type": discretization,
|
"type": discretization,
|
||||||
"filters": [
|
"filters": [
|
||||||
{"type" : "=", "field": "med_5min.ponto", "value": unity},
|
{"type" : "=", "field": "med_5min.ponto", "value": unity},
|
||||||
{"type" : "between", "field": "dia_num", "value": [currentDate, currentDate]}
|
{"type" : "between", "field": "dia_num", "value": [currentDate.slice(0, 8) + '01', currentDate]}
|
||||||
]
|
]
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
setTableData(res.data.data)
|
setTableData(res.data.data)
|
||||||
@ -169,14 +173,14 @@ export default function Telemetria({userName, clients}: any) {
|
|||||||
"type": discretization,
|
"type": discretization,
|
||||||
"filters": [
|
"filters": [
|
||||||
{"type" : "=", "field": "med_5min.ponto", "value": unity},
|
{"type" : "=", "field": "med_5min.ponto", "value": unity},
|
||||||
{"type" : "between", "field": "dia_num", "value": [currentDate, currentDate]}
|
{"type" : "between", "field": "dia_num", "value": [currentDate.slice(0, 8) + '01', currentDate]}
|
||||||
]
|
]
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
setDemRegXDemCon(res.data.data)
|
setDemRegXDemCon2(res.data.data)
|
||||||
htmlToCSV(html, "telemetria.csv")
|
htmlToCSV(html, "telemetria.csv")
|
||||||
}).catch(res => {
|
}).catch(res => {
|
||||||
// console.log(res)
|
// console.log(res)
|
||||||
router.push('/telemetria')
|
// router.push('/telemetria')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -606,9 +610,9 @@ export default function Telemetria({userName, clients}: any) {
|
|||||||
}}/>
|
}}/>
|
||||||
</div>
|
</div>
|
||||||
</ChartFilters>
|
</ChartFilters>
|
||||||
<DemRegXDemConChart data1={demRegXDemCon} data2={demRegXDemCon}
|
<DemRegXDemConChart data1={demRegXDemCon2} data2={demRegXDemCon2}
|
||||||
dataset1={'Demanda contratada + 5%'} dataset2={'barra1'} dataset3={'Demanda Registrada'}
|
dataset1={'Demanda contratada + 5%'} dataset2={'barra1'} dataset3={'Demanda Registrada'}
|
||||||
label={demRegXDemCon.map(value => value.hora)} title='Demanda Contratada X Registrada' subtitle='' red/>
|
label={demRegXDemCon2?.map(value => value.hora)} title='Demanda Contratada X Registrada' subtitle='' red/>
|
||||||
</RenderIf>
|
</RenderIf>
|
||||||
</RenderIf>
|
</RenderIf>
|
||||||
|
|
||||||
@ -623,7 +627,7 @@ export default function Telemetria({userName, clients}: any) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</RenderIf>
|
</RenderIf>
|
||||||
<RenderIf isTrue={startDate.toLocaleDateString()!=='' && endDate.toLocaleDateString()!=='' && tableData!==null}>
|
<RenderIf isTrue={true}>
|
||||||
<table className="tg">
|
<table className="tg">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user