diff --git a/src/views/HandleControl/index.vue b/src/views/HandleControl/index.vue index 07650d7..a7c4e7b 100644 --- a/src/views/HandleControl/index.vue +++ b/src/views/HandleControl/index.vue @@ -466,7 +466,17 @@ const toggleCircuit = (circuitName) => { if (!info.value.disable) return ElMessage.warning('请切换至手动模式') const circuit = info.value.loops.find(c => c.name === circuitName) if (circuit) { - circuit.is_open = !circuit.is_open + ElMessageBox.confirm( + `确认${circuit.is_open ? '关' : '开'}灯?`, + '提示', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + } + ).then(() => { + circuit.is_open = !circuit.is_open + }) } } @@ -506,8 +516,18 @@ const openGlobalBrightnessDialog = () => { // 全开灯光 const openLightSettings = () => { if (!info.value.disable) return ElMessage.warning('请切换至手动模式') - info.value.loops.forEach(circuit => { - circuit.is_open = true + ElMessageBox.confirm( + `确认全开?`, + '提示', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + } + ).then(() => { + info.value.loops.forEach(circuit => { + circuit.is_open = true + }) }) // dimmingChannels.value.forEach(channel => { // channel.brightness = 100 @@ -517,8 +537,18 @@ const openLightSettings = () => { // 全关灯光 const turnOffAll = () => { if (!info.value.disable) return ElMessage.warning('请切换至手动模式') - info.value.loops.forEach(circuit => { - circuit.is_open = false + ElMessageBox.confirm( + `确认全关?`, + '提示', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + } + ).then(() => { + info.value.loops.forEach(circuit => { + circuit.is_open = false + }) }) // dimmingChannels.value.forEach(channel => { // channel.brightness = 0 @@ -558,14 +588,13 @@ const changeMode = () => { cancelButtonText: '取消', type: 'warning', } - ) - .then(() => { - info.value.disable = !info.value.disable - // ElMessage({ - // type: 'success', - // message: `切换${info.value.disable ? '手动' : '自动'}成功`, - // }) - }) + ).then(() => { + info.value.disable = !info.value.disable + // ElMessage({ + // type: 'success', + // message: `切换${info.value.disable ? '手动' : '自动'}成功`, + // }) + }) } let timeInterval = null