feat(aiot): 改进算法参数标签和说明
- 修改参数标签更易理解: - confirm_leave_sec: 确认离岗时间 → 离岗倒计时 - cooldown_sec: 冷却时间 → 告警冷却期 - confirm_on_duty_sec: 确认在岗时间 → 在岗确认时间 - confirm_seconds: 确认时间 → 触发确认时间 - 添加参数说明功能: - 每个参数下方显示详细说明 - 解释参数的具体作用和用途 - 避免用户混淆参数含义 - 优化用户体验: - 离岗倒计时:持续离开X秒才触发告警(避免误报) - 告警冷却期:触发后X秒内不再重复告警(避免骚扰) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -44,11 +44,11 @@ const newListItem = ref('');
|
||||
// 参数名中英文映射
|
||||
const paramNameMap: Record<string, string> = {
|
||||
working_hours: '工作时间段',
|
||||
confirm_on_duty_sec: '确认在岗时间(秒)',
|
||||
confirm_leave_sec: '确认离岗时间(秒)',
|
||||
cooldown_sec: '冷却时间(秒)',
|
||||
cooldown_seconds: '冷却时间(秒)',
|
||||
confirm_seconds: '确认时间(秒)',
|
||||
confirm_on_duty_sec: '在岗确认时间(秒)',
|
||||
confirm_leave_sec: '离岗倒计时(秒)',
|
||||
cooldown_sec: '告警冷却期(秒)',
|
||||
cooldown_seconds: '告警冷却期(秒)',
|
||||
confirm_seconds: '触发确认时间(秒)',
|
||||
min_confidence: '最小置信度',
|
||||
max_targets: '最大目标数',
|
||||
detection_interval: '检测间隔(秒)',
|
||||
@@ -56,11 +56,26 @@ const paramNameMap: Record<string, string> = {
|
||||
tracking_timeout: '跟踪超时(秒)',
|
||||
};
|
||||
|
||||
// 参数说明映射
|
||||
const paramDescMap: Record<string, string> = {
|
||||
confirm_leave_sec: '人员离开后,持续多少秒才触发离岗告警(避免短暂离开误报)',
|
||||
cooldown_sec: '触发告警后,多少秒内不再重复告警(避免频繁告警)',
|
||||
confirm_on_duty_sec: '人员出现后,持续多少秒才确认在岗(避免短暂出现误判)',
|
||||
cooldown_seconds: '触发告警后,多少秒内不再重复告警(避免频繁告警)',
|
||||
confirm_seconds: '检测到目标后,持续多少秒才触发告警(避免瞬间误报)',
|
||||
working_hours: '仅在指定时间段内进行监控,留空表示24小时监控',
|
||||
};
|
||||
|
||||
// 获取参数的中文名称
|
||||
function getParamLabel(key: string): string {
|
||||
return paramNameMap[key] || key;
|
||||
}
|
||||
|
||||
// 获取参数说明
|
||||
function getParamDesc(key: string): string | undefined {
|
||||
return paramDescMap[key];
|
||||
}
|
||||
|
||||
const parsedSchema = computed(() => {
|
||||
try {
|
||||
return JSON.parse(props.paramSchema);
|
||||
@@ -240,19 +255,25 @@ function validateParams(params: Record<string, any>): {
|
||||
:label="getParamLabel(String(key))"
|
||||
>
|
||||
<!-- 整数类型 -->
|
||||
<InputNumber
|
||||
v-if="schema.type === 'int'"
|
||||
v-model:value="formData[String(key)]"
|
||||
:min="schema.min"
|
||||
:placeholder="`默认: ${schema.default}`"
|
||||
style="width: 100%"
|
||||
/>
|
||||
<template v-if="schema.type === 'int'">
|
||||
<InputNumber
|
||||
v-model:value="formData[String(key)]"
|
||||
:min="schema.min"
|
||||
:placeholder="`默认: ${schema.default}`"
|
||||
style="width: 100%"
|
||||
/>
|
||||
<div v-if="getParamDesc(String(key))" class="param-desc">
|
||||
{{ getParamDesc(String(key)) }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 工作时间段(特殊处理) -->
|
||||
<WorkingHoursEditor
|
||||
v-else-if="isWorkingHoursField(String(key))"
|
||||
v-model="formData[String(key)]"
|
||||
/>
|
||||
<template v-else-if="isWorkingHoursField(String(key))">
|
||||
<WorkingHoursEditor v-model="formData[String(key)]" />
|
||||
<div v-if="getParamDesc(String(key))" class="param-desc">
|
||||
{{ getParamDesc(String(key)) }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 普通列表类型 -->
|
||||
<div v-else-if="schema.type === 'list'">
|
||||
@@ -325,4 +346,11 @@ function validateParams(params: Record<string, any>): {
|
||||
.help-text {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.param-desc {
|
||||
margin-top: 4px;
|
||||
font-size: 12px;
|
||||
color: #8c8c8c;
|
||||
line-height: 1.5;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user