This commit is contained in:
lnn19986213 2024-04-17 15:30:18 +08:00
parent 2d8e9c9687
commit cef5143262
2 changed files with 220 additions and 119 deletions

View File

@ -3,11 +3,24 @@
</template> </template>
<script setup> <script setup>
import { onMounted, reactive, ref } from "vue"; import { onMounted, reactive, ref, onBeforeMount, defineProps, watch } from "vue";
// echarts // echarts
import * as echarts from "echarts"; import * as echarts from "echarts";
const props = defineProps({
list: {
type: Array,
default: () => {
return [];
},
},
});
const chart = ref(); // DOM const chart = ref(); // DOM
const data = reactive({
list: [],
option: {}
})
var colors = [ var colors = [
'#4EC2FF', '#4EC2FF',
@ -16,31 +29,8 @@ var colors = [
'#268FFF', '#268FFF',
'#FFE986' '#FFE986'
] ]
const getOption = () => {
var data = [ data.option = {
{
name: '正常',
value: 17
},
{
name: '关注',
value: 16
},
{
name: '追踪',
value: 14
},
{
name: '异常',
value: 8
},
{
name: '警戒',
value: 8
}
];
let option = {
color: colors, color: colors,
legend: { legend: {
orient: 'vertical', orient: 'vertical',
@ -56,12 +46,11 @@ let option = {
}, },
formatter: function (name) { formatter: function (name) {
var target; var target;
for (var i = 0, l = data.length; i < l; i++) { for (var i = 0, l = data.list.length; i < l; i++) {
if (data[i].name == name) { if (data.list[i].name == name) {
target = data[i].value; target = data.list[i].value;
} }
} }
return ` ${name} ${target} `; return ` ${name} ${target} `;
}, },
}, },
@ -70,7 +59,6 @@ let option = {
formatter: '{a} <br/>{b} : {c} ({d}%)' formatter: '{a} <br/>{b} : {c} ({d}%)'
}, },
series: [ series: [
/*内心原型图,展示整体数据概览*/ /*内心原型图,展示整体数据概览*/
{ {
name: '测评分析', name: '测评分析',
@ -82,7 +70,7 @@ let option = {
label: { label: {
show: false, show: false,
}, },
data: data data: data.list
}, },
// //
{ {
@ -107,23 +95,27 @@ let option = {
data: [100], data: [100],
}, },
] ]
}; };
}
// 使 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);
}
watch(() => props.list, (newVal, oldVal) => {
data.list = newVal
getOption()
setChart()
console.log('333', newVal, oldVal)
})
// 使
onMounted(() => {
data.list = props.list
getOption()
setChart()
// :
// window.addEventListener("resize", () => {
// myChart.resize();
// });
}); });
</script> </script>

View File

@ -14,17 +14,19 @@
<div class="yd_title left_2"></div> <div class="yd_title left_2"></div>
<div class="selectLint"> <div class="selectLint">
<div class="selectBox"> <div class="selectBox">
<el-select v-model="value" placeholder="Select" size="large" class="selClass"> <el-select v-model="selectData.value1" placeholder="请选择" size="large" @change="selectChange1">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in selectData.options1" :key="item.value" :label="item.label"
:value="item.value" />
</el-select> </el-select>
</div> </div>
<div class="selectBox"> <div class="selectBox">
<el-select v-model="value" placeholder="Select" size="large"> <el-select v-model="selectData.value2" placeholder="请选择" size="large" @change="selectChange1">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in selectData.options2" :key="item.value" :label="item.label"
:value="item.value" />
</el-select> </el-select>
</div> </div>
</div> </div>
<ePieRose></ePieRose> <ePieRose :list="selectData.list"></ePieRose>
</div> </div>
</div> </div>
<div class="displayFlex center_bg"> <div class="displayFlex center_bg">
@ -102,37 +104,119 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted, onBeforeMount } from 'vue'
import edCSR from "./echarts_education/edCSR.vue"; import edCSR from "./echarts_education/edCSR.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";
import ePie4 from "./echarts_education/pie4.vue"; import ePie4 from "./echarts_education/pie4.vue";
import ePieRose from "./echarts_education/pieRose.vue"; import ePieRose from "./echarts_education/pieRose.vue";
import { ref } from 'vue'
const value = ref('') const selectData = reactive({
const options = [ value1: '111',
{ value2: 'tes1',
value: 'Option1', options1: [{
label: 'Option1', value: '111',
label: '2023秋季检查',
}, },
{ {
value: 'Option2', value: '222',
label: 'Option2', label: '2024春季检查',
},],
options2: [{
value: 'tes1',
label: '中小学心理健康诊断测验(MHT',
}, },
{ {
value: 'Option3', value: 'tes2',
label: 'Option3', label: '小学心理健康诊断测验',
}, },
{ {
value: 'Option4', value: 'tes3',
label: 'Option4', label: '中学心理健康诊断',
},],
list: [],
})
var roseData1 = ref([
{
name: '正常',
value: 17
}, },
{ {
value: 'Option5', name: '关注',
label: 'Option5', value: 16
}, },
] {
name: '追踪',
value: 14
},
{
name: '异常',
value: 8
},
{
name: '警戒',
value: 8
}
]);
var roseData2 = ref([
{
name: '正常',
value: 37
},
{
name: '关注',
value: 26
},
{
name: '追踪',
value: 24
},
{
name: '异常',
value: 18
},
{
name: '警戒',
value: 18
}
]);
var roseData3 = ref([
{
name: '正常',
value: 227
},
{
name: '关注',
value: 169
},
{
name: '追踪',
value: 114
},
{
name: '异常',
value: 98
},
{
name: '警戒',
value: 78
}
]);
const selectChange1 = () => {
if(selectData.value1 == '111'){
selectData.list = roseData1.value
}else if(selectData.value2 == 'tes1'){
selectData.list = roseData2.value
}else if(selectData.value2 == 'tes2'){
selectData.list = roseData3.value
}else{
selectData.list = roseData1.value
}
}
onBeforeMount(() => {
selectData.list = roseData1.value
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -168,6 +252,7 @@ const options = [
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
} }
.center_bg { .center_bg {
width: 582px; width: 582px;
box-sizing: border-box; box-sizing: border-box;
@ -177,6 +262,7 @@ const options = [
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
} }
.right_bg { .right_bg {
width: 642px; width: 642px;
box-sizing: border-box; box-sizing: border-box;
@ -484,6 +570,7 @@ const options = [
.czr-sl { .czr-sl {
display: flex; display: flex;
.historyimg { .historyimg {
width: 255px; width: 255px;
height: 56px; height: 56px;
@ -495,6 +582,7 @@ const options = [
justify-content: space-between; justify-content: space-between;
padding-left: 70px; padding-left: 70px;
span { span {
font-weight: 400; font-weight: 400;
font-size: 16px; font-size: 16px;
@ -507,23 +595,28 @@ const options = [
padding-right: 10px; padding-right: 10px;
} }
} }
.historyimg1 { .historyimg1 {
background-image: url(@/assets/eduImg/jyImg14.png); background-image: url(@/assets/eduImg/jyImg14.png);
margin-right: 10px; margin-right: 10px;
} }
.historyimg2 { .historyimg2 {
background-image: url(@/assets/eduImg/jyImg15.png); background-image: url(@/assets/eduImg/jyImg15.png);
} }
} }
.flex11 { .flex11 {
padding: 12px 0; padding: 12px 0;
} }
.earlyWarning { .earlyWarning {
height: calc(100% - 10px); height: calc(100% - 10px);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-around; justify-content: space-around;
.earlyWarning1 { .earlyWarning1 {
font-size: 26px; font-size: 26px;
color: #ffffff; color: #ffffff;
@ -535,10 +628,12 @@ const options = [
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
img { img {
width: 136px; width: 136px;
height: 100px; height: 100px;
} }
.green { .green {
font-size: 26px; font-size: 26px;
font-weight: bold; font-weight: bold;
@ -551,6 +646,7 @@ const options = [
-webkit-background-clip: text; -webkit-background-clip: text;
-webkit-text-fill-color: transparent; -webkit-text-fill-color: transparent;
} }
.yellow { .yellow {
font-size: 26px; font-size: 26px;
font-weight: bold; font-weight: bold;
@ -563,6 +659,7 @@ const options = [
-webkit-background-clip: text; -webkit-background-clip: text;
-webkit-text-fill-color: transparent; -webkit-text-fill-color: transparent;
} }
.red { .red {
font-size: 26px; font-size: 26px;
font-weight: bold; font-weight: bold;
@ -585,6 +682,7 @@ const options = [
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
span { span {
font-weight: 500; font-weight: 500;
font-size: 14px; font-size: 14px;
@ -594,17 +692,21 @@ const options = [
font-family: PingFangSC, PingFang SC; font-family: PingFangSC, PingFang SC;
} }
} }
.historyimg1 { .historyimg1 {
background-image: url(@/assets/eduImg/jyImg4.png); background-image: url(@/assets/eduImg/jyImg4.png);
} }
.historyimg2 { .historyimg2 {
background-image: url(@/assets/eduImg/jyImg6.png); background-image: url(@/assets/eduImg/jyImg6.png);
} }
.historyimg3 { .historyimg3 {
background-image: url(@/assets/eduImg/jyImg5.png); background-image: url(@/assets/eduImg/jyImg5.png);
} }
} }
} }
.czr-bj { .czr-bj {
width: 529px; width: 529px;
height: calc(100% - 26px); height: calc(100% - 26px);
@ -617,22 +719,29 @@ const options = [
.czrBox { .czrBox {
height: 8vh; height: 8vh;
} }
.situation { .situation {
width: 495px; width: 495px;
height: 26px; height: 26px;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
} }
.situation1 { .situation1 {
background-image: url(@/assets/eduImg/jyImg11.png); background-image: url(@/assets/eduImg/jyImg11.png);
} }
.situation2 { .situation2 {
background-image: url(@/assets/eduImg/jyImg12.png); background-image: url(@/assets/eduImg/jyImg12.png);
} }
.situation3 { .situation3 {
background-image: url(@/assets/eduImg/jyImg13.png); background-image: url(@/assets/eduImg/jyImg13.png);
} }
}; }
;
.selectLint { .selectLint {
width: 94%; width: 94%;
display: flex; display: flex;