<template>
	<view>
		<view class="card" v-for="(item,index) in list" :key="index" @tap="deviceByAdd(item,type)">
			<view class="card-left">
				<view class="card-up-list">
					<view class="card-up-list-list">
						<view>设备名:</view><text>{{item.name}}</text>
					</view>
					<view class="card-right">
					  <text style="font-size: 26upx;color: #4CD964;" v-if="item.status==1">正常</text>
					</view>
				</view>
				<view class="card-up-list">
					<view class="card-up-list-list">
						<view>设备型号:</view><text>{{item.model}}</text>
					</view>					
				</view>
				<view class="card-up-list">
					<view class="card-up-list-list">
						<view>设备编号:</view><text>{{item.in_number}}</text>
					</view>
				</view>
				<view class="card-up-list">
					<view class="card-up-list-list">
						<view>检测项目:</view><text>{{item.check_item}}</text>
					</view>
				</view>
				<view class="card-up-list">
					<view class="card-up-list-list">
						<view>检测目的:</view><text>{{item.check_aim}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {lineCheckDevice} from"../../api/user.js"
	export default {
		data() {
			return {
				list:[],
				type:'',
				id:''
			};
		},
		onLoad(e) {
			this.type=e.type;
			this.id=e.id
			this.getData()
		},methods:{
			getData(){
				lineCheckDevice({line_id:this.id,type:this.type}).then(res=>{
					this.list=res
				})
			},
			deviceByAdd(item,type){
				console.log("type",type)
				uni.navigateTo({
					url: `../deviceByAdd/deviceByAdd?type=${type}&id=${this.id}&planInfo=${encodeURIComponent(JSON.stringify(item))}`,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	}
</script>

<style lang="scss">
@import "./index.scss"
</style>
