|
|
@ -14,6 +14,7 @@ import { useApiContext } from '@/context.ts' |
|
|
|
import { useDeepCompareEffect } from 'react-use' |
|
|
|
import { RFormTypes } from '@/types/r-form/model' |
|
|
|
import { ProCoreActionType } from '@ant-design/pro-utils/es/typing' |
|
|
|
import { getI18nTitle } from '@/i18n.ts' |
|
|
|
|
|
|
|
|
|
|
|
export interface RFormProps { |
|
|
@ -66,7 +67,7 @@ const RForm = ( |
|
|
|
|
|
|
|
useDeepCompareEffect(() => { |
|
|
|
|
|
|
|
let res = transformAntdTableProColumns(curdModal?.columns || [], propColumns) |
|
|
|
let res = transformAntdTableProColumns(curdModal?.columns || [], propColumns, curdModal?.config?.i18n) |
|
|
|
if (resolveColumns) { |
|
|
|
res = resolveColumns(res) |
|
|
|
} |
|
|
@ -101,7 +102,7 @@ const RForm = ( |
|
|
|
formItemProps: { hidden: true } |
|
|
|
} ].concat(res as any).concat([ |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
title: getI18nTitle(curdModal?.config?.i18n, { dataIndex: 'option', title: '操作' },), |
|
|
|
dataIndex: 'option', |
|
|
|
valueType: 'option', |
|
|
|
fixed: 'right', |
|
|
@ -114,7 +115,7 @@ const RForm = ( |
|
|
|
} as any |
|
|
|
]) |
|
|
|
setColumns(_columns) |
|
|
|
}, [ curdModal?.columns, propColumns, renderColumnOptions, resolveColumns, deleteModel, form, isDeleting, setOpen, ]) |
|
|
|
}, [ curdModal?.columns, curdModal?.config?.i18n, propColumns, renderColumnOptions, resolveColumns, deleteModel, form, isDeleting, setOpen, ]) |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
if (apiCtx.isApi && apiCtx.api) { |
|
|
@ -170,7 +171,7 @@ const RForm = ( |
|
|
|
}) |
|
|
|
setOpen(true) |
|
|
|
}} |
|
|
|
type={'primary'}>{'添加'}</Button> |
|
|
|
type={'primary'}>{getI18nTitle('actions.add','添加')}</Button> |
|
|
|
</> |
|
|
|
|
|
|
|
const _renderActions = () => { |
|
|
@ -209,7 +210,7 @@ const RForm = ( |
|
|
|
placeholder: '输入关键字搜索', |
|
|
|
},*/ |
|
|
|
actions: [ |
|
|
|
<Tooltip key={'filter'} title={'高级查询'}> |
|
|
|
<Tooltip key={'filter'} title={getI18nTitle('actions.advanceSearch','高级查询')}> |
|
|
|
<Badge count={getValueCount(search)}> |
|
|
|
<Button |
|
|
|
onClick={() => { |
|
|
@ -277,7 +278,7 @@ const RForm = ( |
|
|
|
form={form} |
|
|
|
layout={'vertical'} |
|
|
|
scrollToFirstError={true} |
|
|
|
title={model?.id !== 0 ? '编辑' : '添加'} |
|
|
|
title={model?.id !== 0 ? getI18nTitle('actions.edit','编辑') : getI18nTitle('actions.add','添加')} |
|
|
|
{...formProps as any} |
|
|
|
open={open} |
|
|
|
onOpenChange={(open) => { |
|
|
@ -291,7 +292,7 @@ const RForm = ( |
|
|
|
columns={columns as ProFormColumnsType[]}/> |
|
|
|
<BetaSchemaForm |
|
|
|
{...curdModal?.form} |
|
|
|
title={'高级查询'} |
|
|
|
title={getI18nTitle('actions.advanceSearch','高级查询')} |
|
|
|
grid={true} |
|
|
|
shouldUpdate={false} |
|
|
|
width={500} |
|
|
@ -313,8 +314,8 @@ const RForm = ( |
|
|
|
}} |
|
|
|
submitter={{ |
|
|
|
searchConfig: { |
|
|
|
resetText: '清空', |
|
|
|
submitText: '查询', |
|
|
|
resetText: getI18nTitle('actions.clear', '清空'), |
|
|
|
submitText: getI18nTitle('actions.search', '查询'), |
|
|
|
}, |
|
|
|
onReset: () => { |
|
|
|
filterForm.resetFields() |
|
|
|