From 00d4082a1709e7c32e7fdefc815266a58d87bf8e Mon Sep 17 00:00:00 2001
From: shj <1790240199@qq.com>
Date: 星期一, 01 八月 2022 10:26:48 +0800
Subject: [PATCH] 对接

---
 src/views/facilityManagement/EquipmentStatistics/index.vue |   36 ++++++++++++++++++++++++++++++------
 1 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/src/views/facilityManagement/EquipmentStatistics/index.vue b/src/views/facilityManagement/EquipmentStatistics/index.vue
index 65cda52..07a359f 100644
--- a/src/views/facilityManagement/EquipmentStatistics/index.vue
+++ b/src/views/facilityManagement/EquipmentStatistics/index.vue
@@ -7,10 +7,36 @@
 <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++) {
+							date.push(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: {},
@@ -35,7 +61,7 @@
 				color: ['#6394f9'],
 				series: [
 					{
-						data: [120, 200, 150, 80, 70, 110, 130],
+						data: data,
 						type: 'bar',
 					},
 				],
@@ -43,13 +69,11 @@
 
 			myChart.setOption(option);
 		};
-		onMounted(() => {
-			init();
-		});
 		return {
 			init,
 			onMounted,
 			main,
+			listApi,
 		};
 	},
 });
@@ -57,7 +81,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