瀏覽代碼

累计报警

wkyy 1 年之前
父節點
當前提交
5e697c0c73
共有 3 個文件被更改,包括 73 次插入13 次删除
  1. 10 0
      apis/pagejs/energy/index.js
  2. 32 6
      pages/statistics/statistics-index.vue
  3. 31 7
      pages/statistics/statistics.vue

+ 10 - 0
apis/pagejs/energy/index.js

@@ -46,4 +46,14 @@ export function deviceCompanyList() {
 		url: url
 		url: url
 	})
 	})
 }
 }
+
+// 统计-累计报警
+export function deviceStatus(data) {
+	var url='/mobile/employee/deviceStatus';
+	return request({
+		method: 'post',
+		data: data,
+		url: url
+	})
+}
  
  

+ 32 - 6
pages/statistics/statistics-index.vue

@@ -44,21 +44,22 @@
 				<view class="item" @click="toDataMonitoringList">
 				<view class="item" @click="toDataMonitoringList">
 					<view class="item-top">
 					<view class="item-top">
 						<view class="img-box">
 						<view class="img-box">
-							<u-circle-progress active-color="#2979ff" :percent="8/15*100" width="88">
+							<u-circle-progress active-color="#2979ff"
+								:percent="alarmsForm.okNum/(alarmsForm.okNum+alarmsForm.errorNum)*100" width="88">
 							</u-circle-progress>
 							</u-circle-progress>
 						</view>
 						</view>
 						<view class="number">
 						<view class="number">
 							<view class="normal">
 							<view class="normal">
-								正常:8
+								正常:{{alarmsForm.okNum}}
 							</view>
 							</view>
 							<view class="abnormal">
 							<view class="abnormal">
-								异常:7
+								异常:{{alarmsForm.errorNum}}
 							</view>
 							</view>
 						</view>
 						</view>
 					</view>
 					</view>
 					<!-- 累计 -->
 					<!-- 累计 -->
 					<view class="total">
 					<view class="total">
-						本月累计报警 <text class="total-number">12</text> 次
+						本月累计报警 <text class="total-number">{{alarmsForm.errorMonthNum}}</text> 次
 					</view>
 					</view>
 				</view>
 				</view>
 
 
@@ -420,7 +421,12 @@
 		},
 		},
 		data() {
 		data() {
 			return {
 			return {
-				companyId: '',
+				alarmsForm: {
+					okNum: 4,
+					errorNum: 0,
+					errorMonthNum: 0
+				}, // 累计报警
+				companyId: '', // 商户ID
 				pageIndexe: 1, // 设备数据检测
 				pageIndexe: 1, // 设备数据检测
 				totalPagee: 1,
 				totalPagee: 1,
 				deviceList: [],
 				deviceList: [],
@@ -459,6 +465,7 @@
 			this.getPowerConsumption(0);
 			this.getPowerConsumption(0);
 			this.getEquipmentDataMonitoring(0);
 			this.getEquipmentDataMonitoring(0);
 			this.getCompanyInfoList()
 			this.getCompanyInfoList()
+			this.getAccumulatedAlarms();
 		},
 		},
 		methods: {
 		methods: {
 			merchantChange(item,index) {
 			merchantChange(item,index) {
@@ -466,6 +473,11 @@
 				var n = this.merchantList1[this.current];
 				var n = this.merchantList1[this.current];
 				this.merchantList1[this.current] = m;
 				this.merchantList1[this.current] = m;
 				this.merchantList2[index] = n;
 				this.merchantList2[index] = n;
+				
+				this.companyId = item.id;
+				this.getPowerConsumption(0);
+				this.getEquipmentDataMonitoring(0);
+				this.popShow = false;
 			},
 			},
 			// 单位
 			// 单位
 			getCompanyInfoList() {
 			getCompanyInfoList() {
@@ -569,7 +581,21 @@
 			},
 			},
 			// 累计报警
 			// 累计报警
 			getAccumulatedAlarms() {
 			getAccumulatedAlarms() {
-
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				API.deviceStatus({
+					companyId: this.companyId
+				}).then((response) => {
+					uni.hideLoading();
+					this.alarmsForm = response.data;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
 			},
 			},
 			getLineCharts() {
 			getLineCharts() {
 				if (!this.myLineChart) {
 				if (!this.myLineChart) {

+ 31 - 7
pages/statistics/statistics.vue

@@ -44,21 +44,22 @@
 				<view class="item" @click="toDataMonitoringList">
 				<view class="item" @click="toDataMonitoringList">
 					<view class="item-top">
 					<view class="item-top">
 						<view class="img-box">
 						<view class="img-box">
-							<u-circle-progress active-color="#2979ff" :percent="0" width="88">
+							<u-circle-progress active-color="#2979ff"
+								:percent="alarmsForm.okNum/(alarmsForm.okNum+alarmsForm.errorNum)*100" width="88">
 							</u-circle-progress>
 							</u-circle-progress>
 						</view>
 						</view>
 						<view class="number">
 						<view class="number">
 							<view class="normal">
 							<view class="normal">
-								正常:0
+								正常:{{alarmsForm.okNum}}
 							</view>
 							</view>
 							<view class="abnormal">
 							<view class="abnormal">
-								异常:0
+								异常:{{alarmsForm.errorNum}}
 							</view>
 							</view>
 						</view>
 						</view>
 					</view>
 					</view>
 					<!-- 累计 -->
 					<!-- 累计 -->
 					<view class="total">
 					<view class="total">
-						本月累计报警 <text class="total-number">0</text> 次
+						本月累计报警 <text class="total-number">{{alarmsForm.errorMonthNum}}</text> 次
 					</view>
 					</view>
 				</view>
 				</view>
 
 
@@ -284,7 +285,12 @@
 		},
 		},
 		data() {
 		data() {
 			return {
 			return {
-				companyId: '',
+				alarmsForm: {
+					okNum: 4,
+					errorNum: 0,
+					errorMonthNum: 0
+				}, // 累计报警
+				companyId: '', // 商户ID
 				pageIndexe: 1, // 设备数据检测
 				pageIndexe: 1, // 设备数据检测
 				totalPagee: 1,
 				totalPagee: 1,
 				deviceList: [],
 				deviceList: [],
@@ -305,7 +311,8 @@
 			this.getfindByOpenId();
 			this.getfindByOpenId();
 			this.getPowerConsumption(0);
 			this.getPowerConsumption(0);
 			this.getEquipmentDataMonitoring(0);
 			this.getEquipmentDataMonitoring(0);
-			this.getCompanyInfoList()
+			this.getCompanyInfoList();
+			this.getAccumulatedAlarms();
 		},
 		},
 		methods: {
 		methods: {
 			merchantChange(item,index) {
 			merchantChange(item,index) {
@@ -317,6 +324,8 @@
 				this.companyId = item.id;
 				this.companyId = item.id;
 				this.getPowerConsumption(0);
 				this.getPowerConsumption(0);
 				this.getEquipmentDataMonitoring(0);
 				this.getEquipmentDataMonitoring(0);
+				this.getAccumulatedAlarms();
+				
 				this.popShow = false;
 				this.popShow = false;
 			},
 			},
 			// 单位
 			// 单位
@@ -421,13 +430,28 @@
 			},
 			},
 			// 累计报警
 			// 累计报警
 			getAccumulatedAlarms() {
 			getAccumulatedAlarms() {
-
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				API.deviceStatus({
+					companyId: this.companyId
+				}).then((response) => {
+					uni.hideLoading();
+					this.alarmsForm = response.data;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
 			},
 			},
 			change(index) {
 			change(index) {
 				this.current = index;
 				this.current = index;
 				this.companyId = this.merchantList1[index].id;
 				this.companyId = this.merchantList1[index].id;
 				this.getPowerConsumption(0);
 				this.getPowerConsumption(0);
 				this.getEquipmentDataMonitoring(0);
 				this.getEquipmentDataMonitoring(0);
+				this.getAccumulatedAlarms();
 			},
 			},
 			toDataMonitoringList() {
 			toDataMonitoringList() {
 				return
 				return