<template>
	<view class="wrap">
		<uni-section :title="point.pointContent" type="line">
			<uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="300" label-position="top">
				<uni-forms-item label="检查结果" name="checkResult" required>
					<view class="uni-data-checkbox-wrap">
						{{checkResult}}
						<!-- <uni-data-checkbox  v-model="formData.checkResult" :localdata="checkResults" />		 -->		
					</view>
				</uni-forms-item>	
				<uni-forms-item label="备注" name="remark">
				  <uni-easyinput disabled v-model="formData.remark" type="textarea" :maxlength="-1" autoHeight placeholder="备注" />
				</uni-forms-item>
				<template v-if="formData.attachList.length>0">
					<view class="attach-box" @click="preview(attach,index)" v-for="(attach,index) in formData.attachList" :key="index">	
						<image class="attach" :src="attach.fileUrl" mode="widthFix"></image>					 
					</view>
				</template>
			</uni-forms>
		</uni-section>
	</view>
</template>

<script>
	import {upload} from '@/api/system/upload.js'	
	import {updateChecklistPoint,getPoint} from '@/api/aqpt/checklistPoint.js'
	export default {
		data() {
			return {
				checkResults:[
					{text:"通过",value:1},
					{text:"不通过",value:-1},
				],
				checkResult:"",
				formData:{
					checkResult:1,	
					remark:"",
					attachList:[]
				},
				rules:{},
				point:{}
			}
		},
		onBackPress() {

		},
		onLoad() {
			this.init()
		},
		methods: {
			init(){
				let point=uni.getStorageSync('point');
				this.point=point;
				this.getPoint()
			},
			getPoint(){
				let point=uni.getStorageSync('point');
				let checklistId=point.checklistId;
				let itemId=point.itemId;
				let recordId=point.recordId;
				let pointId=point.pointId;
				getPoint(checklistId,itemId,recordId,pointId).then((res)=>{
					this.formData=res.data
					for(let i=0;i<this.checkResults.length;i++){
						if(this.checkResults[i].value===res.data.checkResult){
							this.checkResult=this.checkResults[i].text
						}
					}
				})
			},
		    preview(attach,index){
				uni.previewImage({
					urls:[attach.fileUrl],
					current:index
				})
			}
		},
		onUnload() {			
			uni.removeStorageSync('point')
		}
	}
</script>

<style lang="scss" scoped>
.wrap{
	padding: 20rpx;
	position: relative;
	// &::after{
	// 	content: "";
	// 	width: 100%;
	// 	height: 100vh;
	// 	position: fixed;
	// 	left: 0;
	// 	top: 0;
	// 	background-color: rgba(0,0,0,0);
	// 	z-index: 999;
	// }
	.submit-BT {
		width: 750rpx;
		color: #4D73FF;
		text-align: center;
		font-size: 32rpx;
		padding-bottom: 68rpx;
		background-color: #fff;
		position: fixed;
		left: 0;
		bottom: 0;
		z-index: 99;
		box-shadow: 0px 0px 12px 0px #0000000A;
		border-radius: 8px 8px 0px 0px
	}
	::v-deep .uni-forms-item{
		.uni-forms-item__content{
			.uni-data-checkbox-wrap{
				height: 100%;
				display: flex;
				align-items: center;					
			}
	
		}		
	}
	.attach-box{
		&,.attach{
			width: 200rpx;
			height: 200rpx;
			margin-right: 10rpx;
			border: 1px solid #333;			
		}

	}
}
</style>
