wkyy 1 год назад
Родитель
Сommit
051675e688

+ 41 - 21
pages/equipmentDataMonitoring/electronicMonitoring.vue

@@ -377,6 +377,7 @@
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
+				timeOut: false,
 				abnormalRecordsList: [], //异常list
 				abnormalRecordsList: [], //异常list
 				companyId: '', //企业id
 				companyId: '', //企业id
 				meterId: '', //设备id
 				meterId: '', //设备id
@@ -483,6 +484,12 @@
 		onReady() {
 		onReady() {
 			this.getBarCharts(false);
 			this.getBarCharts(false);
 		},
 		},
+		onUnload() {
+			this.timeOut = false;
+		},
+		onHide() {
+			this.timeOut = false;
+		},
 		methods: {
 		methods: {
 			gotoInfo(path,type,name){
 			gotoInfo(path,type,name){
 							 if(!this.FormData.meterId){
 							 if(!this.FormData.meterId){
@@ -658,17 +665,35 @@
 					})
 					})
 				})
 				})
 			},
 			},
-			getTimeSlotStatistics() {
-				uni.showLoading({
-					title: "加载中",
-					mask: true,
-				})
-
+			getTimeSlotStatistics(bl) {
+				if(!bl) {
+					uni.showLoading({
+						title: "加载中",
+						mask: true,
+					})
+				}
+				
 				this.queryDay = parseUnixTime(new Date(this.FormData2.queryDate), '{y}年{m}月{d}日');
 				this.queryDay = parseUnixTime(new Date(this.FormData2.queryDate), '{y}年{m}月{d}日');
 				API.timeSlotStatistics(this.FormData2).then((response) => {
 				API.timeSlotStatistics(this.FormData2).then((response) => {
-					uni.hideLoading();
+					if(!bl) {
+						uni.hideLoading();
+					}
 					this.hourMap = response.data.hourMap;
 					this.hourMap = response.data.hourMap;
-					this.getBarCharts(this.hourMap);
+					// this.sumQuantity = response.data.allKwh;
+					if(!bl) {
+						this.getBarCharts(this.hourMap);
+					} else {
+						this.myChart.setOption({
+							series: [{
+								data: this.hourMap
+							}]
+						});
+					}
+					if(this.timeOut) {
+						setTimeout(() => {
+							this.getTimeSlotStatistics(true);
+						}, 30000)
+					}
 				}).catch(error => {
 				}).catch(error => {
 					uni.showToast({
 					uni.showToast({
 						title: error,
 						title: error,
@@ -725,19 +750,14 @@
 				}
 				}
 				this.myChart.clear();
 				this.myChart.clear();
 
 
-				var data1 = ['0-2点', '2-4点', '4-6点', '6-8点', '8-10点', '10-12点', '12-14点', '14-16点',
-					'16-18点', '18-20点', '20-22点', '22-24点'
-				];
-				var data2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
-				var sumQuantity = 0;
-				if (list) {
-					data1 = [];
-					data2 = [];
-					for (var i in list) {
-						data1.push(i);
-						data2.push(list[i]);
-						sumQuantity += list[i];
-					}
+				var data1=[];
+				var data2=[];
+				var sumQuantity=0
+				for(var i in list){
+					data1.push(i)
+					data2.push(list[i])
+					sumQuantity+=list[i]
+					
 				}
 				}
 				this.sumQuantity = sumQuantity.toFixed(2);
 				this.sumQuantity = sumQuantity.toFixed(2);
 				var headitemby = "";
 				var headitemby = "";

+ 13 - 5
pages/statistics/statistics.vue

@@ -407,6 +407,7 @@
 		},
 		},
 		data() {
 		data() {
 			return {
 			return {
+				timeOut: true,
 				abnormalRecordsList: [], // 异常告警记录
 				abnormalRecordsList: [], // 异常告警记录
 				queryDate: '',
 				queryDate: '',
 				alarmsPercent: 0,
 				alarmsPercent: 0,
@@ -451,6 +452,12 @@
 			// this.getBarCharts();
 			// this.getBarCharts();
 			// this.getLineCharts();
 			// this.getLineCharts();
 		},
 		},
+		onUnload() {
+			this.timeOut = false;
+		},
+		onHide() {
+			this.timeOut = false;
+		},
 		methods: {
 		methods: {
 			merchantChange(item, index) {
 			merchantChange(item, index) {
 				var m = item;
 				var m = item;
@@ -574,18 +581,19 @@
 					this.pageIndexp = 1;
 					this.pageIndexp = 1;
 				}
 				}
 
 
-				uni.showLoading({
-					title: "加载中",
-					mask: true,
-				})
 				API.homePageKwh({
 				API.homePageKwh({
 					pageIndex: this.pageIndexp,
 					pageIndex: this.pageIndexp,
 					pageSize: 5,
 					pageSize: 5,
 					companyId: this.companyId
 					companyId: this.companyId
 				}).then((response) => {
 				}).then((response) => {
-					uni.hideLoading();
+					
 					this.kWhList = response.data.data;
 					this.kWhList = response.data.data;
 					this.totalPagep = response.data.totalPage;
 					this.totalPagep = response.data.totalPage;
+					if(this.timeOut) {
+						setTimeout(() => {
+							this.getPowerConsumption(this.pageIndexp);
+						}, 30000)
+					}
 				}).catch(error => {
 				}).catch(error => {
 					uni.showToast({
 					uni.showToast({
 						title: error,
 						title: error,

+ 40 - 9
pages/workOrderManagement/workOrderStatistics.vue

@@ -122,10 +122,15 @@
 		beforeTimeStamp,
 		beforeTimeStamp,
 		getWeek
 		getWeek
 	} from '@/apis/utils'
 	} from '@/apis/utils'
+	import * as API_workOrder from '@/apis/pagejs/workOrder.js'
 
 
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
+				createdNum: 0,
+				dispatchedNum: 0,
+				endedNum: 0,
+				closedNum: 0,
 				workForm: {
 				workForm: {
 					qkey: '',
 					qkey: '',
 					startDate: '',
 					startDate: '',
@@ -154,25 +159,51 @@
 			this.weekStart = parseUnixTime(firstDay, '{y}-{m}-{d}');
 			this.weekStart = parseUnixTime(firstDay, '{y}-{m}-{d}');
 			this.weekEnd = parseUnixTime(lastDay, '{y}-{m}-{d}');
 			this.weekEnd = parseUnixTime(lastDay, '{y}-{m}-{d}');
 			
 			
+			const start = new Date(today.getFullYear(), today.getMonth(), 1);
+			const end = new Date(today.getFullYear(), today.getMonth() + 1, 0);
+			this.monthStart = parseUnixTime(start, '{y}-{m}-{d}');
+			this.monthEnd = parseUnixTime(end, '{y}-{m}-{d}');
 			console.log('当天:'+this.today+'\n'+'一周:'+this.weekStart+'至'+this.weekEnd+'\n'
 			console.log('当天:'+this.today+'\n'+'一周:'+this.weekStart+'至'+this.weekEnd+'\n'
 				+'一月:'+this.monthStart+'至'+this.monthEnd)
 				+'一月:'+this.monthStart+'至'+this.monthEnd)
+				
+			this.workForm.startDate = this.today;
+			this.workForm.endDate = this.today;
+			this.getRptByStatus();
 		},
 		},
 		onReady() {
 		onReady() {
 			this.getBarCharts();
 			this.getBarCharts();
 		},
 		},
 		methods: {
 		methods: {
+			getRptByStatus() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				API_workOrder.rptByStatus(this.workForm).then((res) => {
+					uni.hideLoading();
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
 			//选择时间
 			//选择时间
 			tabsClick(item,index) {
 			tabsClick(item,index) {
 				this.tabsIndex = index;
 				this.tabsIndex = index;
-				if(index == 0) {
-					this.workForm.startDate = this.today;
-					this.workForm.endDate = this.today;
-				} else if(index == 1) {
-					this.workForm.startDate = this.weekStart;
-					this.workForm.endDate = this.weekEnd;
-				} else if(index == 2) {
-					this.workForm.startDate = this.monthStart;
-					this.workForm.endDate = this.monthEnd;
+				if(index != 3) {
+					if(index == 0) {
+						this.workForm.startDate = this.today;
+						this.workForm.endDate = this.today;
+					} else if(index == 1) {
+						this.workForm.startDate = this.weekStart;
+						this.workForm.endDate = this.weekEnd;
+					} else {
+						this.workForm.startDate = this.monthStart;
+						this.workForm.endDate = this.monthEnd;
+					}
+					
+					this.getRptByStatus();
 				} else {
 				} else {
 					this.show = true;
 					this.show = true;
 				}
 				}