|
|
@@ -13,23 +13,45 @@
|
|
|
|
|
|
<div class="cameraViewSettingWrapper">
|
|
|
<FenceEditor ref="fenceEditorRef" />
|
|
|
+
|
|
|
<div class="cameraVideo"><CameraLiveVideo /></div>
|
|
|
</div>
|
|
|
+ <div>
|
|
|
+ <CameraDirectionControl />
|
|
|
+ <ElButton type="primary" @click="handleAddPreset">添加预置位</ElButton>
|
|
|
+ <AddPresetModal v-if="addPresetModalVisible" @close="handleClose" @ok="handleClose" />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
- import { ref } from 'vue';
|
|
|
+ import { ref, watch } from 'vue';
|
|
|
import FenceToolbar from '../FenceToolbar/FenceToolbar.vue';
|
|
|
import FenceEditor from '../FenceEditor/FenceEditor.vue';
|
|
|
import CameraLiveVideo from '../CameraLiveVideo/CameraLiveVideo.vue';
|
|
|
import ViewWindowSetting from '../ViewWindowSetting/ViewWindowSetting.vue';
|
|
|
import PresetSelect from '../PresetSelect/PresetSelect.vue';
|
|
|
import { ViewType } from '../ViewWindowSetting/types';
|
|
|
+ import useFenceStore from '../../store/useFenceStore';
|
|
|
+ import AddPresetModal from '../AddPresetModal/AddPresetModal.vue';
|
|
|
+ import { createPresetApi } from '@/api/camera/camera-preview';
|
|
|
+ import { ElMessage } from 'element-plus';
|
|
|
+ import { onMounted } from 'vue';
|
|
|
+ import usePresetListStore from '../../store/usePresetListStore';
|
|
|
|
|
|
const fenceEditorRef = ref<typeof FenceEditor | null>(null);
|
|
|
|
|
|
+ const fenceStore = useFenceStore();
|
|
|
+
|
|
|
+ const { data, getPresetList } = usePresetListStore();
|
|
|
+
|
|
|
const viewType = ref<ViewType>(ViewType.window1);
|
|
|
|
|
|
+ const addPresetModalVisible = ref(false);
|
|
|
+
|
|
|
+ const handleClose = () => {
|
|
|
+ addPresetModalVisible.value = false;
|
|
|
+ };
|
|
|
+
|
|
|
const handleRemove = () => {
|
|
|
console.log('handleRemove');
|
|
|
fenceEditorRef.value?.remove();
|
|
|
@@ -60,6 +82,38 @@
|
|
|
const handleUpdatePreset = (val: string) => {
|
|
|
console.log('val', val);
|
|
|
};
|
|
|
+ watch(
|
|
|
+ () => fenceStore.serverFencePoints,
|
|
|
+ (newVal) => {
|
|
|
+ console.log('newVal', newVal);
|
|
|
+ if (!newVal) {
|
|
|
+ fenceEditorRef.value?.clear();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // const rawLinePoints = newVal[0];
|
|
|
+
|
|
|
+ const rawLinePoints = newVal.map((x) => {
|
|
|
+ const points: number[] = [];
|
|
|
+ x.forEach((line) => {
|
|
|
+ points.push(line[0], line[1]);
|
|
|
+ });
|
|
|
+ return points;
|
|
|
+ });
|
|
|
+ if (!rawLinePoints) return;
|
|
|
+ /** 先清空原有的 */
|
|
|
+ fenceEditorRef.value?.clear();
|
|
|
+ fenceEditorRef.value?.createLines(rawLinePoints);
|
|
|
+ },
|
|
|
+ { immediate: true },
|
|
|
+ );
|
|
|
+
|
|
|
+ const handleAddPreset = () => {
|
|
|
+ addPresetModalVisible.value = true;
|
|
|
+ };
|
|
|
+
|
|
|
+ onMounted(() => {
|
|
|
+ getPresetList('dev_01_01');
|
|
|
+ });
|
|
|
</script>
|
|
|
<style scoped>
|
|
|
.cameraViewSettingWrapper {
|