From 7df64634d3d7b292713eebfa008c40b3f5f9f65f Mon Sep 17 00:00:00 2001
From: shj <1790240199@qq.com>
Date: Tue, 20 Sep 2022 15:57:03 +0800
Subject: [PATCH] 修改
---
src/views/facilityManagement/EquipmentStatistics/index.vue | 48 +++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/src/views/facilityManagement/EquipmentStatistics/index.vue b/src/views/facilityManagement/EquipmentStatistics/index.vue
index 65cda52..136eea1 100644
--- a/src/views/facilityManagement/EquipmentStatistics/index.vue
+++ b/src/views/facilityManagement/EquipmentStatistics/index.vue
@@ -7,10 +7,46 @@
<script lang="ts">
import { defineComponent, onMounted, ref } from 'vue';
import * as echarts from 'echarts';
+import { ElMessage } from 'element-plus';
+import { facilityManagementApi } from '/@/api/facilityManagement';
export default defineComponent({
setup() {
+ const listApi = () => {
+ facilityManagementApi()
+ .getequipmentInfoStatistics()
+ .then((res) => {
+ if (res.data.code == 200) {
+ let arr = [];
+ arr = res.data.data;
+ let date = [];
+ for (let i = 0; i < arr.length; i++) {
+ if (arr[i].stopStatus == 1) {
+ date[0] = arr[i].count;
+ } else if (arr[i].stopStatus == 2) {
+ date[1] = arr[i].count;
+ }else if (arr[i].stopStatus == 3) {
+ date[2] = arr[i].count;
+ }else if (arr[i].stopStatus == 4) {
+ date[3] = arr[i].count;
+ }else if (arr[i].stopStatus == -1) {
+ date[4] = arr[i].count;
+ }
+ }
+ init(date);
+ } else {
+ ElMessage({
+ showClose: true,
+ message: res.data.msg,
+ type: 'error',
+ });
+ }
+ });
+ };
+ onMounted(() => {
+ listApi();
+ });
const main = ref();
- const init = () => {
+ const init = (data: any) => {
var myChart = echarts.init(main.value);
var option = {
tooltip: {},
@@ -22,7 +58,7 @@
},
xAxis: {
type: 'category',
- data: ['在用数', '报废数', '维修数', '停用数'],
+ data: ['停用 ', '在用', '维修 ', '报废', '超时未保养'],
},
yAxis: {
type: 'value',
@@ -35,7 +71,7 @@
color: ['#6394f9'],
series: [
{
- data: [120, 200, 150, 80, 70, 110, 130],
+ data: data,
type: 'bar',
},
],
@@ -43,13 +79,11 @@
myChart.setOption(option);
};
- onMounted(() => {
- init();
- });
return {
init,
onMounted,
main,
+ listApi,
};
},
});
@@ -57,7 +91,7 @@
<style scoped>
.box {
background-color: #fff;
- box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
+ box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
}
.title {
font-size: 16px;
--
Gitblit v1.9.2