总览和 告警 界面

This commit is contained in:
mmc
2026-05-07 20:25:14 +08:00
parent 5ef889e435
commit dea212151a
3 changed files with 834 additions and 468 deletions

View File

@@ -23,6 +23,8 @@ export default function StationManage() {
// 组织列表
const [orgList, setOrgList] = useState([]);
// 🔥 新增:选中的组织ID(用于筛选)
const [selectedOrgId, setSelectedOrgId] = useState<number | undefined>(undefined);
// 获取当前登录用户信息
const { userInfo } = useSelector((state: RootState) => state.user);
@@ -62,12 +64,14 @@ export default function StationManage() {
});
};
// ====================== 获取场站列表(分页) ======================
// ====================== 获取场站列表(分页 + 组织筛选) ======================
const getStationData = () => {
const params = {
pageNum: pagination.pageNum,
pageSize: pagination.pageSize,
orgId: userInfo?.orgId,
// 🔥 把选中的组织ID传进去
filterOrgId: selectedOrgId,
};
getStationList(params).then(res => {
if (res.code === 200) {
@@ -89,11 +93,27 @@ export default function StationManage() {
});
};
// 🔥 组织筛选变化
const handleOrgChange = (value: number) => {
setSelectedOrgId(value);
setPagination({ ...pagination, pageNum: 1 }); // 筛选重置页码
};
// 🔥 重置筛选
const handleReset = () => {
setSelectedOrgId(undefined);
setPagination({ ...pagination, pageNum: 1 });
};
// 初始化加载
useEffect(() => {
getStationData();
getOrgData();
}, [pagination.pageNum, pagination.pageSize]);
}, [
pagination.pageNum,
pagination.pageSize,
selectedOrgId // 🔥 监听筛选变化
]);
// ====================== 新增 / 编辑 场站 ======================
const handleAdd = () => {
@@ -206,11 +226,6 @@ export default function StationManage() {
}
},
{ title: '地址', dataIndex: 'address' },
//{
// title: '状态',
// dataIndex: 'status',
// render: s => s === 1 ? <Tag color="green">启用</Tag> : <Tag color="red">停用</Tag>
//},
{
title: '操作',
width: 400,
@@ -232,10 +247,28 @@ export default function StationManage() {
{contextHolder}
<Card title="场站管理" style={{ borderRadius: 8 }}>
<div style={{ marginBottom: 16, display: 'flex', justifyContent: 'space-between' }}>
<Button type="primary" icon={<PlusOutlined />} onClick={handleAdd}>
新增场站
</Button>
{/* 🔥 筛选栏 */}
<div style={{ marginBottom: 16, display: 'flex', alignItems: 'center', gap: 16 }}>
<Select
placeholder="请选择组织筛选"
style={{ width: 220 }}
value={selectedOrgId}
onChange={handleOrgChange}
allowClear
>
{orgList.map(item => (
<Option key={item.id} value={item.id}>
{item.orgName}
</Option>
))}
</Select>
<Button onClick={handleReset}>重置</Button>
<div style={{ marginLeft: 'auto' }}>
<Button type="primary" icon={<PlusOutlined />} onClick={handleAdd}>
新增场站
</Button>
</div>
</div>
<Table
@@ -281,7 +314,6 @@ export default function StationManage() {
<Form.Item name="orgId" label="所属组织" rules={[{ required: true }]}>
<Select placeholder="请选择所属组织" allowClear>
{orgList.map(item => (
// ✅ 这里修复了!原来是 item.orgId,现在是 item.id
<Option key={item.id} value={item.id}>
{item.orgName}
</Option>