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

This commit is contained in:
姚宇浩 2024-05-11 16:52:10 +08:00
commit ecce907ed5
3 changed files with 190 additions and 146 deletions

View File

@ -3,20 +3,49 @@
</template>
<script setup >
import { onMounted, reactive, ref } from "vue";
import { onBeforeMount, reactive, ref } 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} <br />{a3}:{c3}",
formatter: "{b0}<br />{a1}:{c1} <br />{a2}:{c2}",
},
legend: {
data: ["80-90补贴人次", "90-98补贴人次", "99以上补贴人次"],
data: [ "90-98补贴人次", "99以上补贴人次"],
top: "8%",
right: "15%",
textStyle: {
@ -34,7 +63,7 @@ let option = {
xAxis: {
type: "category",
// boundaryGap: false,
data: ["1月", "2月", "3月", "4月", "5月"],
data: data.year,
// splitArea: {
// show: true,
// interval: '10',
@ -76,24 +105,9 @@ let option = {
color: "rgba(180, 180, 180, 0.2)",
},
},
{
name: "80-90补贴人次",
type: "line",
stack: "Total",
symbol: "emptyCircle",
symbolSize: 10,
itemStyle: {
borderColor: "#00FCFF",
borderWidth: 1,
color: "#00FCFF",
},
data: [120, 132, 101, 134, 90],
},
{
name: "90-98补贴人次",
type: "line",
stack: "Total",
symbol: "emptyCircle",
symbolSize: 10,
@ -103,12 +117,11 @@ let option = {
color: "#E8FF00",
},
data: [220, 182, 191, 234, 290],
data: data.list1,
},
{
name: "99以上补贴人次",
type: "line",
stack: "Total",
symbol: "emptyCircle",
symbolSize: 10,
@ -118,26 +131,30 @@ let option = {
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

@ -2,144 +2,161 @@
<div ref="chart" style="width: 100%;height:250px;"></div>
</template>
<script setup >
import { onMounted, reactive, ref } from "vue";
<script setup>
import { onBeforeMount, reactive, ref } from "vue";
// echarts
import * as echarts from "echarts";
const chart = ref(); // DOM
let option = {
tooltip: {
trigger: "axis",
padding: [20, 10, 20, 10],
formatter: "{b0}<br />{a1}:{c1} <br />{a2}:{c2} <br />{a3}:{c3}",
},
legend: {
data: ["80-90补贴人次", "90-98补贴人次", "99以上补贴人次"],
top: "8%",
right: "15%",
textStyle: {
fontSize: 12,
color: "#ffffff",
const props = defineProps({
list1: {
type: Array,
default: () => {
return [];
},
},
grid: {
left: "1%",
right: "10%",
bottom: "3%",
containLabel: true,
list2: {
type: Array,
default: () => {
return [];
},
},
year: {
type: Array,
default: () => {
return [];
},
},
});
xAxis: {
type: "category",
// boundaryGap: false,
data: ["1月", "2月", "3月", "4月", "5月"],
// splitArea: {
// show: true,
// interval: '10',
// areaStyle: {
// color: ["rgba(255, 255, 255, 0.10)"],
// width:10,
// },
// },
axisLabel: {
//
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: ["90-98补贴人次", "99以上补贴人次"],
top: "8%",
right: "15%",
textStyle: {
fontSize: 12,
color: "#ffffff",
},
},
},
yAxis: {
type: "value",
splitLine: {
show: true,
lineStyle: {
color: "rgba(226, 226, 226, 0.3)",
width: 1,
grid: {
left: "1%",
right: "10%",
bottom: "3%",
containLabel: true,
},
xAxis: {
type: "category",
// boundaryGap: false,
data: data.year,
// splitArea: {
// show: true,
// interval: '10',
// areaStyle: {
// color: ["rgba(255, 255, 255, 0.10)"],
// width:10,
// },
// },
axisLabel: {
//
textStyle: {
color: "#ffffff",
},
},
},
axisLabel: {
//
textStyle: {
color: "#ffffff",
yAxis: {
type: "value",
splitLine: {
show: true,
lineStyle: {
color: "rgba(226, 226, 226, 0.3)",
width: 1,
},
},
axisLabel: {
//
textStyle: {
color: "#ffffff",
},
},
},
},
series: [
{
name: "背景",
type: "bar",
data: [0, 0, 0, 0, 0],
showBackground: true,
backgroundStyle: {
color: "rgba(180, 180, 180, 0.2)",
series: [
{
name: "背景",
type: "bar",
data: [0, 0, 0, 0, 0],
showBackground: true,
backgroundStyle: {
color: "rgba(180, 180, 180, 0.2)",
},
},
},
{
name: "80-90补贴人次",
type: "line",
stack: "Total",
symbol: "emptyCircle",
{
name: "90-98补贴人次",
type: "line",
symbol: "emptyCircle",
symbolSize: 10,
itemStyle: {
borderColor: "#00FCFF",
borderWidth: 1,
color: "#00FCFF",
symbolSize: 10,
itemStyle: {
borderColor: "#E8FF00",
borderWidth: 1,
color: "#E8FF00",
},
data: data.list1,
},
data: [120, 132, 101, 134, 90],
},
{
name: "90-98补贴人次",
type: "line",
stack: "Total",
symbol: "emptyCircle",
{
name: "99以上补贴人次",
type: "line",
stack: "Total",
symbol: "emptyCircle",
symbolSize: 10,
itemStyle: {
borderColor: "#E8FF00",
borderWidth: 1,
color: "#E8FF00",
symbolSize: 10,
itemStyle: {
borderColor: "#2468FF",
borderWidth: 1,
color: "#2468FF",
},
data: data.list2,
},
],
};
}
data: [220, 182, 191, 234, 290],
},
{
name: "99以上补贴人次",
type: "line",
stack: "Total",
symbol: "emptyCircle",
symbolSize: 10,
itemStyle: {
borderColor: "#2468FF",
borderWidth: 1,
color: "#2468FF",
},
data: [150, 232, 201, 154, 190],
},
],
};
// 使
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>
<style scoped>
</style>
<style scoped></style>

View File

@ -63,8 +63,8 @@
/>
</span>
</div>
<eP2 v-if="leftchoose.second == '1'"></eP2>
<eP2_2 v-else />
<eP2 v-if="leftchoose.second == '1'" :list1="data.leftCenter1" :list2="data.leftCenter2" :year="data.leftCenterYear"></eP2>
<eP2_2 v-else :list1="data.leftCenter3" :list2="data.leftCenter4" :year="data.leftCenterYear" />
</div>
<div class="flex1" style="margin-top: 10px">
<div class="yd_title left_3">
@ -205,6 +205,8 @@ const data = reactive({
leftTopYear:[],
leftCenter1:[],
leftCenter2:[],
leftCenter3:[],
leftCenter4:[],
leftCenterYear:[],
leftbottom1:[],
leftbottom2:[],
@ -216,7 +218,6 @@ onBeforeMount(() => {
const getData = () => {
http.get("/api/ggfwyth/yl").then((res) => {
if (res.code == 200) {
console.log(res.data);
res.data.endowmentInsurance.ffrc.forEach(element => {
data.leftTop1.push(element.zgffrc)
data.leftTop2.push(element.cxffrc)
@ -226,6 +227,15 @@ const getData = () => {
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
}
});
};