文件名修改

This commit is contained in:
lzc 2025-03-27 17:22:39 +08:00
parent f2d9ca455c
commit e20efc20df
2 changed files with 124 additions and 2 deletions

View File

@ -0,0 +1,122 @@
<template>
<div class="insect-pests-charts">
<custom-echart-mixin :chart-data="handelData" :option="chartsData.option" height="100%" />
</div>
</template>
<script setup>
import { ref, reactive, onMounted, computed } from 'vue';
let itemStyle = reactive({
itemStyle: { borderRadius: [8, 8, 0, 0] },
});
let legendList = reactive(['蝗虫', '飞蛾', '其他', '蚜虫']);
const chartsData = reactive({
option: {
color: ['#3685fe', '#41b879', '#ffd500', '#e57373'],
title: {
text: ' ',
textStyle: {
color: '#333',
},
},
legend: {
show: true,
data: legendList,
left: '0', // 10%
top: '0', //
itemWidth: 15, //
itemHeight: 8, //
textStyle: {
fontSize: 10, //
color: '#fff', //
},
},
barStyle: {
barWidth: 10,
},
dataZoom: [
{
type: 'slider', //
startValue: 0, //
endValue: 2, //
},
{
type: 'inside', //
startValue: 0,
endValue: 2,
},
],
yAxis: [
{
type: 'value',
name: ' ',
axisLabel: {
formatter: '{value}',
},
splitLine: {
show: true, // 线
lineStyle: {
type: 'dashed', // 线
width: 0.5, // 线
},
},
itemStyle: { fontSize: 8 },
},
],
grid: {
x: '10%',
x2: '15%',
y: '20%',
y2: '20%',
},
},
valData: [
{ name: '1月', value: 40, type: '蝗虫', seriesType: 'bar', ...itemStyle },
{ name: '1月', value: 30, type: '飞蛾', seriesType: 'bar', ...itemStyle },
{ name: '1月', value: 100, type: '其他', seriesType: 'bar', ...itemStyle },
{ name: '1月', value: 60, type: '蚜虫', seriesType: 'bar', ...itemStyle },
{ name: '2月', value: 20, type: '蝗虫', seriesType: 'bar', ...itemStyle },
{ name: '2月', value: 20, type: '飞蛾', seriesType: 'bar', ...itemStyle },
{ name: '2月', value: 80, type: '其他', seriesType: 'bar', ...itemStyle },
{ name: '2月', value: 40, type: '蚜虫', seriesType: 'bar', ...itemStyle },
],
});
const randomVal = (num) => {
let list = [];
for (let i = 0; i < legendList.length; i++) {
let addNum = [10, 8, 2, 5];
let val = {
name: num + '月',
value: Number(Math.random() * 100 + addNum[i]).toFixed(2),
seriesType: 'bar',
type: legendList[i],
...itemStyle,
};
list[i] = val;
}
return list;
};
let handelData = computed(() => {
let list = [];
let maxMouth = 12;
for (let i = 0; i < maxMouth; i++) {
let val = randomVal(i + 1);
list = [...list, ...val];
}
list.map((m) => {
return { ...m, value: Number(m.value + Math.random() + 10).toFixed(2) };
});
// console.info('handelData', list);
return list;
});
onMounted(() => {});
</script>
<style lang="scss" scoped>
.insect-pests-charts {
height: 100%;
}
</style>

View File

@ -14,7 +14,7 @@
<div class="left-charts-item">
<customBack top-title="昆虫害监测" :top-postion="'left'">
<template #back>
<!-- <insectPestsCharts></insectPestsCharts> -->
<insectPestsCharts></insectPestsCharts>
</template>
</customBack>
</div>
@ -87,7 +87,7 @@
</template>
<script setup>
import plantTypeCharts from './components/plantTypeCharts.vue';
// import insectPestsCharts from './components/insectPestsCharts.vue';
import insectPestsCharts from './components/insectPestsCharts.vue';
import pathologyCharts from './components/pathologyCharts.vue';
import waterfertilizerCharts from './components/waterfertilizerCharts.vue';
import irrigationCharts from './components/irrigationCharts.vue';