fix: BUG修改

This commit is contained in:
kun 2024-02-22 14:11:59 +08:00
parent 249de86c44
commit 921b918963

View File

@ -16,7 +16,7 @@
v-for="(item, index) in noiseList" v-for="(item, index) in noiseList"
:key="index" :key="index"
:label="item.label" :label="item.label"
:value="item.value" :value="item.label"
@click="checkChange(item.label)" @click="checkChange(item.label)"
/> />
</el-select> </el-select>
@ -31,7 +31,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { GlobalStore } from "@/stores"; import { GlobalStore } from "@/stores";
import { selectDustNoiseDataApi } from "@/api/modules/headNoise"; import { selectDustNoiseDataApi } from "@/api/modules/headNoise";
import { onMounted, reactive, ref, onBeforeUnmount } from "vue"; import { onMounted, reactive, ref, onBeforeUnmount, computed } from "vue";
import * as echarts from "echarts"; import * as echarts from "echarts";
import Card from "@/components/card.vue"; import Card from "@/components/card.vue";
import mitts from "@/utils/bus"; // import mitts from "@/utils/bus"; //
@ -43,39 +43,52 @@ let chart = ref();
const noiseList = [ const noiseList = [
{ {
value: 0, value: 0,
label: "PM2.5" label: "PM2.5",
unit: "μg/m³"
}, },
{ {
value: 1, value: 1,
label: "PM10" label: "PM10",
unit: "μg/m³"
}, },
{ {
value: 2, value: 2,
label: "白天噪音" label: "噪声",
}, unit: "dB"
{
value: 3,
label: "夜晚噪音"
}, },
// {
// value: 3,
// label: ""
// },
{ {
value: 4, value: 4,
label: "风速" label: "风速",
unit: "m/s"
}, },
{ {
value: 5, value: 5,
label: "TSP" label: "TSP",
unit: "μg/m³"
}, },
{ {
value: 6, value: 6,
label: "温度" label: "温度",
unit: "℃"
}, },
{ {
value: 7, value: 7,
label: "湿度" label: "湿度",
unit: "%"
} }
]; ];
let receive = ref("" as any); let receive = ref("" as any);
let selectValue = ref("PM2.5" as any); const selectValue = ref("PM2.5" as any);
const selectUnit = computed(() => {
let item = noiseList.find((item:any) => {
return item.label === selectValue.value
})
return item?.unit
})
function drawChart() { function drawChart() {
let myEchart = echarts.init(document.getElementById("myEcharts")); let myEchart = echarts.init(document.getElementById("myEcharts"));
let option = { let option = {
@ -165,7 +178,7 @@ function drawChart() {
yAxis: [ yAxis: [
{ {
type: "value", type: "value",
name: "单位:ug/m³", name: "单位:" + selectUnit.value,
nameTextStyle: { nameTextStyle: {
color: "#fff", color: "#fff",
nameLocation: "start" nameLocation: "start"