import React, { useState, useEffect } from 'react';
import {
Layout, Menu, Card, Row, Col, Button, Form, Input, Select, Switch, Tag, Space, Typography, message, Table
} from 'antd';
import {
SettingOutlined, UserOutlined, BellOutlined, LinkOutlined, SafetyOutlined, SyncOutlined,
CloudOutlined, TeamOutlined, FileTextOutlined, DatabaseOutlined, CalendarOutlined,
CheckCircleOutlined, ReloadOutlined, DownloadOutlined, DeleteOutlined,
KeyOutlined, AppstoreOutlined, BankOutlined,
NotificationOutlined,
ExperimentOutlined,
EnvironmentOutlined
} from '@ant-design/icons';
import UserRolePage from '../components/SystemSetting/UserPage';
import MenuList from '../components/SystemSetting/MenuList';
import Organization from '../components/SystemSetting/Organization';
import StationManage from '../components/SystemSetting/StationManage';
import { getMenuList } from '../api/mune';
import DeviceAccessPage from '../components/SystemSetting/DeviceAccessPage';
const { Header, Content } = Layout;
const { Text } = Typography;
const { Option } = Select;
const AntdCard = Card as any;
// 基础设置
const BasicSettings = () => {
const [form] = Form.useForm();
const handleSave = () => { message.success('设置已保存'); };
return (
管理员 },
{ title: '手机号', dataIndex: 'phone' },
{ title: '邮箱', dataIndex: 'email' },
{ title: '状态', render: () => ● 在线 },
]} dataSource={[
{ name: '张运维', phone: '138****0001', email: 'zhangyw@pvsrmart.com' },
{ name: '李工程师', phone: '139****0002', email: 'li.gongcheng@pvsrmart.com' },
]} />
);
};
// 右侧面板
const RightPanel = () => (
全部权限
设备管理
逆变器正常
数据保留3年
}>清理缓存}>重启服务
);
// ======================
// 主页面
// ======================
export default function SystemSettings() {
const [activeTab, setActiveTab] = useState('basic');
const [rawMenuList, setRawMenuList] = useState([]);
const [showTabs, setShowTabs] = useState([]);
// 获取菜单
const getMenuListApi = () => {
const params = { pageNum: 1, pageSize: 99999 };
return getMenuList(params);
};
// 动态生成 tab
useEffect(() => {
getMenuListApi().then(res => {
if (res.code === 200) {
const data = res.rows || [];
// 系统设置 parentId = 3394
const systemChild = data.filter(m => m.parentId == 3394);
// ======================
// 👇 按 orderNum 正序排序(数字越小越靠前)
// ======================
systemChild.sort((a, b) => {
return (a.orderNum || 0) - (b.orderNum || 0);
});
const tabs = systemChild.map(item => {
if (item.path == '/systemSetting/basic') {
return { key: 'basic', label: '基础设置', icon: };
}
if (item.path === '/systemSetting/User') {
return { key: 'user-role', label: '用户与角色', icon: };
}
if (item.path === '/systemSetting/menu') {
return { key: 'menu', label: '菜单管理', icon: };
}
if (item.path === '/systemSetting/org') {
return { key: 'org', label: '组织管理', icon: };
}
if (item.path === '/systemSetting/site') {
return { key: 'site', label: '场站管理', icon: };
}
if (item.path === '/systemSetting/notice') {
return { key: 'notice', label: '通知策略', icon: };
}
if (item.path === '/systemSetting/deviceAccess') {
return { key: 'deviceAccess', label: '设备接入', icon: };
}
if (item.path === '/systemSetting/dataSafety') {
return { key: 'dataSafety', label: '数据与安全', icon: };
}
if (item.path === '/systemSetting/systemMaintenance') {
return { key: 'systemMaintenance', label: '系统维护', icon: };
}
return null;
}).filter(Boolean);
setShowTabs(tabs);
// 默认选中第一个
if (tabs.length > 0) {
setActiveTab(tabs[0].key);
}
}
});
}, []);
const BasicSettingsPage = () => 基础设置页面
;
const NoticePage = () => 通知策略页面
;
const DataSafetyPage = () => 数据与安全页面
;
const SystemMaintenancePage = () => 系统维护页面
;
const DefaultPage = () => 请选择菜单
;
const renderTabContent = () => {
switch (activeTab) {
case 'basic':
return ;
case 'user-role':
return ;
case 'menu':
return ;
case 'org':
return ;
case 'site':
return ;
case 'notice':
return ;
case 'deviceAccess':
return ;
case 'dataSafety':
return ;
case 'systemMaintenance':
return ;
default:
return ;
}
};
return (
{renderTabContent()}
);
}