<template>
	<view>
		<!-- 注意，如果需要兼容微信小程序，最好通过setRules方法设置rules规则 -->
		<u--form labelPosition="left" :model="model1"  ref="uForm" >
			<u-form-item label="管护类型" prop="maintainType" borderBottom ref="item1" 
			required
			labelPosition='top'
			 labelWidth="100px">
				<u--input v-model="model1.maintainName" disabled disabledColor="#ffffff" placeholder="请选择管护类型"
					border="none" ></u--input>
			</u-form-item>
			<u-form-item label="内容说明" prop="maintainContent" borderBottom labelPosition='top' required labelWidth="100px">
				<u--textarea v-model="model1.maintainContent" placeholder="请输入内容" disabled></u--textarea>
			</u-form-item>
			<u-form-item label="现场图片" prop="pics" borderBottom labelPosition='top' labelWidth="100px">
				<u-upload :fileList="model1.pics"   name="pics" multiple disabled
				multiple accept='image'	:maxCount="10"></u-upload>

			</u-form-item>
			<u-form-item label="现场视频" prop="videos" borderBottom labelPosition='top' labelWidth="100px"  v-if="model1.videos.length">
		<!-- 		<u-upload :fileList="model1.videos"   name="videos" multiple disabled
				multiple accept='video'	:maxCount="10"></u-upload> -->
							<view class="itemEve">
									<view class="" v-for="item in model1.videos"  style="display: inline-block;">
										<video :src="item.url" style="width: 80px;height: 80px;margin: 5px;"  x5-video-player-type="h5" playsinline webkit-playsinline></video>
									</view>
								
							</view>
			</u-form-item>
		</u--form>
	</view>
</template>

<script>
	export default {
		props:{
			formData:Object
		},
		data() {
			return {
				showSex: false,
				fileListpics: [],
				fileListvideos: [],
				model1: {
					maintainContent: "",
					maintainType: '',
					pics: [],
					videos: []
				},
				actions: [{
						value: 1,
						name: "溢洪道清障"
					},
					{
						value: 2,
						name: "除草除杂"
					},
					{
						value: 3,
						name: "设备养护"
					},
					{
						value: 4,
						name: "环境清洁"
					},
					{
						value: 5,
						name: "危险提示"
					},
					{
						value: 6,
						name: "其他"
					},
				],
				radio: '',
				switchVal: false
			};
		},
		mounted() {
			this.model1 = this.formData
			this.model1.maintainName = this.actions.find(item=>item.value == this.formData.maintainType).name
			this.model1.pics?.map(item1=>{
				item1.url ='http://223.75.53.141:9102/test.by-lyf.tmp' + item1.filePath 
				return item1
			})
			this.model1.videos?.map(item1=>{
				item1.url ='http://223.75.53.141:9102/test.by-lyf.tmp' + item1.filePath 
				return item1
			})
			console.log(this.model1,'83498943r80432',this.formData);
		},
		methods: {

		},
		onReady() {
			//如果需要兼容微信小程序，并且校验规则中含有方法等，只能通过setRules方法设置规则。
			this.$refs.uForm.setRules(this.rules)
		},
	};
</script>