重构(alarm-tree): 使用 alarmOnline 函数替代直接状态检查
将多处行内的告警状态检查替换为统一的 alarmOnline 辅助函数,后续若需调整在线状态校验逻辑仅需修改一处,提升代码可读性与可维护性。
This commit is contained in:
@@ -58,14 +58,14 @@ const renderNodeLabel: TreeProps['renderLabel'] = ({ option }) => {
|
||||
'div',
|
||||
{
|
||||
style: alarmNodeStyle,
|
||||
draggable: alarm.status === 1,
|
||||
draggable: alarmOnline(),
|
||||
onDblclick() {
|
||||
if (alarm.status === 0) return;
|
||||
if (!alarmOnline()) return;
|
||||
selectedDeviceGbCode.value = [alarm.code];
|
||||
window.$message.info(`查看警报器:${JSON.stringify({ code: alarm.code, name: alarm.name })}`);
|
||||
},
|
||||
onDragstart(event) {
|
||||
if (alarm.status === 0) return;
|
||||
if (!alarmOnline()) return;
|
||||
console.log(event);
|
||||
event.dataTransfer?.setData('type', 'alarm');
|
||||
event.dataTransfer?.setData('code', alarm.code);
|
||||
|
||||
Reference in New Issue
Block a user