update: 大屏接口
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user