<template>
		<view class="details">
			<!-- 设备信息 -->
			<view class="main">
				<u--form labelPosition="left" labelAlign="center" :model="detail" ref="form1" >
					<u-form-item label="卡片号码" prop="detail.assetNumber" labelWidth="auto" borderBottom ref="item1" >
						<u--input v-model="detail.assetNumber" border="none" placeholder=" "></u--input>
					</u-form-item>
					<u-form-item label="资产名称" prop="detail.name" labelWidth="auto" borderBottom ref="item1" >
						<u--input v-model="detail.name" border="none" placeholder=" "></u--input>
					</u-form-item>
					<u-form-item label="资产型号" prop="detail.specifications" labelWidth="auto" borderBottom ref="item1" >
						<u--input v-model="detail.specifications" border="none" placeholder=" "></u--input>
					</u-form-item>
					<u-form-item label="资产品牌" prop="detail.brand" labelWidth="auto" borderBottom ref="item1" >
						<u--input v-model="detail.brand" border="none" placeholder=" "></u--input>
					</u-form-item>
					<u-form-item label="资产金额" prop="detail.amount" labelWidth="auto" borderBottom ref="item1" >
						<u--input v-model="detail.amount" border="none" placeholder=" "></u--input>
					</u-form-item>
					<u-form-item label="资产归属" prop="detail.belongTo" labelWidth="auto" borderBottom ref="item1" >
						<u--input v-model="detail.belongTo" border="none" placeholder=" "></u--input>
					</u-form-item>
					<u-form-item label="取得日期" prop="detail.getDate" labelWidth="auto" borderBottom ref="item1" >
						<u--input v-model="detail.getDate" border="none" placeholder=" "></u--input>
					</u-form-item>
					<u-form-item label="使用部门" prop="detail.deptName" labelWidth="auto" borderBottom ref="item1" >
						<u--input v-model="detail.deptName" border="none" placeholder=" "></u--input>
					</u-form-item>
					<u-form-item label="资产状态" prop="detail.statusName" labelWidth="auto" borderBottom ref="item1" >
						<u--input v-model="detail.statusName" border="none" placeholder=" "></u--input>
					</u-form-item>
					</u-form-item>
				</u--form>
				
			</view>
		</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				detail: {
					id: null,
					statusName: null,
					picUrl:''
				},
				useUserId: null,
				nickName: '',
				inspectionList: [],
				done: 0,
				undo: 0,
				showStatus: false,
				actions: [
					{
						name: '正常',
						value: 0
					},
					{
						name: '故障',
						value: 1
					}
				],
				loading: false
			}
		},
		
		onLoad:function(options){
			let data = JSON.parse(options.data);
			this.detail.id = data.id;
			this.getdeviceinfo()
		},
		
		
		onPullDownRefresh(){
			// this.stopPullDownRefresh()
		},
		
		methods: {
			scan() {
				var that = this;
				uni.scanCode({
					success: function(res) {
						that.getdeviceinfo(res.result)
					}
				})
			},
			async getdeviceinfo() {
				this.loading = true;
				const { data:res } = await this.$http('/search', {
					'assetId': this.detail.id
				});
				if(res.code) return
				this.detail = res.asset;
				this.detail.statusName = res.asset.status == 1 ? '故障' : '正常'
				this.loading = false;
			},

		}
	}
</script>

<style lang="scss">
	.details {
		background: #f6f6f6;
		height: 100vh;
		.search{
			.u-icon{
				justify-content: center;
				padding-top: 40vh;
			}
		}
		.u-loading-icon{
			position: absolute;
			top: 40vh;
			left: 42.5vw;
		}
		.main {
			background: #ffffff;
			margin: 2.667vw;
			padding: 2vw;
			border-radius: 8px;
			
			.u-form-item__body__right{
				padding-left: 20vw;
			}
		}
		.submit{
			margin: 1vh 2.667vw;
		}
		.popup{
			padding: 3vw 0;
			.u-text{
				justify-content: center !important;
				margin-bottom: 3vw !important;
			}
		}
	}
</style>