|
|
|
@ -374,8 +374,43 @@ const scanDeviceCount = computed(() => {
|
|
|
|
return info.value?.scan_device_count ?? info.value?.ScanDeviceCount ?? info.value?.Loops?.length ?? 0
|
|
|
|
return info.value?.scan_device_count ?? info.value?.ScanDeviceCount ?? info.value?.Loops?.length ?? 0
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const monitorDisplayLoopCount = 10
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const createEmptyMonitorLoop = (index) => ({
|
|
|
|
|
|
|
|
index,
|
|
|
|
|
|
|
|
name: `#${index + 1}`,
|
|
|
|
|
|
|
|
is_open: false,
|
|
|
|
|
|
|
|
pwm: 0,
|
|
|
|
|
|
|
|
A: 0,
|
|
|
|
|
|
|
|
V: 0,
|
|
|
|
|
|
|
|
Kw: 0,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const normalizeMonitorLoop = (loop, index) => {
|
|
|
|
|
|
|
|
const normalized = createEmptyMonitorLoop(index)
|
|
|
|
|
|
|
|
if (!loop) return normalized
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
...normalized,
|
|
|
|
|
|
|
|
...loop,
|
|
|
|
|
|
|
|
index: loop.index ?? loop.Index ?? index,
|
|
|
|
|
|
|
|
name: loop.name ?? loop.Name ?? normalized.name,
|
|
|
|
|
|
|
|
is_open: loop.is_open ?? loop.IsOpen ?? normalized.is_open,
|
|
|
|
|
|
|
|
pwm: loop.pwm ?? loop.Pwm ?? normalized.pwm,
|
|
|
|
|
|
|
|
A: loop.A ?? normalized.A,
|
|
|
|
|
|
|
|
V: loop.V ?? normalized.V,
|
|
|
|
|
|
|
|
Kw: loop.Kw ?? normalized.Kw,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const monitorLoops = computed(() => {
|
|
|
|
const monitorLoops = computed(() => {
|
|
|
|
return info.value?.Loops || []
|
|
|
|
const loops = info.value?.Loops || []
|
|
|
|
|
|
|
|
return Array.from({ length: monitorDisplayLoopCount }, (_, index) => normalizeMonitorLoop(loops[index], index))
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const faultPollingLoopCount = computed(() => {
|
|
|
|
|
|
|
|
const count = Number(scanDeviceCount.value)
|
|
|
|
|
|
|
|
if (!Number.isFinite(count) || count <= 0) return monitorDisplayLoopCount
|
|
|
|
|
|
|
|
return Math.min(count, monitorDisplayLoopCount)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const loopNo = (loop, index) => {
|
|
|
|
const loopNo = (loop, index) => {
|
|
|
|
@ -386,7 +421,7 @@ const loopNo = (loop, index) => {
|
|
|
|
const maxVisibleFaultCount = 10
|
|
|
|
const maxVisibleFaultCount = 10
|
|
|
|
|
|
|
|
|
|
|
|
const currentFaults = computed(() => {
|
|
|
|
const currentFaults = computed(() => {
|
|
|
|
const loops = info.value?.Loops || []
|
|
|
|
const loops = monitorLoops.value.slice(0, faultPollingLoopCount.value)
|
|
|
|
return loops.flatMap((loop, index) => {
|
|
|
|
return loops.flatMap((loop, index) => {
|
|
|
|
const loopIdx = loop.loop_idx || loop.LoopIdx || loop.index + 1 || index + 1
|
|
|
|
const loopIdx = loop.loop_idx || loop.LoopIdx || loop.index + 1 || index + 1
|
|
|
|
const faults = loop.faults || loop.Faults || []
|
|
|
|
const faults = loop.faults || loop.Faults || []
|
|
|
|
|