fix(iot): 场景联动动作类型切换清理逻辑失效
updateActionType 先调 onActionTypeChange(此时 action.type 仍是旧值) 再赋新值,修复 type guard 永远 false 导致切换执行器类型不清空旧 identifier;onActionTypeChange 内恒真的 type !== action.type 简化为 if (action.identifier)pull/878/MERGE
parent
b5bc537f86
commit
1612e3e1b6
|
|
@ -222,8 +222,9 @@ const removeAction = (index: number) => {
|
|||
* @param type 执行器类型
|
||||
*/
|
||||
const updateActionType = (index: number, type: number) => {
|
||||
actions.value[index].type = type
|
||||
onActionTypeChange(actions.value[index], type)
|
||||
const action = actions.value[index]
|
||||
onActionTypeChange(action, type) // 须在赋新值前调用 ,内部依赖 action.type 旧值
|
||||
action.type = type
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -258,7 +259,7 @@ const onActionTypeChange = (action: Action, type: number) => {
|
|||
action.params = ''
|
||||
}
|
||||
// 如果从其他类型切换到设备控制类型,清空identifier(让用户重新选择)
|
||||
if (action.identifier && type !== action.type) {
|
||||
if (action.identifier) {
|
||||
action.identifier = undefined
|
||||
}
|
||||
} else if (isAlertAction(type)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue