diff --git a/src/components/Selects.tsx b/src/components/Selects.tsx deleted file mode 100644 index 8296cba..0000000 --- a/src/components/Selects.tsx +++ /dev/null @@ -1,205 +0,0 @@ -import { rulesHelper } from '@/common'; -import { Apis } from '@/gen/Apis'; -import { ProColumns, ProFormColumnsType } from '@ant-design/pro-components'; - -type ReturnType = ProColumns & ProFormColumnsType; -type PropsType = { required?: boolean } & ReturnType; - -export const Selects = { - Agents(props?: PropsType): ReturnType { - const { - title = '代理', - key = 'agents_id', - dataIndex = ['agent', 'name'], - required = false, - hideInTable = false, - ...rest - } = props ?? {}; - - return { - title: title, - key: key, - dataIndex: dataIndex, - valueType: 'select', - hideInTable: hideInTable, - formItemProps: { ...(required ? rulesHelper.number : {}) }, - fieldProps: { - showSearch: false, - fieldNames: { - label: 'name', - value: 'id', - }, - }, - request: async () => (await Apis.Select.Agents()).data, - ...rest, - }; - }, - LoanCompany(props?: PropsType): ReturnType { - const { - title = '资金方', - key = 'loan_companies_id', - dataIndex = ['loan_company', 'name'], - required = false, - hideInTable = false, - ...rest - } = props ?? {}; - - return { - title: title, - key: key, - dataIndex: dataIndex, - valueType: 'select', - hideInTable: hideInTable, - formItemProps: { ...(required ? rulesHelper.number : {}) }, - fieldProps: { - showSearch: false, - fieldNames: { - label: 'name', - value: 'id', - }, - }, - request: async () => (await Apis.Select.LoanCompanies()).data, - ...rest, - }; - }, - Markets(props?: PropsType): ReturnType { - const { - title = '选择上游', - key = 'markets_id', - dataIndex = ['market', 'name'], - required = false, - hideInTable = false, - ...rest - } = props ?? {}; - - return { - title: title, - key: key, - dataIndex: dataIndex, - valueType: 'select', - hideInTable: hideInTable, - formItemProps: { ...(required ? rulesHelper.number : {}) }, - fieldProps: { - showSearch: false, - fieldNames: { - label: 'name', - value: 'id', - }, - }, - request: async () => (await Apis.Select.Markets()).data, - ...rest, - }; - }, - Bosses(props?: PropsType): ReturnType { - const { - title = '老板', - key = 'bosses_id', - dataIndex = ['boss', 'name'], - required = false, - hideInTable = false, - ...rest - } = props ?? {}; - - return { - title: title, - key: key, - dataIndex: dataIndex, - valueType: 'select', - hideInTable: hideInTable, - formItemProps: { ...(required ? rulesHelper.number : {}) }, - fieldProps: { - showSearch: false, - fieldNames: { - label: 'name', - value: 'id', - }, - }, - request: async () => (await Apis.Select.Bosses()).data, - ...rest, - }; - }, - Factories(props?: PropsType): ReturnType { - const { - title = '下游厂家', - key = 'factories_id', - dataIndex = ['factory', 'name'], - required = false, - hideInTable = false, - ...rest - } = props ?? {}; - - return { - title: title, - key: key, - dataIndex: dataIndex, - valueType: 'select', - hideInTable: hideInTable, - formItemProps: { ...(required ? rulesHelper.number : {}) }, - fieldProps: { - showSearch: false, - fieldNames: { - label: 'name', - value: 'id', - }, - }, - request: async () => (await Apis.Select.Factories()).data, - ...rest, - }; - }, - Platforms(props?: PropsType): ReturnType { - const { - title = '平台', - key = 'platforms_id', - dataIndex = ['platform', 'name'], - required = false, - hideInTable = false, - ...rest - } = props ?? {}; - - return { - title: title, - key: key, - dataIndex: dataIndex, - valueType: 'select', - hideInTable: hideInTable, - formItemProps: { ...(required ? rulesHelper.number : {}) }, - fieldProps: { - showSearch: false, - fieldNames: { - label: 'name', - value: 'id', - }, - }, - request: async () => (await Apis.Select.Platforms()).data, - ...rest, - }; - }, - Merchants(props?: PropsType): ReturnType { - const { - title = '商户', - key = 'merchants_id', - dataIndex = ['merchant', 'name'], - required = false, - hideInTable = false, - ...rest - } = props ?? {}; - - return { - title: title, - key: key, - dataIndex: dataIndex, - valueType: 'select', - hideInTable: hideInTable, - formItemProps: { ...(required ? rulesHelper.number : {}) }, - fieldProps: { - showSearch: false, - fieldNames: { - label: 'name', - value: 'id', - }, - }, - request: async () => (await Apis.Select.Merchants()).data, - ...rest, - }; - }, -}; diff --git a/src/components/SysSelects.tsx b/src/components/SysSelects.tsx index bbc0cff..00b402c 100644 --- a/src/components/SysSelects.tsx +++ b/src/components/SysSelects.tsx @@ -28,7 +28,7 @@ export const SysSelects = { }, }, request: async () => - (await Apis.SysPermissions.SelectApi()).data?.children, + (await Apis.Permission.SysPermissions.SelectApi()).data?.children, ...rest, }; }, @@ -40,9 +40,9 @@ export const SysSelects = { title: '上级菜单', valueType: 'treeSelect', request: async () => { - return Apis.SysPermissions.Tree({ guard_name: guard_name }).then( - (res) => res.data, - ); + return Apis.Permission.SysPermissions.Tree({ + guard_name: guard_name, + }).then((res) => res.data); }, fieldProps: { allowClear: true, @@ -83,7 +83,7 @@ export const SysSelects = { value: 'id', }, }, - request: async () => (await Apis.SysRoles.Select()).data, + request: async () => (await Apis.Permission.SysRoles.Select()).data, ...rest, }; }, diff --git a/src/pages/system/admins/index.tsx b/src/pages/system/admins/index.tsx index db6108e..e344ac1 100644 --- a/src/pages/system/admins/index.tsx +++ b/src/pages/system/admins/index.tsx @@ -35,16 +35,6 @@ export default function Index({ title = '管理员' }) { renderText: renderTextHelper.TagList, hideInSearch: true, }, - { - 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({