SCADA 面板数据实现前后端对接
This commit is contained in:
@@ -170,15 +170,6 @@ const SCADADeviceList: React.FC<SCADADeviceListProps> = ({
|
||||
// 获取设备状态列表
|
||||
const deviceStatuses = STATUS_OPTIONS;
|
||||
|
||||
// 创建设备索引 Map,使用设备 ID 作为键
|
||||
const deviceIndex = useMemo(() => {
|
||||
const index = new Map<string, SCADADevice>();
|
||||
effectiveDevices.forEach((device) => {
|
||||
index.set(device.id, device);
|
||||
});
|
||||
return index;
|
||||
}, [effectiveDevices]);
|
||||
|
||||
// 过滤设备列表
|
||||
const filteredDevices = useMemo(() => {
|
||||
return effectiveDevices.filter((device) => {
|
||||
@@ -276,6 +267,12 @@ const SCADADeviceList: React.FC<SCADADeviceListProps> = ({
|
||||
});
|
||||
}, []);
|
||||
|
||||
// 清除选择
|
||||
const handleClearSelection = useCallback(() => {
|
||||
setInternalSelection([]);
|
||||
setPendingSelection([]);
|
||||
}, []);
|
||||
|
||||
// 清理定时器
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
@@ -412,6 +409,20 @@ const SCADADeviceList: React.FC<SCADADeviceListProps> = ({
|
||||
{devices.length !== filteredDevices.length &&
|
||||
` (共 ${effectiveDevices.length} 个设备)`}
|
||||
</Typography>
|
||||
|
||||
{/* 清除选择按钮 */}
|
||||
{activeSelection.length > 0 && (
|
||||
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
|
||||
<Chip
|
||||
label={`已选择 ${activeSelection.length} 个设备`}
|
||||
color="primary"
|
||||
size="small"
|
||||
onDelete={handleClearSelection}
|
||||
deleteIcon={<Clear />}
|
||||
sx={{ fontWeight: "medium" }}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
</Stack>
|
||||
</Box>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user