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

			<view class="content">
				<text>变 量&nbsp;&nbsp;ID：{{item.variableId}}</text>
				<text>提醒周期：{{item.promptInterval}}</text>
				<text>上次提醒：{{item.lastCreatTime | timeFilter}}</text>
				<text>操&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;作：</text>

			</view>
		</view>

		<view class="anniu">
			<image class="anniu" src="../../static/设备菜单/前往列表@2x.png" @tap="back"></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				deviceAlarmRepairRecords: [],
			}
		},
		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/deviceAlarmRepairRecord/list',
				method: 'GET',
				data: {},
				success: res => {

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

			})
		},
		methods: {
			back() {
				uni.navigateTo({
					url: '/pages/device/deviceInfo/deviceInfo'
				})
			}
		}
	}
</script>

<style>
	.anniu {
		width: 116rpx;
		height: 116rpx;
		float: right;
		margin-top: 10rpx;
		margin-right: 4rpx;
	}

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

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

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