feat: DingTalk attendance import + integration config + expense types + UI polish

Server:
- Add DingTalk attendance import service with SSE progress streaming
- Add IntegrationConfig entity & module for multi-tenant DingTalk setup
- Add ExpenseType entity & ExpenseTypesModule
- Add SeedModule for DB initialization
- Add UserDingMapping entity for DingTalk user linkage
- Attendance service: import flow with dedup & student auto-mapping
- Rooms service: time-range overlap queries
- Sync controller/service: DingTalk integration wiring
- Permission guard: refactor to pure re-export
- Campus scope middleware: tenant-aware filtering

Admin UI:
- Attendance page: import UI with progress & result summary
- All pages: tableStyle/tablePagination standardization
- Login page: responsive styling
- Sensitive data: useViewSensitive hook for masked viewing
- Vite config: path aliases, build optimization
- Test infra: vitest config, test utilities

Docs: PRD DingTalk batch 1 & 2 design docs
This commit is contained in:
2026-07-09 09:11:56 +08:00
parent f1959f0d2a
commit 42d3f0e27f
71 changed files with 5331 additions and 609 deletions

View File

@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useCallback, useMemo, useState } from 'react';
import { Outlet, useNavigate, useLocation } from 'react-router-dom';
import { Layout, Menu, Button, Avatar, Dropdown, Drawer, Grid } from 'antd';
import {
@@ -123,7 +123,7 @@ const MainLayout: React.FC = () => {
const [drawerOpen, setDrawerOpen] = useState(false);
const navigate = useNavigate();
const location = useLocation();
const user = JSON.parse(localStorage.getItem('user') || '{}');
const user = useMemo(() => JSON.parse(localStorage.getItem('user') || '{}'), []);
const { hasPermission } = usePermission();
const screens = Grid.useBreakpoint();
@@ -146,19 +146,19 @@ const MainLayout: React.FC = () => {
.filter(Boolean) as MenuItemType[];
};
const menuItems = filterByPermission(allMenuItems);
const menuItems = useMemo(() => filterByPermission(allMenuItems), [hasPermission]);
const handleLogout = () => {
const handleLogout = useCallback(() => {
localStorage.removeItem('token');
localStorage.removeItem('user');
localStorage.removeItem('permissions');
navigate('/login');
};
}, [navigate]);
const handleMenuClick = (key: string) => {
const handleMenuClick = useCallback((key: string) => {
navigate(key);
if (isMobile) setDrawerOpen(false);
};
}, [navigate, isMobile]);
const findSelectedKeys = (items: MenuItemType[], pathname: string): string[] => {
for (const item of items) {
@@ -182,8 +182,8 @@ const MainLayout: React.FC = () => {
return [];
};
const selectedKeys = findSelectedKeys(menuItems, location.pathname);
const openKeys = findOpenKeys(menuItems, location.pathname);
const selectedKeys = useMemo(() => findSelectedKeys(menuItems, location.pathname), [menuItems, location.pathname]);
const openKeys = useMemo(() => findOpenKeys(menuItems, location.pathname), [menuItems, location.pathname]);
const transformToMenuItems = (items: MenuItemType[]): any[] => {
@@ -194,7 +194,7 @@ const MainLayout: React.FC = () => {
children: item.children ? transformToMenuItems(item.children) : undefined,
}));
};
const menuContent = (
const menuContent = useMemo(() => (
<Menu
theme="light"
mode="inline"
@@ -204,7 +204,7 @@ const MainLayout: React.FC = () => {
onClick={({ key }) => handleMenuClick(key)}
style={{ border: 'none' }}
/>
);
), [selectedKeys, openKeys, menuItems, handleMenuClick]);
return (
<Layout style={{ minHeight: '100vh' }}>
@@ -259,6 +259,7 @@ const MainLayout: React.FC = () => {
>
<Button
type="text"
aria-label={isMobile || isTablet ? '打开菜单' : collapsed ? '展开侧边栏' : '收起侧边栏'}
icon={
isMobile || isTablet ? (
<MenuUnfoldOutlined />
@@ -285,7 +286,12 @@ const MainLayout: React.FC = () => {
],
}}
>
<div style={{ cursor: 'pointer', display: 'flex', alignItems: 'center', gap: 8 }}>
<div
role="button"
tabIndex={0}
aria-label="用户菜单"
style={{ cursor: 'pointer', display: 'flex', alignItems: 'center', gap: 8 }}
>
<Avatar icon={<UserOutlined />} />
{isDesktop && <span>{user.name || user.username || '用户'}</span>}
</div>
@@ -298,7 +304,6 @@ const MainLayout: React.FC = () => {
padding: isMobile ? 12 : isTablet ? 16 : 24,
background: '#fff',
borderRadius: 12,
overflow: 'auto',
}}
>
<Outlet />