45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
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.Factories.Update>
|
|
{...MyModalFormProps.props}
|
|
title={`编辑${props.title}`}
|
|
trigger={<MyButtons.Edit />}
|
|
wrapperCol={{ span: 24 }}
|
|
width="500px"
|
|
request={() => Promise.resolve(props.item)}
|
|
onFinish={async (values) =>
|
|
Apis.Factories.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: 'public_key',
|
|
title: '下游公钥',
|
|
valueType: 'textarea',
|
|
formItemProps: { ...rulesHelper.text },
|
|
},
|
|
]}
|
|
/>
|
|
);
|
|
}
|