练习 根据object数据自动生成表单并完成数据填写
要求
- 使用umi框架搭建项目
- 根据下文中的object数据中的dataArray字段结构生成表单,表单使用antd组件
- 填写完成后根据dataArray中的path信息使用递归方式将数据填写到对应的currentData中
完整数据:
{
"type": "Australia Birth Certificate",
"countryCode": "AU",
"currentData": {
"firstName": "GuoRong",
"lastName": "XU",
"gender": "Male",
"countryCode": "AU",
"service": [
"Australia Birth Certificate"
],
"identityVariables": {
"birthRegistrationState": "",
"birthRegistrationDate": null,
"birthRegistrationNo": ""
},
"clientReference": "Test_0001",
"customerId": 661,
"dateOfBirth": null,
"consentObtained": {
"Australia Birth Certificate": true
},
"middleName": null
},
"allData": false,
"dataArray": [
{
"path": "./",
"enable": true,
"dataType": "String",
"name": "firstName",
"sampleValue": "Jane",
"currentValue": "GuoRong"
},
{
"path": "./",
"enable": true,
"dataType": "String",
"name": "lastName",
"sampleValue": "Citizen",
"currentValue": "XU"
},
{
"path": "./identityVariables",
"enable": true,
"dataType": "String",
"name": "birthRegistrationState",
"sampleValue": "VIC",
"currentValue": ""
},
{
"path": "./identityVariables",
"enable": true,
"dataType": "Date",
"name": "birthRegistrationDate",
"sampleValue": "08/27/1984",
"currentValue": null
},
{
"path": "./identityVariables",
"enable": true,
"dataType": "String",
"name": "birthRegistrationNo",
"sampleValue": "500156",
"currentValue": ""
},
{
"path": "./",
"enable": true,
"dataType": "Date",
"name": "dateOfBirth",
"sampleValue": "06/07/1984",
"currentValue": null
}
]
}
字段说明:
{
"path": "./",// 填入到dataArray字段中的路径
"enable": true,
"dataType": "String",//字段的类型,需要根据此调用不同的组件
"name": "firstName",//标签名称
"sampleValue": "Jane",//填写举例
"currentValue": "GuoRong"//当前填入的值
},