Complete main UI #37

Merged
FatttSnake merged 192 commits from FatttSnake into dev 2024-02-23 16:31:17 +08:00
Showing only changes of commit ea74fdad87 - Show all commits

View File

@@ -487,15 +487,7 @@ const Role: React.FC = () => {
JSON.stringify(tableParams.pagination?.current) JSON.stringify(tableParams.pagination?.current)
]) ])
return ( const toolbar = (
<>
<FitFullScreen>
<HideScrollbar
style={{ padding: 30 }}
isShowVerticalScrollbar
autoHideWaitingTime={500}
>
<FlexBox gap={20}>
<FlexBox direction={'horizontal'} gap={10}> <FlexBox direction={'horizontal'} gap={10}>
<Card style={{ overflow: 'inherit', flex: '0 0 auto' }}> <Card style={{ overflow: 'inherit', flex: '0 0 auto' }}>
<AntdButton <AntdButton
@@ -503,24 +495,15 @@ const Role: React.FC = () => {
style={{ padding: '4px 8px' }} style={{ padding: '4px 8px' }}
onClick={handleOnAddBtnClick} onClick={handleOnAddBtnClick}
> >
<Icon <Icon component={IconFatwebPlus} style={{ fontSize: '1.2em' }} />
component={IconFatwebPlus}
style={{ fontSize: '1.2em' }}
/>
</AntdButton> </AntdButton>
</Card> </Card>
<Card <Card
hidden={tableSelectedItem.length === 0} hidden={tableSelectedItem.length === 0}
style={{ overflow: 'inherit', flex: '0 0 auto' }} style={{ overflow: 'inherit', flex: '0 0 auto' }}
> >
<AntdButton <AntdButton style={{ padding: '4px 8px' }} onClick={handleOnListDeleteBtnClick}>
style={{ padding: '4px 8px' }} <Icon component={IconFatwebDelete} style={{ fontSize: '1.2em' }} />
onClick={handleOnListDeleteBtnClick}
>
<Icon
component={IconFatwebDelete}
style={{ fontSize: '1.2em' }}
/>
</AntdButton> </AntdButton>
</Card> </Card>
<Card style={{ overflow: 'inherit' }}> <Card style={{ overflow: 'inherit' }}>
@@ -538,14 +521,9 @@ const Role: React.FC = () => {
suffix={ suffix={
<> <>
{!isRegexLegal ? ( {!isRegexLegal ? (
<span style={{ color: COLOR_ERROR_SECONDARY }}> <span style={{ color: COLOR_ERROR_SECONDARY }}></span>
</span>
) : undefined} ) : undefined}
<AntdCheckbox <AntdCheckbox checked={isUseRegex} onChange={handleOnUseRegexChange}>
checked={isUseRegex}
onChange={handleOnUseRegexChange}
>
<AntdTooltip title={'正则表达式'}>.*</AntdTooltip> <AntdTooltip title={'正则表达式'}>.*</AntdTooltip>
</AntdCheckbox> </AntdCheckbox>
</> </>
@@ -563,6 +541,9 @@ const Role: React.FC = () => {
</AntdButton> </AntdButton>
</Card> </Card>
</FlexBox> </FlexBox>
)
const table = (
<Card> <Card>
<AntdTable <AntdTable
dataSource={roleData} dataSource={roleData}
@@ -577,17 +558,9 @@ const Role: React.FC = () => {
}} }}
/> />
</Card> </Card>
</FlexBox> )
</HideScrollbar>
</FitFullScreen> const drawerToolbar = (
<AntdDrawer
title={isDrawerEdit ? '编辑角色' : '添加角色'}
width={'36vw'}
onClose={handleOnDrawerClose}
open={isDrawerOpen}
closable={!isSubmitting}
maskClosable={!isSubmitting}
extra={
<AntdSpace> <AntdSpace>
<AntdTooltip title={'刷新权限列表'}> <AntdTooltip title={'刷新权限列表'}>
<AntdButton onClick={getPowerTreeData} disabled={isSubmitting}> <AntdButton onClick={getPowerTreeData} disabled={isSubmitting}>
@@ -606,8 +579,9 @@ const Role: React.FC = () => {
</AntdButton> </AntdButton>
</AntdSpace> </AntdSpace>
} )
>
const addAndEditForm = (
<AntdForm form={form} disabled={isSubmitting}> <AntdForm form={form} disabled={isSubmitting}>
<AntdForm.Item hidden={!isDrawerEdit} name={'id'} label={'ID'}> <AntdForm.Item hidden={!isDrawerEdit} name={'id'} label={'ID'}>
<AntdInput disabled /> <AntdInput disabled />
@@ -637,6 +611,32 @@ const Role: React.FC = () => {
<AntdSwitch /> <AntdSwitch />
</AntdForm.Item> </AntdForm.Item>
</AntdForm> </AntdForm>
)
return (
<>
<FitFullScreen>
<HideScrollbar
style={{ padding: 30 }}
isShowVerticalScrollbar
autoHideWaitingTime={500}
>
<FlexBox gap={20}>
{toolbar}
{table}
</FlexBox>
</HideScrollbar>
</FitFullScreen>
<AntdDrawer
title={isDrawerEdit ? '编辑角色' : '添加角色'}
width={'36vw'}
onClose={handleOnDrawerClose}
open={isDrawerOpen}
closable={!isSubmitting}
maskClosable={!isSubmitting}
extra={drawerToolbar}
>
{addAndEditForm}
</AntdDrawer> </AntdDrawer>
{contextHolder} {contextHolder}
</> </>