diff --git a/src/assets/css/components/common/flex-box.scss b/src/assets/css/components/common/flex-box.scss new file mode 100644 index 0000000..0a9f239 --- /dev/null +++ b/src/assets/css/components/common/flex-box.scss @@ -0,0 +1,5 @@ +.flex-box { + * { + flex: 1; + } +} \ No newline at end of file diff --git a/src/components/common/FlexBox.tsx b/src/components/common/FlexBox.tsx new file mode 100644 index 0000000..e9b3271 --- /dev/null +++ b/src/components/common/FlexBox.tsx @@ -0,0 +1,24 @@ +import React from 'react' +import '@/assets/css/components/common/flex-box.scss' + +interface FlexBoxProps + extends React.DetailedHTMLProps, HTMLDivElement> { + direction?: 'horizontal' | 'vertical' + gap?: number +} + +const FlexBox = forwardRef((props, ref) => { + const { className, direction, gap, style, ..._props } = props + return ( +
+ ) +}) + +export default FlexBox diff --git a/src/pages/system/Log.tsx b/src/pages/system/Log.tsx index c311814..c41f5b6 100644 --- a/src/pages/system/Log.tsx +++ b/src/pages/system/Log.tsx @@ -2,12 +2,14 @@ import React, { useState } from 'react' import FitFullScreen from '@/components/common/FitFullScreen.tsx' import Card from '@/components/common/Card' import { r_getSysLog } from '@/services/system.tsx' -import { DATABASE_SELECT_SUCCESS } from '@/constants/common.constants.ts' +import { COLOR_FONT_SECONDARY, DATABASE_SELECT_SUCCESS } from '@/constants/common.constants.ts' import HideScrollbar from '@/components/common/HideScrollbar.tsx' import { getLocalTime } from '@/utils/common.ts' +import useMessage from 'antd/es/message/useMessage' +import FlexBox from '@/components/common/FlexBox.tsx' const Log: React.FC = () => { - const tableCardRef = useRef(null) + const [message, contextHolder] = useMessage() const [logData, setLogData] = useState([]) const [loading, setLoading] = useState(false) const [tableParams, setTableParams] = useState({ @@ -143,6 +145,8 @@ const Log: React.FC = () => { return } + setLoading(true) + void r_getSysLog( tableParams.sortField && tableParams.sortOrder ? { @@ -154,7 +158,8 @@ const Log: React.FC = () => { } : { currentPage: tableParams.pagination?.current, - pageSize: tableParams.pagination?.pageSize + pageSize: tableParams.pagination?.pageSize, + ...tableParams.filters } ) .then((res) => { @@ -169,6 +174,10 @@ const Log: React.FC = () => { total: data.data.total } }) + } else { + void message.error({ + content: '获取失败,请稍后重试' + }) } }) .finally(() => { @@ -189,21 +198,48 @@ const Log: React.FC = () => { return ( <> + {contextHolder} - - record.id} - pagination={tableParams.pagination} - loading={loading} - onChange={handleOnTableChange} - /> - + + + + + 请求 Url + + } + suffix={ + + .* + + } + /> + + + + + + + record.id} + pagination={tableParams.pagination} + loading={loading} + onChange={handleOnTableChange} + /> + +