<template>
	<view>
		<view class="inner_box">
			<view class="inner_title">
				<view class="name name_1">序号</view>
				<view class="name name_2">安装地点</view>
				<view class="name name_3">数值/状态</view>
			</view>
			<view class="list_item">
				<view class="item" :class="item.status" v-for="item in List" :key="item.id">
					<view class="text text_1">{{item.id}}</view>
					<view class="text text_2">{{item.position}}</view>
					<view class="text text_3">{{item.value}}{{item.unit}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				status:'',
				List:[]
			};
		},
		onLoad(option) {
			console.log(option)
			this.status = option.status
			
			
			this.changeTitle(option.title)
			this.get_List(option.status)
		},
		methods:{
			changeTitle(title){
				uni.setNavigationBarTitle({
				    title: title
				});
			},
			async get_List(type){
				console.log(type)
				const res = await this.$myRequest({
					method:"POST",
					url:"/safety/info",
					header:{
						"Content-Type":"application/json"
					},
					data:{
						type:"simulation",
						status:type
					}
				})
				console.log(res.data.data)
				this.List = res.data.data
			}
		}
	}
</script>

<style lang="scss">
	.inner_box{
		.inner_title{
			
			padding: 0 24rpx;
			
			height: 94rpx;
			background: #F3F6FA;
			
			display: flex;
			justify-content: space-between;
			align-items: center;
			.name{
				font-size: 27rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #232627;
				text-align: center;
			}
			.name_1{
				width: 125rpx;
			}
			.name_2{
				margin: 0 15rpx;
				width: 420rpx;
			}
			.name_3{
				width: 125rpx;
			}
		}
		.list_item{
			.item{
				padding: 0 24rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				
				border-bottom: 1px solid #f3f3f3;
				.text{
					font-size: 25rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					line-height: 94rpx;
					text-align: center;
				}
				.text_1{
					width: 125rpx;
				}
				.text_2{
					margin: 0 15rpx;
					width: 420rpx;
					
					overflow: hidden;
					text-overflow:ellipsis;
					white-space: nowrap;
				}
				.text_3{
					width: 125rpx;
				}
			}
			.normal{
				color: #27AE60;
			}
			.alarm{
				color: #E74C3C;
			}
			.sign{
				color: #2C3E50;
			}
			.fault{
				color: #2873FF;
			}
		}
	}
</style>
