<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" >
					<view class="">{{item.deviceName}}</view>
				</view>
				<view class="nav-right num">
					<view class="text-grey">
						{{item.trueStatus?'离线':'在线'}}
						<text class="icon iconfont margin-right-xs margin-left-lg">&#xe629;</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				deviceData:[],
				
				modalName: null,
			};
		},
		
		onLoad:function(option){
			console.log(111)
			console.log(option.companyCode)
			this.companyCode=option.companyCode
			this.deviceType=option.deviceType
			this.getDeviceManage({"companyCode":option.companyCode,"deviceType":option.deviceType})
		},
		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
				
			},
			
			// 页面跳转
			goDeviceDetail(item) {
				uni.navigateTo({
					url: '/pages/deviceManage/deviceDetail/deviceDetail?deviceType=1&companyCode='+this.companyCode+'&deviceCode='+item.deviceCode+'',
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			



		}

	}
</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>
