浏览代码

租户费用预警, 增加筛选

zhengkaixin 11 月之前
父节点
当前提交
2ce7a04004

+ 3 - 3
pages/abnormal/abnormalAlarmRecord.vue

@@ -190,9 +190,9 @@
 				API.deviceCompanyList().then((response) => {
 					var list = response.data.companyInfoList;
 					this.companyListMain=response.data.companyInfoList;
-					if(list.length==1&&list[0].childList&&list[0].childList.length){
-						list=list[0].childList
-					}
+					// if(list.length==1&&list[0].childList&&list[0].childList.length){
+					// 	list=list[0].childList
+					// }
 					for(var i in list){
 						var obj=list[i]
 						if(!list.childList){

+ 3 - 3
pages/equipmentInformation/equipmentConditionMonitoring.vue

@@ -302,9 +302,9 @@
 				API.deviceCompanyList().then((response) => {
 					var list = response.data.companyInfoList;
 					this.companyListMain=response.data.companyInfoList;
-					if(list.length==1&&list[0].childList&&list[0].childList.length){
-						list=list[0].childList
-					}
+					// if(list.length==1&&list[0].childList&&list[0].childList.length){
+					// 	list=list[0].childList
+					// }
 					
 					for(var i in list){
 						var obj=list[i]

+ 126 - 4
pages/tenantList/contractList.vue

@@ -8,8 +8,28 @@
 			</view>
 			
 		</u-navbar>
+		<u-select title="" v-model="tabsFrom.show1" :defaultValue="current2"
+		
+		 :list="companyList" value-name="id" label-name="name"
+		    child-name="childList"
+		 mode="mutil-column-auto"
+			@confirm="selector1confirm"  >
+		</u-select>
 		<view class="head-head" style="background: #fff;">
-			<u-search placeholder="请输入关键字" :show-action="false"		 v-model="keyword"></u-search>
+			<view style="
+				text-align: center;
+				display: flex;
+				align-items: center;
+				" >
+				<view style="width: 40%;" @click="tabsFrom.show1=true">
+						{{device}} <u-icon name="arrow-down" color="#999999"></u-icon>
+				</view>
+				<view style="width: 60%;">
+					<u-search placeholder="请输入关键字" :show-action="false"		 v-model="keyword"></u-search>
+					
+				</view>
+				
+			</view>
 			<u-tabs :list="listType" v-if="tenantList.length"  style="margin-top: 12rpx;"  :is-scroll="false" :current="selectType"  @change="change" ></u-tabs>
 			
 		</view>
@@ -120,6 +140,8 @@
 </template>
 
 <script>
+	import * as API_index from '@/apis/pagejs/index.js'
+	
 	import * as API from '@/apis/pagejs/tenantList.js'
 	import {
 		newDate,parseUnixTime
@@ -127,6 +149,7 @@
 	export default {
 		data() {
 			return {
+				device: '全部设备',
 				allShow:false,
 				tenantList:[],
 				getTenantListReady:false,
@@ -136,7 +159,21 @@
 				num2:0,
 				num3:0,
 				num4:0,
+				
+				current2:[0,0],
+				tabsFrom: {
+					show1: false,
+					show1Index: 0,
+					show2Index: '',
+					show2: false,
+					show1Text: "全部类型",
+					show2Text: "全部时间",
+					
+				},
+				companyList:[],
+				
 				companyId:"",
+				sp:0,
 				listType: [{
 									name: '全部'
 								}, {
@@ -157,15 +194,96 @@
 			if(op.companyId){
 				this.companyId=op.companyId
 			}
+			this.getCompanyInfoList()
 		},
 		onReady() {
 			
 			// this.current=1
-			 this.getTenantList()
-		
+			
+			
 		},
 		
 		methods: {
+			selector1confirm(e){
+				var index = [e[0].i,e[1].i]
+				 
+				console.log(e)
+				this.companyId=e[1].value
+				this.device=e[1].label
+				this.sp=e[1].i==0?1:0
+				this.current2=index
+				 this.getTenantList()
+			},
+			getCompanyInfoList() {
+				this.companyKwhList = [];
+			
+				API_index.deviceCompanyList().then((response) => {
+					var list1 = response.data.companyInfoList;
+					var list=[]
+					for(var i in list1){
+						var obj=list1[i]
+						if(obj.type==5){
+							list.push(obj)
+						}
+					}
+					
+					// if(list.length==1&&list[0].childList&&list[0].childList.length){
+					// 	list=list[0].childList
+					// }
+					for(var i in list){
+						var obj=list[i]
+						if(!list.childList){
+							list.childList=[]
+						}
+						
+						list[i].childList.unshift({
+							id:obj.id,
+							name:list.length>1?obj.name:'全部设备',
+							sp:1
+						})
+					}
+					if(list.length>1){
+						list.unshift({
+							id:'',
+							name:"全部",
+							childList:[
+								{
+									id:'',
+									name:"全部设备"
+								}
+							]
+						})
+					}
+					
+					
+					for(var i in list){
+						var obj=list[i]
+						
+						if(this.companyId){
+							for(var j in list[i].childList){
+								var item=list[i].childList[j]
+								
+								if(item.id==this.companyId){
+									//this.current2=[i,j]
+									this.sp=j==0?1:0
+									this.device=item.name
+								}	
+							}
+						}
+						
+					}
+					
+					this.companyList = list;
+					
+					
+					 this.getTenantList()
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
 			tenantshowAll(item){
 				this.allShow=!this.allShow
 				for(var i in this.tenantList){
@@ -268,9 +386,13 @@
 					title: "加载中",
 					mask: true,
 				})
+				this.num1=0
+				this.num2=0
+				this.num3=0
+				this.num4=0
 				API.tenantContractList({
 					companyId:this.companyId,
-					queryParent:this.companyId?1:0
+					queryParent:this.sp?1:0,
 				}).then((response) => {
 					uni.hideLoading();
 					this.getTenantListReady=true