<template>
	<view class="content">
			<form >
				<view class="body user-insert-line">机器名称：{{equipment.name}}</view>
				<view class="body user-insert-line">设备编号：{{equipment.clientId}}</view>
				<view class="body user-insert-line">归属者：{{equipment.adminUserName}}</view>
				<view class="body user-insert-line">地址：{{equipment.fullName}}</view>
				<view class="btn-area">
					<button type="primary" @click="agree(equipment.id)" style="margin-right: 20px;" >脱机处理</button>
				</view>
			</form>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				equipment:{},
			}
		},
		onLoad: function(option) {
			const equipment = JSON.parse(decodeURIComponent(option.equipment));
			//idCardNo
			this.equipment = equipment;
		},
		onShow() {
		},
		methods: {
			agree(id){
				var that = this;
				uni.showModal({
					title: '提示',
					content: '是否脱机？',
					success: function(res) {
						if (res.confirm) {
							var token = uni.getStorageSync("token");
							uni.request({
								url: that.serverurl + '/TEquipment/tuoji',
								header: {
									'token': token
								},
								data:{
									"id":id
								},
								method: "POST",
								success: (res) => {
									uni.showToast({
										title: res.data.message,
										duration: 2000
									});
								},
							});
						} else if (res.cancel) {}
					}
				});
			},
		}
	}
	
</script>

<style>
	.content{
			padding-top:20upx;
			margin-left:20upx;
	}
	.body {
		background-color: #FFFFFF;
		padding: 10upx 20upx 10upx 20upx;
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
	}

	.input {
		/* padding: 10upx 20upx 10upx 0upx; */
		padding-left: 20upx;
		padding-top: 10upx;
		background-color: #FFFFFF;
		width: 500upx;
		height: 50upx;
		box-shadow: 0upx 0upx 20upx #D3D3D3;
		border-radius: 5upx;
	}

	.button {
		margin: 0 auto;
		display: inline-block;
	}

	button[type=primary] {
	    background-color: #007aff;
	    color: #fff;
		display: inline-block;
	}	
	.btn-area{
		padding-top:60upx;
		margin: 0 auto;
		width: 50%;
	}
	.user-insert-line {
	  width: 600upx;
	  height: 23px;
	  border-bottom:solid black 1px;
	  margin: 0 auto;
	}
	.user-insert{
		width: 400upx;
		margin: 0 auto;
	}
	view{
		font-size: 30rpx;
	}
</style>
