Browse Source

分区调整

zhengkaixin 1 năm trước cách đây
mục cha
commit
e3409263f6

+ 2 - 2
config/.env.dev.js

@@ -5,7 +5,7 @@ const UNI_APP = {
 	BASE_URL: 'https://charging.xiaoxinda.com/electric-manager-api/', //test
 	BASE_URL: 'https://dgj.hbjp.com.cn/electric-manager-api/',
 	
-	BASE_URL:'http://192.168.77.162:8081/electric-manager-api/', //sz
+	//BASE_URL:'http://192.168.77.162:8081/electric-manager-api/', //sz
 	
 	NODE_ENV :"dev",
 	SIMPLE_RUN:true,// 无视权限控制跳转页面   , 用于样式人员快速访问各种功能 ,快速测试等
@@ -17,7 +17,7 @@ const UNI_APP = {
 	openId:"oLowyuOJvTszgk96C0f8j0XfcEXg",//zkx
 	
 	openId:"oLowyuAJ1Ld0ivnLj4qp1k5Vy_l4", //老板
-	//openId:"oLowyuFTU3SzpvU4pGNzWk7NC9y0", //me
+	//openId:"oLowyuFTU3SzpvU4pGNzWk7NC9y0", //wky
 	//openId:"oLowyuMMjIkA_bLA4MXzRQ3KJB2E",
 	//openId:"oLowyuHCGgMomNBQEXZSbb5SJxfQ",//杨所
 	//openId:"oLowyuMxAACLlFRDYcM9-w6v0b6o",

+ 4 - 4
pages/equipmentDataMonitoring/electronicMonitoring.vue

@@ -504,7 +504,9 @@
 		},
 		methods: {
 			init(op){
+			
 				if (op.id) {
+					
 					this.ref=op.ref;
 					this.FormData.meterId = op.id;
 					this.FormData2.meterId = op.id;
@@ -512,9 +514,7 @@
 					this.meterId = op.id;
 					this.titleName = this.replaceLastTwoWords(op.name);
 					this.companyId = op.companyId;
-					if(op.list){
-						this.tabsFrom.selector1=op.list
-					}
+					
 				}
 				this.endYear = new Date().getFullYear();
 				this.FormData.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
@@ -524,7 +524,7 @@
 				this.getElectricityStatistics();
 				this.getTimeSlotStatistics();
 				//this.getCompanyInfoList();
-				this.getAbnormalAlarmRecord();
+				//this.getAbnormalAlarmRecord();
 				this.getMeterDetails(this.meterId);
 			},
 			

+ 177 - 105
pages/statistics/statistics.vue

@@ -1,10 +1,11 @@
 <template>
-	<view>
+	<view>
+		
 		<u-picker-select title="日期选择" :maskCloseAble="true" v-model="tabsFrom.show2" :defaultTime="tabsFrom.show2Index" :endYear="endYear"
 			mode="time" :params="params"  @confirm="selector2confirm" @cancel="selector2cancel"
 			@reset="selector2reset">
 		</u-picker-select>
-		<u-select title="" v-model="tabsFrom.show1"
+		<u-select title="" v-model="tabsFrom.show1" :defaultValue="[current2]"
 		 :list="childList" value-name="id" label-name="name"
 			@confirm="selector1confirm"  >
 		</u-select>
@@ -16,7 +17,7 @@
 					|
 				</span>
 				<span style="padding-left: 4px;" >	
-					{{companyInfo.name}}
+					{{datacompanyInfo.name}}
 				</span>
 			</view>
 			<view class="title" v-else>
@@ -30,7 +31,7 @@
 						{{kWhList[0].name}}
 					</template>
 					<template v-else>
-						{{merchantList1[current].name}}
+						{{childList.length==1?companyInfo.name : childInfo.name}}
 					</template>
 				</span>
 				<span style="padding-left: 4px;" v-if="companyList.length==1">
@@ -42,7 +43,7 @@
 						{{kWhList[0].name}}
 					</template>
 					<template v-else>
-						{{companyList[0].name}}
+						{{childList.length==1?companyInfo.name : childInfo.name}}
 					</template>
 				</span>
 			
@@ -53,7 +54,7 @@
 			
 			<view class="tabs2" :class="'tabs-len-2'"  
 			 :style="{width: '100%',   }">
-				<u-tabs-one    :gutter="32"
+				<u-tabs-one    :gutter="32" 
 				:list="companyInfotypeList" :is-scroll="false" active-color="#fff" inactive-color="#CCE2FF"
 					bg-color="#1677FF" :current="1" @change="companyInfotypeChange"></u-tabs-one>
 			</view>
@@ -65,7 +66,7 @@
 			
 			<view class="tabs" :class="'tabs-len-'+merchantList1.length"  v-show="companyList.length>1"
 			 :style="{width: companyList.length>3 ? '' : '100%'}">
-				<u-tabs-one  v-if="utabsone"
+				<u-tabs-one  v-if="utabsone" 
 				:list="merchantList1" :is-scroll="false" active-color="#fff" inactive-color="#CCE2FF"
 					bg-color="#1677FF" :current="current" @change="change"></u-tabs-one>
 			</view>
@@ -78,7 +79,8 @@
 		<u-popup v-model="popShow" duration="10" mode="top" :negative-top="88" border-radius="16">
 			<view class="popup-tabs">
 				<view class="tabs">
-					<u-tabs :list="merchantList1" :is-scroll="false" :current="current" @change="change"></u-tabs>
+					<u-tabs  
+					:list="merchantList1" :is-scroll="false" :current="current" @change="change"></u-tabs>
 				</view>
 				<view class="more">
 					<u-icon name="arrow-up" color="#777777" size="40" @click="popShow=false"></u-icon>
@@ -90,7 +92,8 @@
 					{{item.name}}
 				</view>
 			</view>
-		</u-popup>
+		</u-popup>
+		
 		<view class="main  electronicMonitoring-123" v-show="kWhList.length==1" style="padding:32rpx 0;">
 			
 			<view class="electronicMonitoring-title"
@@ -109,7 +112,29 @@
 			
 		</view>
 		
-		<view class="main current-123" v-show="(kWhList.length!=1)">
+		<view class="main current-123" v-show="(kWhList.length!=1)">
+			
+			<view class="electronicMonitoring-title"
+			 @click="titleCk" 
+			 v-if="companyType==1"
+			 v-show="childList&&childList.length>0" >
+				<view>
+					{{childListName}}
+				</view>
+				<view v-show="childList.length>1">
+					<u-icon name="arrow-down"></u-icon>
+				</view>
+			</view>
+			<view class="electronicMonitoring-title2"
+			v-else
+			 v-show="childList&&childList.length>1" >
+				<u-tabs-one height="60"  v-if="childList&&childList.length"
+				 :currentIndexBl="true" bg-color="#f2f4f6" 
+				 :list="childList" :is-scroll="false" :current="current2" @change="change2"></u-tabs-one>
+
+			</view>
+			
+			
 			<!-- 电表运行情况 -->
 			<view class="statistics-1 statistics">
 				<view class="title">
@@ -154,7 +179,7 @@
 
 			</view>
 			
-			<view class=""  v-show="companyId==''">
+			<view class=""  v-show="companyId==''&&companyList.length>1&&datacompanyInfo.type=='2'">
 				<!-- 电表运行情况 -->
 				<view class="statistics-1 statistics" >
 					<view class="title">
@@ -166,29 +191,23 @@
 						</view>
 					
 					</view>
-					<view class=" contractList">
-						<view class="contractListClass" @click="gotoUrl('/pages/tenantList/contractList?query=1')">
-							<view class="contractListClass1">
-								荆鹏软件园
-							</view>
-							<view  class="contractListClass2">
-								<u-icon name="arrow-right" size="24" color="#838383"></u-icon>
-							</view>
-						</view>
-						<view class="contractListClass" @click="gotoUrl('/pages/tenantList/contractList?query=1')">
+					<view class=" contractList" >
+						<view class="contractListClass" v-for="(item,i) in companyList" :key="i"
+						 @click="change(i+1)">
 							<view class="contractListClass1">
-								鹏育优电
+								{{item.name}}
 							</view>
 							<view  class="contractListClass2">
 								<u-icon name="arrow-right" size="24" color="#838383"></u-icon>
 							</view>
 						</view>
+						 
 						
 					</view>
 				</view>
 			</view>
 			
-			<view class=""  v-show="companyId==''">
+			<view class=""  v-show="companyId==''&&companyList.length>1&&0&&datacompanyInfo.type=='2'">
 				<!-- 电表运行情况 -->
 				<view class="statistics-1 statistics statistics-3" >
 					<view class="title">
@@ -568,7 +587,8 @@
 
 
 
-
+			<u-divider   nonetext="暂无数据" border-color="#CFD2D5">已经到底了</u-divider>
+			
 		</view>
 
 
@@ -601,9 +621,9 @@
 		},
 		data() {
 			return {
-				abnormalRecordsList: [], // 异常告警记录
+				abnormalRecordsList: [], 
 				queryDate: '',
-				queryDateMonth:"",
+				 
 				alarmsPercent: 0,
 				alarmsForm: {
 					okNum: 0,
@@ -622,7 +642,7 @@
 				merchantList1: [], // 商户
 				merchantList2: [],
 				companyList: [],
-				companyInfo:{},
+				datacompanyInfo:{},
 				companyInfotypeCurrent:1,
 				companyInfotypeList:[
 					{
@@ -700,9 +720,9 @@
 					
 				},
 				getHomePageManageReady:false,
-				childListName:"",
+				
 				utabsone:true,
-				companyType:0,
+				
 				incomeExpenditureObj:{},
 				getHomePageKwhshowLoading:false,
 				getHomePageManageshowLoading:false,
@@ -713,14 +733,16 @@
 				tenantListNum1:0,
 				tenantListNum2:0,
 				tenantListNum3:0,
-				childList:[],
+				childList:[],
+				childInfo:{},
+				companyInfo:{},
 			}
 		},
 		onLoad() {
 			var date = new Date();
 			var year = date.getFullYear();
 			var month = date.getMonth() + 1 >= 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1);
-			this.queryDateMonth = year + '-' + month;
+			 
 			this.endYear = new Date().getFullYear();
 			this.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
 		 
@@ -754,6 +776,14 @@
 			if(!this.intervalReady&&this.companyList.length>1){
 				this.startInterval();
 			}
+		},
+		computed:{
+			childListName(){
+				return this.childInfo.name;
+			},
+			companyType(){
+				return this.companyInfo.type;
+			}
 		},
 		methods: {
 			titleCk() {
@@ -870,7 +900,7 @@
 					openId: this.carhelp.getOpenId()
 				}).then((response) => {
 					if(response.data&&response.data.companyInfo){
-						this.companyInfo=response.data.companyInfo
+						this.datacompanyInfo=response.data.companyInfo
 						this.companyInfotype = response.data.companyInfo.type;
 						if(this.companyInfotype==4){
 							this.getFindMeterList()
@@ -913,29 +943,7 @@
 					})
 				})
 			},
-			companyIdSet(val,item){
-				this.companyType= 0
-				if(val&&item){
-					this.companyType= item.type
-				}else{
-					if(!val){
-						
-					}else{
-						var bl=false
-						this.companyList.find(item=>{
-							
-							if(item.id==val){
-							
-								this.companyType= item.type;
-							}
-						})
-						
-					}
-				}
-				
-				
-				
-			},
+		
 			switchBtnApiMethod(node,key){
 				uni.showLoading({
 					title: "加载中",
@@ -1163,41 +1171,67 @@
 			change(index) {
 				this.current = index;
 				this.current2=0;
+				this.childList=[]
 				var company= this.merchantList1[index]
 				if(company.id!=''){
-					this.childList=this.merchantList1[index].childList
+					this.childList=company.childList;
+					if(this.childList&&this.childList.length){
+						this.companyId = this.childList[0].id;
+						this.childInfo=this.childList[0]
+					}else{
+						this.childList=[]
+						this.companyId =company.id
+						this.childInfo=company
+					}
+					
 					
-					this.companyId = this.childList[this.current2].id;
-					this.childListName=this.childList[this.current2].name;
 				}else{
 					this.companyId =''
+					
 				}
+				this.companyInfo=company;
 				
-				 this.companyIdSet(this.companyId)
 				this.merchantChangeApi()
 			},
 			change2(index) {
 			
 				this.current2=index;
-				//this.childList=this.merchantList1[index].childList
+				
 				this.companyId = this.childList[this.current2].id;
-				this.childListName=this.childList[this.current2].name;
+			
+				this.childInfo=this.childList[this.current2]
 				
-				this.companyIdSet(this.companyId)
 				this.merchantChangeApi()
 			},
-			merchantChange(item, index) {
+			merchantChange(company, index) {
 				if(this.current==0){
 					this.current=1;
 				}
-				var m = item;
+				var m = company;
 				var n = this.merchantList1[this.current];
 				this.merchantList1[this.current] = m;
 				this.merchantList2[index] = n;
 				//this.$forceUpdate()
 				this.utabsone=false
-				this.companyId = item.id;
-				 this.companyIdSet(this.companyId)
+				this.companyId = company.id;
+				
+				this.companyInfo=company
+				
+				
+				if(company.id!=''){
+					this.childList=company.childList;
+					if(this.childList&&this.childList.length){
+						this.companyId = this.childList[0].id;
+						this.childInfo=this.childList[0]
+					}else{
+						this.childList=[]
+						this.companyId =company.id
+						this.childInfo=company
+					}	
+				}else{
+					this.companyId =''	
+				}
+				
 				this.merchantChangeApi()
 				this.popShow = false;
 			},
@@ -1227,16 +1261,40 @@
 					}
 
 					this.companyList = list;
-					if(this.companyList&&this.companyList.length){
+					
+					
+					if(this.companyList&&this.companyList.length&&this.companyList.length==1){
+						
 						this.childList=list[0].childList
+						if(!this.childList){
+							this.childList=[]
+						}
+						// this.childList=[
+							
+						// 	...list[0].childList,
+						// 	{
+						// 		name:'创客公寓',
+						// 		id:''
+						// 	},
+						// 	{
+						// 		name:'创客公寓',
+						// 		id:''
+						// 	}
+						// ]
 					}
 					
-					
-					if(this.companyList.length==1&&this.childList.length==1){
+					if(this.companyList.length==1&&this.childList.length==0){
+						this.companyId=this.companyList[0].id
+						
+						this.childInfo=this.companyList[0]
+						this.companyInfo=this.companyList[0]
+					}else if(this.companyList.length==1){
 						this.companyId=this.childList[0].id
-						this.childListName=this.childList[this.current2].name;
-						
-						this.companyIdSet(this.companyId)
+						
+						this.childInfo=this.childList[0]
+						this.companyInfo=this.companyList[0]
+						
+						 
 					
 					}else{
 						this.getHomePageKwh('')
@@ -1329,7 +1387,7 @@
 					return
 				}
 				API.remindList({
-				//	queryDate: this.queryDateMonth,
+				 
 					configId: '',
 					pageIndex: 1,
 					pageSize: 3,
@@ -1349,9 +1407,12 @@
 				
 				console.log(e)
 				this.companyId=e[0].value
-				this.childListName=e[0].label
+			
+				this.current2=e[0].i
+				
+				this.childInfo=this.childList[this.current2];
 				uni.showLoading()
-				this.companyIdSet(this.companyId)
+				
 				this.merchantChangeApi()
 			},
 			// 用电量
@@ -1377,7 +1438,8 @@
 					}
 					
 					if(companyId){
-						this.kWhList = response.data.data;
+						this.kWhList = response.data.data;
+						
 						if(this.kWhList.length==1){
 							this.utabsone=true
 							var item=this.kWhList[0];
@@ -1385,7 +1447,7 @@
 								id:item.id,
 								name:item.name,
 								companyId:item.companyId,
-								list:[{name:"123"},{name:"223"}],
+								
 								ref:1,
 							})
 						}else{
@@ -1638,35 +1700,36 @@
 	// /deep/.u-tab-item {
 	// 	width: 25% !important;
 	// 	flex: none !important;
-	// }
-	.tabs-len-1{
-		
-	}
-	.tabs-len-2{
-		/deep/.u-tab-item {
-			// max-width: 39% !important;
-			// flex: none !important;
+	// }
+	.tabs-box{
+		.tabs-len-1{
+			
 		}
-	}
-	.tabs-len-3{
-		/deep/.u-tab-item {
-			max-width: 39% !important;
-			flex: none !important;
+		.tabs-len-2{
+			/deep/.u-tab-item {
+				// max-width: 39% !important;
+				// flex: none !important;
+			}
 		}
-	}
-	.tabs-len-4{
-		/deep/.u-tab-item {
-			max-width: 26% !important;
-			flex: none !important;
+		.tabs-len-3{
+			/deep/.u-tab-item {
+				max-width: 39% !important;
+				flex: none !important;
+			}
 		}
-	}
-	.tabs{
-		/deep/.u-tab-item:first-child {
-			width: 20% !important;
-			flex: none !important;
+		.tabs-len-4{
+			/deep/.u-tab-item {
+				max-width: 26% !important;
+				flex: none !important;
+			}
+		}
+		.tabs{
+			/deep/.u-tab-item:first-child {
+				width: 20% !important;
+				flex: none !important;
+			}
 		}
 	}
-	
 	// /deep/.u-tab-item2 {
 	// 	width: 33% !important;
 	// 	flex: none !important;
@@ -2405,11 +2468,20 @@
 	
 		
 	}
-	.electronicMonitoring-123{
+	.electronicMonitoring-title2{
+		margin-bottom: 16rpx;
+	}
+	.electronicMonitoring-title{
+		display: flex;
+		margin: 0px 32rpx;
+		    justify-content: space-between;
+	}
+	.current-123{
 		.electronicMonitoring-title{
-			display: flex;
-			margin: 0px 16px;
-			    justify-content: space-between;
+			margin: 8rpx 0rpx 32rpx 0;
 		}
+	}
+	.electronicMonitoring-123{
+		
 	}
 </style>

+ 3 - 0
uni_modules/uview-ui/components/u-select/u-select.vue

@@ -301,6 +301,7 @@ export default {
 					let tmp = {
 						value: data ? data[this.valueName] : null,
 						label: data ? data[this.labelName] : null,
+						i:columnIndex[index],
 					};
 					// 判断是否有需要额外携带的参数
 					if(data && data.extra !== undefined) tmp.extra = data.extra;
@@ -315,6 +316,7 @@ export default {
 				let tmp = {
 					value: data ? data[this.valueName] : null,
 					label: data ? data[this.labelName] : null,
+					i:columnIndex[0],
 				};
 				// 判断是否有需要额外携带的参数
 				if(data && data.extra !== undefined) tmp.extra = data.extra;
@@ -327,6 +329,7 @@ export default {
 					let tmp = {
 						value: data ? data[this.valueName] : null,
 						label: data ? data[this.labelName] : null,
+						i:columnIndex[index],
 					};
 					// 判断是否有需要额外携带的参数
 					if(data && data.extra !== undefined) tmp.extra = data.extra;

+ 12 - 4
uni_modules/uview-ui/components/u-tabs-one/u-tabs-one.vue

@@ -156,7 +156,11 @@
 			itemWidth: {
 				type: [Number, String],
 				default: 'auto'
-			}
+			},
+			currentIndexBl: {
+				type: Boolean,
+				default: false
+			},
 		},
 		data() {
 			return {
@@ -197,15 +201,19 @@
 			tabBarStyle() {
 				let tabInfo = this.tabQueryInfo[this.currentIndex];
 				var tabWidth =this.barWidth + 'rpx';
-				if (tabInfo&&this.currentIndex!=0) {
+				if (tabInfo&&(this.currentIndex!=0||this.currentIndexBl)) {
 					 tabWidth = (tabInfo.width*2-30)+"rpx";
 					
 				}
+				var scrollBarLeft=this.scrollBarLeft
+				if(this.currentIndexBl){
+					scrollBarLeft=scrollBarLeft-15
+				}
 				
 				
 				let style = {
 					width: tabWidth,
-					transform: `translate(${this.scrollBarLeft}px, -100%)`,
+					transform: `translate(${scrollBarLeft}px, -100%)`,
 					// 滑块在页面渲染后第一次滑动时,无需动画效果
 					'transition-duration': `${this.barFirstTimeMove ? 0 : this.duration }s`,
 					'background-color': this.activeColor,
@@ -304,7 +312,7 @@
 				//this.scrollBarLeft = left - uni.upx2px(this.barWidth) / 2;
 				
 				var barWidth =this.barWidth ;
-				if (tabInfo&&this.currentIndex!=0) {
+				if (tabInfo&&(this.currentIndex!=0||this.currentIndexBl)) {
 					 barWidth = (tabInfo.width*2-30);
 					
 				}