<!-- 算法参数配置页面 -->
<template>
  <AlgoParamsSettingBase
    :cameraAllAlgoList="cameraAllAlgoList"
    :isCameraGroup="false"
    :getCameraAlgoList="getCameraAlgoListApi"
  >
    <template #cameraTree>
      <CameraTree />
    </template>
  </AlgoParamsSettingBase>
</template>

<script lang="ts" setup>
  import AlgoParamsSettingBase from '@/modules/algo-params-setting-base/AlgoParamsSettingBase.vue';
  import CameraTree from '@/modules/algo-params-setting-base/components/CameraTree/CameraTree.vue';
  import { AlgoDetail, queryAlgoInfoAllByCameraId } from '@/api/algo/algo';

  import { watch, ref } from 'vue';
  import { useRoute } from 'vue-router';
  import { getCameraAlgoListApi } from '@/api/camera/camera-preview';
  const cameraAllAlgoList = ref<AlgoDetail[]>([]);
  const route = useRoute();

  watch(
    () => route.query.cameraId,
    (nextCameraId) => {
      if (!nextCameraId) return;
      queryAlgoInfoAllByCameraId(nextCameraId).then((res) => {
        cameraAllAlgoList.value = res;
      });
    },
    { immediate: true },
  );
</script>

<style lang="scss" scoped></style>
