56 lines
1.3 KiB
TypeScript
Raw Normal View History

2025-06-27 16:42:11 +08:00
import {
MyBetaModalFormProps,
MyButtons,
MyModalFormProps,
rulesHelper,
} from '@/common';
import { Apis } from '@/gen/Apis';
import { BetaSchemaForm } from '@ant-design/pro-components';
import { message } from 'antd';
export default function Update(props: MyBetaModalFormProps) {
return (
<BetaSchemaForm<ApiTypes.Agents.Update>
{...MyModalFormProps.props}
title={`编辑${props.title}`}
trigger={<MyButtons.Edit />}
wrapperCol={{ span: 24 }}
width="500px"
request={() => Promise.resolve(props.item)}
onFinish={async (values) =>
Apis.Agents.Update({ ...values, id: props.item?.id ?? 0 })
.then(() => {
props.reload?.();
message.success(props.title + '成功');
return true;
})
.catch(() => false)
}
columns={[
{
key: 'name',
title: '简称',
formItemProps: { ...rulesHelper.text },
},
{
key: 'full_name',
title: '全称',
formItemProps: { ...rulesHelper.text },
},
{
key: 'address',
title: '地址',
},
{
key: 'contact',
title: '联系人',
},
{
key: 'phone',
title: '联系电话',
},
]}
/>
);
}