This commit is contained in:
duanxiaohai 2024-06-05 13:10:44 +08:00
parent 7ae45b21cc
commit 1f62119765
2 changed files with 263 additions and 107 deletions

View File

@ -0,0 +1,193 @@
<template>
<div ref="chart" style="width: 50%; height: 280px"></div>
</template>
<script setup>
import { onBeforeMount, onMounted, reactive, ref } from "vue";
// echarts
import * as echarts from "echarts";
const props = defineProps({
list: {
type: Array,
default: () => {
return [];
},
},
});
const chart = ref(); // DOM
const data = reactive({
list: [[], []],
list1: [],
option: {},
initialLegendData: ["县镇", "农村"],
initialLegendData1: ["副高级", "正高级", "未定级", "员级", "中级", "助理级"],
});
const getOption = () => {
data.option = {
tooltip: {
trigger: "axis",
formatter: "{b0}<br/>{a}:{c} <br/>{a1}:{c1} ",
},
legend: {
data: data.initialLegendData,
top: "8%",
right: "11%",
textStyle: {
fontSize: 16,
color: "#ffffff",
},
},
grid: {
left: "1%",
right: "10%",
bottom: "0%",
containLabel: true,
},
calculable: true,
xAxis: [
{
type: "value",
axisLabel: {
//
textStyle: {
color: "#ffffff",
fontSize: 16,
},
},
axisLine: {
//y线
show: false, // x线
},
splitLine: {
show: false, //---grid 线
},
axisTick: {
show: false, //
},
},
],
yAxis: [
{
type: "category",
splitLine: {
show: true,
lineStyle: {
color: "rgba(226, 226, 226, 0.3)",
width: 1,
},
},
axisTick: {
show: false, //
},
axisLabel: {
//
textStyle: {
color: "#ffffff",
fontSize: 16,
},
},
data: data.initialLegendData1,
},
],
series: [
{
z: 1,
name: "县镇",
barGap: "-50%",
type: "bar",
data: data.list[1],
barWidth: "25%", //
barGap: 1 /*多个并排柱子设置柱子之间的间距*/,
label: {
show: true,
position: "inside",
color: "#ffffff",
formatter: function (data) {
return data.value;
},
},
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(254, 255, 142, 1)",
},
{
offset: 1,
color: "rgba(251, 255, 142, 0.20)",
},
]),
},
},
{
z: 2,
name: "农村",
type: "bar",
barGap: "-50%",
data: data.list[0],
barWidth: "25%", //
barGap: 1 /*多个并排柱子设置柱子之间的间距*/,
label: {
show: true,
position: "inside",
color: "#ffffff",
formatter: function (data) {
return data.value;
},
},
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(23, 255, 206, 1)",
},
{
offset: 1,
color: "rgba(23, 255, 202, 0.20)",
},
]),
},
},
],
};
};
const setChart = () => {
// Vue3
var myChart = echarts.init(chart.value);
// 使
myChart.setOption(data.option);
};
const setChart1 = () => {
data.list[0].push(data.list1.xzjszcsl.xzfgj); //
data.list[0].push(data.list1.xzjszcsl.xzzgj); //
data.list[0].push(data.list1.xzjszcsl.xzwdj); //
data.list[0].push(data.list1.xzjszcsl.xzyj); //
data.list[0].push(data.list1.xzjszcsl.xzzj); //
data.list[0].push(data.list1.xzjszcsl.xzzlj); //
data.list[1].push(data.list1.ncjszcsl.ncfgj); //
data.list[1].push(data.list1.ncjszcsl.nczgj); //
data.list[1].push(data.list1.ncjszcsl.ncwdj); //
data.list[1].push(data.list1.ncjszcsl.nczlj); //
data.list[1].push(data.list1.ncjszcsl.ncyj); //
data.list[1].push(data.list1.ncjszcsl.ncwdj); //
console.log(data.list, "乡镇1");
};
// 使
onBeforeMount(() => {
setTimeout(() => {
data.list1 = props.list;
// console.log(data.list1, "");
setChart1();
getOption();
setChart();
}, 600);
});
</script>
<style scoped></style>

View File

@ -11,11 +11,7 @@
<eP1 :list="data.xsql"></eP1> <eP1 :list="data.xsql"></eP1>
<div class="t_1"></div> <div class="t_1"></div>
<div class="t_2"> <div class="t_2">
<div <div class="t_2_1" v-for="(item, index) in data.zdgz" :key="index">
class="t_2_1"
v-for="(item, index) in data.zdgz"
:key="index"
>
<div class="top">{{ item.value }}</div> <div class="top">{{ item.value }}</div>
<div class="t_3"> <div class="t_3">
<div :class="item.cls"></div> <div :class="item.cls"></div>
@ -24,10 +20,7 @@
</div> </div>
</div> </div>
</div> </div>
<div <div class="flex1" style="margin-top: 30px">
class="flex1"
style="margin-top: 30px"
>
<div class="yd_title left_2"> <div class="yd_title left_2">
<div class="animate-border"> <div class="animate-border">
<i></i> <i></i>
@ -97,16 +90,8 @@
</div> </div>
</div> </div>
<div class="schoolb"> <div class="schoolb">
<img <img src="../assets/eduImg/xxgkTop.png" class="gkTop" alt="" />
src="../assets/eduImg/xxgkTop.png" <img src="../assets/eduImg/xxgk.gif" class="gkMove" alt="" />
class="gkTop"
alt=""
>
<img
src="../assets/eduImg/xxgk.gif"
class="gkMove"
alt=""
>
<div class="grade"> <div class="grade">
<div class="schoolbs"> <div class="schoolbs">
<span class="spot">初中</span> <span class="spot">初中</span>
@ -143,15 +128,13 @@
<div class="flex1"> <div class="flex1">
<div style="width: 100%; display: flex; flex-wrap: wrap"> <div style="width: 100%; display: flex; flex-wrap: wrap">
<edie :list="data.xzncxxsl"></edie> <edie :list="data.xzncxxsl"></edie>
<div class="rating"> <edie5 :list="data.xzncjszcsl"></edie5>
<!-- <div class="rating">
<edXX <edXX
:list="data.schoolData" :list="data.schoolData"
:active="selectData.active" :active="selectData.active"
></edXX> ></edXX>
<div class="ratingBtn"> <div class="ratingBtn">
<!-- <div class="onImg" :class="{ ratingImg: selectData.active === '城市' }">
<span @click="ratingBtn('城市')">城市</span>
</div> -->
<div <div
class="onImg" class="onImg"
:class="{ ratingImg: selectData.active === '县镇' }" :class="{ ratingImg: selectData.active === '县镇' }"
@ -165,7 +148,7 @@
<span @click="ratingBtn('农村')">农村</span> <span @click="ratingBtn('农村')">农村</span>
</div> </div>
</div> </div>
</div> </div> -->
</div> </div>
</div> </div>
<div class="flex1"> <div class="flex1">
@ -222,15 +205,8 @@
<div> <div>
<span class="green">16</span> <span class="green">16</span>
</div> </div>
<img <img src="@/assets/eduImg/jyImg10.png" alt="" />
src="@/assets/eduImg/jyImg10.png" <img src="@/assets/eduImg/pp3.gif" alt="" class="ppImg" />
alt=""
/>
<img
src="@/assets/eduImg/pp3.gif"
alt=""
class="ppImg"
/>
<div class="historyimg historyimg1"> <div class="historyimg historyimg1">
<span>绿色预警</span> <span>绿色预警</span>
</div> </div>
@ -239,15 +215,8 @@
<div> <div>
<span class="yellow">239</span> <span class="yellow">239</span>
</div> </div>
<img <img src="@/assets/eduImg/jyImg9.png" alt="" />
src="@/assets/eduImg/jyImg9.png" <img src="@/assets/eduImg/pp2.gif" alt="" class="ppImg" />
alt=""
/>
<img
src="@/assets/eduImg/pp2.gif"
alt=""
class="ppImg"
/>
<div class="historyimg historyimg2"> <div class="historyimg historyimg2">
<span>黄色预警</span> <span>黄色预警</span>
</div> </div>
@ -256,15 +225,8 @@
<div> <div>
<span class="red">139</span> <span class="red">139</span>
</div> </div>
<img <img src="@/assets/eduImg/jyImg8.png" alt="" />
src="@/assets/eduImg/jyImg8.png" <img src="@/assets/eduImg/pp1.gif" alt="" class="ppImg" />
alt=""
/>
<img
src="@/assets/eduImg/pp1.gif"
alt=""
class="ppImg"
/>
<div class="historyimg historyimg3"> <div class="historyimg historyimg3">
<span>红色预警</span> <span>红色预警</span>
</div> </div>
@ -298,8 +260,9 @@
<script setup> <script setup>
import { ref, reactive, onMounted, onBeforeMount } from "vue"; import { ref, reactive, onMounted, onBeforeMount } from "vue";
import edCSR from "./echarts_education/edCSR.vue"; import edCSR from "./echarts_education/edCSR.vue";
import edXX from "./echarts_education/edXX.vue";
import edie from "./echarts_education/pie.vue"; import edie from "./echarts_education/pie.vue";
import edie5 from "./echarts_education/pie5.vue";
import edXX from "./echarts_education/edXX.vue";
import ePie1 from "./echarts_education/pie1.vue"; import ePie1 from "./echarts_education/pie1.vue";
import ePie2 from "./echarts_education/pie2.vue"; import ePie2 from "./echarts_education/pie2.vue";
import ePie3 from "./echarts_education/pie3.vue"; import ePie3 from "./echarts_education/pie3.vue";
@ -311,6 +274,9 @@ import http from "@/utils/request.js";
const selectData = reactive({ const selectData = reactive({
value1: "111", value1: "111",
value2: "tes1", value2: "tes1",
list: [],
list1: [],
active: "县镇",
options1: [ options1: [
{ {
value: "111", value: "111",
@ -335,9 +301,6 @@ const selectData = reactive({
label: "中学心理健康诊断", label: "中学心理健康诊断",
}, },
], ],
list: [],
active: "县镇",
list1: [],
}); });
var roseData1 = ref([ var roseData1 = ref([
{ {
@ -405,30 +368,30 @@ var roseData3 = ref([
value: 78, value: 78,
}, },
]); ]);
var schoolData = ref([ // var schoolData = ref([
{ name: "副高级", value: 44 }, // { name: "", value: 44 },
{ name: "正高级", value: 22 }, // { name: "", value: 22 },
{ name: "未定级", value: 11 }, // { name: "", value: 11 },
{ name: "员级", value: 12 }, // { name: "", value: 12 },
{ name: "中级", value: 54 }, // { name: "", value: 54 },
{ name: "助理级", value: 74 }, // { name: "", value: 74 },
]); // ]);
var schoolData1 = ref([ // var schoolData1 = ref([
{ name: "副高级", value: 11 }, // { name: "", value: 11 },
{ name: "正高级", value: 22 }, // { name: "", value: 22 },
{ name: "未定级", value: 11 }, // { name: "", value: 11 },
{ name: "员级", value: 12 }, // { name: "", value: 12 },
{ name: "中级", value: 22 }, // { name: "", value: 22 },
{ name: "助理级", value: 74 }, // { name: "", value: 74 },
]); // ]);
var schoolData2 = ref([ // var schoolData2 = ref([
{ name: "副高级", value: 22 }, // { name: "", value: 22 },
{ name: "正高级", value: 22 }, // { name: "", value: 22 },
{ name: "未定级", value: 11 }, // { name: "", value: 11 },
{ name: "员级", value: 33 }, // { name: "", value: 33 },
{ name: "中级", value: 54 }, // { name: "", value: 54 },
{ name: "助理级", value: 74 }, // { name: "", value: 74 },
]); // ]);
const selectChange1 = () => { const selectChange1 = () => {
if (selectData.value1 == "111") { if (selectData.value1 == "111") {
@ -441,32 +404,32 @@ const selectChange1 = () => {
selectData.list = roseData1.value; selectData.list = roseData1.value;
} }
}; };
const ratingBtn = (item) => { // const ratingBtn = (item) => {
selectData.active = item; // // selectData.active = item; //
switch (selectData.active) { // switch (selectData.active) {
// case "": // // case "":
// selectData.list1 = schoolData.value; // // selectData.list1 = schoolData.value;
// // break;
// case "":
// data.schoolData[0].value = data.xzncjszcsl.xzjszcsl.xzfgj; //
// data.schoolData[1].value = data.xzncjszcsl.xzjszcsl.xzzgj; //
// data.schoolData[2].value = data.xzncjszcsl.xzjszcsl.xzwdj; //
// data.schoolData[3].value = data.xzncjszcsl.xzjszcsl.xzyj; //
// data.schoolData[4].value = data.xzncjszcsl.xzjszcsl.xzzj; //
// data.schoolData[5].value = data.xzncjszcsl.xzjszcsl.xzzlj; //
// break; // break;
case "县镇": // case "":
data.schoolData[0].value = data.xzncjszcsl.xzjszcsl.xzfgj; // // data.schoolData[0].value = data.xzncjszcsl.ncjszcsl.ncfgj; //
data.schoolData[1].value = data.xzncjszcsl.xzjszcsl.xzzgj; // // data.schoolData[1].value = data.xzncjszcsl.ncjszcsl.nczgj; //
data.schoolData[2].value = data.xzncjszcsl.xzjszcsl.xzwdj; // // data.schoolData[2].value = data.xzncjszcsl.ncjszcsl.ncwdj; //
data.schoolData[3].value = data.xzncjszcsl.xzjszcsl.xzyj; // // data.schoolData[3].value = data.xzncjszcsl.ncjszcsl.nczlj; //
data.schoolData[4].value = data.xzncjszcsl.xzjszcsl.xzzj; // // data.schoolData[4].value = data.xzncjszcsl.ncjszcsl.ncyj; //
data.schoolData[5].value = data.xzncjszcsl.xzjszcsl.xzzlj; // // data.schoolData[5].value = data.xzncjszcsl.ncjszcsl.ncwdj; //
break; // break;
case "农村": // default:
data.schoolData[0].value = data.xzncjszcsl.ncjszcsl.ncfgj; // // break;
data.schoolData[1].value = data.xzncjszcsl.ncjszcsl.nczgj; // // }
data.schoolData[2].value = data.xzncjszcsl.ncjszcsl.ncwdj; // // };
data.schoolData[3].value = data.xzncjszcsl.ncjszcsl.nczlj; //
data.schoolData[4].value = data.xzncjszcsl.ncjszcsl.ncyj; //
data.schoolData[5].value = data.xzncjszcsl.ncjszcsl.ncwdj; //
break;
default:
break;
}
};
const data = reactive({ const data = reactive({
xsql: [], xsql: [],
zdgz: [ zdgz: [
@ -532,7 +495,7 @@ const getData = async () => {
data.xzncjszcsl = res.data.xzncjszcsl; data.xzncjszcsl = res.data.xzncjszcsl;
// //
data.zzxm = res.data.zzxm; data.zzxm = res.data.zzxm;
ratingBtn("县镇"); // ratingBtn("");
// //
} }
}); });