From fd4673d66133ffab003d1aae07a432017069e58c Mon Sep 17 00:00:00 2001 From: 16337 <1633794139@qq.com> Date: Fri, 13 Feb 2026 16:15:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(aiot):=20=E4=BF=AE=E5=A4=8D=E7=AE=97?= =?UTF-8?q?=E6=B3=95=E5=8F=82=E6=95=B0=E4=BF=9D=E5=AD=98=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=20+=20=E6=B7=BB=E5=8A=A0=E4=B8=AD=E6=96=87=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复 Column 'priority' cannot be null 错误 - AlgorithmParamEditor 增加 priority/enabled props 并在保存时传递 - RoiAlgorithmBind 提取绑定的 priority/enabled 并传递给编辑器 - 添加中文参数名映射 (working_hours -> 工作时间段等) - 添加参数验证逻辑和详细错误日志 Co-Authored-By: Claude Opus 4.6 --- .../roi/components/AlgorithmParamEditor.vue | 28 ++++++++++++++++++- .../roi/components/RoiAlgorithmBind.vue | 6 ++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/apps/web-antd/src/views/aiot/device/roi/components/AlgorithmParamEditor.vue b/apps/web-antd/src/views/aiot/device/roi/components/AlgorithmParamEditor.vue index 073a4f6bf..e927a8efc 100644 --- a/apps/web-antd/src/views/aiot/device/roi/components/AlgorithmParamEditor.vue +++ b/apps/web-antd/src/views/aiot/device/roi/components/AlgorithmParamEditor.vue @@ -20,6 +20,8 @@ interface Props { paramSchema: string; currentParams: string; bindId: string; + priority?: number; + enabled?: number; } const props = withDefaults(defineProps(), { @@ -27,6 +29,8 @@ const props = withDefaults(defineProps(), { paramSchema: '{}', currentParams: '{}', bindId: '', + priority: 0, + enabled: 1, }); const emit = defineEmits<{ @@ -37,6 +41,26 @@ const emit = defineEmits<{ const formData = ref>({}); const newListItem = ref(''); +// 参数名中英文映射 +const paramNameMap: Record = { + working_hours: '工作时间段', + confirm_on_duty_sec: '确认在岗时间(秒)', + confirm_leave_sec: '确认离岗时间(秒)', + cooldown_sec: '冷却时间(秒)', + cooldown_seconds: '冷却时间(秒)', + confirm_seconds: '确认时间(秒)', + min_confidence: '最小置信度', + max_targets: '最大目标数', + detection_interval: '检测间隔(秒)', + enable_tracking: '启用跟踪', + tracking_timeout: '跟踪超时(秒)', +}; + +// 获取参数的中文名称 +function getParamLabel(key: string): string { + return paramNameMap[key] || key; +} + const parsedSchema = computed(() => { try { return JSON.parse(props.paramSchema); @@ -111,6 +135,8 @@ async function handleSave() { const payload = { bindId: props.bindId, params: paramsJson, + priority: props.priority ?? 0, // 保留原有priority + enabled: props.enabled ?? 1, // 保留原有enabled }; console.log('[算法参数保存] 发送请求:', payload); @@ -211,7 +237,7 @@ function validateParams(params: Record): { props.roiId, @@ -102,6 +104,8 @@ function openParamEditor(item: AiotDeviceApi.RoiAlgoBinding) { currentBindId.value = item.bind.bindId || ''; currentParams.value = item.bind.params || '{}'; currentParamSchema.value = item.algorithm?.paramSchema || '{}'; + currentPriority.value = item.bind.priority ?? 0; + currentEnabled.value = item.bind.enabled ?? 1; paramEditorOpen.value = true; } @@ -223,6 +227,8 @@ function onParamSaved() { :param-schema="currentParamSchema" :current-params="currentParams" :bind-id="currentBindId" + :priority="currentPriority" + :enabled="currentEnabled" @saved="onParamSaved" />