refactor(device): 设备列表改用上游 Crud 体系,移除 3932 行本地分叉实现
列表、搜索、新增、编辑全部改为 CrudPage/CrudSearch/CrudForm 配置驱动,在线状态通过独立响应式字典接收 SSE 推送。
This commit is contained in:
1 parent
01f42ab21b
commit
9f0d5f37a1
12 files changed
+247
-2255
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import type { DeviceItem, DeviceOnlineVO } from "@/api/device/types";
|
||||
|
||||
/** 设备在线状态:分页接口提供当前页初值,SSE 推送实时覆盖 */
|
||||
export const onlineStatus = reactive<Record<string, number>>({});
|
||||
|
||||
export function syncOnlineStatus(list: DeviceItem[]) {
|
||||
list.forEach((item) => {
|
||||
if (item.serialno) onlineStatus[item.serialno] = item.online ?? 0;
|
||||
});
|
||||
}
|
||||
|
||||
export function updateOnlineStatus(data: DeviceOnlineVO) {
|
||||
if (data?.serialno) onlineStatus[data.serialno] = data.online ?? 0;
|
||||
}
|
||||
Reference in new issue
Block a user