78 lines
2.1 KiB
TypeScript
78 lines
2.1 KiB
TypeScript
|
|
import {
|
||
|
|
MyBetaModalFormProps,
|
||
|
|
MyButtons,
|
||
|
|
MyFormItems,
|
||
|
|
MyModalFormProps,
|
||
|
|
rulesHelper,
|
||
|
|
} from '@/common';
|
||
|
|
import { Apis } from '@/gen/Apis';
|
||
|
|
import { CompanyReceiptAccountsPayChannelEnum } from '@/gen/Enums';
|
||
|
|
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||
|
|
import { Form, message } from 'antd';
|
||
|
|
|
||
|
|
export default function Create(props: MyBetaModalFormProps) {
|
||
|
|
const [form] = Form.useForm();
|
||
|
|
|
||
|
|
return (
|
||
|
|
<BetaSchemaForm<ApiTypes.Company.CompanyReceiptAccounts.Store>
|
||
|
|
{...MyModalFormProps.props}
|
||
|
|
title={`添加收款账号`}
|
||
|
|
wrapperCol={{ span: 24 }}
|
||
|
|
width="500px"
|
||
|
|
trigger={<MyButtons.Create title={`添加账号`} />}
|
||
|
|
form={form}
|
||
|
|
onOpenChange={(open: any) => {
|
||
|
|
if (open) {
|
||
|
|
form.resetFields(); // 清空表单数据
|
||
|
|
}
|
||
|
|
}}
|
||
|
|
onFinish={async (values) =>
|
||
|
|
Apis.Company.CompanyReceiptAccounts.Store({
|
||
|
|
...values,
|
||
|
|
companies_id: props?.item?.id,
|
||
|
|
is_default: values.is_default ? 1 : 0,
|
||
|
|
})
|
||
|
|
.then(() => {
|
||
|
|
props.reload?.();
|
||
|
|
message.success(props.title + '成功');
|
||
|
|
return true;
|
||
|
|
})
|
||
|
|
.catch(() => false)
|
||
|
|
}
|
||
|
|
columns={[
|
||
|
|
{
|
||
|
|
key: 'company_name',
|
||
|
|
title: '收款账户名称',
|
||
|
|
colProps: { span: 24 },
|
||
|
|
formItemProps: { ...rulesHelper.text },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'company_bank',
|
||
|
|
title: '开户行',
|
||
|
|
colProps: { span: 24 },
|
||
|
|
formItemProps: { ...rulesHelper.text },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'company_account',
|
||
|
|
title: '收款账户',
|
||
|
|
colProps: { span: 24 },
|
||
|
|
formItemProps: { ...rulesHelper.text },
|
||
|
|
},
|
||
|
|
MyFormItems.EnumRadio({
|
||
|
|
key: 'pay_channel',
|
||
|
|
title: '收款渠道',
|
||
|
|
colProps: { span: 24 },
|
||
|
|
valueEnum: CompanyReceiptAccountsPayChannelEnum,
|
||
|
|
required: true,
|
||
|
|
}),
|
||
|
|
{
|
||
|
|
key: 'is_default',
|
||
|
|
title: '是否设为默认账号',
|
||
|
|
valueType: 'switch',
|
||
|
|
colProps: { span: 24 },
|
||
|
|
},
|
||
|
|
]}
|
||
|
|
/>
|
||
|
|
);
|
||
|
|
}
|