<template>
	<div>
		<custom-header :back="false" title="申办校验"></custom-header>
		<div style="padding: 20rpx 0">
			<form-builder-vue :formData="formData" :config="config" @submit="submit"></form-builder-vue>
		</div>
	</div>
</template>
<script setup lang='ts'>
	import CustomHeader from '@/components/CustomHeader.vue';
	import formBuilderVue from '@/components/form-builder/form-builder-vue3'
	import {
		reactive,
		ref
	} from 'vue'
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		request
	} from '../../static/js/network/request'
	
	//获取页面配置
	onLoad((opin) => {
		request('ac8756cc31eb4816b8eaeb71907ff9c1', {
			data: {
				qdOrderNo: 'qddd123456'
			}
		}).then((res) => {
			let data = JSON.parse(res.bizContent)
			formData.value = JSON.parse(data.config.tableConfig)
			console.log('输出内容',formData.value)
		})
	})

	let config = ({
		titleWidth: 160,
		submitName: '下一步'
	})
 
	let formData = ref([{
		'title': '车牌号',
		'type': 9,
		'vertical': 2,
		'value': 'vehicle',
		'itemKey': 'name',
		'required': true,
		'itemData': []
	}, {
		'title': '车牌颜色',
		'type': 13,
		'vertical': 2,
		'value': 'native',
		'itemKey': 'name',
		'required': true,
		'itemData': []
	}, {
		'title': '手机号',
		'type': 2,
		'inputType': 'tel',
		'value': 'tel',
		'required': true,
		'maxlength': 11
	}, {
		'title': '车辆类型',
		'type': 4,
		'required': true,
		'value': 'vehicleKind',
		'itemKey': 'name',
		'itemData': []
	}])

	// //车辆颜色 Index('车牌颜色', formData)
	// getLicensePlateColor(2, (res: any) => {
	// 	formData[Index('车牌颜色', formData)].itemData = res
	// })

	// //车型
	// getLicensePlateColor(3, (res: any) => {
	// 	formData[Index('车辆类型', formData)].itemData = res
	// })
	
	//提交
	function submit(item: any) {
		console.log('提交内容',item)
		uni.navigateTo({
			url: '/pages/userInfoUploading/userInfoUploading',
			animationType: 'pop-in',
			animationDuration: 500
		})
	}
	
</script>
<style lang='scss' scoped>

</style>
