Merge branch 'main' of git.zdool.com:xs/ggfwjsc

This commit is contained in:
姚宇浩 2024-05-13 10:53:27 +08:00
commit 5f425eccb3
3 changed files with 140 additions and 41 deletions

View File

@ -3,20 +3,49 @@
</template>
<script setup >
import { onMounted, reactive, ref } from "vue";
import { onBeforeMount, reactive, ref,defineProps } from "vue";
// echarts
import * as echarts from "echarts";
const chart = ref(); // DOM
let option = {
const props = defineProps({
list1: {
type: Array,
default: () => {
return [];
},
},
list2: {
type: Array,
default: () => {
return [];
},
},
year: {
type: Array,
default: () => {
return [];
},
},
});
const data = reactive({
list1: [],
list2: [],
year: [],
option: {}
})
const getOption = () =>{
data.option = {
tooltip: {
trigger: "axis",
padding: [20, 10, 20, 10],
formatter: "{b0}<br />{a1}:{c1} <br />{a2}:{c2} ",
},
legend: {
data: ["职工养老保险金额", "城乡养老保险金额"],
data: ["特困发放人次", "低保发放人次"],
top: "8%",
right: "11%",
textStyle: {
@ -34,7 +63,7 @@ let option = {
xAxis: {
type: "category",
// boundaryGap: false,
data: ["1月", "2月", "3月", "4月", "5月"],
data: data.year,
axisLabel: {
//
textStyle: {
@ -69,9 +98,8 @@ let option = {
},
},
{
name: "职工养老保险金额",
name: "特困发放人次",
type: "line",
stack: "Total",
symbol: "emptyCircle",
symbolSize: 10,
@ -80,12 +108,11 @@ let option = {
borderWidth: 1,
color: "#00FCFF",
},
data: [120, 132, 101, 134, 90],
data: data.list1,
},
{
name: "城乡养老保险金额",
name: "低保发放人次",
type: "line",
stack: "Total",
symbol: "emptyCircle",
symbolSize: 10,
@ -94,27 +121,28 @@ let option = {
borderWidth: 1,
color: "#2468FF",
},
data: [150, 232, 201, 154, 190],
data: data.list2,
},
],
};
// 使
onMounted(() => {
// domecharts
// var myChart = echarts.init(document.getElementById('main'));
}
const setChart = () => {
// Vue3
var myChart = echarts.init(chart.value);
// init(); // vue3.2this
// 使
myChart.setOption(option);
myChart.setOption(data.option);
}
// :
// window.addEventListener("resize", () => {
// myChart.resize();
// });
// 使
onBeforeMount(() => {
setTimeout(() => {
data.list1 = props.list1
data.list2 = props.list2
data.year = props.year
getOption()
setChart()
}, 600)
});
</script>

View File

@ -3,13 +3,42 @@
</template>
<script setup >
import { onMounted, reactive, ref } from "vue";
import { onBeforeMount, reactive, ref,defineProps } from "vue";
// echarts
import * as echarts from "echarts";
const chart = ref(); // DOM
let option = {
const props = defineProps({
list1: {
type: Array,
default: () => {
return [];
},
},
list2: {
type: Array,
default: () => {
return [];
},
},
year: {
type: Array,
default: () => {
return [];
},
},
});
const data = reactive({
list1: [],
list2: [],
year: [],
option: {}
})
const getOption = () =>{
data.option = {
tooltip: {
trigger: "axis",
formatter: "{b0}<br />{a0}:{c0} <br />{a1}:{c1} ",
@ -38,12 +67,12 @@ let option = {
color: "#ffffff",
},
},
data: ["2019", "2020", "2021", "2022", "2023"],
data: data.year,
},
{
axisTick: false,
type: "category",
data: ["2019", "2020", "2021", "2022", "2023"],
data: data.year,
axisLabel: {
show: false,
},
@ -99,7 +128,7 @@ let option = {
{
name: "特困补助金额",
type: "bar",
data: [2.0, 4.9, 7.0, 23.2, 25.6],
data: data.list1,
barWidth: "18%",
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
@ -117,7 +146,7 @@ let option = {
{
name: "低保补助金额",
type: "bar",
data: [2.6, 5.9, 9.0, 26.4, 28.7],
data: data.list2,
barWidth: "18%",
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
@ -144,22 +173,24 @@ let option = {
},
],
};
// 使
onMounted(() => {
// domecharts
// var myChart = echarts.init(document.getElementById('main'));
}
const setChart = () => {
// Vue3
var myChart = echarts.init(chart.value);
// init(); // vue3.2this
// 使
myChart.setOption(option);
myChart.setOption(data.option);
}
// :
// window.addEventListener("resize", () => {
// myChart.resize();
// });
// 使
onBeforeMount(() => {
setTimeout(() => {
data.list1 = props.list1
data.list2 = props.list2
data.year = props.year
getOption()
setChart()
}, 600)
});
</script>

View File

@ -95,8 +95,8 @@
/>
</span>
</div>
<eP3 v-if="leftchoose.third == '1'"></eP3>
<eP3_2 v-else></eP3_2>
<eP3 v-if="leftchoose.third == '1'" :list1="data.leftbottom1" :list2="data.leftbottom2" :year="data.leftbottomYear"></eP3>
<eP3_2 v-else :list1="data.leftbottom3" :list2="data.leftbottom4" :year="data.leftbottomYear"></eP3_2>
</div>
</div>
<div class="displayFlex center_bg">
@ -210,7 +210,14 @@ const data = reactive({
leftCenterYear:[],
leftbottom1:[],
leftbottom2:[],
leftbottom3:[],
leftbottom4:[],
leftbottomYear:[],
centerBottom1:[],
centerBottom2:[],
centerBottomYear:[],
zccs1: [],
zccs2: []
})
onBeforeMount(() => {
getData();
@ -218,24 +225,57 @@ onBeforeMount(() => {
const getData = () => {
http.get("/api/ggfwyth/yl").then((res) => {
if (res.code == 200) {
//
//
res.data.endowmentInsurance.ffrc.forEach(element => {
data.leftTop1.push(element.zgffrc)
data.leftTop2.push(element.cxffrc)
});
//
res.data.endowmentInsurance.ffje.forEach(element => {
data.leftTop3.push(element.zgffje)
data.leftTop4.push(element.cxffje)
});
//
data.leftTopYear = res.data.endowmentInsurance.year
//
//
res.data.oldAgeSubsidy.btrs.forEach(element => {
data.leftCenter1.push(element.ninetyNinetyEight)
data.leftCenter2.push(element.ninetyNine)
});
//
res.data.oldAgeSubsidy.btje.forEach(element => {
data.leftCenter3.push(element.ninetyNinetyEight)
data.leftCenter4.push(element.ninetyNine)
});
data.leftCenterYear = res.data.oldAgeSubsidy.year
//
//
res.data.tkdbOldAge.tkdbffrc.forEach(element => {
data.leftbottom1.push(element.tkjzrc)
data.leftbottom2.push(element.dbjzrc)
});
//
res.data.tkdbOldAge.tkdbffje.forEach(element => {
data.leftbottom3.push(element.tkjzje)
data.leftbottom4.push(element.dbjzje)
});
//
data.leftbottomYear = res.data.tkdbOldAge.year
//
res.data.familyPlanning.familyPlanningData.forEach(element => {
data.centerBottom1.push(element.jhsyrs) //
data.centerBottom2.push(element.jhsybtje) //
});
//
data.centerBottomYear = res.data.familyPlanning.year
//
//
res.data.zlfw.xzzccs.forEach(element => {
data.zccs1.push(element.xzjd) //
data.zccs2.push(element.zccs) //
});
}
});
};