refactor(aiot): 算法抽帧频率改为固定展示,不允许用户配置
- 在算法绑定列表中显示固定帧率标签(绿色Tag) - 离岗检测:3帧/秒 - 周界入侵:1帧/秒 - 其他算法:默认5帧/秒 - 删除参数配置界面的帧率选择器 - 帧率由算法类型决定,不允许用户修改 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -44,7 +44,6 @@ const newListItem = ref('');
|
||||
// 参数名中英文映射
|
||||
const paramNameMap: Record<string, string> = {
|
||||
leave_countdown_sec: '离岗倒计时(秒)',
|
||||
frame_rate: '抽帧频率',
|
||||
working_hours: '工作时间段',
|
||||
// 其他算法参数
|
||||
cooldown_seconds: '告警冷却期(秒)',
|
||||
@@ -59,24 +58,12 @@ const paramNameMap: Record<string, string> = {
|
||||
// 参数说明映射
|
||||
const paramDescMap: Record<string, string> = {
|
||||
leave_countdown_sec: '人员离开后,倒计时多少秒才触发离岗告警',
|
||||
frame_rate: '算法处理视频流的频率,频率越高检测越及时但消耗越大',
|
||||
working_hours: '仅在指定时间段内进行监控,留空表示24小时监控',
|
||||
// 其他算法参数说明
|
||||
cooldown_seconds: '触发告警后,多少秒内不再重复告警(用于周界入侵等算法)',
|
||||
confirm_seconds: '检测到目标后,持续多少秒才触发告警(避免瞬间误报)',
|
||||
};
|
||||
|
||||
// 抽帧频率选项(物业场景优化)
|
||||
const frameRateOptions = [
|
||||
{ value: 10.0, label: '10帧/秒', desc: '高频检测 - 快速移动场景' },
|
||||
{ value: 5.0, label: '5帧/秒', desc: '中高频 - 正常人员活动' },
|
||||
{ value: 3.0, label: '3帧/秒', desc: '中频 - 人员离岗、聚集(推荐)' },
|
||||
{ value: 1.0, label: '1帧/秒', desc: '标准频率 - 周界入侵(推荐)' },
|
||||
{ value: 0.33, label: '1帧/3秒', desc: '低频 - 慢速场景' },
|
||||
{ value: 0.1, label: '1帧/10秒', desc: '极低频 - 车辆检测' },
|
||||
{ value: 0.03, label: '1帧/30秒', desc: '超低频 - 垃圾堆放等静态检测' },
|
||||
];
|
||||
|
||||
// 获取参数的中文名称
|
||||
function getParamLabel(key: string): string {
|
||||
return paramNameMap[key] || key;
|
||||
@@ -142,17 +129,6 @@ function isWorkingHoursField(key: string): boolean {
|
||||
return key === 'working_hours';
|
||||
}
|
||||
|
||||
// 判断是否为抽帧频率字段
|
||||
function isFrameRateField(key: string): boolean {
|
||||
return key === 'frame_rate';
|
||||
}
|
||||
|
||||
// 获取抽帧频率显示文本
|
||||
function getFrameRateLabel(value: number): string {
|
||||
const option = frameRateOptions.find(opt => Math.abs(opt.value - value) < 0.01);
|
||||
return option ? option.label : `${value}帧/秒`;
|
||||
}
|
||||
|
||||
async function handleSave() {
|
||||
try {
|
||||
console.log('[算法参数保存] 开始保存,原始数据:', formData.value);
|
||||
@@ -297,29 +273,6 @@ function validateParams(params: Record<string, any>): {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 抽帧频率(特殊处理) -->
|
||||
<template v-else-if="isFrameRateField(String(key))">
|
||||
<Select
|
||||
v-model:value="formData[String(key)]"
|
||||
:placeholder="`默认: ${getFrameRateLabel(schema.default)}`"
|
||||
style="width: 100%"
|
||||
>
|
||||
<Select.Option
|
||||
v-for="option in frameRateOptions"
|
||||
:key="option.value"
|
||||
:value="option.value"
|
||||
>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<span style="font-weight: 500;">{{ option.label }}</span>
|
||||
<span style="font-size: 12px; color: #8c8c8c;">{{ option.desc }}</span>
|
||||
</div>
|
||||
</Select.Option>
|
||||
</Select>
|
||||
<div v-if="getParamDesc(String(key))" class="param-desc">
|
||||
{{ getParamDesc(String(key)) }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 普通列表类型 -->
|
||||
<div v-else-if="schema.type === 'list'">
|
||||
<div style="margin-bottom: 8px">
|
||||
|
||||
@@ -124,6 +124,15 @@ async function onToggleEnabled(bind: AiotDeviceApi.AlgoBind, val: string | numbe
|
||||
function onParamSaved() {
|
||||
emit('changed');
|
||||
}
|
||||
|
||||
// 获取算法的固定帧率
|
||||
function getAlgoFrameRate(algoCode: string): string {
|
||||
const frameRates: Record<string, string> = {
|
||||
leave_post: '3帧/秒',
|
||||
intrusion: '1帧/秒',
|
||||
};
|
||||
return frameRates[algoCode] || '5帧/秒';
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -174,6 +183,9 @@ function onParamSaved() {
|
||||
<Tag color="blue">
|
||||
{{ item.algorithm?.algoName || item.bind.algoCode }}
|
||||
</Tag>
|
||||
<Tag color="green" style="font-size: 11px">
|
||||
{{ getAlgoFrameRate(item.bind.algoCode) }}
|
||||
</Tag>
|
||||
<span style="color: #999; font-size: 12px">
|
||||
{{ item.bind.algoCode }}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user