Compare commits
No commits in common. "5c244d1a72830d8aad00207e9cdb5609bdd06023" and "0fcdf6e00f9f0659310542aa12cccf2eec65b609" have entirely different histories.
5c244d1a72
...
0fcdf6e00f
@ -1,31 +0,0 @@
|
||||
import { MyButtons } from '@/common';
|
||||
import { Modal } from 'antd';
|
||||
import { useState } from 'react';
|
||||
|
||||
export function MyModal(props?: any) {
|
||||
const [open, setOpen] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<MyButtons.View
|
||||
title={props.title || '详情'}
|
||||
onClick={() => setOpen(true)}
|
||||
/>
|
||||
<Modal
|
||||
title={props?.modal?.title || '标题'}
|
||||
open={open}
|
||||
onOk={() => {
|
||||
setOpen(false);
|
||||
props?.handleOk?.();
|
||||
}}
|
||||
onCancel={() => {
|
||||
setOpen(false);
|
||||
props?.onCancel?.();
|
||||
}}
|
||||
footer={props?.modal?.footer || false}
|
||||
{...props}
|
||||
>
|
||||
{props?.node}
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -6,6 +6,7 @@ import {
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Address } from '@/components/Address';
|
||||
import { SysSelects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { CompaniesMerchantTypeEnum } from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
@ -29,15 +30,20 @@ export default function Create(props: MyBetaModalFormProps) {
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
SysSelects?.Companies({
|
||||
key: 'parent_id',
|
||||
title: '上级组织',
|
||||
colProps: { span: 24 },
|
||||
}),
|
||||
{
|
||||
key: 'name',
|
||||
title: '机构名称',
|
||||
title: '组织名称',
|
||||
colProps: { span: 8 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'short_name',
|
||||
title: '机构简称',
|
||||
title: '组织简称',
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
@ -89,7 +95,7 @@ export default function Create(props: MyBetaModalFormProps) {
|
||||
}),
|
||||
{
|
||||
key: 'address',
|
||||
title: '详细地址',
|
||||
title: '机构地址',
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
]}
|
||||
|
||||
@ -6,34 +6,31 @@ import {
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Address } from '@/components/Address';
|
||||
import { SysSelects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { CompaniesMerchantTypeEnum } from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { Form, message } from 'antd';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default function Update(props: MyBetaModalFormProps) {
|
||||
const [form] = Form.useForm();
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Company.Companies.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={`编辑${props.title}`}
|
||||
form={form}
|
||||
trigger={<MyButtons.Edit />}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="800px"
|
||||
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 || '',
|
||||
],
|
||||
});
|
||||
}
|
||||
}}
|
||||
request={() =>
|
||||
Promise.resolve({
|
||||
...props.item,
|
||||
casacader: [
|
||||
props.item?.province_id || '',
|
||||
props.item?.city_id || '',
|
||||
props.item?.area_id || '',
|
||||
props.item?.street_id || '',
|
||||
],
|
||||
})
|
||||
}
|
||||
onFinish={async (values) =>
|
||||
Apis.Company.Companies.Update({ ...values, id: props.item?.id ?? 0 })
|
||||
.then(() => {
|
||||
@ -44,15 +41,20 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
SysSelects?.Companies({
|
||||
key: 'parent_id',
|
||||
title: '上级组织',
|
||||
colProps: { span: 24 },
|
||||
}),
|
||||
{
|
||||
key: 'name',
|
||||
title: '机构名称',
|
||||
title: '组织名称',
|
||||
colProps: { span: 8 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'short_name',
|
||||
title: '机构简称',
|
||||
title: '组织简称',
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
@ -104,7 +106,7 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
}),
|
||||
{
|
||||
key: 'address',
|
||||
title: '详细地址',
|
||||
title: '机构地址',
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
]}
|
||||
|
||||
@ -2,10 +2,9 @@ import { MyBetaModalFormProps, MyButtons, MyModalFormProps } from '@/common';
|
||||
import { SysSelects } from '@/components/SysSelects';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { Form, message } from 'antd';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default function Update(props: MyBetaModalFormProps) {
|
||||
const [form] = Form.useForm();
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Common.Admins.Update>
|
||||
{...MyModalFormProps.props}
|
||||
@ -13,15 +12,12 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
trigger={<MyButtons.Edit />}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
form={form}
|
||||
onOpenChange={(open: any) => {
|
||||
if (open && props.item) {
|
||||
form.setFieldsValue({
|
||||
...props.item,
|
||||
roles_id: props.item?.roles?.map((item: any) => item.value),
|
||||
});
|
||||
}
|
||||
}}
|
||||
request={() =>
|
||||
Promise.resolve({
|
||||
...props.item,
|
||||
roles_id: props.item?.roles?.map((item: any) => item.value),
|
||||
})
|
||||
}
|
||||
onFinish={async (values) =>
|
||||
Apis.Common.Admins.Update({ ...values, id: props.item?.id ?? 0 })
|
||||
.then(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user