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

This commit is contained in:
lnn19986213 2024-06-18 09:26:12 +08:00
commit ff0421bc3b
6 changed files with 482 additions and 460 deletions

View File

@ -44,12 +44,7 @@
<span> {{ item.name }}</span> <span> {{ item.name }}</span>
</div> </div>
</div> </div>
<eP2 <eP2 :list="data.DataViewing" :year="data.leftCenterYear"></eP2>
:list="data.DataViewing"
:list1="data.leftCenter3"
:list2="data.leftCenter4"
:year="data.leftCenterYear"
></eP2>
</div> </div>
</div> </div>
</div> </div>
@ -65,7 +60,7 @@
<div class="minTopNum"> <div class="minTopNum">
<div <div
class="numItem" class="numItem"
v-for="(item, inex) in minData.minTop" v-for="(item, index) in minData.minTop"
:key="index" :key="index"
> >
{{ item }} {{ item }}
@ -136,7 +131,14 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted, onBeforeMount, computed } from "vue"; import {
ref,
reactive,
onMounted,
onBeforeMount,
onBeforeUnmount,
computed,
} from "vue";
import right2 from "./echart_analyze/right2.vue"; import right2 from "./echart_analyze/right2.vue";
import right1 from "./echart_analyze/right1.vue"; import right1 from "./echart_analyze/right1.vue";
import http from "@/utils/request.js"; import http from "@/utils/request.js";
@ -170,7 +172,7 @@ const data = reactive({
{ {
name: "医保支出万元以上", name: "医保支出万元以上",
value: "11112", value: "11112",
show: false, show: true,
data: ["100", "120", "199", "133", "210"], // data: ["100", "120", "199", "133", "210"], //
}, },
{ {
@ -189,19 +191,19 @@ const data = reactive({
name: "糖尿病", name: "糖尿病",
value: "1241", value: "1241",
show: false, show: false,
data: ["100", "120", "199", "133", "210"], //尿 data: ["100", "120", "19", "133", "210"], //尿
}, },
{ {
name: "高血脂", name: "高血脂",
value: "1414", value: "1414",
show: false, show: false,
data: ["100", "120", "199", "133", "210"], // data: ["100", "120", "199", "13", "210"], //
}, },
{ {
name: "高血糖", name: "高血糖",
value: "2355", value: "2355",
show: false, show: false,
data: ["100", "120", "199", "133", "210"], // data: ["100", "120", "199", "133", "10"], //
}, },
{ {
name: "残疾", name: "残疾",
@ -228,11 +230,16 @@ const data = reactive({
data: ["100", "120", "199", "133", "210"], // data: ["100", "120", "199", "133", "210"], //
}, },
], ],
DataViewing: {}, // DataViewing: [
leftCenter1: ["100", "120", "199", "133", "210"], // {
leftCenter3: ["100", "80", "199", "133", "210"], // name: "医保支出万元以上",
leftCenter4: ["100", "120", "199", "133", "210"], //尿 data: ["100", "120", "199", "133", "210"], //
},
], //
leftCenterYear: ["2019", "2020", "2021", "2022", "2023"], // leftCenterYear: ["2019", "2020", "2021", "2022", "2023"], //
// leftCenter1: ["100", "120", "199", "133", "210"], //
// leftCenter3: ["100", "80", "199", "133", "210"], //
// leftCenter4: ["100", "120", "199", "133", "210"], //尿
zccs1: ["图书馆", "交通出行", "景区"], // zccs1: ["图书馆", "交通出行", "景区"], //
zccs2: ["100", "130", "220"], // zccs2: ["100", "130", "220"], //
@ -255,51 +262,48 @@ const minData = reactive({
}); });
// //
const onViewData = (value, i) => { const onViewData = (value, i) => {
clearInterval(interval); //
data.ViewData[i].show = !data.ViewData[i].show; data.ViewData[i].show = !data.ViewData[i].show;
data.DataViewing = data.ViewData.filter((item) => item.show).map((item) => ({ data.DataViewing = data.ViewData.filter((item) => item.show).map((item) => ({
name: item.name, name: item.name,
data: item.data, data: item.data,
})); }));
console.log(data.DataViewing, 666);
// switch (value) {
// case "":
// data.ViewData[i].show = !data.ViewData[i].show;
// break;
// case "":
// data.ViewData[i].show = true;
// break;
// case "":
// data.ViewData[i].show = true;
// break;
// case "尿":
// data.ViewData[i].show = true;
// break;
// case "":
// data.ViewData[i].show = true;
// break;
// case "":
// data.ViewData[i].show = true;
// break;
// case "":
// data.ViewData[i].show = true;
// break;
// case "":
// data.ViewData[i].show = true;
// break;
// case "":
// data.ViewData[i].show = true;
// break;
// case "":
// data.ViewData[i].show = true;
// break;
// default:
// break;
// }
}; };
onMounted(() => {}); const onViewData1 = (i) => {
data.ViewData[i].show = !data.ViewData[i].show;
data.DataViewing = data.ViewData.filter((item) => item.show).map((item) => ({
name: item.name,
data: item.data,
}));
};
let interval;
let currentIndex = ref(0);
const toggleShow = () => {
const length = data.ViewData.length;
if (length === 0) return;
const current = currentIndex.value;
const nextIndex = (currentIndex.value + 1) % length;
// show
// data.ViewData[current].show = !data.ViewData[current].show;
data.ViewData[nextIndex].show = !data.ViewData[nextIndex].show;
onViewData1(current);
currentIndex.value = nextIndex;
};
const startAutoSwitching = () => {
interval = setInterval(toggleShow, 6000); // 6
};
onMounted(() => {
startAutoSwitching();
});
onBeforeMount(() => {}); onBeforeMount(() => {});
onBeforeUnmount(() => {
clearInterval(interval); //
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -569,8 +573,10 @@ onBeforeMount(() => {});
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
color: #ffffff; color: #ffffff;
margin-top: 14px;
.ViewDataTop { .ViewDataTop {
width: 114px; width: 114px;
height: 132px;
display: flex; display: flex;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
@ -581,9 +587,10 @@ onBeforeMount(() => {});
background-size: 100% 100%; background-size: 100% 100%;
width: 80px; width: 80px;
height: 80px; height: 80px;
margin-bottom: -24px; margin-bottom: -28px;
text-align: center; text-align: center;
line-height: 100px; line-height: 100px;
animation: moveUpDown 2s infinite;
} }
.ViewDataTopimg_1 { .ViewDataTopimg_1 {
background-image: url(@/assets/images/sjfx/sjfx1.png); background-image: url(@/assets/images/sjfx/sjfx1.png);
@ -594,18 +601,31 @@ onBeforeMount(() => {});
} }
.ViewDataBottomimg { .ViewDataBottomimg {
background-image: url(@/assets/images/sjfx/sjfx2.png); background-image: url(@/assets/images/sjfx/sjfx2.png);
background-repeat: no-repeat; animation: scaleUpDown 2s infinite;
background-size: 100% 100%; // transform: scale(1.3);
width: 80px;
height: 80px;
margin-bottom: -24px;
} }
.ViewDataBottomimg_1 { .ViewDataBottomimg_1 {
background-image: url(@/assets/images/sjfx/sjfx3.png); background-image: url(@/assets/images/sjfx/sjfx3.png);
background-repeat: no-repeat; margin-top: 4px;
background-size: 100% 100%; }
width: 105px;
height: 57px; @keyframes moveUpDown {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-10px);
}
}
@keyframes scaleUpDown {
0%,
100% {
transform: scale(1);
}
50% {
transform: scale(1.1);
}
} }
} }
} }

View File

@ -1,41 +1,25 @@
<template> <template>
<div ref="chart" style="width: 100%; height: 260px"></div> <div ref="chart" style="width: 100%; height: 320px"></div>
</template> </template>
<script setup> <script setup>
import { onBeforeMount, reactive, ref, watch } from "vue"; import { onMounted, reactive, ref, watch } from "vue";
// echarts
import * as echarts from "echarts"; import * as echarts from "echarts";
const chart = ref(); // DOM const chart = ref();
const clear = ref(false);
const props = defineProps({ const props = defineProps({
list: { list: Array,
type: Array, year: Array,
default: () => {
return [];
},
},
list1: {
type: Array,
default: () => {
return [];
},
},
list2: {
type: Array,
default: () => {
return [];
},
},
year: {
type: Array,
default: () => {
return [];
},
},
}); });
const ser = ref([
const data = reactive({
list: [],
year: [],
option: {},
name: [],
formatter: "{b0}<br />",
series: [
{ {
name: "背景", name: "背景",
type: "bar", type: "bar",
@ -45,37 +29,85 @@ const ser = ref([
color: "rgba(180, 180, 180, 0.2)", color: "rgba(180, 180, 180, 0.2)",
}, },
}, },
]); ],
const data = reactive({ legend: {
list: [],
list1: [],
list2: [],
year: [],
option: {},
bg: [],
name: [],
ser: [],
len: {
data: [], data: [],
top: "5%", top: "3%",
right: "10%", right: "5%",
textStyle: { textStyle: {
fontSize: 16, fontSize: 16,
color: "#ffffff", color: "#ffffff",
}, },
}, },
bgColor: [
"#2468FF",
"#E8FF00",
"#FF5733",
"#33FF57",
"#3357FF",
"#FF33A1",
"#57FF33",
"#33FFA1",
"#A133FF",
"#FF5733",
],
}); });
const updateSeries = () => {
data.series = [
{
name: "背景",
type: "bar",
data: data.year.map(() => 0),
showBackground: true,
backgroundStyle: {
color: "rgba(180, 180, 180, 0.2)",
},
},
];
if (data.list.length > 0) {
data.list.forEach((item, index) => {
const color = data.bgColor[index % data.bgColor.length];
data.series.push({
yAxisIndex: 0,
name: item.name,
type: "line",
symbol: "emptyCircle",
symbolSize: 10,
itemStyle: {
borderColor: color,
borderWidth: 1,
color: color,
},
label: {
show: true,
color: color,
formatter: (data) => data.value,
},
data: item.data,
});
});
}
data.legend.data = data.list.map((item) => item.name);
data.formatter =
"{b0}<br />" +
data.list
.map((_, index) => `{a${index + 1}}:{c${index + 1}}<br />`)
.join("");
};
const getOption = () => { const getOption = () => {
data.option = { data.option = {
tooltip: { tooltip: {
trigger: "axis", trigger: "axis",
padding: [20, 10, 20, 10], padding: [20, 10, 20, 10],
formatter: "{b0}<br />{a1}:{c1} <br />{a2}:{c2}", formatter: data.formatter,
}, },
legend: data.len, legend: data.legend,
grid: { grid: {
top: "25%", top: "35%",
left: "6%", left: "6%",
right: "6%", right: "6%",
bottom: "3%", bottom: "3%",
@ -85,13 +117,10 @@ const getOption = () => {
type: "category", type: "category",
data: data.year, data: data.year,
axisLabel: { axisLabel: {
//
textStyle: {
color: "#ffffff", color: "#ffffff",
fontSize: 16, fontSize: 16,
}, },
}, },
},
yAxis: [ yAxis: [
{ {
type: "value", type: "value",
@ -104,24 +133,13 @@ const getOption = () => {
width: 1, width: 1,
}, },
}, },
min: 0, // Y min: 0,
max: function (value) { max: (value) =>
// Y Math.ceil(Math.max(value.max, value.max * 1.2) / 50) * 50,
return Math.ceil(Math.max(value.max, value.max * 1.2) / 50) * 50;
},
nameTextStyle: { nameTextStyle: {
// Y fontSize: 14,
fontSize: 14, // 20
}, },
// axisLabel: {
// //
// textStyle: {
// color: "#ffffff",
// fontSize: 16,
// },
// },
axisLine: { axisLine: {
//y线
show: false, show: false,
lineStyle: { lineStyle: {
color: "#ffffff", color: "#ffffff",
@ -133,7 +151,6 @@ const getOption = () => {
}, },
{ {
type: "value", type: "value",
// name: "尿",
splitLine: { splitLine: {
show: false, show: false,
lineStyle: { lineStyle: {
@ -142,21 +159,16 @@ const getOption = () => {
width: 1, width: 1,
}, },
}, },
min: 0, // Y min: 0,
max: function (value) { max: (value) =>
// Y Math.ceil(Math.max(value.max, value.max * 1.6) / 50) * 50,
return Math.ceil(Math.max(value.max, value.max * 1.6) / 50) * 50;
},
nameTextStyle: { nameTextStyle: {
// Y fontSize: 14,
fontSize: 14, // 20
}, },
axisLabel: { axisLabel: {
show: false, show: false,
//
}, },
axisLine: { axisLine: {
//y线
show: false, show: false,
lineStyle: { lineStyle: {
color: "#ffffff", color: "#ffffff",
@ -167,66 +179,39 @@ const getOption = () => {
}, },
}, },
], ],
series: data.ser, series: data.series,
}; };
}; };
const setChart = () => { const setChart = () => {
var myChart = echarts.init(chart.value); const myChart = echarts.init(chart.value);
if (clear.value) {
myChart.clear();
}
myChart.setOption(data.option); myChart.setOption(data.option);
}; };
const setChart1 = () => {
data.ser = ser.value;
if (data.name.length > 0) {
data.list.forEach((item) => {
data.ser.push({
yAxisIndex: 0,
name: item.name,
type: "line",
symbol: "emptyCircle",
symbolSize: 10,
itemStyle: {
borderColor: "#2468FF",
borderWidth: 1,
color: "#2468FF",
},
label: {
show: true,
color: "#2468FF",
formatter: function (data) {
return data.value;
},
},
data: item.data,
});
});
}
};
//
watch( watch(
() => props.list, () => props.list,
(newVal, oldVal) => { (newVal, oldVal) => {
if (newVal.length < oldVal.length) {
clear.value = true;
} else {
clear.value = false;
}
data.list = newVal; data.list = newVal;
data.name = props.list.map((item) => item.name); updateSeries();
data.len.data=data.name; getOption();
// console.log(55555, data.name);
setChart1();
setChart(); setChart();
} }
); );
// 使
onBeforeMount(() => { onMounted(() => {
setTimeout(() => {
data.list = props.list; data.list = props.list;
data.year = props.year; data.year = props.year;
ser.value[0].data = data.year.map((item) => 0); updateSeries();
setChart1();
getOption(); getOption();
setChart(); setChart();
}, 600);
}); });
</script> </script>

View File

@ -115,7 +115,7 @@ let option = {
// formatter: '{c}%' // // formatter: '{c}%' //
}, // }, //
itemStyle: { itemStyle: {
normal: { // normal: {
borderWidth: 1, borderWidth: 1,
// borderColor: "rgba(0, 183, 255, 1)", // borderColor: "rgba(0, 183, 255, 1)",
borderRadius: [0, 0, 50, 0], // borderRadius: [0, 0, 50, 0], //
@ -123,7 +123,7 @@ let option = {
{ offset: 0, color: "rgba(0, 183, 255, 0)" }, { offset: 0, color: "rgba(0, 183, 255, 0)" },
{ offset: 1, color: "rgba(0, 183, 255, 1)" }, { offset: 1, color: "rgba(0, 183, 255, 1)" },
]), ]),
}, // },
}, },
barWidth: 10, barWidth: 10,
data: data2, data: data2,

View File

@ -10,7 +10,6 @@ import * as echarts from "echarts";
const chart = ref(); // DOM const chart = ref(); // DOM
const colors = [ const colors = [
{ {
left: "rgba(234, 162, 57, .16)", left: "rgba(234, 162, 57, .16)",
right: "rgba(234, 162, 57, .6)", right: "rgba(234, 162, 57, .6)",
@ -32,11 +31,13 @@ const colors = [
bottom: "rgba(60, 143, 255, .46)", bottom: "rgba(60, 143, 255, .46)",
front: "rgba(60, 143, 255, .66)", front: "rgba(60, 143, 255, .66)",
}, },
]; ];
const maxList = [90, 90, 90, 90, 90, 90, 90]; const maxList = ref([]);
const valueList = [20, 53, 47, 65, 29, 11, 50]; const valueList = [20, 53, 47, 65, 29, 11, 10];
const data = reactive({
option: {},
Max: 100,
});
// 5: // 5:
//c0:c1,c2:c3 //c0:c1,c2:c3
// -ok rgba(103, 180, 233, 0.04) // -ok rgba(103, 180, 233, 0.04)
@ -145,8 +146,8 @@ echarts.graphic.registerShape("CubeFront_1", CubeFront_1);
echarts.graphic.registerShape("CubeRight_1", CubeRight_1); echarts.graphic.registerShape("CubeRight_1", CubeRight_1);
echarts.graphic.registerShape("CubeTop_1", CubeTop_1); echarts.graphic.registerShape("CubeTop_1", CubeTop_1);
echarts.graphic.registerShape("CubeBottom_1", CubeBottom_1); echarts.graphic.registerShape("CubeBottom_1", CubeBottom_1);
const getOption = () => {
const option = { data.option = {
tooltip: { tooltip: {
trigger: "axis", trigger: "axis",
formatter: "{b0}:{c1}", formatter: "{b0}:{c1}",
@ -183,7 +184,6 @@ const option = {
color: "#fff", color: "#fff",
fontSize: 16, fontSize: 16,
formatter: function (value) { formatter: function (value) {
return value.length > 3 ? value.slice(0, 2) + "..." : value; return value.length > 3 ? value.slice(0, 2) + "..." : value;
}, },
}, },
@ -216,7 +216,8 @@ const option = {
], ],
yAxis: { yAxis: {
min: 0, min: 0,
max: 100, // max: 200,
max: data.Max,
interval: 20, interval: 20,
type: "value", type: "value",
axisLine: { axisLine: {
@ -314,7 +315,7 @@ const option = {
], ],
}; };
}, },
data: maxList, data: maxList.value,
}, },
{ {
type: "custom", type: "custom",
@ -410,7 +411,7 @@ const option = {
position: "top", position: "top",
color: "#ffffff", color: "#ffffff",
formatter: function (data) { formatter: function (data) {
return data.value -5; return data.value - 5;
}, },
}, },
itemStyle: { itemStyle: {
@ -421,14 +422,28 @@ const option = {
barWidth: 20, barWidth: 20,
}, },
], ],
};
};
const setChart = () => {
var myChart = echarts.init(chart.value);
myChart.setOption(data.option);
};
const getMaxCeilingValue = (arr) => {
let max = Math.max(...arr);
return Math.ceil(max / 100) * 100;
}; };
onMounted(() => { onBeforeMount(() => {
var myChart = echarts.init(chart.value); setTimeout(() => {
data.Max = getMaxCeilingValue(valueList);
myChart.setOption(option); maxList.value = valueList.map((item) => data.Max * 0.9);
getOption();
setChart();
}, 600);
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
</style> </style>

View File

@ -179,7 +179,7 @@ const getOption = () => {
barMaxWidth: 20, // barMaxWidth: 20, //
barMinWidth: 5, // barMinWidth: 5, //
itemStyle: { itemStyle: {
normal: { // normal: {
borderWidth: 1, borderWidth: 1,
borderColor: "rgba(0, 183, 255, 1)", borderColor: "rgba(0, 183, 255, 1)",
borderRadius: [0, 0, 50, 0], // borderRadius: [0, 0, 50, 0], //
@ -187,7 +187,7 @@ const getOption = () => {
{ offset: 0, color: "rgba(26, 255, 217, 0)" }, { offset: 0, color: "rgba(26, 255, 217, 0)" },
{ offset: 1, color: "rgba(0, 183, 255, 1)" }, { offset: 1, color: "rgba(0, 183, 255, 1)" },
]), ]),
}, // },
}, },
label: { label: {
show: true, show: true,

View File

@ -176,7 +176,7 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted, onBeforeMount, computed } from "vue"; import { ref, reactive, onMounted, onBeforeMount,onBeforeUnmount, computed } from "vue";
import eP1 from "./echarts_work/eP1.vue"; import eP1 from "./echarts_work/eP1.vue";
import eP2 from "./echarts_work/eP2.vue"; import eP2 from "./echarts_work/eP2.vue";
import eP3 from "./echarts_work/eP3.vue"; import eP3 from "./echarts_work/eP3.vue";
@ -449,6 +449,8 @@ onMounted(() => {
onBeforeMount(() => { onBeforeMount(() => {
getData(); getData();
});
onBeforeUnmount(() => {
clearInterval(interval); // clearInterval(interval); //
}); });
</script> </script>