<template>

	<view class="">
		<view class="cu-list menu-avatar">
			<view class="cu-item deviceTypeItem" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in deviceData"
			 :key="index" :data-target="'move-box-' + index" @tap="goDeviceDetail(item)">
				<view class="cu-avatar round lg" style="background-image:url(../../static/jx.png)"></view>
				<view class="content" style="width:440rpx">
					<view class="inOneLine cut" style="display:block">{{item.deviceName}}</view>
				</view>
				<view class="nav-right num">
					<view class="text-grey">
						{{item.trueStatus=="0"?'在线':'离线'}}
						<text class="icon iconfont margin-right-xs margin-left-lg">&#xe629;</text>
					</view>
				</view>
			</view>
		</view>
		
		<view class="btn-area submitBottomBtn padding-lr-sm" v-if="this.num!=1">
			<button class="bg-blue round  margin-top" @click="goDetail"> 配电系统模拟图 </button>
		</view>
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				deviceData:[],
				
				modalName: null,
				companyCode:"",
				deviceType:"",
				num:''
			};
		},
		
		onLoad:function(option){
			this.companyCode=option.companyCode
			this.deviceType=option.deviceType
			this.getDeviceManage({"companyCode":option.companyCode,"deviceType":option.deviceType})
			this.num=option.num;
			console.log('this.num')
			console.log(this.num)
		},
		// onNavigationBarButtonTap(e) {
		// 	console.log(e)
		// 	uni.navigateTo({
		// 		url: './electricalSystem/index?deviceType='+this.deviceType+'&companyCode='+this.companyCode
		// 	});
		// },
		methods: {
			async getDeviceManage(ming={}) {
				const res= await this.$myRequest({
					url:'OperationMonitoring/getDeviceList',
					data:ming,
					showLoading:true
				})
				console.log(res.data.data)
				this.deviceData=res.data.data
				// this.powerDeviceCount= res.data.data[0].powerDeviceCount
				// this.videoDeviceCount= res.data.data[0].videoDeviceCount
				
			},
			
			goDetail(){
				uni.navigateTo({
					url: './electricalSystem/index?deviceType='+this.deviceType+'&companyCode='+this.companyCode
				});
			},
			
			// 页面跳转
			goDeviceDetail(item) {
				if(this.num==1){
					uni.navigateTo({
						url: '/pages/device-Manage/deviceDetail/deviceDetail?deviceType=1&companyCode='+this.companyCode+'&deviceCode='+item.deviceCode+'',
						success: res => {},
						fail: () => {},
						complete: () => {}
					});
				}else{
					
				}
				
			},
			



		}

	}
</script>

<style lang="scss">
	.cu-list.menu-avatar>.cu-item .content>uni-view:first-child {
		font-size: 32rpx;
	}

	.num {
		font-size: 30rpx;
		color: #666;
	}
</style>
