fix:更新
This commit is contained in:
parent
d655dce836
commit
499ed1f979
@ -14,7 +14,7 @@ export default defineConfig({
|
||||
},
|
||||
proxy: {
|
||||
'/api/': {
|
||||
target: 'http://0.0.0.0:8000',
|
||||
target: 'http://yt:8003',
|
||||
// target: 'https://loanos-test.nchl.net/',
|
||||
changeOrigin: true,
|
||||
pathRewrite: { '^': '' },
|
||||
|
||||
@ -7,11 +7,10 @@ import {
|
||||
UserOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { history } from '@umijs/max';
|
||||
import { Avatar, Drawer, Dropdown, MenuProps, Space } from 'antd';
|
||||
import { Avatar, Dropdown, MenuProps, Space } from 'antd';
|
||||
import { useState } from 'react';
|
||||
import { stateActions } from '../../libs/valtio/actions';
|
||||
import ChangePassword from './ChangePassword';
|
||||
import MyTasks from './Tasks';
|
||||
|
||||
export default function AvatarProps({ user }: { user: any }) {
|
||||
const [open, setOpen] = useState(false);
|
||||
@ -41,7 +40,7 @@ export default function AvatarProps({ user }: { user: any }) {
|
||||
label: (
|
||||
<Space
|
||||
onClick={() => {
|
||||
Apis.Auth.Logout().then(() => {
|
||||
Apis.Common.Auth.Logout().then(() => {
|
||||
stateActions.setLogout();
|
||||
history.push('/login');
|
||||
});
|
||||
@ -78,17 +77,6 @@ export default function AvatarProps({ user }: { user: any }) {
|
||||
</Dropdown>
|
||||
</Space>
|
||||
<ChangePassword open={open} setOpen={setOpen} />
|
||||
<Drawer
|
||||
title="任务"
|
||||
placement="right"
|
||||
closable={false}
|
||||
onClose={onClose}
|
||||
open={openDrawer}
|
||||
key="right"
|
||||
width={500}
|
||||
>
|
||||
<MyTasks item={openDrawer} />
|
||||
</Drawer>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,106 +0,0 @@
|
||||
import { MyButtons, renderTextHelper } from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { SysTasksStatusEnum } from '@/gen/Enums';
|
||||
import { UndoOutlined } from '@ant-design/icons';
|
||||
import { Card, Descriptions, Pagination, Space } from 'antd';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export default function Tasks(props: any) {
|
||||
const [option, setOption] = useState<any>({});
|
||||
const getList = (page: number) => {
|
||||
Apis.SysTasks.List({ perPage: 10, page: page })
|
||||
.then((res) => {
|
||||
setOption(res);
|
||||
})
|
||||
.catch(() => false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (props?.item) {
|
||||
getList(1);
|
||||
}
|
||||
}, [props?.item]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Space direction="vertical" style={{ width: '100%' }}>
|
||||
{!option?.data?.length ? (
|
||||
<div
|
||||
style={{ color: '#999', textAlign: 'center', padding: '20px 0' }}
|
||||
>
|
||||
暂无任务数据
|
||||
</div>
|
||||
) : (
|
||||
''
|
||||
)}
|
||||
{option?.data?.map((res: any) => {
|
||||
return (
|
||||
<Card
|
||||
title={res?.name}
|
||||
key={res?.id}
|
||||
extra={
|
||||
<Space>
|
||||
<MyButtons.Delete
|
||||
size="middle"
|
||||
type="default"
|
||||
onConfirm={() =>
|
||||
Apis.SysTasks.Delete({
|
||||
id: res.id,
|
||||
}).then(() => getList(1))
|
||||
}
|
||||
/>
|
||||
<MyButtons.Default
|
||||
icon={<UndoOutlined />}
|
||||
size="middle"
|
||||
onClick={() => getList(1)}
|
||||
/>
|
||||
</Space>
|
||||
}
|
||||
style={{ width: '100%' }}
|
||||
>
|
||||
<Descriptions column={1}>
|
||||
<Descriptions.Item label="开始时间:">
|
||||
{res?.start_at || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="成功数量:">
|
||||
{res?.success_count || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="失败数量:">
|
||||
{res?.fail_count || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="状态:">
|
||||
<renderTextHelper.Tag
|
||||
Enums={SysTasksStatusEnum}
|
||||
value={res?.status}
|
||||
key="status"
|
||||
/>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="结束时间:">
|
||||
{res?.end_at || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="错误信息:">
|
||||
{res?.error_message || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="失败的策路:">
|
||||
<Space>
|
||||
{res?.is_error_stop ? '失败后暂停' : '失败后续集执行'}
|
||||
{res?.is_error_rollback ? '失败后全部回滚' : '失败后不回滚'}
|
||||
</Space>
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
</Card>
|
||||
);
|
||||
})}
|
||||
<div style={{ display: 'flex', justifyContent: 'end' }}>
|
||||
<Pagination
|
||||
defaultCurrent={option?.meta?.current_page}
|
||||
total={option?.meta?.total}
|
||||
onChange={(page) => {
|
||||
getList(page);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Space>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -73,3 +73,10 @@ export const SysModuleEnum= {
|
||||
'Customer': {"text":"客户","color":"#d4b106","value":"Customer"},
|
||||
};
|
||||
|
||||
// SysPermissionsTypeEnum
|
||||
export const SysPermissionsTypeEnum= {
|
||||
'Directory': {"text":"目录","color":"#6d7e14","value":"Directory"},
|
||||
'Page': {"text":"页面","color":"#4d9a13","value":"Page"},
|
||||
'Button': {"text":"按钮","color":"#97224f","value":"Button"},
|
||||
};
|
||||
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
import {
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyPageContainer,
|
||||
MyProTableProps,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import Create from './modals/Create';
|
||||
import Update from './modals/Update';
|
||||
|
||||
export default function Index({ title = '代理商' }) {
|
||||
return (
|
||||
<MyPageContainer title={title}>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(params, sort, Apis.Agents.List)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title={title} />,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '简称',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '全称',
|
||||
dataIndex: 'full_name',
|
||||
},
|
||||
{
|
||||
dataIndex: 'address',
|
||||
title: '地址',
|
||||
},
|
||||
{
|
||||
dataIndex: 'contact',
|
||||
title: '联系人',
|
||||
},
|
||||
{
|
||||
dataIndex: 'phone',
|
||||
title: '联系电话',
|
||||
},
|
||||
MyColumns.CreatedAt(),
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<Update item={item} reload={action?.reload} title={title} />
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Agents.Delete({ id: item.id }).then(() =>
|
||||
action?.reload(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
]}
|
||||
/>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
@ -1,54 +0,0 @@
|
||||
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 Create(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Agents.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.Agents.Store(values)
|
||||
.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: '联系电话',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,55 +0,0 @@
|
||||
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: '联系电话',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,65 +0,0 @@
|
||||
import {
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyPageContainer,
|
||||
MyProTableProps,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import Create from './modals/Create';
|
||||
import Update from './modals/Update';
|
||||
|
||||
export default function Index({ title = '超市老板' }) {
|
||||
return (
|
||||
<MyPageContainer title={title}>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(params, sort, Apis.Bosses.List)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title={title} />,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '简称',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '全称',
|
||||
dataIndex: 'full_name',
|
||||
},
|
||||
{
|
||||
dataIndex: 'address',
|
||||
title: '地址',
|
||||
},
|
||||
{
|
||||
dataIndex: 'contact',
|
||||
title: '联系人',
|
||||
},
|
||||
{
|
||||
dataIndex: 'phone',
|
||||
title: '联系电话',
|
||||
},
|
||||
MyColumns.CreatedAt(),
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<Update item={item} reload={action?.reload} title={title} />
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Bosses.Delete({ id: item.id }).then(() =>
|
||||
action?.reload(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
]}
|
||||
/>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
@ -1,54 +0,0 @@
|
||||
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 Create(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Bosses.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.Bosses.Store(values)
|
||||
.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: '联系电话',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,55 +0,0 @@
|
||||
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.Bosses.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={`编辑${props.title}`}
|
||||
trigger={<MyButtons.Edit />}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
request={() => Promise.resolve(props.item)}
|
||||
onFinish={async (values) =>
|
||||
Apis.Bosses.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: '联系电话',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,55 +0,0 @@
|
||||
import {
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyPageContainer,
|
||||
MyProTableProps,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import Create from './modals/Create';
|
||||
import Update from './modals/Update';
|
||||
|
||||
export default function Index({ title = '下游厂家' }) {
|
||||
return (
|
||||
<MyPageContainer title={title}>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
search={false}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(params, sort, Apis.Factories.List)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title={title} />,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '厂家名称',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '下游公钥',
|
||||
dataIndex: 'public_key',
|
||||
},
|
||||
MyColumns.CreatedAt(),
|
||||
MyColumns.UpdatedAt(),
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<Update item={item} reload={action?.reload} title={title} />
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Factories.Delete({ id: item.id }).then(() =>
|
||||
action?.reload(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
]}
|
||||
/>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
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 Create(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Factories.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.Factories.Store(values)
|
||||
.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 },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,44 +0,0 @@
|
||||
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 },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,75 +0,0 @@
|
||||
import {
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyPageContainer,
|
||||
MyProTableProps,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { LoanCompaniesTypeEnum } from '@/gen/Enums';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import Create from './modals/Create';
|
||||
import Update from './modals/Update';
|
||||
|
||||
export default function Index({ title = '资金方' }) {
|
||||
return (
|
||||
<MyPageContainer title={title}>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(params, sort, Apis.LoanCompanies.List)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title={title} />,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
valueEnum: LoanCompaniesTypeEnum,
|
||||
},
|
||||
{
|
||||
title: '简称',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '全称',
|
||||
dataIndex: 'full_name',
|
||||
},
|
||||
{
|
||||
title: '上游商户号',
|
||||
dataIndex: 'up_merchant_no',
|
||||
},
|
||||
{
|
||||
dataIndex: 'address',
|
||||
title: '地址',
|
||||
},
|
||||
{
|
||||
dataIndex: 'contact',
|
||||
title: '联系人',
|
||||
},
|
||||
{
|
||||
dataIndex: 'phone',
|
||||
title: '联系电话',
|
||||
},
|
||||
MyColumns.CreatedAt(),
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<Update item={item} reload={action?.reload} title={title} />
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.LoanCompanies.Delete({ id: item.id }).then(() =>
|
||||
action?.reload(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
]}
|
||||
/>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
@ -1,66 +0,0 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { LoanCompaniesTypeEnum } from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default function Create(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.LoanCompanies.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.LoanCompanies.Store(values)
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
MyColumns.EnumTag({
|
||||
key: 'type',
|
||||
title: '类型',
|
||||
valueEnum: LoanCompaniesTypeEnum,
|
||||
}),
|
||||
{
|
||||
key: 'name',
|
||||
title: '简称',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'full_name',
|
||||
title: '全称',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'up_merchant_no',
|
||||
title: '上游商户号',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'address',
|
||||
title: '地址',
|
||||
},
|
||||
{
|
||||
key: 'contact',
|
||||
title: '联系人',
|
||||
},
|
||||
{
|
||||
key: 'phone',
|
||||
title: '联系电话',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,67 +0,0 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { LoanCompaniesTypeEnum } from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default function Update(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.LoanCompanies.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={`编辑${props.title}`}
|
||||
trigger={<MyButtons.Edit />}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
request={() => Promise.resolve(props.item)}
|
||||
onFinish={async (values) =>
|
||||
Apis.LoanCompanies.Update({ ...values, id: props.item?.id ?? 0 })
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
MyColumns.EnumTag({
|
||||
key: 'type',
|
||||
title: '类型',
|
||||
valueEnum: LoanCompaniesTypeEnum,
|
||||
}),
|
||||
{
|
||||
key: 'name',
|
||||
title: '简称',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'full_name',
|
||||
title: '全称',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'up_merchant_no',
|
||||
title: '上游商户号',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'address',
|
||||
title: '地址',
|
||||
},
|
||||
{
|
||||
key: 'contact',
|
||||
title: '联系人',
|
||||
},
|
||||
{
|
||||
key: 'phone',
|
||||
title: '联系电话',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,104 +0,0 @@
|
||||
import {
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyPageContainer,
|
||||
MyProTableProps,
|
||||
} from '@/common';
|
||||
import { Selects } from '@/components/Selects';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { LoansOrderStatusEnum } from '@/gen/Enums';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { useState } from 'react';
|
||||
|
||||
export default function Index({ title = '还款记录' }) {
|
||||
const [query, setQuery] = useState();
|
||||
|
||||
return (
|
||||
<MyPageContainer title={`${title}管理`}>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(
|
||||
params,
|
||||
sort,
|
||||
Apis.LoanDailyDetails.List,
|
||||
setQuery,
|
||||
)
|
||||
}
|
||||
toolBarRender={() => [
|
||||
<MyButtons.Export
|
||||
title="还款计划导出"
|
||||
key="Export"
|
||||
api={Apis.LoanDailyDetails.Export}
|
||||
params={query}
|
||||
/>,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '所属商户',
|
||||
dataIndex: 'merchants_name',
|
||||
search: false,
|
||||
},
|
||||
Selects.Merchants({
|
||||
hideInTable: true,
|
||||
}),
|
||||
{
|
||||
title: '所属资金方',
|
||||
dataIndex: 'loan_companies_name',
|
||||
search: false,
|
||||
},
|
||||
Selects.LoanCompany({
|
||||
hideInTable: true,
|
||||
}),
|
||||
MyColumns.EnumTag({
|
||||
title: '订单状态',
|
||||
dataIndex: 'order_status',
|
||||
valueEnum: LoansOrderStatusEnum,
|
||||
}),
|
||||
{
|
||||
title: '日期',
|
||||
dataIndex: 'date',
|
||||
},
|
||||
{
|
||||
title: '应还-本金',
|
||||
dataIndex: 'due_principal',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
{
|
||||
title: '应还-利息',
|
||||
dataIndex: 'due_interest',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
{
|
||||
title: '应还-递延本金',
|
||||
dataIndex: 'due_deferred_principal',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
{
|
||||
title: '应还-总金额',
|
||||
dataIndex: 'due_total_amount',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
{
|
||||
title: '已还-总金额',
|
||||
dataIndex: 'paid_total_amount',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
{
|
||||
title: '未还-总金额',
|
||||
dataIndex: 'remaining_total_amount',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
// MyColumns.CreatedAt(),
|
||||
]}
|
||||
/>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
@ -1,193 +0,0 @@
|
||||
import {
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyPageContainer,
|
||||
MyProTableProps,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { LoansOrderStatusEnum, LoansTypeEnum } from '@/gen/Enums';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import Create from './modals/Create';
|
||||
|
||||
export default function Index({ title = '贷款订单' }) {
|
||||
return (
|
||||
<MyPageContainer title={`${title}管理`}>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(params, sort, Apis.Loans.List)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title={title} />,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '所属商户',
|
||||
dataIndex: ['merchant', 'name'],
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '所属资金方',
|
||||
dataIndex: ['loan_company', 'name'],
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
MyColumns.EnumTag({
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
valueEnum: LoansTypeEnum,
|
||||
}),
|
||||
MyColumns.EnumTag({
|
||||
title: '订单状态',
|
||||
dataIndex: 'order_status',
|
||||
valueEnum: LoansOrderStatusEnum,
|
||||
}),
|
||||
{
|
||||
title: '贷款天数',
|
||||
dataIndex: 'loan_days',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '开始时间',
|
||||
dataIndex: 'started_at',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '结束时间',
|
||||
dataIndex: 'ended_at',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '总应还',
|
||||
search: false,
|
||||
children: [
|
||||
{
|
||||
title: '本金',
|
||||
dataIndex: 'total_due_principal',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
{
|
||||
title: '利息',
|
||||
dataIndex: 'total_due_interest',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
{
|
||||
title: '总金额',
|
||||
dataIndex: 'total_due_amount',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '每日应还',
|
||||
search: false,
|
||||
children: [
|
||||
{
|
||||
title: '本金',
|
||||
dataIndex: 'daily_due_principal',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
{
|
||||
title: '利息',
|
||||
dataIndex: 'daily_due_interest',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
{
|
||||
title: '总金额',
|
||||
dataIndex: 'daily_due_amount',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
title: '已还',
|
||||
search: false,
|
||||
children: [
|
||||
{
|
||||
title: '天数',
|
||||
dataIndex: 'repaid_days',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '本金',
|
||||
dataIndex: 'repaid_total_principal',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
{
|
||||
title: '利息',
|
||||
dataIndex: 'repaid_total_interest',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
{
|
||||
title: '总金额',
|
||||
dataIndex: 'repaid_total_amount',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '剩余应还',
|
||||
search: false,
|
||||
children: [
|
||||
{
|
||||
title: '天数',
|
||||
dataIndex: 'remaining_due_days',
|
||||
search: false,
|
||||
},
|
||||
|
||||
{
|
||||
title: '本金',
|
||||
dataIndex: 'remaining_due_principal',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
|
||||
{
|
||||
title: '利息',
|
||||
dataIndex: 'remaining_due_interest',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
|
||||
{
|
||||
title: '总金额',
|
||||
dataIndex: 'remaining_due_amount',
|
||||
search: false,
|
||||
valueType: 'money',
|
||||
},
|
||||
],
|
||||
},
|
||||
MyColumns.CreatedAt(),
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Loans.Delete({ id: item.id }).then(() =>
|
||||
action?.reload(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
]}
|
||||
/>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
@ -1,90 +0,0 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyFormItems,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Selects } from '@/components/Selects';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { LoansTypeEnum } 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.Loans.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
width="600px"
|
||||
wrapperCol={{ span: 24 }}
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.Loans.Store(values)
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
form={form}
|
||||
onOpenChange={(open: boolean) => {
|
||||
if (open) {
|
||||
form.setFieldsValue({ repayment_date: 21, loan_terms: 3 });
|
||||
}
|
||||
}}
|
||||
columns={[
|
||||
Selects.Merchants({
|
||||
colProps: { span: 24 },
|
||||
required: true,
|
||||
}),
|
||||
Selects.LoanCompany({
|
||||
colProps: { span: 24 },
|
||||
required: true,
|
||||
}),
|
||||
{
|
||||
title: '名称',
|
||||
key: 'name',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
MyFormItems.EnumRadio({
|
||||
title: '算法类型',
|
||||
key: 'type',
|
||||
valueEnum: LoansTypeEnum,
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
}),
|
||||
{
|
||||
title: '贷款天数',
|
||||
key: 'loan_days',
|
||||
colProps: { span: 12 },
|
||||
formItemProps: { ...rulesHelper.number },
|
||||
width: '100%',
|
||||
},
|
||||
{
|
||||
title: '还款起始日',
|
||||
key: 'started_at',
|
||||
valueType: 'date',
|
||||
colProps: { span: 12 },
|
||||
formItemProps: { ...rulesHelper.number },
|
||||
width: '100%',
|
||||
},
|
||||
MyFormItems.Money({
|
||||
title: '总应还-本金',
|
||||
key: 'total_due_principal',
|
||||
colProps: { span: 12 },
|
||||
formItemProps: { ...rulesHelper.number },
|
||||
width: '100%',
|
||||
}),
|
||||
MyFormItems.Money({
|
||||
title: '总应还-利息',
|
||||
key: 'total_due_interest',
|
||||
colProps: { span: 12 },
|
||||
formItemProps: { ...rulesHelper.number },
|
||||
width: '100%',
|
||||
}),
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,60 +0,0 @@
|
||||
import {
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyPageContainer,
|
||||
MyProTableProps,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import Create from './modals/Create';
|
||||
import Update from './modals/Update';
|
||||
|
||||
export default function Index({ title = '上游市场' }) {
|
||||
return (
|
||||
<MyPageContainer title={title}>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
search={false}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(params, sort, Apis.Markets.List)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title={title} />,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '市场名称',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '市场编号',
|
||||
dataIndex: 'market_no',
|
||||
},
|
||||
{
|
||||
title: '上游公钥',
|
||||
dataIndex: 'public_key',
|
||||
search: false,
|
||||
},
|
||||
MyColumns.UpdatedAt(),
|
||||
MyColumns.CreatedAt(),
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<Update item={item} reload={action?.reload} title={title} />
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Markets.Delete({ id: item.id }).then(() =>
|
||||
action?.reload(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
]}
|
||||
/>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
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 Create(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Markets.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.Markets.Store(values)
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
{
|
||||
key: 'name',
|
||||
title: '市场名称',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'market_no',
|
||||
title: '市场编号',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'public_key',
|
||||
title: '上游公钥',
|
||||
valueType: 'textarea',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
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.Markets.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={`编辑${props.title}`}
|
||||
trigger={<MyButtons.Edit />}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
request={() => Promise.resolve(props.item)}
|
||||
onFinish={async (values) =>
|
||||
Apis.Markets.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: 'market_no',
|
||||
title: '市场编号',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'public_key',
|
||||
title: '上游公钥',
|
||||
valueType: 'textarea',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,136 +0,0 @@
|
||||
import {
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyPageContainer,
|
||||
MyProTableProps,
|
||||
} from '@/common';
|
||||
import { Selects } from '@/components/Selects';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import Create from './modals/Create';
|
||||
import CreateCounters from './modals/CreateCounters';
|
||||
import Update from './modals/Update';
|
||||
import UpdateCounters from './modals/UpdateCounters';
|
||||
|
||||
export default function Index({ title = '商户' }) {
|
||||
const ExpandedRowRender = (e: any) => {
|
||||
const columns = [
|
||||
{ title: 'id', dataIndex: 'id' },
|
||||
{ title: '上游', dataIndex: ['market', 'name'] },
|
||||
{ title: '名称', dataIndex: 'name' },
|
||||
{ title: '上游商家编号', dataIndex: 'up_merchant_no' },
|
||||
{ title: '平台商户号', dataIndex: 'plat_merchant_no' },
|
||||
{ title: '平台柜台号', dataIndex: 'plat_counter_no' },
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<UpdateCounters item={item} reload={action?.reload} title="柜台" />
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.MerchantCounters.Delete({ id: item.id }).then(() =>
|
||||
action?.reload(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
];
|
||||
return (
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
pagination={false}
|
||||
columns={columns}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(
|
||||
{ ...params, merchants_id: e?.id },
|
||||
sort,
|
||||
Apis.MerchantCounters.List,
|
||||
)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<CreateCounters
|
||||
key="Create"
|
||||
reload={action?.reload}
|
||||
title="添加柜台"
|
||||
item={{ merchants_id: e?.id }}
|
||||
/>,
|
||||
]}
|
||||
headerTitle="柜台信息"
|
||||
search={false}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<MyPageContainer title={title}>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(params, sort, Apis.Merchants.List)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title={title} />,
|
||||
]}
|
||||
expandable={{
|
||||
expandedRowRender: ExpandedRowRender,
|
||||
}}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
Selects.Agents({ dataIndex: 'agents_name' }),
|
||||
Selects.Bosses({ dataIndex: 'bosses_name' }),
|
||||
Selects.Factories({ dataIndex: 'factories_name' }),
|
||||
Selects.Platforms({ dataIndex: 'platforms_name' }),
|
||||
// {
|
||||
// title: '代理',
|
||||
// dataIndex: 'agents_name',
|
||||
// search: false,
|
||||
// },
|
||||
// {
|
||||
// title: '厂家',
|
||||
// dataIndex: 'factories_name',
|
||||
// search: false,
|
||||
// },
|
||||
// {
|
||||
// title: '平台',
|
||||
// dataIndex: 'platforms_name',
|
||||
// search: false,
|
||||
// },
|
||||
// {
|
||||
// title: '老板',
|
||||
// dataIndex: 'bosses_name',
|
||||
// search: false,
|
||||
// },
|
||||
{
|
||||
title: '简称',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '全称',
|
||||
dataIndex: 'full_name',
|
||||
},
|
||||
{
|
||||
title: '平台商户号',
|
||||
dataIndex: 'plat_merchant_no',
|
||||
},
|
||||
MyColumns.CreatedAt(),
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<Update item={item} reload={action?.reload} title={title} />
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Merchants.Delete({ id: item.id }).then(() =>
|
||||
action?.reload(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
]}
|
||||
/>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Selects } from '@/components/Selects';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default function Create(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Merchants.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.Merchants.Store(values)
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
Selects.Agents({ required: true }),
|
||||
Selects.Bosses({ required: true }),
|
||||
Selects.Factories({ required: true }),
|
||||
Selects.Platforms({ required: true }),
|
||||
{
|
||||
key: 'name',
|
||||
title: '简称',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'full_name',
|
||||
title: '全称',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,88 +0,0 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyFormItems,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Selects } from '@/components/Selects';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { CommissionTypeEnum } from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default function CreateCounters(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.MerchantCounters.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="800px"
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.MerchantCounters.Store({ ...props?.item, ...values })
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
Selects.Markets({ required: true }),
|
||||
{
|
||||
key: 'name',
|
||||
title: '名称',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'up_merchant_no',
|
||||
title: '上游商家编号',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
valueType: 'formList',
|
||||
dataIndex: 'commissions',
|
||||
title: '分佣配置',
|
||||
formItemProps: { ...rulesHelper.array },
|
||||
fieldProps: {
|
||||
copyIconProps: false,
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
valueType: 'group',
|
||||
colProps: { span: 24 },
|
||||
columns: [
|
||||
{
|
||||
key: 'seq',
|
||||
colProps: { span: 3 },
|
||||
title: '序号',
|
||||
width: '100%',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
MyFormItems.EnumSelect({
|
||||
key: 'type',
|
||||
title: '类型',
|
||||
colProps: { span: 4 },
|
||||
valueEnum: CommissionTypeEnum,
|
||||
required: true,
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
}),
|
||||
{
|
||||
key: 'merchant_no',
|
||||
colProps: { span: 9 },
|
||||
title: '商户编号',
|
||||
},
|
||||
{
|
||||
key: 'percent',
|
||||
colProps: { span: 8 },
|
||||
title: '分佣比例%(0为自动计算)',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Selects } from '@/components/Selects';
|
||||
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.Merchants.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={`编辑${props.title}`}
|
||||
trigger={<MyButtons.Edit />}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
request={() => Promise.resolve(props.item)}
|
||||
onFinish={async (values) =>
|
||||
Apis.Merchants.Update({ ...values, id: props.item?.id ?? 0 })
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
Selects.Agents({ required: true }),
|
||||
Selects.Bosses({ required: true }),
|
||||
Selects.Factories({ required: true }),
|
||||
Selects.Platforms({ required: true }),
|
||||
{
|
||||
key: 'name',
|
||||
title: '简称',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'full_name',
|
||||
title: '全称',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,89 +0,0 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyFormItems,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Selects } from '@/components/Selects';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { CommissionTypeEnum } from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default function UpdateCounters(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.MerchantCounters.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={`编辑${props.title}`}
|
||||
trigger={<MyButtons.Edit />}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="800px"
|
||||
request={() => Promise.resolve(props.item)}
|
||||
onFinish={async (values) =>
|
||||
Apis.MerchantCounters.Update({ ...values, id: props.item?.id ?? 0 })
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
Selects.Markets({ required: true }),
|
||||
{
|
||||
key: 'name',
|
||||
title: '名称',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'up_merchant_no',
|
||||
title: '上游商家编号',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
valueType: 'formList',
|
||||
dataIndex: 'commissions',
|
||||
title: '分佣配置',
|
||||
formItemProps: { ...rulesHelper.array },
|
||||
fieldProps: {
|
||||
copyIconProps: false,
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
valueType: 'group',
|
||||
colProps: { span: 24 },
|
||||
columns: [
|
||||
{
|
||||
key: 'seq',
|
||||
colProps: { span: 3 },
|
||||
title: '序号',
|
||||
width: '100%',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
MyFormItems.EnumSelect({
|
||||
key: 'type',
|
||||
title: '类型',
|
||||
colProps: { span: 4 },
|
||||
valueEnum: CommissionTypeEnum,
|
||||
required: true,
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
}),
|
||||
{
|
||||
key: 'merchant_no',
|
||||
colProps: { span: 9 },
|
||||
title: '商户编号',
|
||||
},
|
||||
{
|
||||
key: 'percent',
|
||||
colProps: { span: 8 },
|
||||
title: '分佣比例%(0为自动计算)',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,71 +0,0 @@
|
||||
import {
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyPageContainer,
|
||||
MyProTableProps,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import Create from './modals/Create';
|
||||
import Update from './modals/Update';
|
||||
import { OrgUsersTypeEnum } from '@/gen/Enums';
|
||||
|
||||
export default function Index({ title = '账号管理' }) {
|
||||
return (
|
||||
<MyPageContainer title={title}>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(params, sort, Apis.OrgUsers.List)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title={title} />,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
MyColumns.EnumTag({
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
valueEnum: OrgUsersTypeEnum,
|
||||
}),
|
||||
{
|
||||
title: '机构名称',
|
||||
dataIndex: ['org', 'name'],
|
||||
key: 'org_name'
|
||||
},
|
||||
{
|
||||
title: '账号',
|
||||
dataIndex: 'username',
|
||||
},
|
||||
{
|
||||
title: 'last_login_ip',
|
||||
dataIndex: 'last_login_ip',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: 'last_login_at',
|
||||
dataIndex: 'last_login_at',
|
||||
search: false,
|
||||
},
|
||||
MyColumns.UpdatedAt(),
|
||||
MyColumns.CreatedAt(),
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<Update item={item} reload={action?.reload} title={title} />
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.OrgUsers.Delete({ id: item.id }).then(() =>
|
||||
action?.reload(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
]}
|
||||
/>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
@ -1,57 +0,0 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyFormItems,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Selects } from '@/components/Selects';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { OrgUsersTypeEnum } from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default function Create(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.OrgUsers.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.OrgUsers.Store(values)
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'type',
|
||||
title: '类型',
|
||||
valueEnum: OrgUsersTypeEnum
|
||||
}),
|
||||
{
|
||||
key: 'org_name',
|
||||
title: '主体名称',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'username',
|
||||
title: '用户名',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'password',
|
||||
title: '密码',
|
||||
valueType: 'password',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,55 +0,0 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Selects } from '@/components/Selects';
|
||||
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.OrgUsers.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={`编辑${props.title}`}
|
||||
trigger={<MyButtons.Edit />}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
request={() => Promise.resolve(props.item)}
|
||||
onFinish={async (values) =>
|
||||
Apis.OrgUsers.Update({ ...values, id: props.item?.id ?? 0 })
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
{
|
||||
key: 'type',
|
||||
title: '类型',
|
||||
readonly: true,
|
||||
},
|
||||
{
|
||||
key: ['org','name'],
|
||||
title: '机构名称',
|
||||
readonly: true,
|
||||
},
|
||||
{
|
||||
key: 'username',
|
||||
title: '用户名',
|
||||
readonly: true,
|
||||
},
|
||||
{
|
||||
key: 'password',
|
||||
title: '密码',
|
||||
valueType: 'password',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,75 +0,0 @@
|
||||
import { MyColumns, MyPageContainer, MyProTableProps } from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { PayOrderStatusEnum, PayOrdersTypeEnum } from '@/gen/Enums';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
|
||||
export default function Index({ title = '支付明细' }) {
|
||||
return (
|
||||
<MyPageContainer title={title}>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(params, sort, Apis.PayOrders.List)
|
||||
}
|
||||
columns={[
|
||||
{
|
||||
title: '交易时间',
|
||||
search: false,
|
||||
dataIndex: 'up_order_at',
|
||||
},
|
||||
{
|
||||
title: '交易时间范围',
|
||||
key: 'up_order_at_range',
|
||||
valueType: 'dateRange',
|
||||
hideInTable: true,
|
||||
},
|
||||
{
|
||||
title: '商户',
|
||||
dataIndex: 'merchant_name',
|
||||
},
|
||||
MyColumns.EnumTag({
|
||||
title: '交易类型',
|
||||
dataIndex: 'type',
|
||||
valueEnum: PayOrdersTypeEnum,
|
||||
}),
|
||||
{
|
||||
title: '下单金额',
|
||||
dataIndex: 'amount_order',
|
||||
},
|
||||
MyColumns.EnumTag({
|
||||
title: '订单状态',
|
||||
dataIndex: 'order_status',
|
||||
valueEnum: PayOrderStatusEnum,
|
||||
}),
|
||||
{
|
||||
title: '平台商户号',
|
||||
dataIndex: 'plat_merchant_no',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '平台柜台号',
|
||||
dataIndex: 'plat_counter_no',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '上游商家编号',
|
||||
dataIndex: 'up_merchant_no',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '下游订单号',
|
||||
dataIndex: 'down_order_no',
|
||||
},
|
||||
{
|
||||
title: '上游订单号',
|
||||
dataIndex: 'up_order_no',
|
||||
},
|
||||
{
|
||||
title: '上游流水号',
|
||||
dataIndex: 'up_tx_no',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
@ -1,61 +0,0 @@
|
||||
import {
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyPageContainer,
|
||||
MyProTableProps,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import Create from './modals/Create';
|
||||
import Update from './modals/Update';
|
||||
|
||||
export default function Index({ title = '平台' }) {
|
||||
return (
|
||||
<MyPageContainer title={title}>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
search={false}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(params, sort, Apis.Platforms.List)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title={title} />,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '平台名称',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '平台私钥',
|
||||
dataIndex: 'private_key',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '平台公钥',
|
||||
dataIndex: 'public_key',
|
||||
search: false,
|
||||
},
|
||||
MyColumns.UpdatedAt(),
|
||||
MyColumns.CreatedAt(),
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<Update item={item} reload={action?.reload} title={title} />
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Platforms.Delete({ id: item.id }).then(() =>
|
||||
action?.reload(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
]}
|
||||
/>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
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 Create(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Platforms.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.Platforms.Store(values)
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
{
|
||||
key: 'name',
|
||||
title: '平台名称',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'private_key',
|
||||
title: '平台私钥',
|
||||
valueType: 'textarea',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'public_key',
|
||||
title: '平台公钥',
|
||||
valueType: 'textarea',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1,50 +0,0 @@
|
||||
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.Platforms.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={`编辑${props.title}`}
|
||||
trigger={<MyButtons.Edit />}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
request={() => Promise.resolve(props.item)}
|
||||
onFinish={async (values) =>
|
||||
Apis.Platforms.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: 'private_key',
|
||||
title: '平台私钥',
|
||||
valueType: 'textarea',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'public_key',
|
||||
title: '平台公钥',
|
||||
valueType: 'textarea',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -18,7 +18,7 @@ export default function Index({ title = '管理员' }) {
|
||||
{...MyProTableProps.props}
|
||||
search={false}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(params, sort, Apis.Admins.List)
|
||||
MyProTableProps.request(params, sort, Apis.Common.Admins.List)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title={title} />,
|
||||
@ -53,7 +53,7 @@ export default function Index({ title = '管理员' }) {
|
||||
<Update item={item} reload={action?.reload} title={title} />
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Admins.Delete({ id: item.id }).then(() =>
|
||||
Apis.Common.Admins.Delete({ id: item.id }).then(() =>
|
||||
action?.reload(),
|
||||
)
|
||||
}
|
||||
|
||||
@ -11,14 +11,14 @@ import { message } from 'antd';
|
||||
|
||||
export default function Create(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Admins.Store>
|
||||
<BetaSchemaForm<ApiTypes.Common.Admins.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.Admins.Store(values)
|
||||
Apis.Common.Admins.Store(values)
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
|
||||
@ -6,7 +6,7 @@ import { message } from 'antd';
|
||||
|
||||
export default function Update(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Admins.Update>
|
||||
<BetaSchemaForm<ApiTypes.Common.Admins.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={`编辑${props.title}`}
|
||||
trigger={<MyButtons.Edit />}
|
||||
@ -19,7 +19,7 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
})
|
||||
}
|
||||
onFinish={async (values) =>
|
||||
Apis.Admins.Update({ ...values, id: props.item?.id ?? 0 })
|
||||
Apis.Common.Admins.Update({ ...values, id: props.item?.id ?? 0 })
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
|
||||
@ -20,7 +20,9 @@ export default function Index({ title = '功能' }) {
|
||||
const [guardName, setGuardName] = useState<string>('Admin');
|
||||
|
||||
const getData = async () => {
|
||||
let data = await Apis.SysPermissions.List({ guard_name: guardName });
|
||||
let data = await Apis.Permission.SysPermissions.List({
|
||||
guard_name: guardName,
|
||||
});
|
||||
setData(data.data);
|
||||
};
|
||||
|
||||
@ -93,7 +95,7 @@ export default function Index({ title = '功能' }) {
|
||||
icon={<UpOutlined />}
|
||||
disabled={!item.parent_id}
|
||||
onClick={() => {
|
||||
Apis.SysPermissions.Move({
|
||||
Apis.Permission.SysPermissions.Move({
|
||||
id: item.id,
|
||||
type: 'up',
|
||||
}).then(() => {
|
||||
@ -106,7 +108,7 @@ export default function Index({ title = '功能' }) {
|
||||
icon={<DownOutlined />}
|
||||
disabled={!item.parent_id}
|
||||
onClick={() => {
|
||||
Apis.SysPermissions.Move({
|
||||
Apis.Permission.SysPermissions.Move({
|
||||
id: item.id,
|
||||
type: 'down',
|
||||
}).then(() => {
|
||||
@ -134,8 +136,8 @@ export default function Index({ title = '功能' }) {
|
||||
/>
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.SysPermissions.Delete({ id: item.id }).then(() =>
|
||||
getData(),
|
||||
Apis.Permission.SysPermissions.Delete({ id: item.id }).then(
|
||||
() => getData(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
||||
@ -19,7 +19,7 @@ export default function Create(
|
||||
) {
|
||||
const [form] = Form.useForm();
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.SysPermissions.Store>
|
||||
<BetaSchemaForm<ApiTypes.Permission.SysPermissions.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
form={form}
|
||||
@ -29,7 +29,7 @@ export default function Create(
|
||||
<MyButtons.Create title={`添加${props.title}`} {...props.buttonProps} />
|
||||
}
|
||||
onFinish={async (values) => {
|
||||
return Apis.SysPermissions.Store({
|
||||
return Apis.Permission.SysPermissions.Store({
|
||||
...values,
|
||||
guard_name: props.guardName,
|
||||
})
|
||||
|
||||
@ -17,14 +17,14 @@ export default function Update(
|
||||
const [form] = Form.useForm();
|
||||
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.SysPermissions.Update>
|
||||
<BetaSchemaForm<ApiTypes.Permission.SysPermissions.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={`编辑${props.title}`}
|
||||
form={form}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="600px"
|
||||
onFinish={async (values) => {
|
||||
return Apis.SysPermissions.Update({
|
||||
return Apis.Permission.SysPermissions.Update({
|
||||
...values,
|
||||
guard_name: props.guardName,
|
||||
id: props.item?.id,
|
||||
|
||||
@ -18,7 +18,7 @@ export default function Index({ title = '角色' }) {
|
||||
{...MyProTableProps.props}
|
||||
search={false}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(params, sort, Apis.SysRoles.List)
|
||||
MyProTableProps.request(params, sort, Apis.Permission.SysRoles.List)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title={title} />,
|
||||
@ -51,7 +51,7 @@ export default function Index({ title = '角色' }) {
|
||||
<Update item={item} reload={action?.reload} title={title} />
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.SysRoles.Delete({ id: item.id }).then(() =>
|
||||
Apis.Permission.SysRoles.Delete({ id: item.id }).then(() =>
|
||||
action?.reload(),
|
||||
)
|
||||
}
|
||||
|
||||
@ -11,14 +11,14 @@ import { message } from 'antd';
|
||||
|
||||
export default function Create(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.SysRoles.Store>
|
||||
<BetaSchemaForm<ApiTypes.Permission.SysRoles.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.SysRoles.Store(values)
|
||||
Apis.Permission.SysRoles.Store(values)
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
|
||||
@ -11,24 +11,24 @@ import { message } from 'antd';
|
||||
|
||||
export default function EditPermissions(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.SysRoles.SetPermissions>
|
||||
<BetaSchemaForm<ApiTypes.Permission.SysRoles.SetPermissions>
|
||||
{...MyModalFormProps.props}
|
||||
title={props.title}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="600px"
|
||||
trigger={<MyButtons.Edit title={props.title} />}
|
||||
request={() =>
|
||||
Apis.SysRoles.GetPermissions({ id: props?.item?.id ?? 0 }).then(
|
||||
(res) => {
|
||||
Apis.Permission.SysRoles.GetPermissions({
|
||||
id: props?.item?.id ?? 0,
|
||||
}).then((res) => {
|
||||
return {
|
||||
id: props?.item?.id,
|
||||
permissions_ids: res.data?.permissions_ids,
|
||||
};
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
onFinish={async (values) => {
|
||||
return Apis.SysRoles.SetPermissions({
|
||||
return Apis.Permission.SysRoles.SetPermissions({
|
||||
...values,
|
||||
id: props.item?.id ?? 0,
|
||||
})
|
||||
@ -45,7 +45,7 @@ export default function EditPermissions(props: MyBetaModalFormProps) {
|
||||
title: '选择权限',
|
||||
...rulesHelper.array,
|
||||
renderFormItem: () => (
|
||||
<MyTreeCheckable api={Apis.SysPermissions.Tree} />
|
||||
<MyTreeCheckable api={Apis.Permission.SysPermissions.Tree} />
|
||||
),
|
||||
},
|
||||
]}
|
||||
|
||||
@ -11,7 +11,7 @@ import { message } from 'antd';
|
||||
|
||||
export default function Update(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.SysRoles.Update>
|
||||
<BetaSchemaForm<ApiTypes.Permission.SysRoles.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={`编辑${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
@ -19,7 +19,7 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
trigger={<MyButtons.Edit />}
|
||||
request={async () => props.item}
|
||||
onFinish={async (values) => {
|
||||
return Apis.SysRoles.Update({
|
||||
return Apis.Permission.SysRoles.Update({
|
||||
...values,
|
||||
id: props.item?.id ?? 0,
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user