wkyy 1 ano atrás
pai
commit
d6ca8a5b61
1 arquivos alterados com 37 adições e 15 exclusões
  1. 37 15
      pages/equipmentDataMonitoring/equipmentElectricity.vue

+ 37 - 15
pages/equipmentDataMonitoring/equipmentElectricity.vue

@@ -6,7 +6,7 @@
 			</view>
 			<view class="title">
 				用电量(度)
-				<image class="img" src="@/assets/img/refresh-line.svg" @click="getCompanyInfoList()"></image>
+				<image class="img" src="@/assets/img/refresh-line.svg" @click="getList(true)"></image>
 			</view>
 
 		</view>
@@ -37,7 +37,7 @@
 			</view>
 		</u-popup>
 
-		<view class="main" v-for="(item, index) in companyKwhList" :key="index" v-if="current==0"
+		<!-- <view class="main" v-for="(item, index) in companyKwhList" :key="index" v-if="current==0"
 			@click="companyChange(item,index)">
 			<view class="item">
 				<view class="item-content">
@@ -80,9 +80,9 @@
 					<u-icon name="arrow-right" color="#d4d4d4" size="24"></u-icon>
 				</view>
 			</view>
-		</view>
+		</view> -->
 
-		<view class="main" v-for="(item, index) in kWhList" :key="item.id" v-if="current!=0"
+		<view class="main" v-for="(item, index) in kWhList" :key="item.index"
 			@click="toElectronicMonitoring(item)">
 			<view class="item">
 				<view class="item-content">
@@ -156,9 +156,17 @@
 				companyKwhList: [],
 				pageIndex: 1,
 				recordsTotal: 0,
+				windowHeight: ''
 			}
 		},
-		onLoad() {
+		onReady() {
+			uni.getSystemInfo({
+				success: function(res) {
+					this.windowHeight = res.windowHeight
+					// console.log(this.windowHeight)
+				}
+			});
+			
 			this.getCompanyInfoList();
 		},
 		onReachBottom() {
@@ -167,6 +175,13 @@
 			}
 		},
 		methods: {
+			refreshList() {
+				if(this.current != 0) {
+					this.getList(true);
+				} else {
+					this.getCompanyInfoList();
+				}
+			},
 			companyChange(item, index) {
 				this.current = index + 1;
 				this.companyId = item.id;
@@ -181,7 +196,7 @@
 				API.companyKwhList({
 					companyId: list.id
 				}).then((response) => {
-					uni.hideLoading();
+
 					var wkh = response.data;
 					var num = 0;
 					if (list.remoteReadingMeterList.length != 0) {
@@ -196,6 +211,10 @@
 						lastMonthKwh: wkh.lastMonthTotalKwh,
 					};
 					this.companyKwhList.push(wkhList);
+					
+					if(this.companyKwhList.length == this.companyList.length) {
+						uni.hideLoading();
+					}
 				}).catch(error => {
 					uni.showToast({
 						title: error,
@@ -204,17 +223,18 @@
 				})
 			},
 			getCompanyInfoList() {
-
+				this.companyKwhList = [];
+				
 				API.deviceCompanyList().then((response) => {
 					var list = response.data.companyInfoList;
 					this.companyList = list;
 
 					var mList1 = [];
 					var mList2 = [];
-					mList1.push({
-						id: '',
-						name: '全部'
-					});
+					// mList1.push({
+					// 	id: '',
+					// 	name: '全部'
+					// });
 
 					for (var i = 0; i < list.length; i++) {
 						if (i >= 3) {
@@ -223,11 +243,13 @@
 							mList1.push(list[i]);
 						}
 
-						this.getCompanyKwhList(list[i]);
+						// this.getCompanyKwhList(list[i]);
 					}
 
 					this.merchantList1 = mList1;
 					this.merchantList2 = mList2;
+					this.companyId = mList1[0].id;
+					this.getList();
 
 				}).catch(error => {
 					uni.showToast({
@@ -251,7 +273,7 @@
 				}
 				var data = {
 					pageIndex: this.pageIndex,
-					pageSize: 5,
+					pageSize: 8,
 					companyId: this.companyId
 				};
 				API.homePageKwh(data).then((res) => {
@@ -282,9 +304,9 @@
 				this.current = index;
 				this.companyId = this.merchantList1[index].id;
 
-				if (index != 0) {
+				// if (index != 0) {
 					this.getList(true);
-				}
+				// }
 			},
 			backStatistics() {
 				uni.navigateBack()