|
|
@@ -8,7 +8,8 @@
|
|
|
|
|
|
<div style="display: flex">
|
|
|
<ElCheckbox label="检测围栏外部" v-model="isFenceRegionOut" @update:modelValue="handleUpdateRegion" />
|
|
|
- <ElCheckbox label="前台画面显示" />
|
|
|
+ <ElCheckbox label="前台画面显示" v-model="isDisplayFenceInVideo" @update:modelValue="handleUpdateDisplay" />
|
|
|
+ <a :href="previewUrl" target="_blank" style="margin-left: 20px" v-if="previewUrl && false">平台相机预览</a>
|
|
|
</div>
|
|
|
<div class="fenceListWrapper">
|
|
|
<FenceNameItem
|
|
|
@@ -53,7 +54,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
- import { defineEmits, ref, watch } from 'vue';
|
|
|
+ import { computed, defineEmits, ref, watch } from 'vue';
|
|
|
import { ElButton, ElSwitch } from 'element-plus';
|
|
|
import ToolbarIcon from '../ToolbarIcon/ToolbarIcon.vue';
|
|
|
import saveIcon from '@/assets/images/camera/save.png';
|
|
|
@@ -69,6 +70,9 @@
|
|
|
import { ServerLineInfo } from '../FenceEditor/constants';
|
|
|
import { storeToRefs } from 'pinia';
|
|
|
import { RegionJudge } from './constants';
|
|
|
+ import { choosePreset, updateFenceDisplayStatus } from '@/api/camera/camera-preview';
|
|
|
+ import { FenceDisplayStatus } from '@/types/camera/constant';
|
|
|
+ import { useGlobSetting } from '@/hooks/setting';
|
|
|
const cameraAlgoStore = useCameraAlgoStore();
|
|
|
|
|
|
const fenceStore = useFenceStore();
|
|
|
@@ -90,6 +94,17 @@
|
|
|
}>();
|
|
|
|
|
|
const isFenceRegionOut = ref(false);
|
|
|
+ const isDisplayFenceInVideo = ref(false);
|
|
|
+
|
|
|
+ const { detail } = storeToRefs(cameraDetailStore);
|
|
|
+
|
|
|
+ const { appPCUrl } = useGlobSetting();
|
|
|
+
|
|
|
+ const previewUrl = computed(() => {
|
|
|
+ const firstSceneId = detail.value?.sceneTemplateList[0]?.sceneId;
|
|
|
+ if (!detail.value?.workshopId || !detail.value?.code || !firstSceneId) return '';
|
|
|
+ return appPCUrl + `#/shop?id=${detail.value?.workshopId}&cameraCode=${detail.value?.code!}&sceneId=${firstSceneId}`;
|
|
|
+ });
|
|
|
|
|
|
watch(
|
|
|
() => selectedAlgoDetail.value?.regionJudge,
|
|
|
@@ -100,6 +115,15 @@
|
|
|
immediate: true,
|
|
|
},
|
|
|
);
|
|
|
+ watch(
|
|
|
+ () => cameraDetailStore.isShowFence,
|
|
|
+ (isShowFence) => {
|
|
|
+ isDisplayFenceInVideo.value = isShowFence;
|
|
|
+ },
|
|
|
+ {
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+ );
|
|
|
|
|
|
const toggleEdit = () => {
|
|
|
emits('toggleEditable', !props.isEdit);
|
|
|
@@ -151,6 +175,27 @@
|
|
|
handleEditCancel();
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
+ const handleUpdateDisplay = (nextStatus: boolean) => {
|
|
|
+ const params = {
|
|
|
+ cameraCode: cameraDetailStore.detail?.code!,
|
|
|
+ isDisplayFence: nextStatus ? FenceDisplayStatus.enabled : FenceDisplayStatus.disabled,
|
|
|
+ };
|
|
|
+
|
|
|
+ updateFenceDisplayStatus(params);
|
|
|
+ if (nextStatus) {
|
|
|
+ // 由于历史原因,需要调用两次接口
|
|
|
+ const cameraId = cameraDetailStore.cameraId;
|
|
|
+ const algoId = cameraAlgoStore.selectedAlgoId!;
|
|
|
+ const presetToken = presetStore.currentPresetToken;
|
|
|
+ const params = {
|
|
|
+ algoId,
|
|
|
+ cameraId,
|
|
|
+ presetToken,
|
|
|
+ };
|
|
|
+ choosePreset(params);
|
|
|
+ }
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|