fix: alarm-query and secutiryBox switch states

This commit is contained in:
yangsy
2025-12-11 01:30:11 +08:00
parent 15a9f68db7
commit 6c7897198c
3 changed files with 10 additions and 7 deletions

View File

@@ -17,22 +17,24 @@ const cardShow = computed(() => {
return Object.values(props).some((value) => !!value); return Object.values(props).some((value) => !!value);
}); });
// 门禁状态 (switches[0]: 0=打开/生效, 1=关闭/失效) // 门禁状态
const accessControlStatus = computed(() => { const accessControlStatus = computed(() => {
if (!switches?.value || switches.value.length === 0) return null; if (!switches?.value || switches.value.length === 0) return null;
return switches.value[0] === 0 ? '打开' : '关闭'; const status = switches.value.at(0)!;
return status === 0 ? '开门' : status === 1 ? '关门' : '-';
}); });
// 防雷状态 (switches[1]: 0=关闭/失效, 1=打开/生效) // 防雷状态
const lightningProtectionStatus = computed(() => { const lightningProtectionStatus = computed(() => {
if (!switches?.value || switches.value.length < 2) return null; if (!switches?.value || switches.value.length < 2) return null;
return switches.value[1] === 1 ? '生效' : '失效'; const status = switches.value.at(1)!;
return status === 0 ? '正常' : status === 1 ? '失效' : '-';
}); });
// 获取状态标签类型 // 获取状态标签类型
const getStatusTagType = (status: string | null) => { const getStatusTagType = (status: string | null) => {
if (['打开', '生效'].includes(status ?? '')) return 'success'; if (['正常'].includes(status ?? '')) return 'success';
if (['关闭', '失效'].includes(status ?? '')) return 'error'; if (['失效'].includes(status ?? '')) return 'error';
return 'default'; return 'default';
}; };

View File

@@ -78,7 +78,7 @@ function useStationAlarmCountsMutation() {
}, },
size: 50000, size: 50000,
current: 1, current: 1,
sort: 'id', sort: 'alarmDate',
order: 'descending', order: 'descending',
}, },
{ {

View File

@@ -342,6 +342,7 @@ const onClickQuery = () => {
tablePagination.pageSize = 10; tablePagination.pageSize = 10;
searchFieldsChanged.value = false; searchFieldsChanged.value = false;
} }
realtimeRefresh.value = false;
getTableData(); getTableData();
}; };