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