wkyy 1 år sedan
förälder
incheckning
6bc0249070

+ 3 - 3
pages/equipmentDataMonitoring/dataMonitoring-list.vue

@@ -228,9 +228,9 @@
 				})
 			},
 			toElectronicMonitoring(item) {
-				// uni.navigateTo({
-				// 	url: '/pages/equipmentDataMonitoring/electronicMonitoring?id=' + item.id + '&name=' + item.name
-				// })
+				uni.navigateTo({
+					url: '/pages/equipmentDataMonitoring/electronicMonitoring?id=' + item.id + '&name=' + item.name
+				})
 			}
 		}
 	}

+ 54 - 96
pages/equipmentDataMonitoring/electronicMonitoring.vue

@@ -6,9 +6,9 @@
 			<!-- <u-picker  title="设备选择" v-model="equipmentShow" 
 			mode="multiSelector"   :default-selector='[0, 1]' :range="multiSelector">
 			</u-picker> -->
-			<u-picker v-model="tabsFrom.show1" mode="selector" :range="tabsFrom.selector1" range-key="label"
-				@confirm="selector1confirm"></u-picker>
-			<u-select v-model="equipmentShow" mode="mutil-column-auto" :list="equipmentList" @confirm="confirm">
+			<!-- <u-picker v-model="tabsFrom.show1" mode="selector" :range="tabsFrom.selector1" range-key="label"
+				@confirm="selector1confirm"></u-picker> -->
+			<u-select v-model="tabsFrom.show1" mode="mutil-column-auto" :list="tabsFrom.selector1" @confirm="selector1confirm">
 
 			</u-select>
 
@@ -412,47 +412,8 @@
 				myChart: null,
 				endYear: '',
 				equipmentShow: false,
-				multiSelector: [
-					['荆鹏集团', '玉桥公园', '全季酒店'],
-					['荆鹏软件园01', '青少年宫02', '御河社区03', '荆州院子04']
-				],
-				equipmentList: [{
-						value: 1,
-						label: '荆鹏集团',
-						children: [{
-								value: 2,
-								label: '荆鹏集团01',
-							},
-							{
-								value: 3,
-								label: '荆鹏集团02',
-							},
-							{
-								value: 4,
-								label: '荆鹏集团03',
-							}
-						]
-					},
-					{
-						value: 5,
-						label: '荆州院子',
-						children: [{
-								value: 6,
-								label: '荆州院子01',
-
-							},
-							{
-								value: 7,
-								label: '荆州院子02',
-
-							},
-							{
-								value: 8,
-								label: '荆州院子03',
-							}
-						]
-					}
-				],
+				multiSelector: [],
+				equipmentList: [],
 				params: {
 					year: true,
 					month: true,
@@ -526,34 +487,36 @@
 
 			this.getElectricityStatistics();
 			this.getTimeSlotStatistics();
-			this.getList();
+			this.getCompanyInfoList();
 		},
 		onReady() {
 			this.getBarCharts(false);
 		},
 		methods: {
 			titleCk(){
-				if(this.kWhList.length>1){
+				if(this.tabsFrom.selector1.length>1){
 					this.tabsFrom.show1=true
 				}
 			},
 			selector1confirm(e) {
-
-				var index = e[0];
-				this.tabsFrom.show1Index = index;
-				this.tabsFrom.show1Text = this.tabsFrom.selector1[index].label;
-				this.tabsFrom.title = this.tabsFrom.selector1[index].label;
-
-				this.FormData.meterId = this.tabsFrom.selector1[index].value;
-				this.FormData.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
-				this.FormData2.meterId = this.tabsFrom.selector1[index].value;
-				this.FormData2.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
-
-				this.FormData.type = 2;
-				this.value = '2';
-
-				this.getTimeSlotStatistics();
-				this.getElectricityStatistics();
+				console.log(e)
+				// var index = e[2];
+				// this.tabsFrom.show1Index = index;
+				if(e[2].value != null) {
+					this.tabsFrom.show1Text = e[2].label;
+					this.tabsFrom.title = e[2].label;
+					
+					this.FormData.meterId = e[2].value;
+					this.FormData.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
+					this.FormData2.meterId = e[2].value;
+					this.FormData2.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
+					
+					this.FormData.type = 2;
+					this.value = '2';
+					
+					this.getTimeSlotStatistics();
+					this.getElectricityStatistics();
+				}
 			},
 			queryDate(queryTime, day) {
 
@@ -573,47 +536,43 @@
 					this.getElectricityStatistics();
 				}
 			},
-			getList() {
+			getCompanyInfoList() {
 				uni.showLoading({
 					title: "加载中",
 					mask: true,
 				})
-				var data = {
-					pageIndex: 1,
-					pageSize: 100
-				};
-				API.homePageKwh(data).then((res) => {
-					uni.hideLoading()
-					this.kWhList = res.data.data;
+				API.deviceCompanyList().then((response) => {
+					uni.hideLoading();
+					var list = response.data.companyInfoList;
 					this.tabsFrom.selector1 = [];
-					this.tabsFrom.selector1 = this.kWhList.map(item => {
+					this.tabsFrom.selector1 = list.map(item => {
 						return {
-							label: item.name,
-							value: item.id
+							label: item.fullName,
+							value: item.id,
+							children: [
+								{
+									label: '抄表',
+									value: '1',
+									children: item.remoteReadingMeterList.map(item => {
+										return {
+											label: item.name,
+											value: item.id,
+										}
+									})
+								},
+								{
+									label: '监控表',
+									value: '1',
+									children: item.remoteMonitorMeterList.map(item => {
+										return {
+											label: item.name,
+											value: item.id,
+										}
+									})
+								}
+							]
 						}
 					})
-					this.getEquipmentDataMonitoring(data)
-				}).catch(error => {
-					uni.showToast({
-						title: error,
-						icon: "none"
-					})
-				})
-			},
-			getEquipmentDataMonitoring(data) {
-				uni.showLoading({
-					title: "加载中",
-					mask: true,
-				})
-				API.homePageDeviceData(data).then((response) => {
-					uni.hideLoading();
-					var list = response.data.data;
-					for (var i = 0; i < list.length; i++) {
-						this.tabsFrom.selector1.push({
-							label: list[i].name,
-							value: list[i].id
-						})
-					}
 				}).catch(error => {
 					uni.showToast({
 						title: error,
@@ -672,7 +631,6 @@
 						}
 						this.$forceUpdate()
 					}
-					//this.electricityMeterList=response.data.meterList
 				}).catch(error => {
 					uni.showToast({
 						title: error,

+ 50 - 54
pages/equipmentDataMonitoring/equipmentElectricity.vue

@@ -11,7 +11,7 @@
 
 		</view>
 		<!-- 标签 -->
-		<view class="tabs-box" v-if="list.length >2">
+		<view class="tabs-box" v-if="companyList.length >2">
 			<view class="tabs">
 				<u-tabs :list="merchantList1" :is-scroll="false" inactive-color="#999999" active-color="#666666" :current="current"
 					@change="change"></u-tabs>
@@ -36,21 +36,21 @@
 				</view>
 			</view>
 		</u-popup>
-		<view class="tatol-main">
+		<view class="tatol-main" v-for="(m, i) in kWhList" :key="i" style="margin-bottom: 15px;">
 			<!-- 用电量合计 -->
-			<view class="total" v-if="false">
+			<view class="total">
 				<view class="company">
 					<view class="name">
-						{{c.companyName}}
+						{{m.companyName}}
 					</view>
 					<view class="amount">
-						共 {{c.deviceList.length}} 台设备
+						共 {{m.deviceList.length}} 台设备
 					</view>
 				</view>
 				<view class="infos">
 					<view class="infos-item">
 						<view class="number">
-							{{c.thisDayKwh.toFixed(2)}}
+							{{m.thisDayKwh.toFixed(2)}}
 						</view>
 						<view class="time">
 							今日
@@ -58,7 +58,7 @@
 					</view>
 					<view class="infos-item">
 						<view class="number">
-							{{c.thisMonthKwh}}
+							{{m.thisMonthKwh.toFixed(2)}}
 						</view>
 						<view class="time">
 							本月
@@ -66,7 +66,7 @@
 					</view>
 					<view class="infos-item">
 						<view class="number">
-							{{c.lastMonthKwh}}
+							{{m.lastMonthKwh.toFixed(2)}}
 						</view>
 						<view class="time">
 							上月
@@ -76,7 +76,7 @@
 			</view>
 
 			<view class="main">
-				<view class="item" v-for="(item, index) in kWhList" :key="index" @click="toElectronicMonitoring(item)">
+				<view class="item" v-for="(item, index) in m.deviceList" :key="index" @click="toElectronicMonitoring(item)">
 					<view class="icon">
 						<image class="img" src="@/assets/img/energyMeter.svg" mode=""></image>
 					</view>
@@ -127,10 +127,7 @@
 				</view>
 			</view>
 		</view>
-
-
-
-
+		
 	</view>
 </template>
 
@@ -140,13 +137,12 @@
 	export default {
 		data() {
 			return {
-				companyList: [],
-				merchantList1: [], // 商户
+				companyList: [], // 商户
+				merchantList1: [], 
 				merchantList2: [],
-				kWhList: [],
+				kWhList: [], //设备
 				companyId: '',
 				popShow: false,
-				list: [],
 				current: 0
 			}
 		},
@@ -165,15 +161,15 @@
 				})
 				API.deviceCompanyList().then((response) => {
 					uni.hideLoading();
-					this.list = response.data.companyInfoList;
-					for (var i = 0; i < this.list.length; i++) {
-						this.list[i].name = this.list[i].fullName;
+					this.companyList = response.data.companyInfoList;
+					for (var i = 0; i < this.companyList.length; i++) {
+						this.companyList[i].name = this.companyList[i].fullName;
 					}
-					if (this.list.length > 3) {
-						this.merchantList1.push(this.list.slice(0, 3));
-						this.merchantList2.push(this.list.slice(3));
+					if (this.companyList.length > 3) {
+						this.merchantList1.push(this.companyList.slice(0, 3));
+						this.merchantList2.push(this.companyList.slice(3));
 					} else {
-						this.merchantList1 = this.list;
+						this.merchantList1 = this.companyList;
 					}
 					this.merchantList1.unshift({
 						id: '',
@@ -198,34 +194,34 @@
 				};
 				API.homePageKwh(data).then((res) => {
 					uni.hideLoading()
-					this.kWhList = res.data.data;
-					// var idList = [];
-					// var list = []
-					// for (var i = 0; i < this.kWhList.length; i++) {
-					// 	idList.push(this.kWhList[i].companyId);
-					// }
-					// idList = Array.from(new Set(idList));
-					// for (var m = 0; m < idList.length; m++) {
-					// 	list.push({
-					// 		companyId: idList[m],
-					// 		companyName: '',
-					// 		thisDayKwh: 0,
-					// 		thisMonthKwh: 0,
-					// 		lastMonthKwh: 0,
-					// 		deviceList: []
-					// 	});
-					// 	for (var n = 0; n < this.kWhList .length; n++) {
-					// 		if(this.kWhList[n].companyId == idList[m]) {
-					// 			list[m].companyName = this.kWhList[n].companyName;
-					// 			list[m].deviceList.push(this.kWhList[n]);
-					// 			list[m].thisDayKwh += this.kWhList[n].thisDayKwh;
-					// 			list[m].thisMonthKwh += this.kWhList[n].thisMonthKwh;
-					// 			list[m].lastMonthKwh += this.kWhList[n].lastMonthKwh;
-					// 		}
-					// 	}
-					// }
+					var dataList = res.data.data;
+					var idList = [];
+					var list = []
+					for (var i = 0; i < dataList.length; i++) {
+						idList.push(dataList[i].companyId);
+					}
+					idList = Array.from(new Set(idList));
+					for (var m = 0; m < idList.length; m++) {
+						list.push({
+							companyId: idList[m],
+							companyName: '',
+							thisDayKwh: 0,
+							thisMonthKwh: 0,
+							lastMonthKwh: 0,
+							deviceList: []
+						});
+						for (var n = 0; n < dataList.length; n++) {
+							if(dataList[n].companyId == idList[m]) {
+								list[m].companyName = dataList[n].companyName;
+								list[m].deviceList.push(dataList[n]);
+								list[m].thisDayKwh += dataList[n].thisDayKwh;
+								list[m].thisMonthKwh += dataList[n].thisMonthKwh;
+								list[m].lastMonthKwh += dataList[n].lastMonthKwh;
+							}
+						}
+					}
 					// console.log(list)
-					// this.companyList = list;
+					this.kWhList = list;
 				}).catch(error => {
 					uni.showToast({
 						title: error,
@@ -238,15 +234,15 @@
 				var n = this.merchantList1[this.current];
 				this.merchantList1[this.current] = m;
 				this.merchantList2[index] = n;
-				
 				this.companyId = item.id;
-				this.getList();
-				
 				this.popShow = false;
+				
+				this.getList();
 			},
 			change(index) {
 				this.current = index;
 				this.companyId = this.merchantList1[index].id;
+
 				this.getList();
 			},
 			backStatistics() {

+ 2 - 2
pages/statistics/statistics.vue

@@ -205,8 +205,8 @@
 						查看全部<u-icon name="arrow-right" size="24" color="#838383"></u-icon>
 					</view>
 				</view>
-				<view class="monitoring-item" v-for="(item, index) in deviceList" :key="index">
-					<!-- @click="toElectronicMonitoring(item)"> -->
+				<view class="monitoring-item" v-for="(item, index) in deviceList" :key="index"
+					@click="toElectronicMonitoring(item)">
 					<view class="item-title">
 						<view class="text1">
 							{{item.name}}