Complete main UI #37

Merged
FatttSnake merged 192 commits from FatttSnake into dev 2024-02-23 16:31:17 +08:00
2 changed files with 18 additions and 8 deletions
Showing only changes of commit 9a39e05fdf - Show all commits

1
src/global.d.ts vendored
View File

@@ -176,6 +176,7 @@ interface TableParam {
} }
interface UserGetParam extends PageParam { interface UserGetParam extends PageParam {
searchType?: string
searchValue?: string searchValue?: string
searchRegex?: boolean searchRegex?: boolean
} }

View File

@@ -4,7 +4,6 @@ import dayjs from 'dayjs'
import { import {
COLOR_BACKGROUND, COLOR_BACKGROUND,
COLOR_ERROR_SECONDARY, COLOR_ERROR_SECONDARY,
COLOR_FONT_SECONDARY,
COLOR_PRODUCTION, COLOR_PRODUCTION,
DATABASE_DELETE_SUCCESS, DATABASE_DELETE_SUCCESS,
DATABASE_DUPLICATE_KEY, DATABASE_DUPLICATE_KEY,
@@ -64,6 +63,7 @@ const User: React.FC = () => {
const [userData, setUserData] = useState<UserWithRoleInfoVo[]>([]) const [userData, setUserData] = useState<UserWithRoleInfoVo[]>([])
const [isLoadingUserData, setIsLoadingUserData] = useState(false) const [isLoadingUserData, setIsLoadingUserData] = useState(false)
const [searchType, setSearchType] = useState('ALL')
const [searchValue, setSearchValue] = useState('') const [searchValue, setSearchValue] = useState('')
const [isUseRegex, setIsUseRegex] = useState(false) const [isUseRegex, setIsUseRegex] = useState(false)
const [isRegexLegal, setIsRegexLegal] = useState(true) const [isRegexLegal, setIsRegexLegal] = useState(true)
@@ -557,6 +557,10 @@ const User: React.FC = () => {
} }
} }
const handleOnSearchTypeChange = (value: string) => {
setSearchType(value)
}
const handleOnUseRegexChange = (e: _CheckboxChangeEvent) => { const handleOnUseRegexChange = (e: _CheckboxChangeEvent) => {
setIsUseRegex(e.target.checked) setIsUseRegex(e.target.checked)
if (e.target.checked) { if (e.target.checked) {
@@ -596,6 +600,7 @@ const User: React.FC = () => {
: undefined, : undefined,
sortOrder: sortOrder:
tableParams.sortField && tableParams.sortOrder ? tableParams.sortOrder : undefined, tableParams.sortField && tableParams.sortOrder ? tableParams.sortOrder : undefined,
searchType,
searchValue: searchValue.trim().length ? searchValue : undefined, searchValue: searchValue.trim().length ? searchValue : undefined,
searchRegex: isUseRegex ? isUseRegex : undefined, searchRegex: isUseRegex ? isUseRegex : undefined,
...tableParams.filters ...tableParams.filters
@@ -885,14 +890,18 @@ const User: React.FC = () => {
<Card style={{ overflow: 'inherit' }}> <Card style={{ overflow: 'inherit' }}>
<AntdInput <AntdInput
addonBefore={ addonBefore={
<span <AntdSelect
style={{ value={searchType}
fontSize: '0.9em', onChange={handleOnSearchTypeChange}
color: COLOR_FONT_SECONDARY style={{ width: '6em' }}
}} dropdownStyle={{ textAlign: 'center' }}
> >
<AntdSelect.Option value={'ALL'}></AntdSelect.Option>
</span> <AntdSelect.Option value={'ID'}>ID</AntdSelect.Option>
<AntdSelect.Option value={'USERNAME'}></AntdSelect.Option>
<AntdSelect.Option value={'NICKNAME'}></AntdSelect.Option>
<AntdSelect.Option value={'EMAIL'}></AntdSelect.Option>
</AntdSelect>
} }
suffix={ suffix={
<> <>