update: 大屏接口

This commit is contained in:
xf
2025-07-08 10:11:15 +08:00
parent 01f3339833
commit a2da7e4be7
6 changed files with 76 additions and 14 deletions
+25 -5
View File
@@ -42,6 +42,7 @@
import { ref, onMounted } from 'vue';
import * as echarts from 'echarts';
import { getClassCharts } from '/@/views/indexSun/indexSun.ts';
import { twoLApi } from '/@/views/indexSun/indexSun.api.ts';
const chooseType = ref('0');
const selectValue = ref('all');
@@ -50,17 +51,36 @@
function clickChooseType(type) {
if (chooseType.value === type) return;
chooseType.value = type;
initChart();
getData();
// initChart();
}
onMounted(() => {
initChart();
getData();
// initChart();
});
const myChart = ref(null);
function getData() {
twoLApi({
sex: chooseType.value,
depart: '',
}).then((res) => {
console.log(res, 'resessss');
if (res.code == 200) {
initChart(res.result);
}
});
}
function initChart() {
function initChart(value) {
myChart.value = echarts.init(newChart.value!);
const dx = ['120', '应急就医'];
const dy = [46, 39];
const dx =
value.map((item) => {
return item.name;
}) || [];
const dy =
value.map((item) => {
return item.count;
}) || [];
let option = getClassCharts(dx, dy);
myChart.value.setOption(option);
window.addEventListener('resize', () => {