抄盘手端 - 设置设备任务参数调整

This commit is contained in:
柳清爽
2025-04-16 17:49:17 +08:00
parent ad0d487b6b
commit 9e44fef525
5 changed files with 25 additions and 234 deletions

View File

@@ -353,8 +353,11 @@ export default function DeviceDetailPage() {
// 准备更新后的功能状态
const updatedFeatures = { ...device.features, [feature]: checked }
// 创建API请求参数
const configUpdate = { [feature]: checked }
// 创建API请求参数将布尔值转换为0/1
const configUpdate = {
deviceId: device.id,
[feature]: checked ? 1 : 0
}
// 立即更新UI状态提供即时反馈
setDevice(prev => prev ? {
@@ -363,7 +366,7 @@ export default function DeviceDetailPage() {
} : null)
// 调用API更新服务器配置
const response = await updateDeviceTaskConfig(device.id, configUpdate)
const response = await updateDeviceTaskConfig(configUpdate)
if (response && response.code === 200) {
toast.success(`${getFeatureName(feature)}${checked ? '已启用' : '已禁用'}`)