瀏覽代碼

bug处理

zhengkaixin 1 年之前
父節點
當前提交
cdb2624908
共有 1 個文件被更改,包括 52 次插入31 次删除
  1. 52 31
      pages/statistics/statistics.vue

+ 52 - 31
pages/statistics/statistics.vue

@@ -784,7 +784,7 @@
 			 this.month=date.getMonth() + 1
 			this.endYear = new Date().getFullYear();
 			this.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
-		 
+			this.datacompanyInfo=this.carhelp.getPersonInfoPlus().companyInfo
 			this.getfindByOpenId();
 			this.getCompanyInfoList();
 			
@@ -900,7 +900,7 @@
 					return bl
 				}
 			},
-			getTenantList(){
+			getTenantList(companyId){
 				// uni.showLoading({
 				// 	title: "加载中",
 				// 	mask: true,
@@ -909,9 +909,12 @@
 				this.tenantListNum2=0
 				this.tenantListNum3=0
 				API_tenantList.tenantContractList({
-					companyId:this.companyId
+					companyId:companyId
 				}).then((response) => {
-					uni.hideLoading();
+					uni.hideLoading();
+					if(this.companyId!=companyId){
+											 return
+					}
 					//this.getTenantListReady=true
 					var tenantList=response.data.tenantInfoList;
 					this.tenantListNum0=tenantList.length
@@ -961,7 +964,7 @@
 						
 						this.codes =response.data.regUser.codes
 						if(this.companyId&&this.codes&&this.codes.indexOf('property')!=-1){
-							this.getTenantList()
+							this.getTenantList(this.companyId)
 						}
 						
 					}
@@ -1022,15 +1025,18 @@
 				})
 				console.log(node,key)
 			},
-			getIncomeExpenditure(){
+			getIncomeExpenditure(companyId){
 				
 				API.incomeExpenditure({
 					//parentMeterId:item.id,
 					queryDate:this.queryDate,
-					companyId: this.companyId,
+					companyId: companyId,
 					type: this.list[this.homePageManageType].value
 				}).then((response) => {
-					
+					
+					if(this.companyId!=companyId){
+						return
+					}
 					this.incomeExpenditureObj=response.data
 					this.incomeExpenditureObj.id=1
 					
@@ -1042,7 +1048,10 @@
 				})
 			},
 			// 设备数据监测
-			getHomePageManageChildMeter(item,bl) {
+			getHomePageManageChildMeter(item,bl,companyId) {
+				if(!companyId){
+					companyId=this.companyId
+				}
 				if(!bl){
 					// uni.showLoading({
 					// 	title: "加载中",
@@ -1053,7 +1062,7 @@
 				API.homePageManageChildMeter({
 					parentMeterId:item.id,
 					queryDate:this.queryDate,
-					companyId: this.companyId,
+					companyId: companyId,
 					type: this.list[this.homePageManageType].value
 				}).then((response) => {
 					// if(!bl){
@@ -1064,6 +1073,9 @@
 					// 	this.meterListShow.id=1
 					// 	this.recursionList(this.meterList)
 					// }
+					if(this.companyId!=companyId){
+							return
+					}
 					
 					var childMeterList=response.data.childMeterList
 					item.childMeterList=childMeterList
@@ -1072,7 +1084,7 @@
 					if(!bl){
 						for(var i in childMeterList){
 							var obj=childMeterList[i]
-							this.getHomePageManageChildMeter(obj,true)
+							this.getHomePageManageChildMeter(obj,true,this.companyId)
 						}
 					}
 					
@@ -1113,14 +1125,14 @@
 				if (e.day) {
 					this.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
 					
-					this.getHomePageManage();
+					this.getHomePageManage(0,this.companyId);
 				} else {
 				
 					this.homePageManageType = this.clickType;
 					if (this.homePageManageType != 5) {
 						this.list[5].name = '指定时间';
 					}
-					this.getHomePageManage();
+					this.getHomePageManage(0,this.companyId);
 				}
 			},
 			selector2cancel() {
@@ -1156,7 +1168,7 @@
 					this.list[5].value = '10';
 				}
 				//this.list[5].name = queryTime;
-				this.getHomePageManage();
+				this.getHomePageManage(0,this.companyId);
 			},
 			clearTimer() {
 				if (this.intervalId) {
@@ -1180,10 +1192,10 @@
 				if (this.companyId) {
 					
 					if(this.companyId&&this.codes&&this.codes.indexOf('property')!=-1){
-						this.getTenantList()
+						this.getTenantList(this.companyId)
 					}
 					this.getHomePageKwh(this.companyId)
-					this.getAbnormalAlarmRecord();
+					this.getAbnormalAlarmRecord(this.companyId);
 					
 				}else{
 					this.kWhList=[]
@@ -1191,7 +1203,7 @@
 					this.getPlatformRevenue()
 					
 				}
-				this.getDeviceStatus()
+				this.getDeviceStatus(this.companyId)
 			},
 			companyInfotypeChange(index){
 				if(index!=this.companyInfotypeCurrent){
@@ -1366,13 +1378,13 @@
 					//this.params.day = false;
 				} else {
 					this.list[5].name = '指定时间'
-					this.getHomePageManage()
+					this.getHomePageManage(0,this.companyId)
 				}
 				
 				
 			},
 			
-			getHomePageManage(bl) {
+			getHomePageManage(bl,companyId) {
 				this.getHomePageManageReady=false
 				if(bl){
 					this.getHomePageManageshowLoading=false
@@ -1389,7 +1401,7 @@
 				
 				API.homePageManage({
 					queryDate:this.queryDate,
-					companyId: this.companyId,
+					companyId: companyId ,
 					type: type
 				}).then((response) => {
 					this.getHomePageManageReady=true
@@ -1400,7 +1412,9 @@
 						uni.hideLoading();
 					}
 					
-					
+					if(this.companyId!=companyId){
+						return
+					}
 					
 					
 					this.meterList = response.data.meterList;
@@ -1414,7 +1428,7 @@
 								this.getBarCharts()
 						})
 						
-						this.getIncomeExpenditure();
+						this.getIncomeExpenditure(this.companyId);
 					}
 					
 					
@@ -1429,7 +1443,7 @@
 			},
 			
 			// 报警
-			getAbnormalAlarmRecord() {
+			getAbnormalAlarmRecord(companyId) {
 				if(this.companyId&&this.codes&&this.codes.indexOf('property')!=-1){
 					
 				}else{
@@ -1440,9 +1454,11 @@
 					configId: '',
 					pageIndex: 1,
 					pageSize: 3,
-					companyId: this.companyId
+					companyId: companyId
 				}).then((response) => {
-				
+					if(this.companyId!=companyId){
+						return 
+					}
 					this.abnormalRecordsList = response.data.data;
 				}).catch(error => {
 					uni.showToast({
@@ -1485,7 +1501,9 @@
 						//uni.hideLoading();
 						this.getHomePageKwhshowLoading=false;
 					}
-					
+					if(this.companyId!=companyId){
+						return
+					}
 					if(companyId){
 						this.kWhList = response.data.data;
 						
@@ -1506,9 +1524,9 @@
 							},200)
 							
 						}else{
-							this.getHomePageManage(1)
+							this.getHomePageManage(1,this.companyId)
 							
-							this.getAbnormalAlarmRecord();
+							this.getAbnormalAlarmRecord(this.companyId);
 						}
 					}else{
 						
@@ -1533,7 +1551,7 @@
 				})
 			},
 			getPlatformRevenueBl(){
-				console.log("getPlatformRevenueBl",this.datacompanyInfo)
+				
 				return  this.companyId==''&&this.companyList.length>1&&this.datacompanyInfo.type=='2'
 			},
 			getPlatformRevenue(){
@@ -1558,12 +1576,15 @@
 				})
 			},
 			// 累计报警
-			getDeviceStatus() {
+			getDeviceStatus(companyId) {
 				 
 				API.deviceStatus({
-					companyId: this.companyId
+					companyId: companyId
 				}).then((response) => {
 					 
+					 if(this.companyId!=companyId){
+						 return
+					 }
 					 setTimeout(()=>{
 					 	this.$nextTick(()=>{
 					 		this.utabsone=true