fix(iot): 场景联动动作类型切换清理逻辑失效

updateActionType 先调 onActionTypeChange(此时 action.type 仍是旧值)
再赋新值,修复 type guard 永远 false 导致切换执行器类型不清空旧
identifier;onActionTypeChange 内恒真的 type !== action.type
简化为 if (action.identifier)
pull/878/MERGE
YunaiV 2026-05-22 20:24:58 +08:00
parent b5bc537f86
commit 1612e3e1b6
1 changed files with 4 additions and 3 deletions

View File

@ -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)) {