forked from drone/command-center-dashboard

chenyao
2025-04-14 b0ccd2d131b2e3df5d901385e38ed0077b8d0fbc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!--当前任务详情-->
<template>
  <el-dialog
        modal-class="current-task-details"
        v-model="isShowCurrentTaskDetails"
        title="当前任务详情"
        :width="pxToRem(1500)"
        :close-on-click-modal="false"
        :destroy-on-close="true"
    @opened="handleDialogOpened">
        <div class="content-container">
      <!-- 视频直播 -->
      <div class="video-container">
        <LiveVideo />
      </div>
      <!-- 展示地图 -->
      <div id="CurrentTaskMap" class="map-container"></div>
    </div>
  </el-dialog>
</template>
 
<script setup>
import { pxToRem } from '@/utils/rem';
import LiveVideo from '@/components/LiveVideo.vue';
import { liveStart } from '@/api/home/machineNest';
import { getJobDetails } from '@/api/home/task';
import cesiumOperation from '@/utils/cesium-tsa';
import { useStore } from 'vuex';
 
import { initPointWayline } from './initPointWayline';
 
const { parsingFiles } = initPointWayline()
 
const { _init, viewerDestory } = cesiumOperation()
 
 
const isShowCurrentTaskDetails = defineModel('show');
const props = defineProps({
  rowData: { // 任务列表row数据
    type: Object,
    default: () => ({})
  }
});
 
// 获取直播地址
const getVideoUrl = () => {
  liveStart(props.rowData.deviceSns).then(res => {
    if (res.data.code !== 0) return;
    airPortUrl.value = res.data.data.rtcs_url;
  });
};
 
// 获取任务详情获取航线文件
const getTaskDetails = () => {
    getJobDetails({ wayLineJobInfoId: props.rowData.id }).then(res => {
        if (res.data.data.way_lines && res.data.data.way_lines.length === 1) {
      // console.log(window.$viewer,'顶顶顶顶')
      parsingFiles(res.data.data.way_lines[0].url, window.$viewer);
    }
    })
}
 
const handleDialogOpened = () => {
  nextTick(() => {
    _init('CurrentTaskMap');
  });
};
 
// 监听 rowData 变化
watch(() => props.rowData, (newVal) => {
  if (newVal && Object.keys(newVal).length) {
    // getVideoUrl();
    getTaskDetails();
  }
}, { deep: true, immediate: true });
 
onUnmounted(() => {
  viewerDestory();
});
 
onMounted(() => {
});
</script>
 
<style lang="scss" scoped>
.current-task-details {
  display: flex;
  justify-content: space-between;
  .content-container {
    display: flex;
    // gap: 20px;
    height: 600px;
    
    .video-container {
      width: 50%;
      padding-right: 10px;
    }
    
    .map-container {
      width: 50%;
      padding-left: 10px;
      height: 100%;
    }
  }
  #CurrentTaskMap {
    :deep() {
      .cesium-viewer {
        width: 100%;
        height: 100%;
        overflow: hidden;
 
        .cesium-viewer-cesiumWidgetContainer {
          width: 100%;
          height: 100%;
 
          .cesium-widget {
            width: 100%;
            height: 100%;
 
            canvas {
              width: 100%;
              height: 100%;
            }
          }
        }
      }
 
      .cesium-viewer-bottom {
        display: none;
      }
    }
  }
}
</style>