update:大屏调整
This commit is contained in:
@@ -11,7 +11,10 @@
|
||||
import { getHealthDataList } from '/@/components/body-d-right/right.api';
|
||||
import { useSpin } from '/@/components/body-d-left/bodyLeftHooks.ts';
|
||||
import { ringOption, useHealth } from '/@/components/body-d-right/bodyRightHooks.ts';
|
||||
import { useSession, caching } from '/@/hooks/autoRefresh/caching.ts';
|
||||
|
||||
const { setSession, getSession } = useSession();
|
||||
const { RIGHT_KEY2 } = caching;
|
||||
const { setSpin, spinning } = useSpin();
|
||||
const healthChart = ref<HTMLElement>();
|
||||
onMounted(() => {
|
||||
@@ -26,15 +29,21 @@
|
||||
if (code != 200) {
|
||||
return;
|
||||
}
|
||||
setHealth(result);
|
||||
const yData = unref(getValue);
|
||||
let total = yData.reduce((accumulator, currentValue) => Number(accumulator) + Number(currentValue), 0);
|
||||
initChart(unref(healthData), total);
|
||||
setSession(RIGHT_KEY2, JSON.stringify(result));
|
||||
setValue(result);
|
||||
} catch {
|
||||
initChart(unref(healthData), 0);
|
||||
const result = JSON.parse(getSession(RIGHT_KEY2));
|
||||
setValue(result);
|
||||
}
|
||||
}
|
||||
|
||||
function setValue(result) {
|
||||
setHealth(result);
|
||||
const yData = unref(getValue);
|
||||
let total = yData.reduce((accumulator, currentValue) => Number(accumulator) + Number(currentValue), 0);
|
||||
initChart(unref(healthData), total);
|
||||
}
|
||||
|
||||
function initChart(chartData, total) {
|
||||
let myChart = echarts.init(healthChart.value);
|
||||
let options = ringOption(chartData, total);
|
||||
|
||||
Reference in New Issue
Block a user