This commit is contained in:
姚宇浩 2024-05-13 10:53:21 +08:00
parent 59b78327da
commit 3f951d5d0a
7 changed files with 719 additions and 576 deletions

View File

@ -1,216 +1,224 @@
<template> <template>
<div <div ref="chart" style="width: 100%; height: 400px"></div>
ref="chart"
style="width: 100%;height: 400px"
></div>
</template> </template>
<script setup > <script setup >
import { onMounted, reactive, ref } from "vue"; import { onMounted, reactive, ref, onBeforeMount, defineProps } from "vue";
// echarts // echarts
import * as echarts from "echarts"; import * as echarts from "echarts";
const props = defineProps({
list: {
type: Array,
default: () => [],
},
year: {
type: Array,
default: () => [],
},
});
const chart = ref(); // DOM const chart = ref(); // DOM
const data1 = [ const data = reactive({
"龙游县人民医院", list: [],
"龙游县中医院", jgmc: [],
"龙游县横山镇中心卫生院", rs: [],
"龙游县溪水镇中心卫生院", option: {},
"龙游县龙游街道社区卫生服务中心", bg: [],
"龙游县塔石镇中心卫生院", });
"龙游县罗家县中心卫生院", const getOption = () => {
]; data.option = {
let option = { tooltip: {
tooltip: { trigger: "axis",
trigger: "axis", // formatter: "{b0}<br />{a0}:{c0} <br />{a1}:{c1} ",
// formatter: "{b0}<br />{a0}:{c0} <br />{a1}:{c1} ",
},
grid: {
top: "13%",
left: "1%",
right: "10%",
bottom: "0%",
containLabel: true,
},
calculable: true,
xAxis: [
{
type: "category",
axisLabel: {
formatter: function (params) {
var str = ""; //
var paramsLen = params.length; //
var len = 6; //
var rowNumber = Math.ceil(paramsLen / len); //
if (paramsLen > len) {
//len
for (var i = 0; i < rowNumber; i++) {
var temp = ""; //
var start = i * len; //
var end = start + len; //
if (i == rowNumber - 1) {
//
temp = params.substring(start, paramsLen);
} else {
//
temp = params.substring(start, end) + "\n";
}
str += temp; //
}
} else {
//
str = params;
}
return str; //
},
textStyle: {
color: "#ffffff",
},
rotate: 40,
},
data: data1,
}, },
],
yAxis: [ grid: {
{ top: "13%",
name:'在册数', left: "15%",
type: "value", right: "10%",
splitLine: { bottom: "0%",
show: true, containLabel: true,
lineStyle: {
color: "rgba(226, 226, 226, 0.2)",
width: 1,
},
},
axisLabel: {
//
textStyle: {
color: "#ccc",
},
},
axisLine: {
//y线
show: false,
lineStyle: {
color: "#ffffff",
width: 1,
type: "solid",
},
},
}, },
calculable: true,
], xAxis: [
series: [ {
{ type: "category",
name: "职工医疗保险发放人次", axisLabel: {
type: "bar", // formatter: function (params) {
data: [2.0, 4.9, 7.0, 23.2, 25.6,100,50], // var str = ""; //
barWidth: 20, // var paramsLen = params.length; //
itemStyle: { // var len = 6; //
normal: { // var rowNumber = Math.ceil(paramsLen / len); //
color: function (params) { // if (paramsLen > len) {
let colorList = [ // //len
["rgba(23, 237, 255, 1)", "rgba(23, 237, 255, 0.20)"], // for (var i = 0; i < rowNumber; i++) {
["rgba(142, 187, 255, 1)", "rgba(142, 187, 255, 0.20)"], // var temp = ""; //
["rgba(255, 243, 119, 1)", "rgba(255, 242, 142, 0.20)"], // var start = i * len; //
]; // var end = start + len; //
if (params.dataIndex == 0) { // if (i == rowNumber - 1) {
return new echarts.graphic.LinearGradient( // //
0, // temp = params.substring(start, paramsLen);
0, // } else {
0, // //
1, //y->y2 // temp = params.substring(start, end) + "\n";
[ // }
{ // str += temp; //
offset: 0, // }
color: "rgba(23, 237, 255, 1)", // } else {
}, // //
{ // str = params;
offset: 1, // }
color: "rgba(23, 237, 255, 0.20)", // return str; //
}, // },
], textStyle: {
false color: "#ffffff",
); },
} else if (params.dataIndex % 3 == 0) { rotate: 40,
return new echarts.graphic.LinearGradient( },
0, data: data.jgmc,
0, },
0, ],
1, //y->y2
[ yAxis: [
{ {
offset: 0, name: "在册数",
color: "rgba(23, 237, 255, 1)", type: "value",
}, splitLine: {
{ show: true,
offset: 1, lineStyle: {
color: "rgba(23, 237, 255, 0.20)", color: "rgba(226, 226, 226, 0.2)",
}, width: 1,
], },
false },
); axisLabel: {
} else if (params.dataIndex % 2 == 0) { //
return new echarts.graphic.LinearGradient( textStyle: {
0, color: "#ffffff",
0, },
0, },
1, //y->y2 axisLine: {
[ //y线
{ show: false,
offset: 0, lineStyle: {
color: "rgba(255, 243, 119, 1)", color: "#ffffff",
}, width: 1,
{ type: "solid",
offset: 1,
color: "rgba(255, 242, 142, 0.20)",
},
],
false
);
} else {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
{
offset: 0,
color: "rgba(142, 187, 255, 1)",
},
{
offset: 1,
color: "rgba(142, 187, 255, 0.20)",
},
],
false
);
}
}, },
}, },
}, },
}, ],
], series: [
{
name: "职工医疗保险发放人次",
type: "bar",
data: data.rs,
barWidth: 20,
itemStyle: {
normal: {
color: function (params) {
let colorList = [
["rgba(23, 237, 255, 1)", "rgba(23, 237, 255, 0.20)"],
["rgba(142, 187, 255, 1)", "rgba(142, 187, 255, 0.20)"],
["rgba(255, 243, 119, 1)", "rgba(255, 242, 142, 0.20)"],
];
if (params.dataIndex == 0) {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
{
offset: 0,
color: "rgba(23, 237, 255, 1)",
},
{
offset: 1,
color: "rgba(23, 237, 255, 0.20)",
},
],
false
);
} else if (params.dataIndex % 3 == 0) {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
{
offset: 0,
color: "rgba(23, 237, 255, 1)",
},
{
offset: 1,
color: "rgba(23, 237, 255, 0.20)",
},
],
false
);
} else if (params.dataIndex % 2 == 0) {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
{
offset: 0,
color: "rgba(255, 243, 119, 1)",
},
{
offset: 1,
color: "rgba(255, 242, 142, 0.20)",
},
],
false
);
} else {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
{
offset: 0,
color: "rgba(142, 187, 255, 1)",
},
{
offset: 1,
color: "rgba(142, 187, 255, 0.20)",
},
],
false
);
}
},
},
},
},
],
};
}; };
const setChart = () => {
// 使
onMounted(() => {
// domecharts
// var myChart = echarts.init(document.getElementById('main'));
// Vue3 // Vue3
var myChart = echarts.init(chart.value); var myChart = echarts.init(chart.value);
// init(); // vue3.2this
// 使 // 使
myChart.setOption(option); myChart.setOption(data.option);
};
// : onBeforeMount(() => {
// window.addEventListener("resize", () => { setTimeout(() => {
// myChart.resize(); data.list = props.list;
// }); data.list.forEach((item, index) => {
data.jgmc.push(item.jgmc);
data.rs.push(item.rs);
});
getOption();
setChart();
}, 600);
}); });
</script> </script>

View File

@ -3,13 +3,29 @@
</template> </template>
<script setup > <script setup >
import { onMounted, reactive, ref } from "vue"; import { onMounted, reactive, ref,onBeforeMount,defineProps } from "vue";
// echarts // echarts
import * as echarts from "echarts"; import * as echarts from "echarts";
const props = defineProps({
list: {
type: Array,
default: () => [],
},
year:{
type: Array,
default: () => [],
}
});
const data= reactive({
list:[],
year:[],
option:{},
bg:[],
})
const chart = ref(); // DOM const chart = ref(); // DOM
const data1 = ["2019", "2020", "2021", "2022", "2023"];
let option = { const getOption = () => {
data.option = {
tooltip: { tooltip: {
trigger: "axis", trigger: "axis",
formatter: "{b0}<br />{a0}:{c0} ", formatter: "{b0}<br />{a0}:{c0} ",
@ -33,12 +49,12 @@ let option = {
}, },
}, },
data: data1, data: data.year,
}, },
{ {
axisTick: false, axisTick: false,
type: "category", type: "category",
data: data1, data: data.year,
axisLabel: { axisLabel: {
show: false, show: false,
}, },
@ -102,7 +118,7 @@ let option = {
{ {
name: "体检人数", name: "体检人数",
type: "bar", type: "bar",
data: [120, 49, 70, 232, 25.6], data: data.list,
barWidth: 20, barWidth: 20,
itemStyle: { itemStyle: {
normal: { normal: {
@ -191,28 +207,32 @@ let option = {
itemStyle: { itemStyle: {
color: "rgba(221, 242, 255, 0.1)", color: "rgba(221, 242, 255, 0.1)",
}, },
data: ["2019", "2020", "2021", "2022", "2023"].map(() => 100), data: data.bg.map(() => 100),
barWidth: 50, barWidth: 50,
}, },
], ],
}; };
}
// 使 const setChart = () => {
onMounted(() => {
// domecharts
// var myChart = echarts.init(document.getElementById('main'));
// Vue3 // Vue3
var myChart = echarts.init(chart.value); var myChart = echarts.init(chart.value);
// init(); // vue3.2this
// 使 // 使
myChart.setOption(option); myChart.setOption(data.option);
}
// : onBeforeMount(() => {
// window.addEventListener("resize", () => { setTimeout(() => {
// myChart.resize(); data.list = props.list
// }); data.year = props.year
data.year.forEach(()=>{
data.bg.push(0)
})
getOption()
setChart()
}, 600)
}); });
</script> </script>
<style scoped> <style scoped>

View File

@ -1,131 +1,151 @@
<template> <template>
<div ref="chart" style="width: 100%;height:210px;"></div> <div ref="chart" style="width: 100%; height: 210px"></div>
</template> </template>
<script setup > <script setup >
import { onMounted, reactive, ref } from "vue"; import { onMounted, reactive, ref, onBeforeMount, defineProps } from "vue";
// echarts // echarts
import * as echarts from "echarts"; import * as echarts from "echarts";
const props = defineProps({
list: {
type: Array,
default: () => [],
},
year: {
type: Array,
default: () => [],
},
});
const chart = ref(); // DOM const chart = ref(); // DOM
const data = reactive({
list: [],
year: [],
option: {},
bg: [],
});
let option = { const getOption = () => {
tooltip: { data.option = {
trigger: "axis", tooltip: {
padding: [20, 10, 20, 10], trigger: "axis",
formatter: "{b0}<br />{a1}:{c1} ", padding: [20, 10, 20, 10],
}, formatter: "{b0}<br />{a1}:{c1} ",
grid: { },
top:'5%', grid: {
left: "1%", top: "5%",
right: "10%", left: "1%",
bottom: "3%", right: "10%",
containLabel: true, bottom: "3%",
}, containLabel: true,
},
xAxis: { xAxis: {
type: "category", type: "category",
// boundaryGap: false, // boundaryGap: false,
data: ["1月", "2月", "3月", "4月", "5月"], data: data.year,
// splitArea: { // splitArea: {
// show: true, // show: true,
// interval: '10', // interval: '10',
// areaStyle: { // areaStyle: {
// color: ["rgba(255, 255, 255, 0.10)"], // color: ["rgba(255, 255, 255, 0.10)"],
// width:10, // width:10,
// }, // },
// }, // },
axisLabel: { axisLabel: {
// //
textStyle: { textStyle: {
color: "#ffffff", 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)",
},
},
{
name: "高血压人数",
type: "line",
stack: "Total",
symbol: "emptyCircle",
symbolSize: 10,
itemStyle: {
borderColor: "#00FCFF",
borderWidth: 1,
color: "#00FCFF",
}, areaStyle: {
color: "#F4F65B",
normal: {
//线4x0,y0,x2,y2(0~1);true
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
// color: 'RGBA(184, 204, 241, 1)'
color: 'rgba(0, 252, 255, 0.50)',
},
{
offset: 1,
color: "rgba(0, 252, 255, 0)",
},
],
false
),
shadowBlur: 0, //shadowBlurshadowColor,shadowOffsetX/Y,
}, },
}, },
data: [120, 182, 191, 234, 200],
}, },
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: data.bg,
showBackground: true,
backgroundStyle: {
color: "rgba(180, 180, 180, 0.2)",
},
},
{
name: "高血压人数",
type: "line",
stack: "Total",
symbol: "emptyCircle",
// 使 symbolSize: 10,
onMounted(() => { itemStyle: {
// domecharts borderColor: "#00FCFF",
// var myChart = echarts.init(document.getElementById('main')); borderWidth: 1,
color: "#00FCFF",
},
areaStyle: {
color: "#F4F65B",
normal: {
//线4x0,y0,x2,y2(0~1);true
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
// color: 'RGBA(184, 204, 241, 1)'
color: "rgba(0, 252, 255, 0.50)",
},
{
offset: 1,
color: "rgba(0, 252, 255, 0)",
},
],
false
),
shadowBlur: 0, //shadowBlurshadowColor,shadowOffsetX/Y,
},
},
data: data.list,
},
],
};
};
const setChart = () => {
// Vue3 // Vue3
var myChart = echarts.init(chart.value); var myChart = echarts.init(chart.value);
// init(); // vue3.2this
// 使 // 使
myChart.setOption(option); myChart.setOption(data.option);
};
// : onBeforeMount(() => {
// window.addEventListener("resize", () => { setTimeout(() => {
// myChart.resize(); data.list = props.list;
// }); data.year = props.year;
data.year.forEach(() => {
data.bg.push(0);
});
getOption();
setChart();
}, 600);
}); });
</script> </script>

View File

@ -1,164 +1,189 @@
<template> <template>
<div ref="chart" style="width: 100%; height:250px;"></div> <div ref="chart" style="width: 100%; height: 250px"></div>
</template> </template>
<script setup > <script setup >
import { onMounted, reactive, ref } from "vue"; import { onMounted, reactive, ref, onBeforeMount, defineProps } from "vue";
// echarts // echarts
import * as echarts from "echarts"; import * as echarts from "echarts";
const props = defineProps({
list: {
type: Array,
default: () => [],
},
year: {
type: Array,
default: () => [],
},
});
const data = reactive({
list: [],
zgffrc: [], //
cxffrc: [], //
year: [],
option: {},
bg:[],
});
const chart = ref(); // DOM const chart = ref(); // DOM
let option = { const getOption = () => {
tooltip: { data.option = {
trigger: "axis", tooltip: {
formatter: "{b0}<br />{a0}:{c0} <br />{a1}:{c1} ", trigger: "axis",
}, formatter: "{b0}<br />{a0}:{c0} <br />{a1}:{c1} ",
legend: {
top: "6%",
right: "11%",
textStyle: {
fontSize: 12,
color: "#ffffff",
}, },
}, legend: {
grid: { top: "6%",
top:'23%', right: "11%",
left: "1%", textStyle: {
right: "10%", fontSize: 12,
bottom: "0%", color: "#ffffff",
containLabel: true, },
}, },
calculable: true, grid: {
xAxis: [ top: "23%",
{ left: "1%",
type: "category", right: "10%",
axisLabel: { bottom: "0%",
// containLabel: true,
textStyle: { },
color: "#ffffff", calculable: true,
xAxis: [
{
type: "category",
axisLabel: {
//
textStyle: {
color: "#ffffff",
},
},
data: data.year,
},
{
axisTick: false,
type: "category",
data: data.year,
axisLabel: {
show: false,
}, },
}, },
data: ["2019", "2020", "2021", "2022", "2023"], ],
},
{
axisTick: false,
type: "category",
data: ["2019", "2020", "2021", "2022", "2023"],
axisLabel: {
show: false,
},
},
],
yAxis: [ yAxis: [
{ {
type: "value", type: "value",
splitLine: { splitLine: {
show: true, show: true,
lineStyle: { lineStyle: {
color: "rgba(226, 226, 226, 0.3)", color: "rgba(226, 226, 226, 0.3)",
width: 1, width: 1,
},
},
axisLabel: {
//
textStyle: {
color: "#ffffff",
},
}, },
}, },
axisLabel: { {
// type: "value",
textStyle: { min: 0,
color: "#ffffff", max: 100,
splitLine: {
show: false,
lineStyle: {
type: "solid",
color: "rgb(221, 242, 255,0.1)",
},
},
axisLine: {
show: false,
lineStyle: {
type: "dotted",
},
},
axisLabel: {
show: false,
fontSize: 14,
fontFamily: "MicrosoftYaHei",
color: "#DEF1FF",
lineHeight: 19,
}, },
}, },
}, ],
{ series: [
type: "value", {
min: 0, name: "职工医疗保险发放人次",
max: 100, type: "bar",
splitLine: { data: data.zgffrc,
show: false, barWidth: "18%",
lineStyle: { itemStyle: {
type: "solid", color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
color: "rgb(221, 242, 255,0.1)", {
offset: 0,
color: "rgba(142, 187, 255, 1)",
},
{
offset: 1,
color: "rgba(142, 187, 255, 0.20)",
},
]),
}, },
}, },
axisLine: { {
show: false, name: "城乡医疗保险发放人次",
lineStyle: { type: "bar",
type: "dotted", data: data.cxffrc,
barWidth: "18%",
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(23, 237, 255, 1)",
},
{
offset: 1,
color: "rgba(23, 237, 255, 0.20)",
},
]),
}, },
}, },
axisLabel: { {
show: false, type: "bar",
fontSize: 14, xAxisIndex: 1,
fontFamily: "MicrosoftYaHei", yAxisIndex: 1,
color: "#DEF1FF", itemStyle: {
lineHeight: 19, color: "rgba(221, 242, 255, 0.1)",
},
data: data.bg.map(() => 100),
barWidth: 50,
}, },
}, ],
], };
series: [
{
name: "职工医疗保险发放人次",
type: "bar",
data: [2.0, 4.9, 7.0, 23.2, 25.6],
barWidth: "18%",
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(142, 187, 255, 1)",
},
{
offset: 1,
color: "rgba(142, 187, 255, 0.20)",
},
]),
},
},
{
name: "城乡医疗保险发放人次",
type: "bar",
data: [2.6, 5.9, 9.0, 26.4, 28.7],
barWidth: "18%",
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(23, 237, 255, 1)",
},
{
offset: 1,
color: "rgba(23, 237, 255, 0.20)",
},
]),
},
},
{
type: "bar",
xAxisIndex: 1,
yAxisIndex: 1,
itemStyle: {
color: "rgba(221, 242, 255, 0.1)",
},
data: ["2019", "2020", "2021", "2022", "2023"].map(() => 100),
barWidth: 50,
},
],
}; };
const setChart = () => {
// 使
onMounted(() => {
// domecharts
// var myChart = echarts.init(document.getElementById('main'));
// Vue3 // Vue3
var myChart = echarts.init(chart.value); var myChart = echarts.init(chart.value);
// init(); // vue3.2this
// 使 // 使
myChart.setOption(option); myChart.setOption(data.option);
};
// : onBeforeMount(() => {
// window.addEventListener("resize", () => { setTimeout(() => {
// myChart.resize(); data.list = props.list;
// }); data.year = props.year;
data.list.forEach((item) => {
data.zgffrc.push(item.zgffrc);
data.cxffrc.push(item.cxffrc);
data.bg.push("");
})
getOption();
setChart();
}, 600);
}); });
</script> </script>

View File

@ -1,121 +1,142 @@
<template> <template>
<div ref="chart" style="width: 100%; height:250px;"></div> <div ref="chart" style="width: 100%; height: 250px"></div>
</template> </template>
<script setup > <script setup >
import { onMounted, reactive, ref } from "vue"; import { onMounted, reactive, ref, onBeforeMount, defineProps } from "vue";
// echarts // echarts
import * as echarts from "echarts"; import * as echarts from "echarts";
const props = defineProps({
list: {
type: Array,
default: () => [],
},
year: {
type: Array,
default: () => [],
},
});
const data = reactive({
list: [],
zgffje: [], //
cxffje: [], //
year: [],
option: {},
bg: [],
});
const chart = ref(); // DOM const chart = ref(); // DOM
let option = { const getOption = () => {
tooltip: { data.option = {
trigger: "axis", tooltip: {
padding: [20, 10, 20, 10], trigger: "axis",
formatter: "{b0}<br />{a1}:{c1} <br />{a2}:{c2} ", padding: [20, 10, 20, 10],
}, formatter: "{b0}<br />{a1}:{c1} <br />{a2}:{c2} ",
legend: {
data: ["职工医疗保险金额", "城乡医疗保险金额"],
top: "6%",
right: "11%",
textStyle: {
fontSize: 12,
color: "#ffffff",
}, },
}, legend: {
grid: { data: ["职工医疗保险金额", "城乡医疗保险金额"],
top:'23%', top: "6%",
left: "1%", right: "11%",
right: "10%",
bottom: "3%",
containLabel: true,
},
xAxis: {
type: "category",
// boundaryGap: false,
data: ["1月", "2月", "3月", "4月", "5月"],
axisLabel: {
//
textStyle: { textStyle: {
fontSize: 12,
color: "#ffffff", color: "#ffffff",
}, },
}, },
}, grid: {
yAxis: { top: "23%",
type: "value", left: "1%",
splitLine: { right: "10%",
show: true, bottom: "3%",
lineStyle: { containLabel: true,
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)",
},
},
{
name: "职工医疗保险金额",
type: "line",
stack: "Total",
symbol: "emptyCircle",
symbolSize: 10, xAxis: {
itemStyle: { type: "category",
borderColor: "#00FCFF", // boundaryGap: false,
borderWidth: 1, data: data.year,
color: "#00FCFF", axisLabel: {
//
textStyle: {
color: "#ffffff",
},
}, },
data: [120, 132, 101, 134, 90],
}, },
{ yAxis: {
name: "城乡医疗保险金额", type: "value",
type: "line", splitLine: {
stack: "Total", show: true,
symbol: "emptyCircle", lineStyle: {
color: "rgba(226, 226, 226, 0.3)",
symbolSize: 10, width: 1,
itemStyle: { },
borderColor: "#2468FF", },
borderWidth: 1, axisLabel: {
color: "#2468FF", //
textStyle: {
color: "#ffffff",
},
}, },
data: [150, 232, 201, 154, 190],
}, },
], series: [
{
name: "背景",
type: "bar",
data: data.bg,
showBackground: true,
backgroundStyle: {
color: "rgba(180, 180, 180, 0.2)",
},
},
{
name: "职工医疗保险金额",
type: "line",
symbol: "emptyCircle",
symbolSize: 10,
itemStyle: {
borderColor: "#00FCFF",
borderWidth: 1,
color: "#00FCFF",
},
data: data.zgffje,
},
{
name: "城乡医疗保险金额",
type: "line",
symbol: "emptyCircle",
symbolSize: 10,
itemStyle: {
borderColor: "#2468FF",
borderWidth: 1,
color: "#2468FF",
},
data: data.cxffje,
},
],
};
}; };
const setChart = () => {
// 使
onMounted(() => {
// domecharts
// var myChart = echarts.init(document.getElementById('main'));
// Vue3 // Vue3
var myChart = echarts.init(chart.value); var myChart = echarts.init(chart.value);
// init(); // vue3.2this
// 使 // 使
myChart.setOption(option); myChart.setOption(data.option);
};
// : onBeforeMount(() => {
// window.addEventListener("resize", () => { setTimeout(() => {
// myChart.resize(); data.list = props.list;
// }); data.year = props.year;
data.list.forEach((item) => {
data.zgffje.push(item.zgffje);
data.cxffje.push(item.cxffje);
data.bg.push("");
});
getOption();
setChart();
}, 600);
}); });
</script> </script>

View File

@ -3,13 +3,30 @@
</template> </template>
<script setup > <script setup >
import { onMounted, reactive, ref } from "vue"; import { onMounted, reactive, ref,onBeforeMount,defineProps } from "vue";
// echarts // echarts
import * as echarts from "echarts"; import * as echarts from "echarts";
const chart = ref(); // DOM const props = defineProps({
list: {
type: Array,
default: () => [],
},
year:{
type: Array,
default: () => [],
}
});
const data= reactive({
list:[],
year:[],
option:{},
bg:[],
})
let option = { const chart = ref(); // DOM
const getOption = () => {
data.option = {
tooltip: { tooltip: {
trigger: "axis", trigger: "axis",
padding: [20, 10, 20, 10], padding: [20, 10, 20, 10],
@ -26,7 +43,7 @@ let option = {
xAxis: { xAxis: {
type: "category", type: "category",
// boundaryGap: false, // boundaryGap: false,
data: ["1月", "2月", "3月", "4月", "5月"], data: data.year,
// splitArea: { // splitArea: {
// show: true, // show: true,
// interval: '10', // interval: '10',
@ -62,7 +79,7 @@ let option = {
{ {
name: "背景", name: "背景",
type: "bar", type: "bar",
data: [0, 0, 0, 0, 0], data: data.bg,
showBackground: true, showBackground: true,
backgroundStyle: { backgroundStyle: {
color: "rgba(180, 180, 180, 0.2)", color: "rgba(180, 180, 180, 0.2)",
@ -106,27 +123,31 @@ let option = {
shadowBlur: 0, //shadowBlurshadowColor,shadowOffsetX/Y, shadowBlur: 0, //shadowBlurshadowColor,shadowOffsetX/Y,
}, },
}, },
data: [120, 182, 191, 234, 200], data: data.list,
}, },
], ],
}; };
}
// 使 const setChart = () => {
onMounted(() => {
// domecharts
// var myChart = echarts.init(document.getElementById('main'));
// Vue3 // Vue3
var myChart = echarts.init(chart.value); var myChart = echarts.init(chart.value);
// init(); // vue3.2this
// 使 // 使
myChart.setOption(option); myChart.setOption(data.option);
}
// : onBeforeMount(() => {
// window.addEventListener("resize", () => { setTimeout(() => {
// myChart.resize(); data.list = props.list
// }); data.year = props.year
data.year.forEach(()=>{
data.bg.push(0)
})
getOption()
setChart()
}, 600)
}); });
</script> </script>
<style scoped> <style scoped>

View File

@ -30,16 +30,16 @@
/> />
</span> </span>
</div> </div>
<ePie v-if="leftchoose.first == '1'"></ePie> <ePie v-if="leftchoose.first == '1'" :list='data.medicalInsurance.ffrc' :year='data.medicalInsurance.year'></ePie>
<ePie2 v-else></ePie2> <ePie2 v-else :list='data.medicalInsurance.ffje' :year='data.medicalInsurance.year'></ePie2>
</div> </div>
<div class="flex1" style="margin-top: 10px"> <div class="flex1" style="margin-top: 10px">
<div class="yd_title left_3"></div> <div class="yd_title left_3"></div>
<div class="sm_title_1"></div> <div class="sm_title_1"></div>
<tnb></tnb> <tnb :list='data.lmb.tnbrs' :year='data.lmb.year'></tnb>
<div class="sm_title_2"></div> <div class="sm_title_2"></div>
<gxy></gxy> <gxy :list='data.lmb.gxyrs' :year='data.lmb.year'></gxy>
</div> </div>
</div> </div>
<div class="displayFlex center_bg"> <div class="displayFlex center_bg">
@ -51,7 +51,7 @@
<div class="right"> <div class="right">
<div class="right_top">门急诊人次</div> <div class="right_top">门急诊人次</div>
<img src="@/assets/images/hygiene/jt.png" class="right_center" /> <img src="@/assets/images/hygiene/jt.png" class="right_center" />
<div class="right_bottom">867.371</div> <div class="right_bottom">{{data.mz.mjzrc}}</div>
</div> </div>
</div> </div>
<div class="item"> <div class="item">
@ -59,7 +59,7 @@
<div class="right"> <div class="right">
<div class="right_top">住院人数</div> <div class="right_top">住院人数</div>
<img src="@/assets/images/hygiene/jt.png" class="right_center" /> <img src="@/assets/images/hygiene/jt.png" class="right_center" />
<div class="right_bottom">6.723</div> <div class="right_bottom">{{data.mz.zyrs}}</div>
</div> </div>
</div> </div>
</div> </div>
@ -96,7 +96,7 @@
<div class="yd_title familyPlanning"></div> <div class="yd_title familyPlanning"></div>
<!-- 计划生育 --> <!-- 计划生育 -->
<!-- <div style="width: 100%; "> --> <!-- <div style="width: 100%; "> -->
<eP5></eP5> <eP5 :list='data.jsbgl'></eP5>
<!-- </div> --> <!-- </div> -->
</div> </div>
</div> </div>
@ -105,12 +105,12 @@
<div class="yd_title mechanism"></div> <div class="yd_title mechanism"></div>
<div class="history"> <div class="history">
<div class="history1"> <div class="history1">
<div class="va">2048</div> <div class="va">{{data.fyglrs.ycfrc}}</div>
<img src="@/assets/images/hygiene/yf.png" alt="" /> <img src="@/assets/images/hygiene/yf.png" alt="" />
<div class="historyimg">孕产妇系统管理人数</div> <div class="historyimg">孕产妇系统管理人数</div>
</div> </div>
<div class="history1"> <div class="history1">
<div class="va">21810</div> <div class="va">{{data.fyglrs.etrs}}</div>
<img src="@/assets/images/hygiene/et.png" alt="" /> <img src="@/assets/images/hygiene/et.png" alt="" />
<div class="historyimg">0-6岁儿童系统管理人数</div> <div class="historyimg">0-6岁儿童系统管理人数</div>
</div> </div>
@ -118,12 +118,12 @@
</div> </div>
<div class="flex1" style="flex: 1.1"> <div class="flex1" style="flex: 1.1">
<div class="yd_title service"></div> <div class="yd_title service"></div>
<eP7></eP7> <eP7 :list='data.jktj.jktjrs' :year='data.jktj.year'></eP7>
</div> </div>
<div class="flex1"> <div class="flex1">
<div class="yd_title last"></div> <div class="yd_title last"></div>
<div class="table"> <div class="table">
<div class="item" v-for="i in 15"> <div class="item" v-for="i in data.jkhd">
3月2日健康日在龙中公园进行健康活动宣 3月2日健康日在龙中公园进行健康活动宣
</div> </div>
</div> </div>
@ -144,7 +144,8 @@ import eP4 from "./echarts_hygiene/eP4.vue";
import eP4_1 from "./echarts_hygiene/eP4_1.vue"; import eP4_1 from "./echarts_hygiene/eP4_1.vue";
import tnb from "./echarts_hygiene/tnb.vue"; import tnb from "./echarts_hygiene/tnb.vue";
import gxy from "./echarts_hygiene/gxy.vue"; import gxy from "./echarts_hygiene/gxy.vue";
import { ref, onMounted, onBeforeMount } from "vue"; import { ref,reactive, onMounted, onBeforeMount } from "vue";
import http from "@/utils/request.js";
const leftchoose = ref({ const leftchoose = ref({
first: "1", first: "1",
second: "1", second: "1",
@ -153,6 +154,33 @@ const leftchoose = ref({
const change = (name, index) => { const change = (name, index) => {
leftchoose.value[name] = index; leftchoose.value[name] = index;
}; };
const data = reactive({
medicalInsurance:{},//
lmb:{},//
mz:{},//
jkda:[],//
jsbgl:[],//
fyglrs:{},//
jktj:{},//65
jkhd:[],//
})
onBeforeMount(() => {
getData();
});
const getData = () => {
http.get("/api/ggfwyth/health").then((res) => {
if (res.code == 200) {
data.medicalInsurance = res.data.medicalInsurance;
data.lmb = res.data.lmb;
data.mz = res.data.mz;
// data.jkda = res.data.jkda;
data.jsbgl = res.data.jsbgl;
data.fyglrs = res.data.fyglrs;
data.jktj = res.data.jktj;
data.jkhd = res.data.jkhd;
}
});
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>