on-site-robots-screen/src/views/home/components/left-one.vue

194 lines
5.1 KiB
Vue
Raw Normal View History

2025-06-17 16:01:11 +08:00
<template>
<!-- 左侧盒子1 -->
<div class="left-one child-container">
<n-flex justify="space-between" v-if="isShowAllBtns">
2025-06-24 18:12:02 +08:00
<div class="btns" @click="onHandlePresetSetting" v-if="!fullScreenVisible">
预置位配置
</div>
<div class="btns" @click="onHandleInspectionTask" v-if="!fullScreenVisible">
巡视任务
</div>
2025-06-17 16:01:11 +08:00
<div class="btns" @click="onHandleOperationPanel" v-if="!fullScreenVisible">
操作面板
</div>
<div class="btns" @click="onHandleOpenFullScreen" v-if="!fullScreenVisible">
全屏控制
</div>
<!-- 返回 -->
<div class="back-btn" @click="onHandleBackFullScreen" v-if="fullScreenVisible">
<img src="@/assets/home-imgs/back-icon.png" />
返回
</div>
<div class="back-btn" @click="onHandleChangeView" v-if="fullScreenVisible">
视角切换
</div>
</n-flex>
<div class="video-container" :style="{ marginTop: isShowAllBtns ? '24px' : '0' }">
2025-06-24 18:12:02 +08:00
<FlvPlayer :cameraNode="cameraNode" :videoId="props.videoId" />
2025-06-17 16:01:11 +08:00
</div>
</div>
2025-06-24 18:12:02 +08:00
<!-- 预置位配置 -->
<n-modal v-model:show="presetSettingVisible">
<PresetSetting
v-if="showModal === 1"
@onHandleCloseModal="onHandleCloseModal"
:presetSettingVisible="presetSettingVisible"
/>
<InspectionTask
v-if="showModal === 2"
@onHandleCloseModal="onHandleCloseModal"
@onHandleAddInspectionTask="onHandleAddInspectionTask"
/>
</n-modal>
<!-- 新增巡视任务 -->
<n-modal v-model:show="addInspectionTaskVisible">
<AddOrEditForm
v-if="addInspectionTaskVisible"
@onHandleCloseModalInner="onHandleCloseModalInner"
/>
</n-modal>
2025-06-17 16:01:11 +08:00
</template>
<script setup>
import { ref } from 'vue'
2025-06-24 18:12:02 +08:00
import PresetSetting from './modal-content/preset-setting.vue'
import InspectionTask from './modal-content/inspection-task.vue'
import AddOrEditForm from './modal-content/add-or-edit-form.vue'
import FlvPlayer from '@/components/FlvPlayer/index.vue'
const presetSettingVisible = ref(false)
const addInspectionTaskVisible = ref(false)
const showModal = ref(1)
2025-06-17 16:01:11 +08:00
const props = defineProps({
fullScreenVisible: {
type: Boolean,
default: false,
},
isShowAllBtns: {
type: Boolean,
default: true,
},
2025-06-24 18:12:02 +08:00
cameraNode: {
type: Object,
default: () => {},
},
videoId: {
type: String,
default: 'video-1',
},
2025-06-17 16:01:11 +08:00
})
2025-06-24 18:12:02 +08:00
const emits = defineEmits([
'onHandleOperationPanel',
'onHandleFullScreen',
'onHandleFullScreenToggle',
'onHandleChangeView',
])
// 预置位配置
const onHandlePresetSetting = () => {
showModal.value = 1
presetSettingVisible.value = true
}
// 关闭预置位配置
const onHandleCloseModal = () => {
showModal.value = null
presetSettingVisible.value = false
}
// 巡视任务
const onHandleInspectionTask = () => {
showModal.value = 2
presetSettingVisible.value = true
}
// 新增巡视任务
const onHandleAddInspectionTask = () => {
addInspectionTaskVisible.value = true
}
// 关闭新增或修改巡视任务
const onHandleCloseModalInner = () => {
addInspectionTaskVisible.value = false
}
2025-06-17 16:01:11 +08:00
// 打开操作面板
const onHandleOperationPanel = () => {
emits('onHandleOperationPanel', true)
}
// 全屏控制
const onHandleOpenFullScreen = () => {
emits('onHandleFullScreenToggle', true)
}
// 退出全屏
const onHandleBackFullScreen = () => {
emits('onHandleFullScreenToggle', false)
}
// 视角切换
2025-06-24 18:12:02 +08:00
const onHandleChangeView = () => {
emits('onHandleChangeView')
}
2025-06-17 16:01:11 +08:00
</script>
<style lang="scss" scoped>
.left-one {
display: flex; /* 新增 */
flex-direction: column; /* 新增 */
height: 100%; /* 确保容器有高度 */
.btns {
2025-06-24 18:12:02 +08:00
// width: 90px;
padding: 0 10px;
height: 36px;
2025-06-17 16:01:11 +08:00
background: url('@/assets/home-imgs/button-bg.png') no-repeat center center;
background-size: 100% 100%;
2025-06-24 18:12:02 +08:00
line-height: 36px;
2025-06-17 16:01:11 +08:00
text-align: center;
2025-06-24 18:12:02 +08:00
font-size: 12px;
2025-06-17 16:01:11 +08:00
cursor: pointer;
}
.back-btn {
width: 140px;
height: 32px;
background: url('@/assets/home-imgs/back-btn.png') no-repeat center center;
background-size: 100% 100%;
line-height: 32px;
text-align: center;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
img {
width: 14px;
height: 14px;
margin-right: 4px;
}
}
> .video-container {
flex: 1; /* 占据剩余空间 */
min-height: 0; /* 关键:允许内容压缩 */
position: relative; /* 新增 */
video {
position: absolute; /* 新增 */
top: 0;
left: 0;
object-fit: cover; /* 保持视频比例 */
}
}
}
</style>