<template>
	<view>
		<view style="position: fixed;z-index: 100;">
			<uni-nav-bar @clickLeft="clickLeft" left-icon="back" title="修改名称"></uni-nav-bar>
		</view>
		<view class="mod">
			<view class="mod_name">
				<p>设备名称</p>
				<input type="text" v-model="moddata.device_name" style="background-color: #FAFAFA;"/>
			</view>
			<view class="mod_id">
				<p>设备ID</p>
				<input type="text" :value="moddata.device_id" disabled/>
			</view>
			<view class="mod_user">
				<p>适配用户</p>
				<input type="text" value="无" disabled/>
			</view>
			<view class="mod_time">
				<p>设备添加时间</p>
				<input type="text" :value="moddata.status_time|timeFormat()" disabled />
			</view>
			<view class="sub" @click="btn">
				提 交
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				moddata:[]
			}
		},
		methods: {
			async eqlist() { //设备列表
				const res = await this.$myRequest({
					url: '/api/api_gateway?method=forecast.worm_lamp.revise_device',
					data: {
						device_id: this.moddata.device_id,
						device_name:this.moddata.device_name
					}
				})
			},
			btn(){
				this.eqlist()
			},
			clickLeft(){
				uni.switchTab({
					url:"./index"
				})
			}
		},
		onLoad(option){
			this.moddata=JSON.parse(option.data)
			console.log(this.moddata)
		}
	}
</script>

<style lang="scss">
.mod{
	width: 100%;
	position: absolute;
	top: 44px;
	height: 92vh;
	background-color: #FAFAFA;
	.mod_name,.mod_id,.mod_user,.mod_time{
		width: 90%;
		margin: 30rpx auto;
		display: flex;
		justify-content: space-between;
		background-color: #FFFFFF;
		padding: 20rpx 10rpx;
		color: #57C77A;
		line-height: 50rpx;
		input{
			text-align: right;
			font-size: 28rpx;
			padding: 10rpx;
		}
	}
}
.sub{
	width: 90%;
	margin: 30rpx auto;
	text-align: center;
	height: 70rpx;
	line-height: 70rpx;
	background-color: #57C77A;
	border-radius: 35rpx;
	color: #FFFFFF;
}
</style>
