2025-06-29 18:42:50 +08:00
|
|
|
import {
|
|
|
|
|
MyBetaModalFormProps,
|
|
|
|
|
MyButtons,
|
|
|
|
|
MyFormItems,
|
|
|
|
|
MyModalFormProps,
|
|
|
|
|
rulesHelper,
|
|
|
|
|
} from '@/common';
|
|
|
|
|
import { Address } from '@/components/Address';
|
|
|
|
|
import { Apis } from '@/gen/Apis';
|
|
|
|
|
import { CompaniesMerchantTypeEnum } from '@/gen/Enums';
|
|
|
|
|
import { BetaSchemaForm } from '@ant-design/pro-components';
|
2025-06-30 13:41:38 +08:00
|
|
|
import { Form, message } from 'antd';
|
2025-06-29 18:42:50 +08:00
|
|
|
|
|
|
|
|
export default function Update(props: MyBetaModalFormProps) {
|
2025-06-30 13:41:38 +08:00
|
|
|
const [form] = Form.useForm();
|
2025-06-29 18:42:50 +08:00
|
|
|
return (
|
|
|
|
|
<BetaSchemaForm<ApiTypes.Company.Companies.Update>
|
|
|
|
|
{...MyModalFormProps.props}
|
|
|
|
|
title={`编辑${props.title}`}
|
2025-06-30 13:41:38 +08:00
|
|
|
form={form}
|
2025-06-30 16:07:20 +08:00
|
|
|
trigger={
|
|
|
|
|
<MyButtons.Default
|
|
|
|
|
title="修改"
|
|
|
|
|
color="primary"
|
|
|
|
|
variant="filled"
|
|
|
|
|
size="small"
|
|
|
|
|
/>
|
|
|
|
|
}
|
2025-06-29 18:42:50 +08:00
|
|
|
wrapperCol={{ span: 24 }}
|
|
|
|
|
width="800px"
|
2025-06-30 13:41:38 +08:00
|
|
|
onOpenChange={(open: any) => {
|
|
|
|
|
if (open && props.item) {
|
|
|
|
|
form.setFieldsValue({
|
|
|
|
|
...props.item,
|
|
|
|
|
casacader: [
|
|
|
|
|
props.item?.province_id || '',
|
|
|
|
|
props.item?.city_id || '',
|
|
|
|
|
props.item?.area_id || '',
|
|
|
|
|
props.item?.street_id || '',
|
|
|
|
|
],
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}}
|
2025-06-29 18:42:50 +08:00
|
|
|
onFinish={async (values) =>
|
|
|
|
|
Apis.Company.Companies.Update({ ...values, id: props.item?.id ?? 0 })
|
|
|
|
|
.then(() => {
|
|
|
|
|
props.reload?.();
|
|
|
|
|
message.success(props.title + '成功');
|
|
|
|
|
return true;
|
|
|
|
|
})
|
|
|
|
|
.catch(() => false)
|
|
|
|
|
}
|
|
|
|
|
columns={[
|
|
|
|
|
{
|
|
|
|
|
key: 'name',
|
2025-06-30 13:41:38 +08:00
|
|
|
title: '机构名称',
|
2025-06-29 18:42:50 +08:00
|
|
|
colProps: { span: 8 },
|
|
|
|
|
formItemProps: { ...rulesHelper.text },
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'short_name',
|
2025-06-30 13:41:38 +08:00
|
|
|
title: '机构简称',
|
2025-06-29 18:42:50 +08:00
|
|
|
colProps: { span: 8 },
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'business_license_number',
|
|
|
|
|
title: '营业执照号',
|
|
|
|
|
colProps: { span: 8 },
|
|
|
|
|
formItemProps: { ...rulesHelper.text },
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
key: 'contact_name',
|
|
|
|
|
title: '联系人姓名',
|
|
|
|
|
colProps: { span: 8 },
|
|
|
|
|
formItemProps: { ...rulesHelper.text },
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'contact_phone',
|
|
|
|
|
title: '联系人手机',
|
|
|
|
|
colProps: { span: 8 },
|
|
|
|
|
valueType: 'number',
|
|
|
|
|
fieldProps: {
|
|
|
|
|
maxLength: 11,
|
|
|
|
|
},
|
|
|
|
|
formItemProps: { ...rulesHelper.number },
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'contact_email',
|
|
|
|
|
title: '联系人邮箱',
|
|
|
|
|
colProps: { span: 8 },
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'contact_address',
|
|
|
|
|
title: '联系人地址',
|
|
|
|
|
colProps: { span: 24 },
|
|
|
|
|
},
|
|
|
|
|
MyFormItems.EnumRadio({
|
|
|
|
|
key: 'merchant_type',
|
|
|
|
|
title: '商户类型',
|
|
|
|
|
colProps: { span: 24 },
|
|
|
|
|
valueEnum: CompaniesMerchantTypeEnum,
|
|
|
|
|
required: true,
|
|
|
|
|
}),
|
|
|
|
|
Address.Cascader({
|
|
|
|
|
key: 'casacader',
|
|
|
|
|
title: '选择地址',
|
|
|
|
|
colProps: { span: 24 },
|
|
|
|
|
keys: ['province', 'city', 'area', 'street'],
|
|
|
|
|
required: true,
|
|
|
|
|
}),
|
|
|
|
|
{
|
|
|
|
|
key: 'address',
|
2025-06-30 13:41:38 +08:00
|
|
|
title: '详细地址',
|
2025-06-29 18:42:50 +08:00
|
|
|
colProps: { span: 24 },
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|