This commit is contained in:
朱菊兰 2024-05-21 08:34:03 +08:00
parent f84355b673
commit 3228987c40
2 changed files with 16 additions and 44 deletions

View File

@ -1,31 +1,22 @@
<template>
<div>
<div class="left-chart-base">
<NotMsg v-show="notMsg" />
<div class="legend" v-show="!notMsg">
<span
v-for="item in legend"
:key="item.label"
class="legend-item"
:style="{ fontSize: isFullscreen ? '0.85vw' : '0.73vw' }"
>{{ item.label }}</span
>
</div>
<div
id="factoryEnergyChart"
style="width: 100%; height: 100%"
v-show="!notMsg"
></div>
<div class="left-chart-base">
<div class="legend">
<span
v-for="item in legend"
:key="item.label"
class="legend-item"
:style="{ fontSize: isFullscreen ? '0.85vw' : '0.73vw' }"
>{{ item.label }}</span
>
</div>
<div id="factoryEnergyChart" style="width: 100%; height: 100%"></div>
</div>
</template>
<script>
import { debounce } from "@/utils/debounce";
import * as echarts from "echarts";
import NotMsg from "./../../components/NotMsg";
export default {
name: "Energy",
components: { NotMsg },
props: {
legend: {
type: Array,
@ -40,16 +31,14 @@ export default {
return {
isFullscreen: false,
actualOptions: null,
notMsg: false,
chart: "",
options: {
color: ["#FFD160", "#2760FF", "#12FFF5"],
grid: {
left: "3%",
right: "4%",
bottom: "0",
left: "7%",
right: "7%",
bottom: "8%",
top: "15%",
containLabel: true,
},
tooltip: {
trigger: "axis",
@ -274,7 +263,6 @@ export default {
},
];
if (this.energyCockpits.length > 0) {
this.notMsg = false;
let dataArr = this.energyCockpits.map((item) => {
return item.groupName;
});
@ -296,8 +284,6 @@ export default {
}
}
}
} else {
this.notMsg = true;
}
if (this.chart) {
this.chart.dispose();

View File

@ -1,20 +1,11 @@
<template>
<div>
<NotMsg v-show="notMsg" />
<div
id="factoryStoreChart"
style="width: 100%; height: 100%"
v-show="!notMsg"
></div>
</div>
<div id="factoryStoreChart" style="width: 100%; height: 100%"></div>
</template>
<script>
import { debounce } from "@/utils/debounce";
import * as echarts from "echarts";
import NotMsg from "./../../components/NotMsg";
export default {
name: "Store",
components: { NotMsg },
props: {
stock: {
type: Object,
@ -30,15 +21,13 @@ export default {
return {
isFullscreen: false,
actualOptions: null,
notMsg: false,
chart: "",
options: {
grid: {
left: "3%",
left: "8%",
right: "1%",
bottom: "0",
bottom: "8%",
top: "15%",
containLabel: true,
},
tooltip: {},
xAxis: {
@ -157,12 +146,9 @@ export default {
let xAxis = Object.keys(this.stock) || [];
let data = [];
if (xAxis.length > 0) {
this.notMsg = false;
data = xAxis.map((item) => {
return this.stock[item].total;
});
} else {
this.notMsg = true;
}
if (this.chart) {
this.chart.dispose();