| | |
| | | minimumLevel: 3, |
| | | }) |
| | | const _init = async id => { |
| | | console.log(id,'顶顶顶') |
| | | Cesium.Camera.DEFAULT_VIEW_FACTOR = -0.45 |
| | | // 西南东北,默认显示中国 |
| | | Cesium.Camera.DEFAULT_VIEW_RECTANGLE = Cesium.Rectangle.fromDegrees(66, 4, 135, 53.55) |
| | |
| | | </div> |
| | | <div class="item">任务时间: |
| | | <el-time-picker |
| | | v-model="searchForm.execute_time_arr" |
| | | v-model="timeSlot" |
| | | placeholder="选择时间" |
| | | format="HH:mm" |
| | | value-format="HH:mm"/> |
| | |
| | | // 添加子组件引用 |
| | | const taskTableRef = ref(null); |
| | | const taskData = ref(''); |
| | | const timeSlot = ref(''); |
| | | const searchForm = reactive({ |
| | | name: '', |
| | | ai_types: [], |
| | |
| | | return; |
| | | } |
| | | // 检查任务时间 |
| | | if (searchForm.execute_time_arr) { |
| | | if (timeSlot.value) { |
| | | const now = new Date(); |
| | | const today = now.toDateString(); |
| | | const selectedDate = new Date(taskData.value).toDateString(); |
| | | |
| | | if (today === selectedDate) { |
| | | const [hours, minutes] = searchForm.execute_time_arr.split(':'); |
| | | const [hours, minutes] = timeSlot.value.split(':'); |
| | | const selectedTime = new Date(); |
| | | selectedTime.setHours(parseInt(hours), parseInt(minutes)); |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | if (searchForm.dock_sns.length === 0) { |
| | | ElMessage({ |
| | | message: '请选择机场', |
| | | type: 'warning' |
| | | }); |
| | | return; |
| | | } |
| | | searchForm.begin_time = `${taskData.value} 00:00:00`; |
| | | searchForm.end_time = `${taskData.value} 23:59:59`; |
| | | |
| | | searchForm.execute_time_arr = timeSlot.value ? [timeSlot.value] : []; |
| | | createTask(searchForm).then((res) => { |
| | | if (res.data.code === 0) { |
| | | ElMessage.success('任务创建成功'); |
| | | // 关闭当前窗口,刷新任务管理列表 |
| | | isShowAddTask.value = false; |
| | | // 清除数据 |
| | | cancel(); |
| | | emit('refresh'); |
| | | } |
| | | }); |
| | |
| | | searchForm.file_id = ''; |
| | | searchForm.begin_time = ''; |
| | | searchForm.end_time = ''; |
| | | searchForm.execute_time_arr = ''; |
| | | timeSlot.value = ''; |
| | | searchForm.remark = ''; |
| | | searchForm.dock_sns = []; |
| | | rangDate.value = []; |
| | |
| | | import cesiumOperation from '@/utils/cesium-tsa'; |
| | | import { useStore } from 'vuex'; |
| | | |
| | | import { initPointWayline } from './initPointWayline'; |
| | | |
| | | const { parsingFiles } = initPointWayline() |
| | | |
| | | const { _init, viewerDestory } = cesiumOperation() |
| | | const store = useStore(); |
| | | |
| | | |
| | | const isShowCurrentTaskDetails = defineModel('show'); |
| | | const props = defineProps({ |
| | |
| | | |
| | | // 获取直播地址 |
| | | const getVideoUrl = () => { |
| | | console.log(props.rowData, '当前任务详情'); |
| | | 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 => { |
| | | console.log(res.data.data, '顶顶顶'); |
| | | if (res.data.data.way_lines && res.data.data.way_lines.length === 1) { |
| | | const line = res.data.data.way_lines[0].url |
| | | // console.log(window.$viewer,'顶顶顶顶') |
| | | parsingFiles(res.data.data.way_lines[0].url, window.$viewer); |
| | | } |
| | | }) |
| | | } |
| | |
| | | // 监听 rowData 变化 |
| | | watch(() => props.rowData, (newVal) => { |
| | | if (newVal && Object.keys(newVal).length) { |
| | | getVideoUrl(); |
| | | // getVideoUrl(); |
| | | getTaskDetails(); |
| | | } |
| | | }, { deep: true, immediate: true }); |
| | |
| | | * |
| | | * @param { 单点航线 相关功能} url |
| | | */ |
| | | export const initPointWayline = (url) => { |
| | | export const initPointWayline = () => { |
| | | |
| | | let viewer = window.$viewer; |
| | | let viewer = null; |
| | | |
| | | |
| | | // 解析kmz文件 |
| | | const parsingFiles = async (url) => { |
| | | const { fileInfoObj } = analyzeKmzFile(`${url}?_t=${new Date().getTime()}`); |
| | | const xmlStr = fileInfoObj['wpmz/template.kml'] |
| | | const xmlJson = XMLToJSON(xmlStr)?.['Document'] |
| | | const parsingFiles = async (url,viewer) => { |
| | | viewer = viewer; |
| | | console.log('initPointWayline', viewer); |
| | | const res = await analyzeKmzFile(`${url}?_t=${new Date().getTime()}`) |
| | | const waylinesXML = await res.fileInfoObj['wpmz/waylines.wpml'] |
| | | const xmlJson = XMLToJSON(waylinesXML)?.['Document']; |
| | | if (xmlJson.Folder.Placemark.length) return; |
| | | drawWayline(xmlJson) |
| | | }; |
| | | // 在地图上画线 |
| | | const drawWayline = (xmlJson) => { |
| | | const points = xmlJson?.['Folder']?.['Placemark']; |
| | | let positions = []; |
| | | // 获取点的位置 |
| | | const points = xmlJson.Folder.Placemark; |
| | | console.log('points', points); |
| | | getPositionsHeight(points, viewer, 100).then((result) => { |
| | | console.log(result); |
| | | positions = result.map((item) => { |
| | | return Cesium.Cartesian3.fromDegrees( |
| | | Number(item.longitude), |
| | |
| | | }); |
| | | result.forEach((item, index) => { |
| | | let setting = {}; |
| | | setting = { |
| | | id: 'route_point_' + index, |
| | | position: positions[index], |
| | | |
| | | label: { |
| | | text: `${index + 1}`, |
| | | font: 'bold 14px serif', |
| | | style: globalCesium.LabelStyle.FILL, |
| | | verticalOrigin: globalCesium.VerticalOrigin.CENTER, // 垂直居中 |
| | | horizontalOrigin: globalCesium.HorizontalOrigin.CENTER, // 水平居中 |
| | | pixelOffset: new globalCesium.Cartesian2(0, 0), // 根据需要调整偏移量 |
| | | eyeOffset: new globalCesium.Cartesian3(0, 0, -10) // 使标签在点的上方 |
| | | }, |
| | | |
| | | point: { |
| | | pixelSize: 24, |
| | | color: new globalCesium.Color.fromBytes(255, 186, 0, 255), |
| | | }, |
| | | } |
| | | viewer.entities.add(setting) |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | return { parsingFiles }; |
| | | }; |