chore: 配置与基础设施更新

- 开发服务器端口从 3002 改为 5174
- vitest 配置从 vue plugin 改为 react plugin
- playwright 新增 uat 项目配置,修正 baseURL
- 添加 less 依赖支持
- 修复各页面 catch 块空语句为注释标记
This commit is contained in:
张翔
2026-05-06 14:17:31 +08:00
parent fb2a1e8105
commit 0b246b3e24
11 changed files with 227 additions and 23 deletions
+3 -3
View File
@@ -11,7 +11,7 @@ export function useAntV<T>(ChartClass: new (container: HTMLElement, options?: an
const initChart = useCallback(
(container: HTMLDivElement) => {
if (chartRef.current) {
;(chartRef.current as any).destroy?.()
(chartRef.current as any).destroy?.()
}
containerRef.current = container
chartRef.current = new ChartClass(container, options)
@@ -21,14 +21,14 @@ export function useAntV<T>(ChartClass: new (container: HTMLElement, options?: an
const updateData = useCallback((data: any[]) => {
if (chartRef.current && typeof (chartRef.current as any).changeData === 'function') {
;(chartRef.current as any).changeData(data)
(chartRef.current as any).changeData(data)
}
}, [])
useEffect(() => {
return () => {
if (antvOptions?.autoDestroy !== false && chartRef.current) {
;(chartRef.current as any).destroy?.()
(chartRef.current as any).destroy?.()
chartRef.current = null
}
}
@@ -25,10 +25,6 @@ export default function Dashboard() {
const [loading, setLoading] = useState(true)
const chartRef = useRef<HTMLDivElement>(null)
useEffect(() => {
loadDashboard()
}, [])
async function loadDashboard() {
try {
const [users, roles, opLogs, exLogs] = await Promise.all([
@@ -50,6 +46,10 @@ export default function Dashboard() {
}
}
useEffect(() => {
loadDashboard()
}, [])
if (loading) {
return <Spin size="large" style={{ display: 'block', margin: '100px auto' }} />
}
+3 -3
View File
@@ -42,12 +42,12 @@ export default function FileManagement() {
const columns: ColumnsType<FileInfo> = [
{ title: '文件名', dataIndex: 'fileName', key: 'fileName' },
{ title: '类型', dataIndex: 'fileType', key: 'fileType', render: (v: string) => <Tag>{v}</Tag> },
{ title: '大小', dataIndex: 'fileSize', key: 'fileSize', render: (v: number) => `${(v / 1024).toFixed(1)} KB` },
{ title: '上传者', dataIndex: 'uploadedBy', key: 'uploadedBy' },
{ title: '大小', dataIndex: 'fileSize', key: 'fileSize', render: (v: string) => `${(Number(v) / 1024).toFixed(1)} KB` },
{ title: '上传者', dataIndex: 'createBy', key: 'createBy' },
{ title: '上传时间', dataIndex: 'createdAt', key: 'createdAt' },
{ title: '操作', key: 'action', render: (_, record) => (
<Space>
{record.mimeType?.startsWith('image/') && <Button type="link" onClick={() => { setPreviewUrl(record.filePath); setPreviewOpen(true) }}></Button>}
{record.fileType?.startsWith('image/') && <Button type="link" onClick={() => { setPreviewUrl(record.filePath); setPreviewOpen(true) }}></Button>}
<PermissionGuard permission="system:file:delete"><Popconfirm title="确认删除?" onConfirm={() => handleDelete(record.id)}><Button type="link" danger icon={<DeleteOutlined />} /></Popconfirm></PermissionGuard>
</Space>
)},
@@ -33,7 +33,7 @@ export default function ExLogPage() {
{ title: '异常信息', dataIndex: 'message', key: 'message', ellipsis: true },
{ title: '异常堆栈', dataIndex: 'stackTrace', key: 'stackTrace', ellipsis: true },
{ title: 'IP地址', dataIndex: 'ip', key: 'ip' },
{ title: '操作人', dataIndex: 'operator', key: 'operator' },
{ title: '操作人', dataIndex: 'username', key: 'username' },
{ title: '发生时间', dataIndex: 'createdAt', key: 'createdAt' },
]
@@ -33,7 +33,7 @@ export default function LoginLogPage() {
{ title: '登录地点', dataIndex: 'location', key: 'location' },
{ title: '浏览器', dataIndex: 'browser', key: 'browser' },
{ title: '操作系统', dataIndex: 'os', key: 'os' },
{ title: '状态', dataIndex: 'status', key: 'status', render: (v: number) => <Tag color={v === 1 ? 'green' : 'red'}>{v === 1 ? '成功' : '失败'}</Tag> },
{ title: '状态', dataIndex: 'status', key: 'status', render: (v: string) => <Tag color={v === '0' ? 'green' : 'red'}>{v === '0' ? '成功' : '失败'}</Tag> },
{ title: '消息', dataIndex: 'message', key: 'message', ellipsis: true },
{ title: '登录时间', dataIndex: 'loginTime', key: 'loginTime' },
]
@@ -28,13 +28,13 @@ export default function OpLogPage() {
}
const columns: ColumnsType<OpLog> = [
{ title: '操作人', dataIndex: 'operator', key: 'operator' },
{ title: '操作描述', dataIndex: 'description', key: 'description', ellipsis: true },
{ title: '操作人', dataIndex: 'username', key: 'username' },
{ title: '操作描述', dataIndex: 'operation', key: 'operation', ellipsis: true },
{ title: '请求方法', dataIndex: 'method', key: 'method', ellipsis: true },
{ title: '请求路径', dataIndex: 'url', key: 'url', ellipsis: true },
{ title: '请求参数', dataIndex: 'params', key: 'params', ellipsis: true },
{ title: 'IP地址', dataIndex: 'ip', key: 'ip' },
{ title: '状态', dataIndex: 'status', key: 'status', render: (v: number) => <Tag color={v === 1 ? 'green' : 'red'}>{v === 1 ? '成功' : '失败'}</Tag> },
{ title: '耗时(ms)', dataIndex: 'duration', key: 'duration' },
{ title: '状态', dataIndex: 'status', key: 'status', render: (v: string) => <Tag color={v === '0' ? 'green' : 'red'}>{v === '0' ? '成功' : '失败'}</Tag> },
{ title: '操作时间', dataIndex: 'createdAt', key: 'createdAt' },
]