diff --git a/src/views/home/csr/CSRContent22.vue b/src/views/home/csr/CSRContent22.vue index 8cf036e..50b11f7 100644 --- a/src/views/home/csr/CSRContent22.vue +++ b/src/views/home/csr/CSRContent22.vue @@ -57,8 +57,13 @@ const getStatListlBar = async ([startYear, endYear] = [2020, 2023]) => { const year = Number(startYear) + i arr.push(year) const item = data.find((it:any) => +it.year === year) - serieOne.push(item ? item.dis : 0) - serieTwo.push(item ? item.dsz : 0) + serieOne.push({value:item ? item.dis : 0,itemStyle:{}}) + serieTwo.push({value:item ? item.dsz : 0,itemStyle:{}}) + } + serieOne[0].itemStyle = { + shadowColor: 'rgba(0, 0, 0, 0.7)', + shadowOffsetY: 10, + shadowBlur: 20 } option.value.xAxis.data = arr option.value.series[0].data = serieOne @@ -66,11 +71,15 @@ const getStatListlBar = async ([startYear, endYear] = [2020, 2023]) => { } const statListlPieData = ref([]) -const getStatListlPie = async ( year = '2020', channel = 'DIS') => { +const pieUseTotalData = ref(0) +const pieDischargeTotal = ref(0) +const getStatListlPie = async ( year = option.value.xAxis.data || '2020', channel = 'DIS') => { numberList.forEach((item) => { pieDecObj.value[item + 1] = 0 pieDecObj.value[item + 2] = 0 }) + pieUseTotalData.value = 0 + pieDischargeTotal.value = 0 const { data = [] } = await fetchStatListlPie({ year, channel @@ -87,10 +96,12 @@ const getStatListlPie = async ( year = '2020', channel = 'DIS') => { name: numberObj[item], value: pieDecObj.value[item + 1] || '-' }) + pieUseTotalData.value += pieDecObj.value[item + 1] || 0 optionP1.value.series[1].data.push({ name: numberObj[item], value: pieDecObj.value[item + 2] || '-' }) + pieDischargeTotal.value += pieDecObj.value[item + 2] || 0 }) } @@ -98,7 +109,6 @@ const getStatListlPie = async ( year = '2020', channel = 'DIS') => { onMounted( () => { const char = charData() option.value = char.option.value - console.log("🚀 ~ file: CSRContent22.vue:36 ~ option:", option) // chartRef.value = char.chartRef.value const char1 = charData2() option1.value = char1.option.value @@ -111,6 +121,16 @@ onMounted( () => { }) const chartClick = (it:any) => { + option.value.series.forEach((item:any) => { + item.data.forEach((i:any) => { + i.itemStyle = {} + }) + }) + option.value.series[it.seriesIndex].data[it.dataIndex].itemStyle = { + shadowColor: 'rgba(0, 0, 0, 0.7)', + shadowOffsetY: 10, + shadowBlur: 20 + }; getStatListlPie(it.name, it.seriesName) pieYear.value = (+it.name).toString().substring(2) } @@ -230,11 +250,17 @@ const handleDateChange = (val:any) => { style="align-content: space-between" >
原材料使用量合计:{{ pieUseTotalData }}千克
+原材料碳排放量合计:{{ pieDischargeTotal }}吨
+
{{ title }}
-