监控、工单报表清洗在线用户页面

This commit is contained in:
mmc
2026-05-08 11:00:11 +08:00
parent 9645c2b651
commit 254ab64358
12 changed files with 1805 additions and 101 deletions

View File

@@ -23,7 +23,7 @@ export default function StationManage() {
// 组织列表
const [orgList, setOrgList] = useState([]);
// 🔥 新增:选中的组织ID(用于筛选)
// 🔥 选中的组织ID(用于筛选)
const [selectedOrgId, setSelectedOrgId] = useState<number | undefined>(undefined);
// 获取当前登录用户信息
@@ -50,7 +50,7 @@ export default function StationManage() {
total: 0
});
// ====================== 获取组织列表(根据 userId 过滤) ======================
// ====================== 获取组织列表 ======================
const getOrgData = () => {
const params = {
pageNum: 1,
@@ -64,14 +64,12 @@ export default function StationManage() {
});
};
// ====================== 获取场站列表(分页 + 组织筛选) ======================
// ====================== 获取场站列表 ======================
const getStationData = () => {
const params = {
pageNum: pagination.pageNum,
pageSize: pagination.pageSize,
orgId: userInfo?.orgId,
// 🔥 把选中的组织ID传进去
filterOrgId: selectedOrgId,
orgId: selectedOrgId, // 🔥 最终使用的筛选 orgId
};
getStationList(params).then(res => {
if (res.code === 200) {
@@ -93,26 +91,37 @@ export default function StationManage() {
});
};
// 🔥 组织筛选变化
// 组织筛选变化
const handleOrgChange = (value: number) => {
setSelectedOrgId(value);
setPagination({ ...pagination, pageNum: 1 }); // 筛选重置页码
setPagination({ ...pagination, pageNum: 1 });
};
// 🔥 重置筛选
// 重置筛选
const handleReset = () => {
setSelectedOrgId(undefined);
setPagination({ ...pagination, pageNum: 1 });
};
// 初始化加载
// ====================== 初始化加载 ======================
useEffect(() => {
getOrgData();
}, []);
// 🔥 关键:如果 userInfo.orgId 存在,则默认选中
useEffect(() => {
if (userInfo?.orgId) {
setSelectedOrgId(userInfo.orgId);
}
}, [userInfo]);
// 加载数据
useEffect(() => {
getStationData();
getOrgData();
}, [
pagination.pageNum,
pagination.pageSize,
selectedOrgId // 🔥 监听筛选变化
selectedOrgId
]);
// ====================== 新增 / 编辑 场站 ======================
@@ -247,28 +256,30 @@ export default function StationManage() {
{contextHolder}
<Card title="场站管理" style={{ borderRadius: 8 }}>
{/* 🔥 筛选栏 */}
<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>
{/* 🔥 筛选栏:只有 userInfo 没有 orgId 时才显示 */}
{!userInfo?.orgId && (
<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>
)}
<div style={{ display: 'flex', justifyContent: 'end', marginBottom: 16 }}>
<Button type="primary" icon={<PlusOutlined />} onClick={handleAdd}>
新增场站
</Button>
</div>
<Table