fix: bug#10559

This commit is contained in:
xieyonghong 2023-03-25 13:49:40 +08:00
parent 605466c482
commit 75d748a416
1 changed files with 36 additions and 2 deletions

View File

@ -242,10 +242,40 @@ const getOnline = () => {
const onlineYdata = y;
onlineYdata.reverse();
setOnlineChartOption(x, onlineYdata);
onlineFooter.value[0].value = y?.[1];
}
});
};
/**
* 昨日在线
*/
const getYesterdayOnline = () => {
const startTime = dayjs().subtract(1, 'days').startOf('day').format('YYYY-MM-DD HH:mm:ss');
const endTime = dayjs().subtract(1, 'days').endOf('day').format('YYYY-MM-DD HH:mm:ss');
dashboard([
{
dashboard: 'device',
object: 'session',
measurement: 'online',
dimension: 'agg',
group: 'aggOnline',
params: {
state: 'online',
limit: 24,
from: startTime,
to: endTime,
time: '1d',
format: 'yyyy-MM-dd HH:mm:ss',
},
},
]).then((res) => {
if (res.status == 200) {
onlineFooter.value[0].value = res.result?.[0]?.data.value || 0
}
});
}
const setOnlineChartOption = (x: Array<any>, y: Array<number>): void => {
onlineOptions.value = {
xAxis: {
@ -441,7 +471,7 @@ const setDevMesChartOption = (
],
};
};
getOnline();
//
const getDevice = () => {
dashboard([
@ -557,6 +587,10 @@ const getEcharts = (data: any) => {
}
});
};
getOnline();
getYesterdayOnline()
</script>
<style lang="less" scoped>
.message-card,