Kaynağa Gözat

权限控制

zhengkaixin 3 ay önce
ebeveyn
işleme
e8d81cfb6b
3 değiştirilmiş dosya ile 202 ekleme ve 114 silme
  1. 6 26
      components/Tabbar.vue
  2. 16 1
      pages.json
  3. 180 87
      pages/index/index.vue

+ 6 - 26
components/Tabbar.vue

@@ -32,20 +32,20 @@
 						iconPath: img2,
 						selectedIconPath: img1,
 						text: '主页 ',
-						pagePath2: "/pages/index/index",
+						pagePath: "/pages/index/index",
 					},
 					 {
 					 	iconPath: img4,
 					 	selectedIconPath: img3,
 					 	text: '设备',
-					 	pagePath2: "/pages/deviceTab/index",
+					 	pagePath: "/pages/deviceTab/index",
 					 	
 					 },
 					{
 						iconPath: img6,
 						selectedIconPath: img5,
 						text: '用户',
-						pagePath2: "/pages/userTab/index",
+						pagePath: "/pages/userTab/index",
 						
 					},
 					
@@ -54,35 +54,15 @@
 						selectedIconPath: img7,
 
 						text: '我的',
-						pagePath2: "/pages/myTab/index",
+						pagePath: "/pages/myTab/index",
 					}
 				],
 			};
 
 		},
 		methods: {
-			setcount(c) {
-				this.myCurrent = c
-			},
-			beforeSwitch(index) {
-
-
-				if (index == this.current) {
-					return false
-				}
-				var url = this.tabbarList[index].pagePath2;
-
-				uni.navigateTo({
-					url: url
-				})
-				if (index == 1) {
-					this.myCurrent = this.oldindex;
-					return false;
-				} else {
-					return true;
-				}
-
-			},
+			
+			
 
 		},
 		mounted() {

+ 16 - 1
pages.json

@@ -170,7 +170,22 @@
 
 
 
-
+"tabBar": {
+		
+		"list": [{
+			"pagePath": "pages/index/index"
+			
+		}, {
+			"pagePath": "pages/deviceTab/index"
+			
+		},{
+			"pagePath": "pages/userTab/index"
+			
+		}, {
+			"pagePath": "pages/myTab/index"
+			
+		}]
+	},
 
 	"globalStyle": {
 		"navigationStyle": "custom", // 隐藏系统导航栏

+ 180 - 87
pages/index/index.vue

@@ -34,7 +34,7 @@
 				</view>
 			</view>
 
-			<view class="statistics ">
+			<view class="statistics "   >
 				<view class="title">
 					<view class="icon">
 						<image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
@@ -116,7 +116,7 @@
 			</view>
 
 
-			<view class="statistics ">
+			<view class="statistics " v-show="companyId&&parkingId==''" >
 				<view class="title">
 					<view class="icon">
 						<image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
@@ -146,7 +146,7 @@
 				</view>
 			</view>
 
-			<view class="statistics ">
+			<view class="statistics "  v-show="companyId">
 				<view class="title">
 					<view class="icon">
 						<image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
@@ -154,7 +154,8 @@
 					<view class="text">
 						<view>车位异常记录</view>
 
-						<view class="check-all">查看全部<u-icon name="arrow-right"></u-icon></view>
+						<view class="check-all" @click="gotoUrl('/pages/myTab/abnormalList?companyId='+companyId)"
+						>查看全部<u-icon name="arrow-right"></u-icon></view>
 
 					</view>
 
@@ -195,7 +196,7 @@
 				</view>
 			</view>
 
-			<view class="statistics ">
+			<view class="statistics " >
 				<view class="title">
 					<view class="icon">
 						<image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
@@ -224,7 +225,7 @@
 				</view>
 			</view>
 
-			<view class="statistics ">
+			<view class="statistics "  >
 				<view class="title">
 					<view class="icon">
 						<image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
@@ -281,7 +282,7 @@
 			</view>
 
 
-			<view class="statistics ">
+			<view class="statistics "  v-show="companyId" >
 				<view class="title">
 					<view class="icon">
 						<image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
@@ -289,7 +290,7 @@
 					<view class="text">
 						<view>设备列表</view>
 
-						<view class="check-all" @click="gotoUrl('/pages/deviceTab/index')">查看全部<u-icon
+						<view class="check-all"   @click="gotoDeviceList()">查看全部<u-icon
 								name="arrow-right"></u-icon></view>
 
 					</view>
@@ -309,23 +310,25 @@
 
 									</view>
 									<view class="item-tags">
-										<view class="tag tag1">
-											公共车位
+										<view class="tag  " :class="'tag'+item.type">
+											{{item.typeN}}
 
 										</view>
-										<view class="tag">
-											在线
+										<view class="tag" :class="'statusN'+item.status">
+											{{item.statusN}}
 
 										</view>
-										<view class="tag">
-											空闲
+										<view class="tag" :class="'lockStatus'+item.lockStatus">
+											{{item.lockStatus==0?'空闲':'使用中'}}
 										</view>
 									</view>
 
 								</view>
 								<u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
 							</view>
-
+							<u-divider border-color="#CFD2D5"   @click="gotoDeviceList()"
+							v-if="equipmentList.length==10">最多显示10条,点击查看更多</u-divider>
+							
 						</view>
 
 
@@ -381,16 +384,16 @@
 					}
 				],
 				jpContentMap: {
-					body1: 2,
-					body2: 2,
-					body3: 2,
-					body4: 2,
-					body5: 2,
-					body6: 2,
-					body7: 2,
-					body8: 2,
-					body9: 2,
-					body10: 2,
+					body1: 0,
+					body2: 0,
+					body3: 0,
+					body4: 0,
+					body5: 0,
+					body6: 0,
+					body7: 0,
+					body8: 0,
+					body9: 0,
+					body10: 0,
 				}
 			}
 		},
@@ -439,30 +442,137 @@
 						...this.parkingList
 					]
 				}
-				console.log(sz.length)
+				 
 				return sz
 			},
 		},
-		methods: {
+		methods: {
+			gotoDeviceList(){
+				if(this.companyId){
+						this.gotoUrl('/pages/deviceTab/deviceList?companyId='+this.companyId)
+				}else{
+						this.gotoUrl('/pages/deviceTab/index')
+				}
+			},
+			getfloorStatus(){
+				this.jpContentMap.body1=0
+				
+				API.floorStatus({
+					companyId: this.companyId,
+					parkingId:this.parkingId
+				}).then((response) => {
+				
+					uni.hideLoading();
+					this.jpContentMap.body1=2
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				
+				})
+				
+			},
+			getfloorlockList(){
+				this.jpContentMap.body7=0
+				
+				API.floorlockList({
+					companyId: this.companyId,
+					parkingId:this.parkingId,
+					pageSize:10
+				}).then((response) => {
+				
+					uni.hideLoading();
+					if(response.data.totalPage){
+						this.jpContentMap.body7=2
+						this.equipmentList=response.data.data
+					}else{
+						this.jpContentMap.body7=1
+					}
+					
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				
+				})
+			},
+			getApi1(){
+				
+				if(this.companyId==""){
+					this.getfloorStatus()
+				}else{
+					this.parkingInfoList()
+				}
+				
+			},
+			getApi2(){
+				this.getfloorStatus()
+				this.getfloorlockList()
+				
+				if(this.parkingId==""){
+					
+				}else{
+					
+				}
+			},
+			change1companyList(i) {
+				//this.companyListIndex=i
+				var companyId = ""
+				 
+				if (i == -1) {
+					if (this.companyId == companyId) {
+			
+					} else {
+						this.companyId = ""
+						this.parkingList = [];
+						this.getApi1()
+					}
+				} else {
+					var item = this.companyList[i]
+					companyId = item.id
+					if (this.companyId == companyId) {
+						
+					} else {
+						this.companyId = companyId
+			
+						this.parkingId = "";
+						this.current2 = 0;
+						this.$refs.tabs2.showBar = true
+						
+						this.getApi1()
+					}
+				}
+			
+			},
 			change2parkingList(i) {
-
+				 
 				var parkingId = ""
 
-				if (i == -1) {
-
+				if (i == -1) {
+					
+					if (this.parkingId == parkingId) {
+					
+					} else {
+						this.parkingId="";
+						this.getApi2()
+						
+					}
 				} else {
 					var item = this.parkingList[i]
-					parkingId = item.id
-				}
-				if (this.parkingId == parkingId) {
-
-				} else {
-					//this.parkingId="";
-					//this.parkingInfoList()
+					parkingId = item.id
+					if (this.parkingId == parkingId) {
+					
+					} else {
+						this.parkingId=parkingId;
+						this.getApi2()
+					}
 				}
+				
 			},
 			showselect2confirm(e) {
-				console.log(e)
+			 
 				this.change2parkingList(e[0])
 			},
 			utabsChange2other() {
@@ -475,35 +585,9 @@
 				this.change2parkingList(index - 1)
 				this.$refs.tabs2.showBar = true
 			},
-			change1companyList(i) {
-				//this.companyListIndex=i
-				var companyId = ""
-				console.log(i)
-				if (i == -1) {
-					if (this.companyId == companyId) {
-
-					} else {
-						this.companyId = ""
-						this.parkingList = [];
-					}
-				} else {
-					var item = this.companyList[i]
-					companyId = item.id
-					if (this.companyId == companyId) {
-
-					} else {
-						this.companyId = companyId
-
-						this.parkingId = "";
-						this.current2 = 0;
-						this.$refs.tabs2.showBar = true
-						this.parkingInfoList()
-					}
-				}
-
-			},
+			
 			showselect1confirm(e) {
-				console.log(e)
+				 
 				this.change1companyList(e[0])
 			},
 
@@ -518,9 +602,7 @@
 				this.$refs.tabs.showBar = true
 			},
 			parkingInfoList() {
-				if (this.companyId == "") {
-					return
-				}
+				
 				uni.showLoading({
 					title: "加载中",
 					mask: true,
@@ -529,24 +611,25 @@
 
 				API.parkingList({
 					companyId: this.companyId,
-
+					pageSize:999
 				}).then((response) => {
 
 					uni.hideLoading();
 					var parkingInfoList = response.data.parkingInfoList
 					this.parkingList = [
 						...parkingInfoList,
-						...parkingInfoList,
-
 					];
-					console.log(this.parkingList.length)
-					// if(companyInfoList.length==1){
-					// 	this.change1companyList(0)
-					// }else{
-					// 	this.change1companyList(-1)
-					// }
-
+				
+					if(this.parkingList.length==1){
+						
+						this.change2parkingList(0)
+						
+					}else{
+						this.change2parkingList(-1)
+						this.getApi2()
+					}
 
+					this.getfloorlockList()
 				}).catch(error => {
 					uni.showToast({
 						title: error,
@@ -569,16 +652,14 @@
 					uni.hideLoading();
 					var companyInfoList = response.data.companyInfoList
 					this.companyList = [
-						...companyInfoList,
-						...companyInfoList,
 						...companyInfoList,
-						...companyInfoList,
-
+						
 					];
 					if (this.companyList.length == 1) {
 						this.change1companyList(0)
 					} else {
-						this.change1companyList(-1)
+						this.change1companyList(-1)
+						this.getApi1()
 					}
 
 
@@ -762,7 +843,7 @@
 					}]
 				};
 
-				//console.log(option)
+				 
 				myChart.setOption(option);
 				this.echartsList[key] = myChart;
 			},
@@ -1161,7 +1242,7 @@
 					try {
 						this.init()
 					} catch (e) {
-						console.log(e)
+						 
 						uni.showToast({
 							title: e,
 							icon: "none"
@@ -1484,7 +1565,7 @@
 			display: flex;
 			display: flex;
 			justify-content: space-between;
-
+			margin-bottom: 24rpx ;
 			.item-title {
 				color: rgba(51, 51, 51, 1);
 				font-size: 28rpx;
@@ -1506,6 +1587,18 @@
 
 				.tag1 {
 					background-color: rgba(22, 119, 255, 1);
+				}
+				.tag2 {
+					background-color: rgba(129,97,255,1);
+				}
+				.statusN1{
+					
+				}
+				.statusN0{
+					background-color: rgba(153,153,153,1);
+				}
+				.lockStatus1{
+					background-color: rgba(153,153,153,1);
 				}
 			}
 		}