| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <template>
- <div>
- <div class="cameraMain">
- <div class="cameraTree">
- <CameraTreeCom />
- </div>
- <div class="cameraSettingWrapper">
- <div class="cameraView">
- <CameraViewSetting v-if="cameraDetailStore.cameraId" />
- <div class="cameraPlaceholder" v-else>请选择左侧相机</div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script lang="ts" setup>
- import { onMounted, ref, watch } from 'vue';
- import { storeToRefs } from 'pinia';
- import CameraTreeCom from './components/CameraTree/CameraTree.vue';
- import CameraViewSetting from './components/CameraViewSetting/CameraViewSetting.vue';
- import useCameraDetailStore from './store/useCameraDetailStore';
- import useCameraAlgoStore from './store/useCameraAlgoStore';
- import usePresetListStore from './store/usePresetListStore';
- import useFenceStore from './store/useFenceStore';
- import { IsPtz } from '@/api/camera/camera-overview';
- import { getCameraDeatilById } from '@/api/camera/camera-preview';
- const cameraDetailStore = useCameraDetailStore();
- const { isShowFence } = storeToRefs(cameraDetailStore);
- const cameraAlgoStore = useCameraAlgoStore();
- const fenceStore = useFenceStore();
- const presetListStore = usePresetListStore();
- watch(
- () => cameraDetailStore.cameraId,
- async (cameraId) => {
- isShowFence.value = false;
- fenceStore.clear();
- if (cameraId) {
- const presetList = await presetListStore.getPresetList(cameraId);
- getCameraDeatilById(cameraId).then((res) => {
- cameraDetailStore.setDetail(res);
- // 如果isPtz为null,或者为0,都按照枪击相机
- if (res.isPtz === IsPtz.disabled || !res.isPtz) {
- presetListStore.currentPresetToken = presetList?.[0].token;
- }
- });
- cameraAlgoStore.getCameraAlgoList(cameraId);
- cameraAlgoStore.selectedAlgoId = null;
- }
- },
- {
- immediate: true,
- },
- );
- onMounted(() => {
- cameraAlgoStore.getAllAlgoList();
- });
- </script>
- <style lang="scss" scoped>
- .cameraParamsSetting {
- width: 350px;
- min-height: 300px;
- // border: 1px solid #ccc;
- }
- .cameraParamsSetting {
- width: 350px;
- min-height: 300px;
- // border: 1px solid #ccc;
- }
- .algorithmsSetting {
- flex: 1;
- border-left: 1px solid #ccc;
- padding-left: 20px;
- }
- .cameraMain {
- display: flex;
- background: #fff;
- // height: calc(100vh - 90px);
- }
- .cameraTree {
- min-width: 270px;
- max-width: 600px;
- flex-shrink: 0;
- // height: 800px;
- // border: 1px solid #ccc;
- border: 1px solid #f0f2f5;
- margin: 5px;
- }
- .cameraPlaceholder {
- color: #333;
- text-align: center;
- margin-top: 100px;
- margin-left: 100px;
- }
- </style>
|