|
@ -23,14 +23,14 @@ const handleResize = () => { |
|
|
const projectCount = ref(0); |
|
|
const projectCount = ref(0); |
|
|
const projectData: any = ref([]); |
|
|
const projectData: any = ref([]); |
|
|
const getChartData = async () => { |
|
|
const getChartData = async () => { |
|
|
projectCount.value = 0 |
|
|
projectCount.value = 0; |
|
|
projectData.value = []; |
|
|
projectData.value = []; |
|
|
const pramas = { |
|
|
const pramas = { |
|
|
endTime: '', |
|
|
endTime: '', |
|
|
startTime: '', |
|
|
startTime: '', |
|
|
group: 'K1' |
|
|
group: 'K1' |
|
|
}; |
|
|
}; |
|
|
const data = await chartStore.initStatisticChart(pramas); |
|
|
const data: any = await chartStore.initStatisticChart(pramas); |
|
|
if (data?.yaxis?.length) { |
|
|
if (data?.yaxis?.length) { |
|
|
let newArr = data.yaxis.flatMap((v: any) => v.series); |
|
|
let newArr = data.yaxis.flatMap((v: any) => v.series); |
|
|
newArr?.forEach((item: any) => { |
|
|
newArr?.forEach((item: any) => { |
|
@ -41,8 +41,27 @@ const getChartData = async () => { |
|
|
}); |
|
|
}); |
|
|
projectCount.value += Number(item.sum || 0); |
|
|
projectCount.value += Number(item.sum || 0); |
|
|
}); |
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 默认数据 |
|
|
|
|
|
projectData.value = [ |
|
|
|
|
|
{ |
|
|
|
|
|
name: '水库', |
|
|
|
|
|
value: 0, |
|
|
|
|
|
unit: '座' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
name: '水闸', |
|
|
|
|
|
value: 0, |
|
|
|
|
|
unit: '座' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
name: '堤防', |
|
|
|
|
|
value: 0, |
|
|
|
|
|
unit: '段' |
|
|
|
|
|
} |
|
|
|
|
|
]; |
|
|
} |
|
|
} |
|
|
await initChart() |
|
|
await initChart(); |
|
|
}; |
|
|
}; |
|
|
const initChart = () => { |
|
|
const initChart = () => { |
|
|
if (!chartRef.value) return; |
|
|
if (!chartRef.value) return; |
|
|