<template>
	<view>
		<view class="alarm" v-for="item in deviceAlarmRecords" :key="item.code">
			<text class="title">{{item.alarmName}}</text>

			<view class="content">
				<text>地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;区：</text> 
				<text>客户名称：</text>
				<text>报警类型：{{item.alarmType}}</text>
				<text>报警时间：{{item.createTime | timeFilter}}</text>
			</view>


		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				deviceAlarmRecords: [],
			}
		},
		filters: {
			timeFilter(data) {
				if(data!=='') {
					let time = uni.$moment(data).format("YYYY-MM-DD HH:mm:ss")
					return time
				}
			}
		},
		onLoad() {
			uni.request({
				url: 'http://127.0.0.1:9999/deviceAlarmRecord/list',
				method: 'GET',
				data: {},
				success: res => {

					this.deviceAlarmRecords = res.data.data.deviceAlarmRecords;
					console.log(res.data.data.deviceAlarmRecords);
				},

			})
		},
		methods: {

		}
	}
</script>

<style>
	.alarm {
		width: 702rpx;
		height: 329rpx;
		background-color: white;
		margin-top: 30rpx;
		margin-left: 24rpx;
		border-radius: 10rpx;
		padding-top: 30rpx;
	}

	.content {
		font-size: 28rpx;
		display: flex;
		flex-direction: column;
		margin-top: 30rpx;
		margin-left: 30rpx;
		line-height: 55rpx;
		color: #444546;
	}

	.title {
		font-size: 36rpx;
		margin-left: 30rpx;
		color: #282828;
		font-weight: 600;
	}
</style>
