const onOk = useCallback(() => { form.validateFields().then(res => { debugger const values = res as AddOrEditMenuFormProps; const info: any = { ...menu, ...values, }; const flag = props.list.find((item)=>{ return item.styleId == info.styleTypeId.value }) if(flag){ message.warning('此尺码已存在!') }else{ values.list = props.list props.onConfirm({...values}) } }); }, []);
数据格式
{
"styleTypeId": {
"label": "12312",
"value": 1,
"key": 1
},
"list": [
{
"code": "黑",
"id": 1,
"name": "12312"
},
{
"code": "黑",
"id": 2,
"name": "12312"
},
{
"code": "黑",
"id": 3,
"name": "12312"
},
{
"code": "黑",
"id": 4,
"name": "12312"
},
{
"code": "天青色",
"id": 5,
"name": "天青色"
},
{
"code": "红",
"id": 6,
"name": "红"
},
{
"code": "青",
"id": 7,
"name": "青"
},
{
"code": "绿",
"id": 8,
"name": "绿"
},
{
"code": "蓝",
"id": 9,
"name": "蓝"
},
{
"code": "橙",
"id": 10,
"name": "橙"
},
{
"code": "黄",
"id": 11,
"name": "黄"
},
{
"code": "黑",
"id": 12,
"name": "黑"
},
{
"code": "1",
"id": 13,
"name": "1"
}
]
}