基础设置页面 设备管理页面

This commit is contained in:
mmc
2026-05-08 15:53:27 +08:00
parent cd1861bdc0
commit f6be595220
6 changed files with 720 additions and 81 deletions

View File

@@ -18,6 +18,8 @@ import StationManage from '../components/SystemSetting/StationManage';
import { getMenuList } from '../api/mune';
import DeviceAccessPage from '../components/SystemSetting/DeviceAccessPage';
import OnlineUserPage from '../components/SystemSetting/OnlineUser';
import DeviceManagementPage from '../components/SystemSetting/DeviceManagement';
import BasicSettings from '../components/SystemSetting/BasicSettings';
const { Header, Content } = Layout;
const { Text } = Typography;
@@ -25,56 +27,7 @@ const { Option } = Select;
const AntdCard = Card as any;
// 基础设置
const BasicSettings = () => {
const [form] = Form.useForm();
const handleSave = () => { message.success('设置已保存'); };
return (
<div style={{ padding: 24 }}>
<Row gutter={16} style={{ marginBottom: 24 }}>
<Col span={5}><AntdCard size="small"><Space><div style={{ background: '#e6f4ff', borderRadius: 8, padding: 8 }}><CloudOutlined style={{ color: '#1677ff', fontSize: 20 }} /></div><div><div style={{ fontSize: 13, color: '#666' }}>当前版本</div><div style={{ fontWeight: 600 }}>v2.8.1 <Tag color="blue">最新版</Tag></div></div></Space></AntdCard></Col>
<Col span={5}><AntdCard size="small"><Space><div style={{ background: '#f6ffed', borderRadius: 8, padding: 8 }}><TeamOutlined style={{ color: '#52c41a', fontSize: 20 }} /></div><div><div style={{ fontSize: 13, color: '#666' }}>在线用户</div><div style={{ fontWeight: 600 }}>12 <span style={{ color: '#52c41a', fontSize: 12 }}>↑ 2</span></div></div></Space></AntdCard></Col>
<Col span={5}><AntdCard size="small"><Space><div style={{ background: '#fff2f0', borderRadius: 8, padding: 8 }}><BellOutlined style={{ color: '#ff4d4f', fontSize: 20 }} /></div><div><div style={{ fontSize: 13, color: '#666' }}>告警通道</div><div style={{ fontWeight: 600 }}>3 / 4 <span style={{ color: '#52c41a', fontSize: 12 }}>正常</span></div></div></Space></AntdCard></Col>
<Col span={5}><AntdCard size="small"><Space><div style={{ background: '#e6fffb', borderRadius: 8, padding: 8 }}><DatabaseOutlined style={{ color: '#13c2c2', fontSize: 20 }} /></div><div><div style={{ fontSize: 13, color: '#666' }}>数据备份状态</div><div style={{ fontWeight: 600 }}>正常 <span style={{ color: '#52c41a', fontSize: 12 }}>●</span></div></div></Space></AntdCard></Col>
<Col span={4}><AntdCard size="small"><Space><div style={{ background: '#f9f0ff', borderRadius: 8, padding: 8 }}><CalendarOutlined style={{ color: '#722ed1', fontSize: 20 }} /></div><div><div style={{ fontSize: 13, color: '#666' }}>最近更新</div><div style={{ fontWeight: 600 }}>2025-05-20</div></div></Space></AntdCard></Col>
</Row>
<AntdCard title="基础配置" style={{ marginBottom: 24 }}>
<Form form={form} layout="vertical">
<Row gutter={16}><Col span={8}><Form.Item label="系统名称" name="systemName"><Input defaultValue="光伏电站智能监控与运维系统" /></Form.Item></Col><Col span={8}><Form.Item label="默认电站" name="defaultSite"><Select defaultValue="1MW 光伏电站"><Option value="1MW">1MW 光伏电站</Option></Select></Form.Item></Col><Col span={8}><Form.Item label="默认语言" name="defaultLang"><Select defaultValue="中文"><Option value="zh">中文</Option><Option value="en">English</Option></Select></Form.Item></Col></Row>
<Row gutter={16}><Col span={8}><Form.Item label="时区" name="timezone"><Select defaultValue="UTC+08:00"><Option value="UTC+08:00">UTC+08:00</Option></Select></Form.Item></Col><Col span={8}><Form.Item label="首页默认页面" name="homePage"><Select defaultValue="总览首页"><Option value="overview">总览首页</Option></Select></Form.Item></Col><Col span={8}><Form.Item label="数据刷新频率" name="refreshRate"><Select defaultValue="5分钟"><Option value="5">5分钟</Option></Select></Form.Item></Col></Row>
<Row gutter={16}><Col span={8}><Form.Item label="地图服务" name="mapService"><Select defaultValue="高德地图"><Option value="amap">高德地图</Option></Select></Form.Item></Col><Col span={8}><Form.Item label="工单自动编号" valuePropName="checked"><Switch defaultChecked /></Form.Item></Col><Col span={8}><Form.Item label="AI建议自动生成" valuePropName="checked"><Switch defaultChecked /></Form.Item></Col></Row>
<Row gutter={16}><Col span={8}><Form.Item label="移动端同步" valuePropName="checked"><Switch defaultChecked /></Form.Item></Col></Row>
<Space><Button type="primary" onClick={handleSave}>保存设置</Button><Button>恢复默认</Button></Space>
</Form>
</AntdCard>
<AntdCard title="通知与告警策略" style={{ marginBottom: 24 }}>
<Row gutter={16} style={{ marginBottom: 16 }}>
<Col span={6}><Space><div style={{ background: '#f6ffed', borderRadius: 8, padding: 8 }}><BellOutlined style={{ color: '#52c41a', fontSize: 20 }} /></div><div><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><Text strong>短信</Text><Switch defaultChecked /></div><Text type="secondary">已启用</Text></div></Space></Col>
<Col span={6}><Space><div style={{ background: '#e6f4ff', borderRadius: 8, padding: 8 }}><BellOutlined style={{ color: '#1677ff', fontSize: 20 }} /></div><div><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><Text strong>邮件</Text><Switch defaultChecked /></div><Text type="secondary">已启用</Text></div></Space></Col>
<Col span={6}><Space><div style={{ background: '#fff7e6', borderRadius: 8, padding: 8 }}><BellOutlined style={{ color: '#fa8c16', fontSize: 20 }} /></div><div><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><Text strong>Telegram</Text><Switch defaultChecked /></div><Text type="secondary">已启用</Text></div></Space></Col>
<Col span={6}><Space><div style={{ background: '#fff0f6', borderRadius: 8, padding: 8 }}><BellOutlined style={{ color: '#eb2f96', fontSize: 20 }} /></div><div><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><Text strong>系统通知</Text><Switch defaultChecked /></div><Text type="secondary">已启用</Text></div></Space></Col>
</Row>
<Row gutter={16}><Col span={8}><Form.Item label="严重告警立即通知" valuePropName="checked"><Switch defaultChecked /></Form.Item></Col><Col span={8}><Form.Item label="发电下降超过15%" valuePropName="checked"><Switch defaultChecked /></Form.Item></Col><Col span={8}><Form.Item label="通信中断通知" valuePropName="checked"><Switch defaultChecked /></Form.Item></Col></Row>
<Row gutter={16}><Col span={8}><Form.Item label="每日汇总推送" valuePropName="checked"><Switch defaultChecked /></Form.Item></Col><Col span={8}><Form.Item label="夜间免打扰"><Select defaultValue="23:00-07:00"><Option value="23:00-07:00">23:00-07:00</Option></Select></Form.Item></Col></Row>
</AntdCard>
<AntdCard title="用户与权限预览">
<Table size="small" pagination={{ pageSize: 4 }} columns={[
{ title: '用户名', dataIndex: 'name' },
{ title: '角色', render: () => <Tag color="blue">管理员</Tag> },
{ title: '手机号', dataIndex: 'phone' },
{ title: '邮箱', dataIndex: 'email' },
{ title: '状态', render: () => <span style={{ color: '#52c41a' }}>● 在线</span> },
]} dataSource={[
{ name: '张运维', phone: '138****0001', email: 'zhangyw@pvsrmart.com' },
{ name: '李工程师', phone: '139****0002', email: 'li.gongcheng@pvsrmart.com' },
]} />
</AntdCard>
</div>
);
};
// 右侧面板
const RightPanel = () => (
@@ -160,6 +113,9 @@ export default function SystemSettings() {
if (item.path === '/systemSetting/monitor') {
return { key: 'monitor', label: '系统监控', icon: <SyncOutlined /> };
}
if (item.path === '/systemSetting/devices') {
return { key: 'devices', label: '设备管理', icon: <AppstoreOutlined /> };
}
return null;
}).filter(Boolean);
@@ -172,7 +128,6 @@ export default function SystemSettings() {
}
});
}, []);
const BasicSettingsPage = () => <div style={{ padding: 20 }}><h2>基础设置页面</h2></div>;
const NoticePage = () => <div style={{ padding: 20 }}><h2>通知策略页面</h2></div>;
const DataSafetyPage = () => <div style={{ padding: 20 }}><h2>数据与安全页面</h2></div>;
const SystemMaintenancePage = () => <div style={{ padding: 20 }}><h2>系统维护页面</h2></div>;
@@ -180,7 +135,7 @@ export default function SystemSettings() {
const renderTabContent = () => {
switch (activeTab) {
case 'basic':
return <BasicSettingsPage />;
return <BasicSettings />;
case 'user-role':
return <UserRolePage />;
case 'menu':
@@ -199,6 +154,8 @@ export default function SystemSettings() {
return <SystemMaintenancePage />;
case 'monitor':
return <OnlineUserPage />;
case 'devices':
return <DeviceManagementPage />;
default:
return <DefaultPage />;
}