|
|
@@ -48,7 +48,7 @@
|
|
|
import useCameraDetailStore from '../../store/useCameraDetailStore';
|
|
|
import usePresetListStore from '../../store/usePresetListStore';
|
|
|
// import AddAlgoDialog from './AddAlgoDialog.vue';
|
|
|
- import { createAlgoSubmitParams } from '@/modules/algo/algo-params-edit/utils';
|
|
|
+ import { createAlgoSubmitParams, algoDetailToJSON } from '@/modules/algo/algo-params-edit/utils';
|
|
|
import {
|
|
|
getInferCode,
|
|
|
getAlgoType,
|
|
|
@@ -118,50 +118,12 @@
|
|
|
if (!algoId) return;
|
|
|
const detail = getAlgoDetail(algoId);
|
|
|
if (!detail) return;
|
|
|
- // console.log('detail change', detail);
|
|
|
- // const detectionJSON = getDetectionJSON(detail?.detectionFrequency);
|
|
|
- const enableCard = detail?.status === ALGO_ENABLED_STATUS.enabled ? true : false;
|
|
|
- const electronicFenceBool = detail?.electronicFence === FENCE_ENBALED_STATUS.enabled ? true : false;
|
|
|
-
|
|
|
- // const timeRangeArr = getDetectionTimeJSON(detail?.detectionTime) || [];
|
|
|
- const timeRangeArr = getDetectionTime(detail?.detectionTime) || [];
|
|
|
- const metaValues = getMetaValues(detail?.extra) || [];
|
|
|
-
|
|
|
- const commonInfo = getExtraCommonInfo(detail);
|
|
|
-
|
|
|
- selectedAlgoDetail.value = {
|
|
|
- ...detail,
|
|
|
- inferCode: getInferCode(detail?.extra),
|
|
|
- // detectionJSON,
|
|
|
- enableCardBool: enableCard,
|
|
|
- electronicFenceBool,
|
|
|
- timeRangeArr,
|
|
|
- metaValues,
|
|
|
- regionJudge: commonInfo.regionJudge || 0,
|
|
|
- judge: commonInfo.judge || commonInfo.judge == 0 ? commonInfo.judge : 1,
|
|
|
- eventDurationMinMs:
|
|
|
- commonInfo.eventDurationMinMs || commonInfo.eventDurationMinMs == 0 ? commonInfo.eventDurationMinMs : 1,
|
|
|
- eventDurationMinFrames:
|
|
|
- commonInfo.eventDurationMinFrames || commonInfo.eventDurationMinFrames == 0
|
|
|
- ? commonInfo.eventDurationMinFrames
|
|
|
- : 1,
|
|
|
- eventAlarmIntervalMs:
|
|
|
- commonInfo.eventAlarmIntervalMs || commonInfo.eventAlarmIntervalMs == 0 ? commonInfo.eventAlarmIntervalMs : 1,
|
|
|
- eventAlarmIntervalFrames:
|
|
|
- commonInfo.eventAlarmIntervalFrames || commonInfo.eventAlarmIntervalFrames == 0
|
|
|
- ? commonInfo.eventAlarmIntervalFrames
|
|
|
- : 1,
|
|
|
- };
|
|
|
+ selectedAlgoDetail.value = algoDetailToJSON(detail);
|
|
|
fenceStore.getFence({
|
|
|
algoId: algoId,
|
|
|
cameraId: cameraDetailStore.cameraId,
|
|
|
presetToken: presetStore.currentPresetToken,
|
|
|
});
|
|
|
-
|
|
|
- //是否有窗口时间
|
|
|
- if (commonInfo.timeWindow) {
|
|
|
- selectedAlgoDetail.value.timeWindow = commonInfo.timeWindow;
|
|
|
- }
|
|
|
});
|
|
|
|
|
|
const toggleFenceTool = () => {
|
|
|
@@ -206,32 +168,6 @@
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- // 开启关闭电子围栏
|
|
|
- const handleToggleFence = (detail: CameraAlgoItem, fenceStatus: boolean) => {
|
|
|
- const cameraId = cameraDetailStore.cameraId;
|
|
|
- const algoId = detail.algoId;
|
|
|
- // console.log({ detail, status });
|
|
|
- const status = fenceStatus ? FENCE_ENBALED_STATUS.enabled : FENCE_ENBALED_STATUS.disabled;
|
|
|
- const params = {
|
|
|
- cameraId: cameraId,
|
|
|
- id: detail.id as number,
|
|
|
- algoId,
|
|
|
- electronicFence: status,
|
|
|
- };
|
|
|
- const initialStatus = detail.electronicFence;
|
|
|
- detail.electronicFence = status;
|
|
|
- selectedAlgoId.value = algoId;
|
|
|
- isChanged.value = false;
|
|
|
- algoSettingIsOpen.value = false;
|
|
|
- updateCameraAlgoApi(params)
|
|
|
- .then(() => {
|
|
|
- ElMessage.success(fenceStatus ? '电子围栏已开启' : '电子围栏已关闭');
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- detail.electronicFence = initialStatus;
|
|
|
- });
|
|
|
- };
|
|
|
-
|
|
|
const handleSubmit = (param) => {
|
|
|
const cameraId = cameraDetailStore.cameraId;
|
|
|
|