const save = async (key: any) => {
try {
const row: any = await formKuan.validateFields();
const newData = [...data];
const index = newData.findIndex((item: any) => key === item.id);
if (index > -1) {
const item: any = newData[index];
item.editable = false;
newData.splice(index, 1, { ...item, ...row });
setData(newData);
setEditingKey("");
} else {
newData.push(row);
setData(newData);
setEditingKey("");
}
} catch (errInfo) {
console.log("保存失败", errInfo);
}
};