源数据
[
{
"value": "6",
"label": "Markus",
"avatar": "http://127.0.0.1/images/avatar/7228462491.png",
"role": "",
"email": "markus@163.com",
"id_user": "6",
"permisson_role_title": "程序员",
"id_permission_role": 47
},
{
"value": "7",
"label": "DaZeng",
"avatar": "http://127.0.0.1/images/avatar/4898025611.png",
"role": "",
"email": "DaZeng@163.com",
"id_user": "7",
"permisson_role_title": "程序员",
"id_permission_role": 47
}
]
新数据
// Using new fields to assemble new data and adding it to form <FUNCTION>
const callBackAddUserToTaskFunction = (value: any) => {
if (Array.isArray(value)) {
const employees = value.map((item: any) => ({
"user_role_id": item.id_permission_role,
"user_id": item.id_user,
}));
form.setFieldValue('employees', employees as []);
}
}
[
{
"user_role_id": 46,
"user_id": "5"
},
{
"user_role_id": 46,
"user_id": "6"
}
]