From b1a6ae289775ce53cc2b5c60afcb107652ed86ba Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 09 Feb 2026 11:00:53 +0800
Subject: [PATCH] feat:反无无用文件移除
---
/dev/null | 235 ---------------------------------------
applications/drone-command/src/main.js | 4
applications/drone-command/src/utils/cesium/publicCesium.js | 33 -----
applications/drone-command/env/.env.development | 2
applications/drone-command/src/router/views/index.js | 27 ----
5 files changed, 4 insertions(+), 297 deletions(-)
diff --git a/applications/drone-command/env/.env.development b/applications/drone-command/env/.env.development
index 08ba807..5e01e67 100644
--- a/applications/drone-command/env/.env.development
+++ b/applications/drone-command/env/.env.development
@@ -16,7 +16,7 @@
#开发环境代理地址(推荐本地新建文件 .env.development.local 来进行覆盖)
# VITE_APP_URL=https://wrj.shuixiongit.com/api
-VITE_APP_URL=http://192.168.1.33
+VITE_APP_URL=http://192.168.1.168
# 域名
VITE_APP_AREA_NAME=https://wrj.shuixiongit.com
diff --git a/applications/drone-command/src/components/PlaybackVideo/PlaybackVideo.vue b/applications/drone-command/src/components/PlaybackVideo/PlaybackVideo.vue
deleted file mode 100644
index 1298234..0000000
--- a/applications/drone-command/src/components/PlaybackVideo/PlaybackVideo.vue
+++ /dev/null
@@ -1,141 +0,0 @@
-<template>
- <el-dialog
- class="command-dialog-video playback-dialog"
- v-model="isShow"
- append-to-body
- :close-on-click-modal="false"
- :destroy-on-close="true"
- :show-close="false"
- >
- <template #header>
- <div class="title">视频回放</div>
-
- <div class="close" @click="isShow = false"></div>
- </template>
-
- <div v-loading="loading" element-loading-background="rgba(0, 0, 0, 0.7)">
- <div class="mpa-container">
- <MapContainer ref="mapContainerEle" />
- </div>
-
- <div class="video-player-container">
- <VideoPlayer ref="videoPlayerEle" />
- </div>
-
- <div v-show="photoEleShow" class="photo-list-container">
- <PhotoList ref="photoListEle" />
- </div>
- </div>
- </el-dialog>
-</template>
-
-<script setup>
-import PhotoList from '@/components/PlaybackVideo/components/PhotoList.vue'
-import VideoPlayer from '@/components/PlaybackVideo/components/VideoPlayer.vue'
-import MapContainer from '@/components/PlaybackVideo/components/MapContainer.vue'
-import { getWaylinejobLiveRecordPage, findFlightLogInfoByJobId, aiImagesPage } from '@/api/playback/'
-const isShow = defineModel('show', {
- type: Boolean,
- default: true,
-})
-
-const detailData = defineModel('detailData', {
- type: Object,
- default: () => ({}),
-})
-
-const props = defineProps(['detailsData'])
-
-const loading = ref(true)
-const photoEleShow = ref(false)
-
-const positionData = ref(null)
-const attachmentData = ref(null)
-
-const mapContainerEle = ref(null)
-const videoPlayerEle = ref(null)
-const photoListEle = ref(null)
-
-const jobId = inject('jobId')
-
-provide('videoData', detailData)
-provide('positionData', positionData)
-provide('attachmentData', attachmentData)
-
-watch(isShow, newVal => {
- if (newVal) {
- init()
- }
-})
-
-const init = async () => {
- loading.value = true
- await nextTick()
-
- Promise.all([
- findFlightLogInfoByJobId({ jobId: jobId.value }),
- aiImagesPage({ size: 30, current: 1 }, { size: 30, current: 1, wayLineJobId: jobId.value, resultTypes: [0, 2] }),
- ]).then(([positionDetails, attachmentDetails]) => {
- let arr = positionDetails.data.data.filter(item => {
- return item.create_time >= detailData.value.start_time && item.create_time <= detailData.value.end_time
- })
-
- positionData.value = arr.sort((a, b) => a.create_time - b.create_time)
-
- attachmentData.value =
- attachmentDetails.data.data.records
- .filter(item => {
- return (
- item.metadata.createdTime >= detailData.value.start_time &&
- item.metadata.createdTime <= detailData.value.end_time
- )
- })
- .map(item => ({
- ...item,
- metadata: {
- ...item.metadata,
- createdTime: item.metadata.createdTime,
- },
- })) || []
-
- photoEleShow.value = attachmentData.value.length > 0
-
- videoPlayerEle.value.init(detailData.value, attachmentData.value)
- mapContainerEle.value.init(positionData.value, props.detailsData, props.taskData)
- photoListEle.value.init(detailData.value, attachmentData.value)
-
- loading.value = false
- })
-}
-</script>
-
-<style lang="scss" scoped>
-.mpa-container {
- position: absolute;
- top: 58px;
- left: 10px;
- width: 338px;
- height: 206px;
- z-index: 1;
- border-radius: 8px;
- overflow: hidden;
-}
-
-.video-player-container {
- width: 100%;
- height: 100%;
-}
-
-.photo-list-container {
- position: absolute;
- top: 58px;
- right: 10px;
- width: 338px;
- height: calc(100% - 116px);
- z-index: 1;
- border-radius: 8px;
- background: rgba(2, 2, 2, 0.6);
- overflow: hidden;
- backdrop-filter: blur(13.7px);
-}
-</style>
diff --git a/applications/drone-command/src/components/PlaybackVideo/components/MapContainer.vue b/applications/drone-command/src/components/PlaybackVideo/components/MapContainer.vue
deleted file mode 100644
index 033a347..0000000
--- a/applications/drone-command/src/components/PlaybackVideo/components/MapContainer.vue
+++ /dev/null
@@ -1,227 +0,0 @@
-<template>
- <div class="command-cesium map-box" id="map">
- <PlanarRouteLineList
- :curRouteLineData="curRouteLineData"
- @routeLineListClick="routeLineListClick"
- :customClass="'airline-list'"
- />
- </div>
-</template>
-
-<script setup>
-import _ from 'lodash'
-import { useRouteLine } from '@/hooks/useRouteLine/useRouteLine.js'
-// import { getWaylineSplitApi } from '@/api/routePlan'
-
-import PlanarRouteLineList from '@/components/PlanarRouteLineList/PlanarRouteLineList.vue'
-
-import { flyVisual } from '@ztzf/utils'
-
-import * as Cesium from 'cesium'
-import { PublicCesium } from '@/utils/cesium/publicCesium'
-import { ArrowLineMaterialProperty } from '@/utils/cesium/Material'
-import aircraftGltf from '@/assets/gltf/aircraft.gltf'
-import EventBus from '@/utils/eventBus'
-
-// 加载航线hook
-const {
- curRouteLineData,
- routeLineListClick,
- initViewer,
- renderPreviewLine,
- removePreviewLine,
- resetCurRouteLineData,
- renderDroneRouteLine,
-} = useRouteLine()
-
-let viewer = null
-let publicCesiumInstance = null
-
-const initMap = () => {
- publicCesiumInstance = new PublicCesium({
- dom: 'map',
- terrain: true,
- flatMode: false,
- layerMode: 4,
- contour: true,
- })
-
- viewer = publicCesiumInstance.getViewer()
- viewer.scene.globe.depthTestAgainstTerrain = true
-
- initViewer(viewer)
-}
-
-// 绘制线和飞行
-const drawLine = async detailsData => {
- detailsData.way_lines.forEach(async item => {
- // if (item.is_split) {
- // getWaylineSplitApi(item.workspace_id).then(async res => {
- // // 大航线拆分
- // let result = res.data.data
- // littleFileLine.value = result.wayline_file_list
- // let bigPolygonList = await renderPreviewLine(
- // import.meta.env.VITE_APP_AIRLINE_URL + result.object_key,
- // result.wayline_type,
- // result.wayline_file_list
- // )
- // emit('wayLineFileSelected', bigPolygonList)
- // })
- // } else {
- await renderPreviewLine(item.url, item.wayline_type)
- // }
- })
-}
-
-let arrowLineMaterialProperty = new ArrowLineMaterialProperty({
- color: new Cesium.Color(128 / 255, 215 / 255, 255 / 255, 1),
- directionColor: new Cesium.Color(1, 1, 1, 1),
- outlineColor: new Cesium.Color(1, 1, 1, 1),
- outlineWidth: 0,
- speed: 5,
-})
-
-let droneEntity = null
-let planarRouteEntity = null
-let sampledPosition
-
-const initPlanarRoute = data => {
- flyVisual({ positionsData: data.map(i => [i.longitude, i.latitude, i.height]), viewer, multiple: 3.2 })
-
- if (planarRouteEntity) {
- viewer.entities.remove(planarRouteEntity)
- planarRouteEntity = null
- }
-
- planarRouteEntity = viewer.entities.add({
- polyline: {
- width: 4,
- positions: data.map(i =>
- Cesium.Cartesian3.fromDegrees(Number(i.longitude), Number(i.latitude), Number(i.height))
- ),
- material: arrowLineMaterialProperty,
- clampToGround: false,
- },
- })
-}
-
-let startJulian = null
-let endJulian = null
-
-const init = async (positionData, detailsData) => {
- await nextTick()
-
- if (!viewer) initMap()
-
- resetCurRouteLineData()
- removePreviewLine()
-
- drawLine(detailsData)
-
- // initPlanarRoute(positionData)
-
- // sampledPosition = new Cesium.SampledPositionProperty()
- // positionData.forEach(item => {
- // const time = toJulianDate(item.create_time)
- // const pos = Cesium.Cartesian3.fromDegrees(item.longitude, item.latitude, item.height)
- // sampledPosition.addSample(time, pos)
- // })
-
- // // 3️⃣ 设置 Clock
- // startJulian = toJulianDate(positionData[0].create_time)
- // endJulian = toJulianDate(positionData[positionData.length - 1].create_time)
- // viewer.clock.startTime = startJulian.clone()
- // viewer.clock.stopTime = endJulian.clone()
- // viewer.clock.currentTime = startJulian.clone()
- // viewer.clock.multiplier = 1
- // viewer.clock.shouldAnimate = false
- // viewer.clock.clockRange = Cesium.ClockRange.CLAMPED
-
- // if (droneEntity) {
- // viewer.entities.remove(droneEntity)
- // droneEntity = null
- // }
-
- // droneEntity = viewer.entities.add({
- // availability: new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({ start: startJulian, stop: endJulian })]),
- // position: sampledPosition,
- // model: {
- // uri: aircraftGltf, //注意entitits.add方式加载gltf文件时,这里是uri,不是url,并且这种方式只能加载.glb格式的文件
- // scale: 1, //缩放比例
- // minimumPixelSize: 64, //最小像素大小,可以避免太小看不见
- // maximumScale: 128,
- // },
- // })
-}
-
-// ========== 播放/暂停/倍速/重播 控制 ==========
-const mapAnimationPlay = () => {
- if (!viewer) return
- viewer.clock.shouldAnimate = true
-}
-
-const mapAnimationPause = () => {
- if (!viewer) return
- viewer.clock.shouldAnimate = false
-}
-
-const mapAnimationSetSpeed = speed => {
- if (!viewer) return
- viewer.clock.multiplier = speed
-}
-
-const mapAnimationReplay = () => {
- if (!viewer) return
- viewer.clock.currentTime = startJulian.clone()
- viewer.clock.shouldAnimate = true
-}
-
-// 传入一个时间,跳转到该时间点
-const mapAnimationSetCurrentTime = time => {
- if (!viewer) return
- // 支持传入 Date 或毫秒数
- let julian = toJulianDate(time)
-
- viewer.clock.currentTime = julian
- // 如果希望暂停时也能直接跳过去:强制暂停后更新
- // viewer.clock.shouldAnimate = false
-}
-
-// 转换函数:毫秒 → JulianDate
-function toJulianDate(ms) {
- return Cesium.JulianDate.fromDate(new Date(ms))
-}
-
-onMounted(() => {
- // EventBus.on('mapAnimationPlay', mapAnimationPlay)
- // EventBus.on('mapAnimationPause', mapAnimationPause)
- // EventBus.on('mapAnimationSetSpeed', mapAnimationSetSpeed)
- // EventBus.on('mapAnimationReplay', mapAnimationReplay)
- // EventBus.on('mapAnimationSetCurrentTime', mapAnimationSetCurrentTime)
-})
-
-onBeforeUnmount(() => {
- droneEntity && viewer.entities.remove(droneEntity)
- droneEntity = null
- viewer?.entities?.removeAll()
- publicCesiumInstance?.viewerDestroy()
- publicCesiumInstance = null
- viewer = null
- // EventBus.off('mapAnimationPlay', mapAnimationPlay)
- // EventBus.off('mapAnimationPause', mapAnimationPause)
- // EventBus.off('mapAnimationSetSpeed', mapAnimationSetSpeed)
- // EventBus.off('mapAnimationReplay', mapAnimationReplay)
- // EventBus.off('mapAnimationSetCurrentTime', mapAnimationSetCurrentTime)
-})
-
-defineExpose({
- init,
-})
-</script>
-
-<style lang="scss" scoped>
-.map-box {
- width: 100%;
- height: 100%;
-}
-</style>
diff --git a/applications/drone-command/src/components/PlaybackVideo/components/PhotoList.vue b/applications/drone-command/src/components/PlaybackVideo/components/PhotoList.vue
deleted file mode 100644
index 4b1eefc..0000000
--- a/applications/drone-command/src/components/PlaybackVideo/components/PhotoList.vue
+++ /dev/null
@@ -1,187 +0,0 @@
-<template>
- <div class="photo-container">
- <div class="photo-statistics">
- <div class="label">事件照片</div>
- <div class="num">{{ eventsPhotoArr.length }}</div>
- </div>
- <div class="photo-statistics">
- <div class="label">照片总数</div>
- <div class="num">{{ allPhotoArr.length }}</div>
- </div>
- <div class="list-box">
- <div class="item" v-for="(item, ind) in allPhotoArr" :key="ind">
- <el-image
- style="width: 100%; height: 100%"
- :src="item.smallUrl"
- :preview-src-list="[item.showUrl]"
- fit="cover"
- preview-teleported
- ></el-image>
-
- <div class="bottom-box">
- <div class="time">{{ item.metadata.createdTime }}</div>
-
- <div
- class="status"
- :class="EVENT_STATUS_CLASSES[item.status]"
- v-if="EVENT_STATUS_CLASSES[item.status]"
- >
- {{ EVENT_STATUS_LABELS[item.status] }}
- </div>
- </div>
- </div>
- </div>
- </div>
-</template>
-
-<script setup>
-import { getShowImg, getSmallImg } from '@/utils/util'
-import { EVENT_STATUS_LABELS, EVENT_STATUS_CLASSES } from '@ztzf/constants'
-
-const eventsPhotoArr = ref([])
-const allPhotoArr = ref([])
-
-const init = async (vData, pData) => {
- await nextTick()
-
- allPhotoArr.value = pData.map(item => ({
- ...item,
- showUrl: getShowImg(item.link),
- smallUrl: getSmallImg(item.link),
- metadata: {
- ...item.metadata,
- createdTime: formatTimeDiff(item.metadata.createdTime, vData.start_time),
- },
- }))
- eventsPhotoArr.value = pData.filter(item => item.resultType === 2) || []
-}
-
-defineExpose({
- init,
-})
-
-function formatTimeDiff(timestamp1, timestamp2) {
- // 计算差值(毫秒)
- const diffMs = Math.abs(timestamp1 - timestamp2)
-
- // 转换为秒
- const totalSeconds = Math.floor(diffMs / 1000)
-
- // 计算小时、分钟、秒
- const hours = Math.floor(totalSeconds / 3600)
- const minutes = Math.floor((totalSeconds % 3600) / 60)
- const seconds = totalSeconds % 60
-
- // 格式化为两位数
- const pad = num => num.toString().padStart(2, '0')
-
- // 根据是否有小时决定格式
- if (hours > 0) {
- return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`
- } else {
- return `${pad(minutes)}:${pad(seconds)}`
- }
-}
-</script>
-
-<style lang="scss" scoped>
-.photo-container {
- padding: 0 16px 16px;
- display: flex;
- flex-direction: column;
- width: 100%;
- height: 100%;
- color: #fff;
- font-family: Source Han Sans CN, Source Han Sans CN;
- font-weight: 400;
- font-size: 14px;
- font-style: normal;
- text-transform: none;
-
- .photo-statistics {
- display: flex;
- align-items: center;
- justify-content: space-between;
- line-height: 44px;
- border-bottom: 1px solid rgba(255, 255, 255, 0.11);
- padding: 0 30px; // 添加内边距让内容有间距
- box-sizing: border-box; // 确保边框包含在宽度内
- border-radius: 4px; // 添加圆角让边框更明显
- background: rgba(0, 0, 0, 0.3); // 添加背景色让边框更清晰
-
- .num {
- color: #ff974d;
- }
- }
-
- .list-box {
- margin-top: 16px;
- height: 0;
- flex: 1;
- overflow: hidden;
- overflow-y: auto;
-
- .item {
- margin-top: 10px;
- position: relative;
- width: 100%;
- height: 190px;
- background: #ff974d;
- border-radius: 8px 8px 8px 8px;
- overflow: hidden;
-
- &:first-child {
- margin-top: 0;
- }
-
- .bottom-box {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 12px;
- position: absolute;
- bottom: 0;
- width: 100%;
- height: 32px;
- width: 305px;
- background: rgba(20, 18, 18, 0.8);
- border-radius: 0 0 8px 8px;
-
- .status {
- padding: 0 8px;
- line-height: 24px;
- border-radius: 4px 4px 4px 4px;
- font-family: Source Han Sans CN, Source Han Sans CN;
- font-weight: 400;
- font-size: 14px;
- color: #ffffff;
- text-align: center;
- font-style: normal;
- text-transform: none;
- }
-
- // 待处理
- .pending {
- background: #ff7411;
- }
- // 待审核
- .reviewed {
- background: #ff472f;
- }
- // 处理中
- .processing {
- background: #ffff61;
- }
- // 已完成
- .done {
- background: #06d957;
- }
- // 已完结
- .ended {
- background: #06d957;
- }
- }
- }
- }
-}
-</style>
diff --git a/applications/drone-command/src/components/PlaybackVideo/components/VideoPlayer.vue b/applications/drone-command/src/components/PlaybackVideo/components/VideoPlayer.vue
deleted file mode 100644
index 1e2a700..0000000
--- a/applications/drone-command/src/components/PlaybackVideo/components/VideoPlayer.vue
+++ /dev/null
@@ -1,170 +0,0 @@
-<template>
- <video ref="videoEle" class="video-js video-container"></video>
-</template>
-
-<script setup>
-// import videoSrc from '@/assets/mp4/DJI_20250917140642_0001_V.mp4'
-import { inputEmits } from 'element-plus'
-import videojs from 'video.js'
-import zhCN from 'video.js/dist/lang/zh-CN.json'
-// 添加中文语言支持
-videojs.addLanguage('zh-CN', zhCN)
-import 'videojs-markers'
-import EventBus from '@/utils/eventBus'
-
-const videoEle = ref(null)
-
-let player = null
-
-const videoData = inject('videoData')
-
-const init = async (vData, pData) => {
- await nextTick()
-
- if (!player) {
- player = videojs(videoEle.value, {
- html5: {
- preload: 'auto', // 可选值:'auto', 'metadata', 'none'
- },
- controls: true, // 启用默认控件
- playbackRates: [0.5, 1, 1.5, 2],
- })
- }
-
- player.src(vData.play_url)
-
- player.on('play', play)
-
- player.on('pause', pause)
-
- player.on('ratechange', ratechange)
-
- player.on('error', error)
-
- player.controlBar.playToggle.on('click', click)
-
- player.on('seeked', seeked)
-
- console.log(pData, vData, 1)
-
- pData.length > 0 &&
- player.markers({
- showTime: false,
- showTooltips: true,
- markerStyle: {
- 'width': '6px',
- 'background-color': 'red',
- },
- markerTip: {
- display: false,
- },
- onMarkerClick: marker => {
- console.log(`点击了标记:${marker.text}`)
- },
- onMarkerReached: marker => {
- console.log(`到达标记:${marker.text}`)
- },
-
- markers: pData.map((item, ind) => {
- let className = 'ended'
-
- switch (item.status) {
- case 0:
- className = 'pending'
- break
-
- case 2:
- className = 'reviewed'
- break
-
- case 3:
- className = 'processing'
- break
-
- case 4:
- className = 'done'
- break
-
- case 5:
- className = 'ended'
- break
-
- default:
- className = 'noneEvent'
- break
- }
-
- return {
- time: getTimestampDiffInSeconds(item.metadata.createdTime, vData.start_time), // 标记时间,单位为秒
- class: className,
- }
- }),
- })
-}
-
-function play() {
- console.log('播放按钮被点击')
- // EventBus.emit('mapAnimationPlay')
-}
-
-function pause() {
- console.log('暂停按钮被点击')
- // EventBus.emit('mapAnimationPause')
-}
-
-function ratechange() {
- console.log('播放速率已改变,当前速率: ' + player.playbackRate())
- // EventBus.emit('mapAnimationSetSpeed', player.playbackRate())
-}
-
-let retryCount = 0
-const maxRetries = 3
-function error() {
- if (player.error().code === 2 && retryCount < maxRetries) {
- retryCount++
- console.log(`尝试重新加载 (${retryCount}/${maxRetries})`)
- setTimeout(() => player.src(player.currentSrc()), 2000)
- }
-}
-
-function click() {
- if (player.hasClass('vjs-ended')) {
- console.log('重播按钮被点击')
- // 执行重播相关操作
- // EventBus.emit('mapAnimationReplay')
- }
-}
-
-function seeked() {
- const time = player.currentTime() * 1000 + videoData.value.videoStartTime
-
- // EventBus.emit('mapAnimationSetCurrentTime', time)
-}
-
-onBeforeUnmount(() => {
- if (player) {
- player.dispose()
- }
-})
-
-defineExpose({
- init,
-})
-
-function getTimestampDiffInSeconds(timestamp1, timestamp2) {
- // 计算两个时间戳的绝对差值(毫秒)
- const diffInMilliseconds = Math.abs(timestamp1 - timestamp2)
-
- // 将毫秒转换为秒
- const diffInSeconds = diffInMilliseconds / 1000
-
- return diffInSeconds
-}
-</script>
-
-<style lang="scss" scoped>
-.video-container {
- width: 100%;
- height: 100%;
-}
-</style>
diff --git a/applications/drone-command/src/components/map-container/mapContainer-copy.vue b/applications/drone-command/src/components/map-container/mapContainer-copy.vue
deleted file mode 100644
index 66d1b89..0000000
--- a/applications/drone-command/src/components/map-container/mapContainer-copy.vue
+++ /dev/null
@@ -1,264 +0,0 @@
-<!--
- * @Author: shuishen 1109946754@qq.com
- * @Date: 2024-10-25 15:07:51
- * @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2025-04-28 11:34:40
- * @FilePath: \drone-command\src\components\map-container\mapContainer.vue
- * @Description:
- *
- * Copyright (c) 2024 by shuishen, All Rights Reserved.
--->
-<template>
- <div class="map-container">
- <div class="viewer-container" id="viewer-container">
- <div class="content">
- <slot name="content"></slot>
- </div>
- </div>
- </div>
-</template>
-
-<script setup>
-import * as turf from '@turf/turf'
-
-import { nextTick, onMounted, onUnmounted } from 'vue'
-import { read } from 'xlsx'
-
-import startPng from '@/assets/map_images/Startingpointicon.png'
-import endPng from '@/assets/map_images/EndPointicon.png'
-
-window.$viewer = null
-window.$Cesium = null
-let pointLayer = null
-let polylineLayer = null
-let pointHtmlLayer = null
-
-const { VITE_APP_BASE } = import.meta.env
-// import * as Cesium from 'cesium'
-// import 'cesium/Build/Cesium/Widgets/widgets.css'
-const isViewerReady = ref(false)
-const { rowDetails } = defineProps({
- rowDetails: {
- type: Object,
- default: () => ({}),
- }
-})
-
-
-async function initMap () {
- if (window.$viewer) return
-
- await DC.ready({
- // Cesium: Cesium,
- baseUrl: `${VITE_APP_BASE}/libs/dc-sdk/resources/`,
- })
-
- window.$Cesium = DC.getLib('Cesium')
-
- // 天地图地图
- const imageryProvider_standZh = new window.$Cesium.UrlTemplateImageryProvider({
- url: 'https://t{s}.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=e45274b0235bb913eceb393aabbf9c9c',
- subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
- maximumLevel: 18,
- credit: 'stand_zj',
- })
- const imageryProvider_stand = new window.$Cesium.UrlTemplateImageryProvider({
- url: 'https://t{s}.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=e45274b0235bb913eceb393aabbf9c9c',
- subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
- // format: 'image/jpeg',
- // show: true,
- maximumLevel: 18,
- credit: 'stand_tc',
- })
-
- window.$viewer = new DC.Viewer('viewer-container', {
- "sceneMode": 2 //1: 2.5D,2: 2D,3: 3D
- })
-
- window.$viewer.locationBar.enable = false
-
- window.$viewer?.zoomToPosition(new DC.Position(115.892151, 28.676493, 1000000, 0, -90, 0))
-
- window.$viewer?.imageryLayers.addImageryProvider(imageryProvider_stand)
- window.$viewer?.imageryLayers.addImageryProvider(imageryProvider_standZh)
-
- pointLayer = new DC.VectorLayer('pointLayer')
- window.$viewer?.addLayer(pointLayer)
- polylineLayer = new DC.VectorLayer('polylineLayer')
- window.$viewer?.addLayer(polylineLayer)
- pointHtmlLayer = new DC.HtmlLayer('pointHtmlLayer')
- window.$viewer?.addLayer(pointHtmlLayer)
-
- isViewerReady.value = true
-}
-
-/**
-* 初始化标注添加
-* @param type 类型
-* @param data 数据
-*/
-const initAddEntity = (type, data) => {
- watch(() => isViewerReady.value,
- (ready) => {
- if (ready) {
- type === 'point' ? addPoint(data) : addPolyline(data)
- }
- },
- { deep: true, immediate: true } // 初始化时立即执行
- )
-}
-
-/**
-* 添加点标注
-* @param data 数据 数据格式 [lng, lat]
-*/
-function addPoint (data) {
- if (pointLayer) pointLayer.clear()
-
- const [lng, lat] = data
-
- if (!lng || !lat) return
-
- let point = new DC.Point(new DC.Position(lng, lat))
- pointLayer.addOverlay(point)
-
- window.$viewer?.zoomTo(pointLayer)
-}
-
-/**
-* 添加点标注
-* @param data 数据 数据格式 [[lng, lat], [lng, lat], [lng, lat]]
-*/
-function addPolyline (data) {
- if (polylineLayer) polylineLayer.clear()
- if (pointHtmlLayer) pointHtmlLayer.clear()
-
- if (data.length === 0) return
-
- const positionStr = data.map(item => {
- const [lng, lat] = item
-
- return `${lng}, ${lat}`
- }).join(';')
-
- let polyline = new DC.Polyline(positionStr)
- polyline.setStyle({
- width: 4,
- material: new DC.PolylineTrailMaterialProperty({
- color: DC.Color.DEEPSKYBLUE,
- speed: 10
- }),
- clampToGround: true
- })
- polylineLayer.addOverlay(polyline)
-
-
- data.forEach((item, index) => {
- const [lng, lat] = item
- let position = new DC.Position(lng, lat)
-
- console.log(lng, lat)
- let billboard = null
-
- if (index === 0) {
- billboard = new DC.Billboard(position, startPng)
- }
-
- if (index === data.length - 1) {
- billboard = new DC.Billboard(position, endPng)
- }
-
-
- billboard && (billboard.size = [20, 20])
- billboard && (billboard.setStyle({
- "pixelOffset": { "x": 0, "y": -8 }
- }))
- billboard && polylineLayer.addOverlay(billboard)
-
- if (index !== 0 && index !== data.length - 1) {
- let divIcon = new DC.DivIcon(
- position,
- `<div class="point-icon-box">${index}</div>`
- )
- pointHtmlLayer.addOverlay(divIcon)
- }
- })
-
- const line = turf.lineString(positionStr.split(';').map(i => i.split(',')))
- const bbox = turf.bbox(line)
- const bboxPolygon = turf.bboxPolygon(bbox)
- const scaledPolygon = turf.transformScale(bboxPolygon, 3)
- const newBbox = turf.bbox(scaledPolygon)
-
- window.$viewer?.flyToBounds(
- newBbox,
- { heading: 0, pitch: -90, roll: 0 },
- () => { },
- 0
- )
-}
-
-onMounted(() => {
- nextTick(() => {
- initMap()
- })
-})
-
-onUnmounted(() => {
- if (pointLayer) {
- window.$viewer?.removeLayer(pointLayer)
- pointLayer = null
- }
-
- if (polylineLayer) {
- window.$viewer?.removeLayer(polylineLayer)
- polylineLayer = null
- }
-
- window.$viewer?.entities.removeAll()
- window.$viewer?.imageryLayers.removeAll()
- window.$viewer?.dataSources.removeAll()
- let gl = window.$viewer.scene.context._originalGLContext
- gl.canvas.width = 1
- gl.canvas.height = 1
-
- window.$viewer && window.$viewer.setTerrain()
- window.$viewer && window.$viewer.destroy()
- window.$viewer = null
- delete window.$viewer
- window.$Cesium = null
- delete window.$Cesium
- var cesiumContainer = document.getElementById('viewer-container')
- if (cesiumContainer) {
- cesiumContainer.remove() // 移除与地图相关的DOM元素
- }
-})
-
-defineExpose({
- initAddEntity
-})
-</script>
-
-<script>
-export default {
- name: 'MapContainer'
-}
-</script>
-
-<style lang="scss" scoped>
-.map-container {
- position: relative;
- width: 100% !important;
- height: 100% !important;
- overflow: hidden;
-}
-
-.viewer-container {
- position: absolute;
- top: 50%;
- left: 50%;
- width: 120%;
- height: 120%;
- transform: translate(-50%, -50%);
-}
-</style>
diff --git a/applications/drone-command/src/components/map-container/mapContainer.vue b/applications/drone-command/src/components/map-container/mapContainer.vue
deleted file mode 100644
index c9c6ae3..0000000
--- a/applications/drone-command/src/components/map-container/mapContainer.vue
+++ /dev/null
@@ -1,172 +0,0 @@
-<!--
- * @Author: shuishen 1109946754@qq.com
- * @Date: 2024-10-25 15:07:51
- * @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2025-04-28 11:34:40
- * @FilePath: \drone-command\src\components\map-container\mapContainer.vue
- * @Description:
- *
- * Copyright (c) 2024 by shuishen, All Rights Reserved.
--->
-<template>
- <div class="map-container">
- <div class="viewer-container command-cesium" id="viewer-container">
- <div class="content">
- <slot name="content"></slot>
- </div>
-
- <PlanarRouteLineList
- :curRouteLineData="curRouteLineData"
- @routeLineListClick="routeLineListClick"
- />
- </div>
- </div>
-</template>
-
-<script setup>
-import PlanarRouteLineList from '@/components/PlanarRouteLineList/PlanarRouteLineList.vue';
-
-import * as Cesium from 'cesium';
-import { Cartesian3, Terrain, Viewer } from 'cesium';
-import { PublicCesium } from '@/utils/cesium/publicCesium';
-import ImageTrailMaterial from '@/utils/cesium/ImageTrailMaterial';
-import { flyVisual } from '@ztzf/utils';
-import * as turf from '@turf/turf';
-
-import { nextTick, onBeforeUnmount, onMounted, onUnmounted } from 'vue';
-import { read } from 'xlsx';
-
-import startPng from '@/assets/map_images/Startingpointicon.png';
-import endPng from '@/assets/map_images/EndPointicon.png';
-import rwqfdImg from '@/assets/images/task/arrow-right-blue.png';
-import newNumPoint from '@/assets/images/task/custom-point.png';
-
-import { useRouteLine } from '@/hooks/useRouteLine/useRouteLine.js';
-const viewInstance = shallowRef(null);
-// 加载航线hook
-const { curRouteLineData, routeLineListClick, initViewer, renderPreviewLine } = useRouteLine();
-
-let publicCesiumInstance = null;
-let viewer = null;
-
-const { VITE_APP_BASE } = import.meta.env;
-// import * as Cesium from 'cesium'
-// import 'cesium/Build/Cesium/Widgets/widgets.css'
-const isViewerReady = ref(false);
-const { rowDetails } = defineProps({
- rowDetails: {
- type: Object,
- default: () => ({}),
- },
-});
-
-async function initMap() {
- if (viewer) return;
- publicCesiumInstance = new PublicCesium({ dom: 'viewer-container', layerMode: 4 });
- viewer = publicCesiumInstance.getViewer();
- viewInstance.value = publicCesiumInstance;
- initViewer(viewer);
- isViewerReady.value = true;
-}
-
-/**
- * 初始化标注添加
- * @param type 类型
- * @param data 数据
- */
-const initAddEntity = (type, data) => {
- watch(
- () => isViewerReady.value,
- ready => {
- if (ready) {
- viewer.entities.removeAll();
- if (type === 'initPosition') {
- viewInstance.value?.flyToContour();
- } else {
- type === 'point' ? addPoint(data) : addPolyline(data);
- }
- }
- },
- { deep: true, immediate: true } // 初始化时立即执行
- );
-};
-
-/**
- * 添加点标注
- * @param data 数据 数据格式 [lng, lat]
- */
-function addPoint(data) {
- const [lng, lat] = data;
-
- if (!lng || !lat) return;
-
- viewer.entities.add({
- position: Cartesian3.fromDegrees(lng, lat),
- point: {
- pixelSize: 10,
- color: Cesium.Color.BLUE,
- outlineColor: Cesium.Color.WHITE,
- outlineWidth: 2,
- },
- });
-
- // 定位到点位
- const points = [[lng, lat]]; // 确保格式为二维数组
- flyVisual({ positionsData: points, viewer, multiple: 10 });
-}
-
-/**
- * 添加点标注
- * @param data 数据 数据格式 [[lng, lat], [lng, lat], [lng, lat]]
- */
-async function addPolyline(data) {
- await renderPreviewLine(data.url, data.type, data.cb, data.infos);
-}
-
-const getViewer = () => viewer;
-
-onMounted(() => {
- nextTick(() => {
- initMap();
- });
-});
-
-onBeforeUnmount(() => {
- var cesiumContainer = document.getElementById('viewer-container');
- if (cesiumContainer) {
- cesiumContainer.remove(); // 移除与地图相关的DOM元素
- }
-
- viewer.entities.removeAll();
- publicCesiumInstance.viewerDestroy();
- viewer = null;
-});
-
-defineExpose({
- initAddEntity,
- getViewer
-});
-</script>
-
-<script>
-export default {
- name: 'MapContainer',
-};
-</script>
-
-<style lang="scss" scoped>
-.map-container {
- position: relative;
- width: 100% !important;
- height: 100% !important;
- overflow: hidden;
-}
-
-.viewer-container {
- position: absolute;
- top: 0%;
- left: 0%;
- width: 100%;
- height: 100%;
-}
-</style>
diff --git a/applications/drone-command/src/main.js b/applications/drone-command/src/main.js
index d533119..5d8a74c 100644
--- a/applications/drone-command/src/main.js
+++ b/applications/drone-command/src/main.js
@@ -49,8 +49,6 @@
// 业务组件
import tenantPackage from './views/system/tenantpackage.vue'
-// 地图依赖
-import mapContainer from './components/map-container/mapContainer.vue'
import * as DC from '@dvgis/dc-sdk'
import '@dvgis/dc-sdk/dist/dc.min.css'
@@ -102,7 +100,7 @@
app.component('thirdRegister', thirdRegister)
app.component('flowDesign', flowDesign)
app.component('tenantPackage', tenantPackage)
-app.component('mapContainer', mapContainer)
+
app.config.globalProperties.$dayjs = dayjs
app.config.globalProperties.website = website
diff --git a/applications/drone-command/src/router/views/index.js b/applications/drone-command/src/router/views/index.js
index e155b30..41381d0 100644
--- a/applications/drone-command/src/router/views/index.js
+++ b/applications/drone-command/src/router/views/index.js
@@ -146,30 +146,5 @@
component: () => import(/* webpackChunkName: "views" */ '@/views/system/helpCenter.vue'),
},
],
- },
-
- {
- path: '/resource',
- component: Layout,
- redirect: '/resource/patchManagement',
- children: [
- {
- path: 'patchManagement',
- name: '图斑管理',
- meta: {
- i18n: 'info',
- },
- component: () => import(/* webpackChunkName: "views" */ '@/views/resource/patchManagement.vue'),
- },
-
- {
- path: 'patchTypeManagement',
- name: '图斑类型管理',
- meta: {
- i18n: 'info',
- },
- component: () => import(/* webpackChunkName: "views" */ '@/views/resource/patchTypeManagement.vue'),
- },
- ],
- },
+ }
]
diff --git a/applications/drone-command/src/utils/cesium/publicCesium.js b/applications/drone-command/src/utils/cesium/publicCesium.js
index de0c994..3c340d7 100644
--- a/applications/drone-command/src/utils/cesium/publicCesium.js
+++ b/applications/drone-command/src/utils/cesium/publicCesium.js
@@ -20,7 +20,6 @@
} = getBaseConfig()
import { addBlueFilter } from '@/utils/cesium/common'
-import { useBoundary } from '@/utils/cesium/useBoundary'
let smallMpaCenterDistance = null
let curCameraHpr = null
@@ -118,7 +117,6 @@
this.terrainLoading = null
this.terrainEnabled = false
this.globalBaseMapLayers = []
- this.boundary = null
this.init(options)
}
@@ -130,13 +128,7 @@
layerMode = 17,
contour = true,
flyToContour = false,
- multiple = 1.4,
- dockOptions = {},
- boundaryChange,
terrainLoadCallback,
- boundaryColor = '#00F9EC',
- dockRangeType = 1,
- useDockHeight = false
} = options
Cesium.Camera.DEFAULT_VIEW_FACTOR = -0.45
// 西南东北,默认显示中国
@@ -168,8 +160,6 @@
this.setFixedNoonLighting()
- // 边界,机巢
- this.boundary = useBoundary(this.viewer, { multiple, dockOptions, boundaryChange, boundaryColor, dockRangeType, useDockHeight })
this.viewer?.imageryLayers.removeAll()
this.viewer._cesiumWidget._creditContainer.style.display = 'none'
handler = new Cesium.ScreenSpaceEventHandler(this.viewer?.scene.canvas)
@@ -181,9 +171,7 @@
this.viewer.scene.screenSpaceCameraController.maximumZoomDistance = 4500000
this.switchLayers(layerMode)
this.switchFlatMode(flatMode)
- this.switchContour(contour)
- flyToContour && this.flyToContour(contour)
-
+
if (Cesium.FeatureDetection.supportsImageRenderingPixelated()) {
let dpr = window.devicePixelRatio
while (dpr >= 2.0) dpr /= 2.0 // 避免过高缩放导致模糊
@@ -277,25 +265,6 @@
cesiumContainer.remove() // 移除与地图相关的DOM元素
this.viewerDom = null
}
- }
-
- setShowDock (sns) {
- this.boundary?.setShowDock(sns)
- }
- setDockCoverColor (sns) {
- this.boundary?.setDockCoverColor(sns)
- }
- // 切换轮廓显示
- async switchContour (open) {
- if (open) {
- await this.boundary?.openContour()
- } else {
- this.boundary?.closeContour()
- }
- }
- // 飞向轮廓居中
- flyToContour () {
- this.boundary?.flyToBoundary()
}
// 飞行 flyto
diff --git a/applications/drone-command/src/utils/cesium/useBoundary.js b/applications/drone-command/src/utils/cesium/useBoundary.js
deleted file mode 100644
index abddf39..0000000
--- a/applications/drone-command/src/utils/cesium/useBoundary.js
+++ /dev/null
@@ -1,432 +0,0 @@
-import _ from 'lodash'
-import { boxTransformScale } from '@/utils/turfFunc'
-import { MAP_LEVEL } from '@/const/drc'
-import * as Cesium from 'cesium'
-import { PolyGradientMaterial } from '@/utils/cesium/Material'
-import { useStore } from 'vuex'
-import { getDeviceRegion, getDeviceRegionCount } from '@/api/job/task'
-import userStore from '@/store/modules/user'
-import { areaCodeToArr, getContourByCode, getDockPolyLine, getLnglatAltitude } from '@/utils/cesium/mapUtil'
-import getBaseConfig from '@/buildConfig/config'
-import { getDroneStatusImage } from '@/utils/stateToImageMap/drone'
-import { GroundCirclePrimitiveManager } from '@/utils/mapUtils'
-
-import lowBattery from '@/assets/images/aiNowFly/low-battery.svg'
-import mediumBattery from '@/assets/images/aiNowFly/medium-battery.svg'
-import fullBattery from '@/assets/images/aiNowFly/full-charge.svg'
-
-const { VITE_APP_BASE, VITE_APP_ENV, VITE_APP_REGION_URL } = import.meta.env
-const { singleDockSystem } = getBaseConfig()
-
-/**
- * 使用通用的边界
- * @param viewer
- * @param options
- */
-export const useBoundary = (viewer, options = {}) => {
- const {
- multiple = 1.4,
- dockOptions = {},
- boundaryChange,
- boundaryColor,
- dockRangeType,
- useDockHeight = false,
- } = options
- const { scrollShowDock = false, showDock = false, showDockNameAndBattery = false } = dockOptions
-
- const manager = new GroundCirclePrimitiveManager()
- manager.init(viewer)
-
- // 缩放判断list(包含省市县的轮廓边界散点数据)
- let scalingJudgment = _.cloneDeep(MAP_LEVEL).map(i => ({ ...i, gJson: null, show: false, outline: {} }))
- let active = null
- const defaultDir = `${VITE_APP_REGION_URL}/100000/`
- const userAreaCode = userStore.state.userInfo.detail.areaCode
- const selectedAreaCode = userStore.state.selectedAreaCode
- const dockSource = new Cesium.CustomDataSource('dockSource')
- const outlineSource = new Cesium.CustomDataSource('outlineSource')
- const minOutlineSource = new Cesium.CustomDataSource('minOutlineSource')
-
- viewer.dataSources.add(dockSource)
- viewer.dataSources.add(outlineSource)
- viewer.dataSources.add(minOutlineSource)
- let initDockList = []
- let showDockSnList = null
-
- if (scrollShowDock || showDock) {
- getDeviceRegionFun().then(list => {
- initDockList = list
- if (showDock && !scrollShowDock) droneSplashed()
- })
- }
-
- // 获取设备列表
- async function getDeviceRegionFun() {
- const res = await getDeviceRegion({ areaCode: selectedAreaCode })
- return res?.data?.data || []
- }
-
- // 确定缩放比例
- const determineScaling = () => {
- if (!viewer) return
- let height = viewer.camera.positionCartographic.height
- // 根据高度展示对应的 gJson
- for (let [index, item] of scalingJudgment.entries()) {
- if (!item.show) return
- if (height > item.heightRange[0] && height <= item.heightRange[1]) {
- if (active === item.name) return
- boundaryChange?.(item?.gJson?.features)
- active = item.name
- removeBoundary()
- renderOutline(item)
- scrollShowDock && removeDockCover()
- item.gJson || (scrollShowDock && droneSplashed(item))
- break
- }
- }
- }
-
- const removeBoundary = () => {
- minOutlineSource?.entities.removeAll()
- outlineSource?.entities?.removeAll()
- }
- const removeAllEntities = () => {
- removeBoundary()
- removeDockCover()
- }
-
- const removeDockCover = () => {
- dockSource?.entities?.removeAll()
- manager?.removeAll()
- }
-
- const getFiler = async url => {
- const res = await fetch(url)
- return await res.json()
- }
-
- function getBase64Image(imgUrl) {
- const img = new Image()
- const canvas = document.createElement('canvas')
- const ctx = canvas.getContext('2d')
-
- return new Promise(resolve => {
- img.onload = function () {
- canvas.width = img.width
- canvas.height = img.height
- ctx.drawImage(img, 0, 0)
- const base64 = canvas.toDataURL('image/png')
- resolve(base64)
- }
- img.src = imgUrl
- })
- }
-
- function batteryLevelSvg(batteryNum) {
- if (batteryNum <= 30) {
- return lowBattery
- } else if (batteryNum > 30 && batteryNum <= 60) {
- return mediumBattery
- } else {
- return fullBattery
- }
- }
-
- async function nestSVG(nickname, batteryImgUrl, batteryNum) {
- let txt = nickname.length < 4 ? 130 : nickname.length * 38
- let tranx = nickname.length < 4 ? 86 : nickname.length * 26 + 3
- const batteryBase64Image = await getBase64Image(batteryImgUrl)
- const svg = `
- <svg width="${txt}" height="100" xmlns="http://www.w3.org/2000/svg">
- <g transform="translate(${tranx}, 10)">
- <!-- 电池图标 -->
- <image href="${batteryBase64Image}" x="0" y="2" width="12" height="13"/>
- <!-- 电量值 -->
- <text x="12" y="10" font-size="14" fill="${
- batteryNum <= 30 ? '#FF604B' : batteryNum >= 60 ? '#40FF5C' : '#00FFF2'
- }" text-anchor="start" dominant-baseline="middle" font-weight="bolder" font-family="Source Han Sans CN" text-rendering="geometricPrecision">
- ${batteryNum}%
- </text>
- </g>
- </svg>
- `
- return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`
- }
-
- // 无人机散点渲染
- const droneSplashed = () => {
- manager.removeAll()
- let showDockList =
- showDockSnList === null
- ? _.cloneDeep(initDockList)
- : initDockList.filter(item => showDockSnList.includes(item.device_sn))
-
- showDockList.forEach(async (item, index) => {
- if (item.status === 'OFFLINE') return
- let polyline = {}
-
- if (dockRangeType === 2) {
- manager.addCircleOutline({
- data: {
- lng: item.longitude,
- lat: item.latitude,
- },
- frameColor: Cesium.Color.fromCssColorString('#7FFFD4'),
- })
- } else {
- manager.addCircle({
- data: {
- lng: item.longitude,
- lat: item.latitude,
- },
- materialColor: item.color ? item.color : Cesium.Color.CORNFLOWERBLUE.withAlpha(0.3),
- })
- }
-
- if (useDockHeight) {
- polyline = getDockPolyLine(item, viewer)
- }
- const batteryImgUrl = batteryLevelSvg(item.capacity_percent)
- const combinedImage = await nestSVG(item.nickname, batteryImgUrl, item.capacity_percent)
- let pointObj = {}
- try {
- pointObj = await getLnglatAltitude(item.longitude, item.latitude, viewer)
- } catch (e) {}
- const position = Cesium.Cartesian3.fromDegrees(
- +item.longitude,
- +item.latitude,
- useDockHeight ? +item.height : pointObj?.height || 0
- )
- if (showDockNameAndBattery) {
- // 带电量
- dockSource.entities.add({
- position,
- billboard: {
- // new Cesium.ConstantProperty(pointData.status === 'OFFLINE' ? endingImg : unSelectedOnline),
- image: combinedImage,
- },
- })
- }
- dockSource.entities.add({
- label: {
- text: item.nickname,
- font: 'bold 16px Source Han Sans CN',
- fillColor: Cesium.Color.WHITE,
- outlineColor: Cesium.Color.BLACK,
- outlineWidth: 2,
- style: Cesium.LabelStyle.FILL_AND_OUTLINE,
- verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
- pixelOffset: new Cesium.Cartesian2(0, -24),
- },
- position,
- polyline,
- billboard: {
- image: getDroneStatusImage(item.status),
- width: 60,
- height: 60,
- disableDepthTestDistance: Number.POSITIVE_INFINITY,
- eyeOffset: new Cesium.Cartesian3(0, 0, -5),
- },
- })
- })
- }
-
- // 渲染各个独立的轮廓
- const renderOutline = item => {
- // 加载大边界
- item.outline &&
- Cesium.GeoJsonDataSource.load(item.outline).then(dataSource => {
- const entities = dataSource.entities.values
- entities.forEach((entity, index) => {
- // 创建独立折线作为轮廓
- const positions = entity.polygon.hierarchy.getValue().positions
- const randomInt = Math.floor(Math.random() * 5) + 1
- let polygon = {}
- if (item.name === '县' && !scalingJudgment[0].outline) {
- let material = new PolyGradientMaterial({
- color: Cesium.Color.fromCssColorString(arrColor[randomInt]),
- opacity: 0.7,
- alphaPower: 1.3,
- })
- entity.polygon.extrudedHeight = (entity.properties.childrenNum._value || 1) * 500
- entity.polygon.material = material
- polygon = entity.polygon
- entity.polygon.outline = false // 显示边框
- }
- outlineSource.entities.add({
- polyline: {
- positions: positions,
- width: 5, // 直接设置宽度
- clampToGround: true,
- material: Cesium.Color.fromCssColorString(boundaryColor),
- },
- polygon,
- })
- })
- })
-
- if (!item.gJson) return
- // 加载小边界
- Cesium.GeoJsonDataSource.load(item.gJson).then(dataSource => {
- // 获取数据源中的实体
- const entities = dataSource.entities.values
- entities.forEach(entity => {
- const positions = entity.polygon.hierarchy.getValue().positions
- minOutlineSource.entities.add({
- polyline: {
- positions: positions,
- width: 1, // 直接设置宽度
- clampToGround: true,
- material: Cesium.Color.fromCssColorString(boundaryColor),
- },
- })
- })
- })
- }
-
- const findFun = (featItem, numItem) => Number(featItem.region_code.slice(0, 6)) === numItem.properties.adcode
-
- // 打开边界
- const openContour = async () => {
- const areaCode = selectedAreaCode || userAreaCode
- viewer.scene.postRender.removeEventListener(determineScaling)
- if (!areaCode) return
- const hierarchy = areaCodeToArr(areaCode.slice(0, 6))
- const jsonPath = hierarchy.join('/')
- scalingJudgment = scalingJudgment.map(item => ({ ...item, show: true }))
- scalingJudgment[0].gJson = null
- active = null
- const res = await getDeviceRegionCount({ areaCode })
- const list = res?.data?.data || []
- try {
- // 省市县三级
- if (hierarchy.length === 1) {
- const gJson1 = await getFiler(`${defaultDir}${jsonPath}/indexDistrict.json`)
- const gJson2 = await getFiler(`${defaultDir}${jsonPath}/index.json`)
- scalingJudgment[1].gJson = {
- ...gJson1,
- features: gJson1.features.map(item => {
- const findData = list.flatMap(item => item.childrens || []).find(item1 => findFun(item1, item))
- return { ...item, data: { ...findData } }
- }),
- }
- scalingJudgment[2].gJson = gJson2
- }
- // 市县两级
- if (hierarchy.length === 2) {
- scalingJudgment[2].gJson = null
- scalingJudgment[2].show = false
- scalingJudgment[1].gJson = await getFiler(`${defaultDir}${jsonPath}/index.json`)
- }
- // 区县一级
- if (hierarchy.length === 3) {
- scalingJudgment[1].gJson = null
- scalingJudgment[1].show = false
- scalingJudgment[2].gJson = null
- scalingJudgment[2].show = false
- }
- // 轮廓
- const outlineGJson = await getContourByCode(areaCode.slice(0, 6))
- scalingJudgment.forEach(item => item.show && (item.outline = outlineGJson))
- renderOutline(scalingJudgment[(hierarchy.length - 3) * -1])
- } catch (e) {}
- try {
- viewer?.scene?.postRender?.addEventListener(determineScaling)
- }catch (e) {
-
- }
- }
-
- // 关闭边界
- function closeContour() {
- removeAllEntities()
- viewer.scene.postRender.removeEventListener(determineScaling)
- }
-
- // 飞向边界
- async function flyToBoundary() {
- // 单机巢系统
- if (singleDockSystem) {
- if (!initDockList.length) {
- initDockList = await getDeviceRegionFun()
- }
- viewer?.camera.flyTo({
- destination: Cesium.Cartesian3.fromDegrees(initDockList[0].longitude, initDockList[0].latitude, 22000),
- duration: 0,
- })
- return
- }
- const areaCode = selectedAreaCode || userAreaCode
- const gJson = await getContourByCode(areaCode.slice(0, 6))
- const dataSource = await Cesium.GeoJsonDataSource.load(gJson)
- if (!dataSource) return
- viewer.dataSources.add(dataSource)
- // 获取多边形边界所有点
- let positionList = []
- dataSource.entities.values.forEach(function (entity) {
- if (entity.polygon) {
- // 获取多边形的边界球
- // const boundingSphere = entity.polygon.hierarchy.getValue(viewer.clock.currentTime).boundingSphere
- let curPolygonPosition = entity.polygon.hierarchy._value.positions.map(item => {
- let cartographic = Cesium.Cartographic.fromCartesian(item)
- let lng = Cesium.Math.toDegrees(cartographic.longitude) // 经度
- let lat = Cesium.Math.toDegrees(cartographic.latitude) // 纬度
- return [_.round(lng, 6), _.round(lat, 6)]
- })
- positionList = positionList.concat(curPolygonPosition)
- }
- })
- const newBox = boxTransformScale(positionList, multiple)
- viewer.camera.flyTo({
- destination: Cesium.Rectangle.fromDegrees(...newBox),
- offset: new Cesium.HeadingPitchRange(0, Cesium.Math.toRadians(-90), 0),
- duration: 0.5,
- })
-
- dataSource.entities.values.forEach(entity => {
- entity.polygon.material = new Cesium.ColorMaterialProperty(Cesium.Color.YELLOW.withAlpha(0))
- entity.polygon.outline = new Cesium.ConstantProperty(false) // 显示边框
- entity.polygon.outlineColor = new Cesium.ConstantProperty(Cesium.Color.AQUAMARINE.withAlpha(0))
- })
- }
-
- /**
- * 设置要显示的机巢列表
- * @param dockSns - 要显示的机巢设备序列号数组。如果为 undefined,则显示所有已初始化的机巢;如果为空数组,则不显示任何机巢。
- */
- function setShowDock(dockSns) {
- if (dockSns === undefined) {
- showDockSnList = null
- } else if (dockSns.length === 0) {
- showDockSnList = []
- } else {
- showDockSnList = dockSns
- }
- removeDockCover()
- if (!showDock) return
- if (scrollShowDock ? active === '县' : true) {
- droneSplashed()
- }
- }
- function setDockCoverColor(arr) {
- initDockList.forEach(item => {
- arr.forEach(dock => {
- item.color = dock.device_sn === item.device_sn ? dock.color : null
- })
- })
- if (scrollShowDock ? active === '县' : true) {
- droneSplashed()
- }
- }
- onBeforeUnmount(() => {
- manager.destroy()
- })
-
- return {
- openContour,
- closeContour,
- flyToBoundary,
- setShowDock,
- setDockCoverColor,
- }
-}
diff --git a/applications/drone-command/src/views/monitor/log/api.vue b/applications/drone-command/src/views/monitor/log/api.vue
deleted file mode 100644
index b4798a4..0000000
--- a/applications/drone-command/src/views/monitor/log/api.vue
+++ /dev/null
@@ -1,218 +0,0 @@
-<template>
- <basic-container >
- <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form"
- :permission="permissionList" :before-open="beforeOpen" v-model:page="page" @search-change="searchChange"
- @search-reset="searchReset" @current-change="currentChange" @size-change="sizeChange"
- @refresh-change="refreshChange" @on-load="onLoad">
- </avue-crud>
- </basic-container>
-</template>
-
-<script>
-import { getApiList, getApiLogs } from '@/api/logs'
-import { mapGetters } from 'vuex'
-
-export default {
- data () {
- return {
- form: {},
- selectionList: [],
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- option: {
- emptyBtnText: '重置',
- emptyBtnIcon: 'el-icon-refresh',
- // height: 'auto',
- // calcHeight: 32,
- tip: false,
- searchShow: true,
- searchGutter: 30,
- searchMenuPosition: 'left',
- searchMenuSpan: 4,
- border: true,
- index: true,
- viewBtn: true,
- editBtn: false,
- addBtn: false,
- delBtn: false,
- menuWidth: 120,
- dialogType: 'drawer',
-
- height: 'auto',
- calcHeight: 20,
-
- column: [
- {
- label: '操作名称',
- prop: 'title',
- search: true,
- searchSpan: 4,
- },
- {
- label: '操作人',
- prop: 'createBy',
- search: true,
- width: 120,
- searchSpan: 4,
- },
- {
- label: '操作人IP',
- prop: 'remoteIp',
- width: 130,
- },
- {
- label: '服务模块',
- prop: 'serviceId',
- width: '120',
- },
- {
- label: '服务host',
- prop: 'serverHost',
- hide: true,
- },
- {
- label: '服务ip',
- prop: 'serverIp',
- width: '160',
- hide: true,
- },
- {
- label: '服务环境',
- prop: 'env',
- width: '85',
- },
-
- {
- label: '请求方法',
- prop: 'method',
- width: '85',
- },
- {
- label: '请求接口',
- prop: 'requestUri',
- search: true,
- searchSpan: 4,
- },
- {
- label: '用户代理',
- prop: 'userAgent',
- span: 24,
- hide: true,
- },
- {
- label: '请求数据',
- prop: 'params',
- type: 'textarea',
- span: 24,
- minRows: 2,
- hide: true,
- },
- {
- label: '操作时间',
- prop: 'daterange',
- type: 'daterange',
- search: true,
- searchRange: true,
- searchSpan: 8,
- format: 'YYYY-MM-DD',
- valueFormat: 'YYYY-MM-DD',
- startPlaceholder: '开始时间',
- endPlaceholder: '结束时间',
- viewDisplay: false,
- hide: true,
- rules: [
- {
- required: true,
- message: '请选择操作时间',
- trigger: 'blur',
- },
- ],
- change: (value) => {
- this.searchChange({ ...this.query,daterange:value.value}, () => {});
- }
- },
- {
- label: '操作时间',
- prop: 'createTime',
- width: '180',
- },
- ],
- },
- data: [],
- }
- },
-
- computed: {
- ...mapGetters(['permission']),
- permissionList () {
- return {
- viewBtn: this.validData(this.permission.log_api_view, false),
- }
- },
- },
- methods: {
- searchReset () {
- this.query = {}
- this.onLoad(this.page)
- },
- searchChange (params, done) {
- this.query = params
- this.page.currentPage = 1
- this.onLoad(this.page, params)
- done()
- },
- beforeOpen (done, type) {
- if (['edit', 'view'].includes(type)) {
- getApiLogs(this.form.id).then(res => {
- this.form = res.data.data
- })
- }
- done()
- },
- currentChange (currentPage) {
- this.page.currentPage = currentPage
- },
- sizeChange (pageSize) {
- this.page.pageSize = pageSize
- },
- refreshChange () {
- this.onLoad(this.page, this.query)
- },
- onLoad (page, params = {}) {
- const { daterange } = this.query
- let values = {
- ...params,
- ...this.query,
- }
- if (daterange) {
- values = {
- ...values,
- startTime: daterange[0],
- endTime: daterange[1],
- }
- values.daterange = null
- }
- this.loading = true
- getApiList(page.currentPage, page.pageSize, values).then(res => {
- const data = res.data.data
- this.page.total = data.total
- this.data = data.records
- this.loading = false
- })
- },
- },
-}
-</script>
-
-
-<style lang="scss">
-
-.avue-crud__dialog__header .el-dialog__title {
- font-size: 18px !important;
-}
-</style>
\ No newline at end of file
diff --git a/applications/drone-command/src/views/monitor/log/error.vue b/applications/drone-command/src/views/monitor/log/error.vue
deleted file mode 100644
index 3d2a5e6..0000000
--- a/applications/drone-command/src/views/monitor/log/error.vue
+++ /dev/null
@@ -1,173 +0,0 @@
-<template>
- <basic-container>
- <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" :before-open="beforeOpen"
- v-model="form" :permission="permissionList" v-model:page="page" @search-change="searchChange"
- @search-reset="searchReset" @current-change="currentChange" @size-change="sizeChange"
- @refresh-change="refreshChange" @on-load="onLoad">
- </avue-crud>
- </basic-container>
-</template>
-
-<script>
-import { getErrorList, getErrorLogs } from '@/api/logs'
-import { mapGetters } from 'vuex'
-
-export default {
- data () {
- return {
- form: {},
- selectionList: [],
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- option: {
- emptyBtnText: '重置',
- emptyBtnIcon: 'el-icon-refresh',
- tip: false,
- searchShow: true,
- searchGutter: 30,
- searchMenuPosition: 'left',
- searchMenuSpan: 4,
- border: true,
- index: true,
- viewBtn: true,
- editBtn: false,
- addBtn: false,
- delBtn: false,
- menuWidth: 120,
- dialogType: 'drawer',
-
- height: 'auto',
- calcHeight: 20,
-
- column: [
- {
- label: '服务名称',
- prop: 'serviceId',
- search: true,
- searchSpan: 4,
- width: '120',
- },
-
- {
- label: '服务host',
- prop: 'serverHost',
- },
- {
- label: '服务ip',
- prop: 'serverIp',
- width: '160',
- },
- {
- label: '软件环境',
- prop: 'env',
- width: '85',
- },
- {
- label: '请求方法',
- prop: 'method',
- width: '85',
- },
- {
- label: '请求接口',
- prop: 'requestUri',
- search: true,
- searchSpan: 4,
- },
- {
- label: '操作人',
- prop: 'createBy',
- search: true,
- searchSpan: 4,
- width: '120',
- },
- {
- label: '日志时间',
- prop: 'createTime',
- width: '180',
- },
- {
- label: '用户代理',
- prop: 'userAgent',
- span: 24,
- hide: true,
- },
- {
- label: '请求数据',
- prop: 'params',
- type: 'textarea',
- span: 24,
- minRows: 2,
- hide: true,
- },
- {
- label: '日志数据',
- prop: 'stackTrace',
- type: 'textarea',
- span: 24,
- minRows: 16,
- hide: true,
- },
- ],
- },
- data: [],
- }
- },
- computed: {
- ...mapGetters(['permission']),
- permissionList () {
- return {
- viewBtn: this.validData(this.permission.log_error_view, false),
- }
- },
- },
- methods: {
- searchReset () {
- this.query = {}
- this.onLoad(this.page)
- },
- searchChange (params, done) {
- this.query = params
- this.page.currentPage = 1
- this.onLoad(this.page, params)
- done()
- },
- beforeOpen (done, type) {
- if (['edit', 'view'].includes(type)) {
- getErrorLogs(this.form.id).then(res => {
- this.form = res.data.data
- })
- }
- done()
- },
- currentChange (currentPage) {
- this.page.currentPage = currentPage
- },
- sizeChange (pageSize) {
- this.page.pageSize = pageSize
- },
- refreshChange () {
- this.onLoad(this.page, this.query)
- },
- onLoad (page, params = {}) {
- let values = {
- ...params,
- ...this.query,
- }
- this.loading = true
- getErrorList(page.currentPage, page.pageSize, values).then(res => {
- const data = res.data.data
- this.page.total = data.total
- this.data = data.records
- this.loading = false
- })
- },
- },
-}
-</script>
-
-<style scoped lang="scss"></style>
diff --git a/applications/drone-command/src/views/monitor/log/flightLog.vue b/applications/drone-command/src/views/monitor/log/flightLog.vue
deleted file mode 100644
index 8bf95ad..0000000
--- a/applications/drone-command/src/views/monitor/log/flightLog.vue
+++ /dev/null
@@ -1,529 +0,0 @@
-<!-- 飞行日志 -->
-<template>
- <div class="flight">
- <div class="command-form-search">
- <el-form :model="params" inline>
- <el-row :gutter="24">
- <el-col :span="4">
- <el-form-item label="任务名称:">
- <el-input v-model="params.jobName" placeholder="请输入任务名称" clearable />
- </el-form-item>
- </el-col>
- <el-col :span="4">
- <el-form-item label="任务编号:">
- <el-input v-model="params.jobInfoNum" placeholder="请输入任务编号" clearable />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="选择日期:">
- <el-date-picker
- v-model="rangTime"
- type="daterange"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- clearable
- @change="changeselect"
- />
- </el-form-item>
- </el-col>
- <el-col :span="4">
- <el-button type="primary" @click="getList" :icon="Search">搜索</el-button>
- <el-button @click="cancelSearch" :icon="Refresh">重置</el-button>
- </el-col>
- </el-row>
- </el-form>
- </div>
- <div class="mange-table">
- <!-- <el-tabs v-model="tabType" class="demo-tabs" @tab-click="handleTabClick">-->
- <!-- <el-tab-pane label="全部" name="全部"></el-tab-pane>-->
- <!-- <el-tab-pane label="我的收藏" name="收藏"></el-tab-pane>-->
- <!-- -->
- <!-- </el-tabs>-->
- <el-table border :data="tableList" class="custom-header">
- <el-table-column label="序号" type="index" width="60"></el-table-column>
- <el-table-column prop="job_name" label="任务名称" align="center" show-overflow-tooltip></el-table-column>
- <el-table-column prop="job_info_num" label="任务编号" align="center" show-overflow-tooltip></el-table-column>
-<!-- <el-table-column prop="title" label="飞行类型" align="center" show-overflow-tooltip></el-table-column>-->
- <el-table-column prop="nickname" label="机巢名称" align="center"></el-table-column>
- <el-table-column prop="start_time" label="开始时间" align="center">
- <template #default="scope">
- {{ timeFormatConvert(scope.row.start_time) }}
- </template>
- </el-table-column>
- <el-table-column prop="end_time" label="结束时间" align="center">
- <template #default="scope">
- {{ timeFormatConvert(scope.row.end_time) }}
- </template>
- </el-table-column>
- <el-table-column prop="create_name" label="创建人" align="center"></el-table-column>
- <!-- <el-table-column prop="end_time" label="标签" align="center">-->
- <!-- <template #default="scope">-->
- <!-- <el-select v-model="scope.row.label_id" @change="handleUpdateLabel(scope.row)" clearable>-->
- <!-- <el-option-->
- <!-- v-for="item in tagList"-->
- <!-- :key="item.id"-->
- <!-- :label="item.label_name"-->
- <!-- :value="item.id"-->
- <!-- ></el-option>-->
- <!-- </el-select>-->
- <!-- </template>-->
- <!-- </el-table-column>-->
- <el-table-column label="操作" width="300" align="center">
- <template #default="scope">
- <el-button icon="el-icon-view" type="text" @click="handleDetail(scope.row)">查看</el-button>
- <el-button icon="el-icon-view" type="text" @click="handleLineTrajectory(scope.row)">轨迹</el-button>
- <el-button icon="el-icon-delete" type="text" @click="handleDelete(scope.row)">删除</el-button>
- <!-- <el-button type="text" @click="handleStar(scope.row)">-->
- <!-- <el-icon><Star /></el-icon>-->
- <!-- {{ scope.row.is_favorite ? '取消收藏':'收藏' }}</el-button>-->
- <el-button type="text" @click="handleExport(scope.row)"><el-icon><Download /></el-icon>导出</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
-
- <div class="pagination">
- <el-pagination class="command-pagination" popper-class="custom-pagination-dropdown" background
- :page-sizes="[10, 20, 30, 40, 50, 100]" :size="size" v-model:current-page="params.page"
- v-model:page-size="params.page_size" layout="total, sizes, prev, pager, next, jumper" :total="total"
- @size-change="handleSizeChange" @current-change="handleCurrentChange" />
- </div>
- </div>
- <el-dialog class="command-dialog-mange" append-to-body v-model="isShowView" title="查看" :width="pxToRem(1200)" :close-on-click-modal="false" :destroy-on-close="true">
- <el-table border :data="tableDataDetails" height="466">
- <el-table-column label="序号" type="index" width="60"></el-table-column>
- <el-table-column prop="flight_type" label="飞行类型" align="center" show-overflow-tooltip></el-table-column>
- <el-table-column prop="create_time" label="飞行时间" align="center" show-overflow-tooltip></el-table-column>
- <el-table-column prop="longitude" label="经度" align="center"></el-table-column>
- <el-table-column prop="latitude" label="纬度" align="center"></el-table-column>
- <el-table-column prop="height" label="绝对高度" align="center"></el-table-column>
- <el-table-column prop="elevation" label="实时真高" align="center"></el-table-column>
- </el-table>
- <template #footer>
- <div class="pagination dialog-footer" style="display: flex;justify-content: end;margin-top: 10px;">
- <el-pagination class="command-pagination" popper-class="custom-pagination-dropdown" background
- :page-sizes="[10, 20, 30, 40, 50, 100]" :size="size" v-model:current-page="detailParams.current"
- v-model:page-size="detailParams.size" layout="total, sizes, prev, pager, next, jumper" :total="detailTotal"
- @size-change="handleSizeChangeDetails" @current-change="handleCurrentChangeDetails" />
- </div>
- </template>
- </el-dialog>
- <el-dialog class="command-dialog-mange" append-to-body v-model="isShowFlyMapView" title="查看" :width="pxToRem(1000)" :close-on-click-modal="false" :destroy-on-close="true">
- <div id="flyMap" class="command-cesium"></div>
- </el-dialog>
-</template>
-<script setup>
-import { getHistoryTrack, cancelStar, addStar, updateDroneFlight, deleteDroneFlight, droneFlightLogInfoPage } from '@/api/logs';
-// import { flightLogPage } from '@/api/airspace/airspace';
-import { downloadXls } from '@/utils/util';
-import { exportBlob } from '@/api/common'
-import * as Cesium from 'cesium';
-import { PublicCesium } from '@/utils/cesium/publicCesium';
-import { ElMessage, ElMessageBox, ElLoading } from 'element-plus';
-import {Delete, Refresh, Search} from '@element-plus/icons-vue';
-import { ArrowLineMaterialProperty } from '@/utils/cesium/Material'
-import { flyVisual } from '@ztzf/utils'
-import rwqfdImg from '@/assets/images/signMachineNest/rwqfd.png'
-import endPointImg from '@/assets/images/EndPointicon.png'
-import { nextTick } from 'vue';
-
-let publicCesiumInstance = null;
-let viewer = null;
-const viewInstance = shallowRef(null);
-const homeViewer = shallowRef(null);
-
-let previewDataSource = null
-
-const total = ref(0)
-let rangTime = ref([])
-const params = ref({
- isFavorite: false,
- page: 1,
- page_size: 10,
- startTime: '',
- endTime: '',
- jobName: '',
- jobInfoNum: '',
-});
-
-let tableList = ref([])
-
-let isShowView = ref(false)
-
-let isShowFlyMapView = ref(false)
-
-let tabType = ref('全部')
-
-function timeFormatConvert(time) {
- if (!time) return '/'
- const date = new Date(time);
- return date.toLocaleString();
-}
-
-function cancelSearch() {
- rangTime.value = []
- params.value = {
- startTime: '',
- endTime: '',
- isFavorite: tabType.value === '收藏' ? true : false,
- page: 1,
- page_size: 10,
- jobName: '',
- jobInfoNum: '',
- }
- getList()
-}
-
-function getList() {
- params.value.startTime = rangTime.value?.length ? rangTime.value[0].getTime() : ''
- params.value.endTime = rangTime.value?.length? new Date(
- rangTime.value[1].getFullYear(),
- rangTime.value[1].getMonth(),
- rangTime.value[1].getDate(),
- 23, 59, 59
- ).getTime() : ''
- getHistoryTrack(params.value).then(res => {
- tableList.value = res.data.data.list || []
- total.value = res.data.data.pagination.total || 0
- })
-}
-
-function handleAll() {
- params.value.isFavorite = false
- params.value.page = 1
- tabType.value = '全部'
- getList()
-}
-// 查看
-let tableDataDetails = ref([])
-let detailTotal = ref(0)
-let detailParams = ref({
- current: 1,
- size: 10,
- flightId: ''
-})
-function handleDetail(row) {
- isShowView.value = true
- detailParams.value.current = 1
- detailParams.value.size = 10
- detailParams.value.flightId = row.id
- detailTotal.value = 0
- droneFlightLogInfoPage(detailParams.value).then(res => {
- tableDataDetails.value = res.data.data.records
- detailTotal.value = res.data.data.total
- })
-}
-// 地图
-const initMap = () => {
- if (!document.getElementById('flyMap')) {
- return;
- }
- publicCesiumInstance = new PublicCesium({
- dom: 'flyMap',
- flatMode: false,
- terrain: true,
- layerMode: 4,
- contour: false,
- });
- homeViewer.value = publicCesiumInstance.getViewer();
- viewer = publicCesiumInstance.getViewer();
- viewInstance.value = publicCesiumInstance;
- viewer.scene.globe.depthTestAgainstTerrain = true;
- viewInstance.value.switchContour(true);
-};
-// 预览轨迹
-let arrowLineMaterialProperty = new ArrowLineMaterialProperty({
- color: new Cesium.Color(128 / 255, 215 / 255, 255 / 255, 1),
- directionColor: new Cesium.Color(1, 1, 1, 1),
- outlineColor: new Cesium.Color(1, 1, 1, 1),
- outlineWidth: 0,
- speed: 5,
-})
-async function handleLineTrajectory(row) {
- isShowFlyMapView.value = true;
-
- // 确保地图容器已渲染
- await nextTick();
-
- // 确保地图初始化完成
- // if (!viewer) {
- // initMap();
- // }
- initMap();
-
- detailParams.value.size = 9999
- detailParams.value.current = 1
- detailParams.value.flightId = row.id;
- const res = await droneFlightLogInfoPage(detailParams.value);
- tableDataDetails.value = res.data.data.records;
-
- // 清除现有数据源(如果有)
- if (previewDataSource) {
- viewer.dataSources.remove(previewDataSource);
- }
-
- // 创建新数据源
- previewDataSource = new Cesium.CustomDataSource('previewDataSource');
- await viewer.dataSources.add(previewDataSource);
-
- // 确保数据有效
- const validPositions = tableDataDetails.value
- .filter(i => i.longitude && i.latitude && i.height)
- .map(i => Cesium.Cartesian3.fromDegrees(
- Number(i.longitude),
- Number(i.latitude),
- Number(i.height)
- ));
-
- if (validPositions.length > 0) {
- previewDataSource.entities.add({
- polyline: {
- width: 4,
- positions: validPositions,
- material: arrowLineMaterialProperty,
- clampToGround: false,
- },
- });
- // 起点
- // previewDataSource.entities.add({
- // position: validPositions[0],
- // billboard: {
- // image: rwqfdImg,
- // width: 50,
- // height: 50,
- // },
- // })
- // 终点
- // previewDataSource.entities.add({
- // position: validPositions[validPositions.length - 1],
- // billboard: {
- // image: new Cesium.ConstantProperty(endPointImg),
- // width: 30,
- // height: 30,
- // verticalOrigin: Cesium.VerticalOrigin.BOTTOM, // 底部对齐
- // },
- // })
-
-
- flyVisual({
- positionsData: tableDataDetails.value.map(i => [
- Number(i.longitude),
- Number(i.latitude),
- Number(i.height)
- ]),
- viewer,
- multiple: 4.6,
- pitch: -60
- });
- } else {
- console.warn('No valid positions data');
- }
-}
-// 分页
-function handleSizeChangeDetails(val) {
- detailParams.value.size = val
- detailParams.value.current = 1
- droneFlightLogInfoPage(detailParams.value).then(res => {
- tableDataDetails.value = res.data.data.records
- detailTotal.value = res.data.data.total
- })
-}
-function handleCurrentChangeDetails(val) {
- detailParams.value.current = val
- droneFlightLogInfoPage(detailParams.value).then(res => {
- tableDataDetails.value = res.data.data.records
- detailTotal.value = res.data.data.total
- })
-}
-
-
-function handleStartList() {
- params.value.isFavorite = true
- tabType.value = '收藏'
- params.value.page = 1
- getList()
-}
-
-// function handleTabClick() {
-// if (tabType.value === '全部') {
-// handleAll()
-// } else if (tabType.value === '收藏') {
-// handleStartList()
-// }
-// }
-
-// 收藏
-function handleStar(row) {
- if (row.is_favorite) {
- cancelStar(row.id).then(res => {
- ElMessage.success('取消收藏成功')
- getList()
- })
- } else {
- addStar({ flight_log_id: row.id }).then(res => {
- ElMessage.success('收藏成功')
- getList()
- })
- }
-}
-
-// 打标签
-function handleUpdateLabel(row) {
- updateDroneFlight({ id: row.id, label_id: row.label_id }).then(res => {
- // getList()
- ElMessage.success('设置标签成功')
- })
-}
-
-// 删除
-function handleDelete(row) {
- ElMessageBox.confirm('确定删除该条数据?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- }).then(() => {
- deleteDroneFlight({ id: row.id }).then(res => {
- ElMessage.success('删除成功')
- getList()
- })
- }).catch(() => {
- ElMessage({
- type: 'info',
- message: '已取消删除'
- })
- })
-}
-
-// 导出
-function handleExport(row) {
- exportBlob(
- `/drone-device-core/log/droneFlightLogInfo/export/${row.id}`
- ).then(res => {
- downloadXls(res.data, `${row.job_name}.xlsx`)
- })
-}
-
-// 日期选择
-// const changeselect = () => {
-// params.value.startTime = rangTime.value[0] ? rangTime.value[0].getTime() : ''
-// params.value.endTime = rangTime.value[1]? rangTime.value[1].getTime() : ''
-// getList()
-// };
-
-function handleSizeChange(val) {
- params.value.page_size = val
- getList()
-}
-function handleCurrentChange(val) {
- params.value.page = val
- getList()
-}
-let tagList = ref([])
-function tagManageList() {
- flightLogPage({ current:1, size: 99 }).then(res => {
- tagList.value = res.data.data.records || []
- })
-}
-
-onMounted(() => {
- // tagManageList()
- getList()
-})
-</script>
-
-<style lang="scss" scoped>
-.flight {
- height: 0;
- flex: 1;
- margin: 0 10px 10px 10px;
- background-color: #ffffff;
- padding: 10px 20px;
- border-radius: 5px;
- display: flex;
- flex-direction: column;
- //.search-box {
- // height: 30px;
- //}
-
- :deep(.el-input) {
- .el-input__wrapper {
- width: 200px;
- }
- }
-
- // 表格
- .mange-table {
- height: 0;
- flex: 1;
- //margin-top: 18px;
- overflow: auto;
- }
- :deep(.el-pagination) {
- display: flex;
- justify-content: right;
- }
-
- :deep(.el-pagination button) {
- background: center center no-repeat none !important;
- color: #8eb8ea !important;
- }
- :deep(.command-select){
- .el-select__selection {
- width: 200px;
- }
- }
-}
-
-.content {
- padding: 20px;
-
- .view-table {
- width: 100%;
- border-collapse: collapse;
- border: 1px solid #EBEEF5;
-
- tr {
- &:not(:last-child) {
- border-bottom: 1px solid #EBEEF5;
- }
-
- td {
- padding: 12px 10px;
-
- &.label {
- width: 140px;
- text-align: right;
- // color: #909399;
- // background-color: #F5F7FA;
- border-right: 1px solid #EBEEF5;
- }
-
- &.value {
- width: 180px;
- // color: #303133;
- }
- }
- }
- }
-}
-.content-edit {
- .el-form {
- .el-form-item {
- width: 300px;
- :deep(.el-form-item__label) {
- width: 120px;
- }
-
- }
- .btns {
- display: flex;
- justify-content: center
- }
- }
-}
-#flyMap {
- height: 500px;
- width: 100%;
-}
-</style>
diff --git a/applications/drone-command/src/views/monitor/log/usual.vue b/applications/drone-command/src/views/monitor/log/usual.vue
deleted file mode 100644
index 17a335b..0000000
--- a/applications/drone-command/src/views/monitor/log/usual.vue
+++ /dev/null
@@ -1,164 +0,0 @@
-<template>
- <basic-container>
- <avue-crud
- :option="option"
- :table-loading="loading"
- :data="data"
- ref="crud"
- v-model="form"
- :permission="permissionList"
- v-model:page="page"
- :before-open="beforeOpen"
- @search-change="searchChange"
- @search-reset="searchReset"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad"
- >
- </avue-crud>
- </basic-container>
-</template>
-
-<script>
-import { getUsualList, getUsualLogs } from '@/api/logs';
-import { mapGetters } from 'vuex';
-
-export default {
- data() {
- return {
- form: {},
- selectionList: [],
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- option: {
- tip: false,
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- viewBtn: true,
- editBtn: false,
- addBtn: false,
- delBtn: false,
- menuWidth: 120,
- dialogType: 'drawer',
- column: [
- {
- label: '服务id',
- prop: 'serviceId',
- search: true,
- },
- {
- label: '服务host',
- prop: 'serverHost',
- search: true,
- },
- {
- label: '服务ip',
- prop: 'serverIp',
- },
- {
- label: '软件环境',
- prop: 'env',
- width: '100',
- },
- {
- label: '日志级别',
- prop: 'logLevel',
- },
- {
- label: '日志id',
- prop: 'logId',
- },
- {
- label: '请求接口',
- prop: 'requestUri',
- },
- {
- label: '日志时间',
- prop: 'createTime',
- width: '180',
- },
- {
- label: '用户代理',
- prop: 'userAgent',
- span: 24,
- hide: true,
- },
- {
- label: '日志数据',
- prop: 'logData',
- type: 'textarea',
- span: 24,
- minRows: 2,
- hide: true,
- },
- {
- label: '请求数据',
- prop: 'params',
- type: 'textarea',
- span: 24,
- minRows: 2,
- hide: true,
- },
- ],
- },
- data: [],
- };
- },
- computed: {
- ...mapGetters(['permission']),
- permissionList() {
- return {
- viewBtn: this.validData(this.permission.log_usual_view, false),
- };
- },
- },
- methods: {
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- beforeOpen(done, type) {
- if (['edit', 'view'].includes(type)) {
- getUsualLogs(this.form.id).then(res => {
- this.form = res.data.data;
- });
- }
- done();
- },
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- onLoad(page, params = {}) {
- this.loading = true;
- getUsualList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- });
- },
- },
-};
-</script>
-
-<style></style>
diff --git a/applications/drone-command/src/views/resource/attach.vue b/applications/drone-command/src/views/resource/attach.vue
deleted file mode 100644
index 7fca00b..0000000
--- a/applications/drone-command/src/views/resource/attach.vue
+++ /dev/null
@@ -1,327 +0,0 @@
-<template>
- <basic-container>
- <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" :permission="permissionList"
- :before-open="beforeOpen" v-model="form" ref="crud" @row-del="rowDel" @search-change="searchChange"
- @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
- @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
- <template #menu-left>
- <el-button type="primary" plain v-if="permission.attach_upload" icon="el-icon-upload" @click="handleUpload">上 传
- </el-button>
- <el-button type="danger" icon="el-icon-delete" plain v-if="permission.attach_delete" @click="handleDelete">删 除
- </el-button>
- </template>
- <template #menu="scope">
- <el-button type="primary" text icon="el-icon-download" v-if="permission.attach_download"
- @click="handleDownload(scope.row)">下载
- </el-button>
- </template>
- <template #attachSize="{ row }">
- <el-tag>{{ `${func.bytesToKB(row.attachSize)} KB` }}</el-tag>
- </template>
- </avue-crud>
- <el-dialog title="附件管理" append-to-body v-model="attachBox" width="555px">
- <avue-form ref="form" :option="attachOption" v-model="attachForm" :upload-after="uploadAfter">
- </avue-form>
- </el-dialog>
- </basic-container>
-</template>
-
-<script>
-import { getList, getDetail, removeAttachAndData } from '@/api/resource/attach'
-import { mapGetters } from 'vuex'
-import func from '@/utils/func'
-
-export default {
- data () {
- return {
- form: {},
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- attachBox: false,
- selectionList: [],
- option: {
- emptyBtnText: '重置',
- emptyBtnIcon: 'el-icon-refresh',
- tip: false,
- searchShow: true,
- searchGutter: 30,
- searchMenuPosition: 'left',
- searchMenuSpan: 4,
- border: true,
- index: true,
- viewBtn: true,
- // grid: true,
- selection: true,
- dialogClickModal: false,
-
- addBtn: false,
-
- height: 'auto',
- calcHeight: 20,
- column: [
- {
- label: '附件地址',
- prop: 'link',
- rules: [
- {
- required: true,
- message: '请输入附件地址',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '附件域名',
- prop: 'domainUrl',
- rules: [
- {
- required: true,
- message: '请输入附件域名',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '附件名称',
- prop: 'name',
- search: true,
- searchSpan: 4,
- rules: [
- {
- required: true,
- message: '请输入附件名称',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '附件原名',
- prop: 'originalName',
- search: true,
- searchSpan: 4,
- rules: [
- {
- required: true,
- message: '请输入附件原名',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '附件拓展名',
- prop: 'extension',
- search: true,
- searchSpan: 4,
- searchLabelWidth: 95,
- rules: [
- {
- required: true,
- message: '请输入附件拓展名',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '附件大小',
- prop: 'attachSize',
- slot: true,
- rules: [
- {
- required: true,
- message: '请输入附件大小',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '创建日期',
- prop: 'createTime'
- },
- {
- label: '创建日期',
- prop: 'daterange',
- type: 'daterange',
- search: true,
- searchRange: true,
- searchSpan: 8,
- format: 'YYYY-MM-DD',
- valueFormat: 'YYYY-MM-DD',
- startPlaceholder: '开始时间',
- endPlaceholder: '结束时间',
- viewDisplay: false,
- hide: true,
- rules: [
- {
- required: true,
- message: '请选择操作时间',
- trigger: 'blur',
- },
- ],
- change: (value) => {
- this.searchChange({ ...this.query,daterange:value.value}, () => {});
- }
- },
- ],
- },
- data: [],
- attachForm: {},
- attachOption: {
- submitBtn: false,
- emptyBtn: false,
- column: [
- {
- label: '附件上传',
- prop: 'attachFile',
- type: 'upload',
- drag: true,
- loadText: '模板上传中,请稍等',
- span: 24,
- propsHttp: {
- res: 'data',
- },
- action: '/blade-resource/oss/endpoint/put-file-attach',
- },
- ],
- },
- }
- },
- computed: {
- func () {
- return func
- },
- ...mapGetters(['permission']),
- permissionList () {
- return {
- addBtn: false,
- editBtn: false,
- viewBtn: false,
- delBtn: this.validData(this.permission.attach_delete, false),
- }
- },
- ids () {
- let ids = []
- this.selectionList.forEach(ele => {
- ids.push(ele.id)
- })
- return ids.join(',')
- },
- },
- methods: {
- handleUpload () {
- this.attachBox = true
- },
- uploadAfter (res, done, loading, column) {
- window.console.log(column)
- this.attachBox = false
- this.refreshChange()
- done()
- },
- handleDownload (row) {
- window.open(`${row.link}`)
- },
- rowDel (row) {
- this.$confirm('确定将选择数据及对应的文件删除?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => {
- return removeAttachAndData(row.id)
- })
- .then(() => {
- this.onLoad(this.page)
- this.$message({
- type: 'success',
- message: '操作成功!',
- })
- })
- },
- handleDelete () {
- if (this.selectionList.length === 0) {
- this.$message.warning('请选择至少一条数据')
- return
- }
- this.$confirm('确定将选择数据及对应的文件删除?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => {
- return removeAttachAndData(this.ids)
- })
- .then(() => {
- this.onLoad(this.page)
- this.$message({
- type: 'success',
- message: '操作成功!',
- })
- this.$refs.crud.toggleSelection()
- })
- },
- beforeOpen (done, type) {
- if (['edit', 'view'].includes(type)) {
- getDetail(this.form.id).then(res => {
- this.form = res.data.data
- })
- }
- done()
- },
- searchReset () {
- this.query = {}
- this.onLoad(this.page)
- },
- searchChange (params, done) {
- this.query = params
- this.page.currentPage = 1
- this.onLoad(this.page, params)
- done()
- },
- selectionChange (list) {
- this.selectionList = list
- },
- selectionClear () {
- this.selectionList = []
- this.$refs.crud.toggleSelection()
- },
- currentChange (currentPage) {
- this.page.currentPage = currentPage
- },
- sizeChange (pageSize) {
- this.page.pageSize = pageSize
- },
- refreshChange () {
- this.onLoad(this.page, this.query)
- },
- onLoad (page, params = {}) {
- const { daterange } = this.query
- let values = {
- ...params,
- ...this.query,
- }
- if (daterange) {
- values = {
- ...values,
- startTime: daterange[0],
- endTime: daterange[1],
- }
- values.daterange = null
- }
- this.loading = true
- getList(page.currentPage, page.pageSize, values).then(res => {
- const data = res.data.data
- this.page.total = data.total
- this.data = data.records
- this.loading = false
- this.selectionClear()
- })
- },
- },
-}
-</script>
-
-<style scoped lang="scss"></style>
diff --git a/applications/drone-command/src/views/resource/components/BoxSelect.vue b/applications/drone-command/src/views/resource/components/BoxSelect.vue
deleted file mode 100644
index 87a9858..0000000
--- a/applications/drone-command/src/views/resource/components/BoxSelect.vue
+++ /dev/null
@@ -1,250 +0,0 @@
-<template>
- <div></div>
-</template>
-
-<script setup>
-import * as Cesium from 'cesium'
-import { ElMessage } from 'element-plus'
-
-let curPolygonPosition = []
-let savePolygonPosition = []
-let curPolygon = null
-let curPolygonEntity = null
-let curPolygonObj = null
-let menuPanel = null
-let saveMenuPanel = null
-
-const viewInstance = inject('viewInstance')
-const homeViewer = inject('homeViewer')
-
-const updateBoxSelect = inject('updateBoxSelect')
-
-function preventDefault(event) {
- event.preventDefault()
-
- return
-}
-
-function init() {
- // draw.drawPlane();
- curPolygon = new Cesium.PolygonHierarchy()
- curPolygonEntity = new Cesium.Entity()
-
- homeViewer.value.scene.globe.depthTestAgainstTerrain = true
-
- viewInstance.value.addLeftClickEvent(null, addPlanerPointEvent, 'drawCustomPolygon')
- viewInstance.value.addRightClickEvent(null, addPlanarMenuEvent, 'drawCustomPolygon')
- viewInstance.value.addMouseHandler(null, mouseMoveEvent, 'drawCustomPolygon')
-}
-
-function mouseMoveEvent(movement, viewer) {
- const mouseInfo = viewInstance.value.getMouseInfoAll(movement.endPosition)
-
- const { x, y } = mouseInfo.windowPosition
-
- if (!menuPanel) {
- menuPanel = createMenuPanel()
- viewer.container.appendChild(menuPanel)
- }
-
- menuPanel.style.transform = `translate3d(${x}px, ${y}px, 0)`
-
- if (
- curPolygonObj &&
- mouseInfo.surfacePosition &&
- mouseInfo.surfacePosition != null &&
- curPolygonPosition.length >= 1
- ) {
- curPolygonPosition.pop()
- curPolygonPosition.push(mouseInfo.surfacePosition)
-
- curPolygon.positions.pop()
- curPolygon.positions.push(mouseInfo.surfacePosition)
- }
-}
-
-function addPlanerPointEvent(click, pick) {
- const { position } = click
-
- const mouseInfo = viewInstance.value.getMouseInfoAll(position)
-
- if (mouseInfo.surfacePosition && mouseInfo.surfacePosition != null) drawCustomPolygon(mouseInfo)
-}
-
-function addPlanarMenuEvent(click, pick, viewer) {
- if (savePolygonPosition.length <= 2) {
- ElMessage.warning('当前绘制无法形成面,请继续绘制或取消绘制!!')
-
- return
- }
- const { position } = click
-
- const mouseInfo = viewInstance.value.getMouseInfoAll(position)
-
- remove()
- removeMenuPanel()
-
- if (mouseInfo.surfacePosition && mouseInfo.surfacePosition != null) drawCustomPolygon(mouseInfo)
-
- const { x, y } = position
- saveMenuPanel = createSaveMenuPanel()
- saveMenuPanel.addEventListener('click', saveMenuClickEvent)
- saveMenuPanel.style.transform = `translate3d(${x}px, ${y}px, 0)`
- viewer.container.appendChild(saveMenuPanel)
-}
-
-function createSaveMenuPanel() {
- const menuPanel = document.createElement('div')
- menuPanel.className = 'planar-menu-panel'
-
- const arr = [
- { title: '保存框选', class: 'save-draw' },
- { title: '清除框选', class: 'anew-draw' },
- ]
-
- arr.forEach(item => {
- const title = document.createElement('div')
- title.innerText = item.title
- title.className = item.class
- menuPanel.appendChild(title)
- })
-
- return menuPanel
-}
-
-const emit = defineEmits(['upDateBoxSelect'])
-
-function saveMenuClickEvent(e) {
- const className = e.target.className
- if (className === 'save-draw') {
- emit('upDateBoxSelect')
- updateBoxSelect(savePolygonPosition)
- }
- if (className == 'anew-draw') {
- cancel()
- }
-
- removeSaveMenuPanel()
-}
-
-function removeSaveMenuPanel() {
- if (saveMenuPanel) {
- homeViewer.value.container?.removeChild(saveMenuPanel)
- saveMenuPanel.removeEventListener('click', saveMenuClickEvent)
- saveMenuPanel = null
- }
-}
-
-function createMenuPanel() {
- const menuPanel = document.createElement('div')
- menuPanel.className = 'planar-menu-panel'
-
- const title = document.createElement('div')
- title.innerText = '左击选择点位,右击结束'
- title.className = 'proof-custom-add-polygon'
- menuPanel.appendChild(title)
-
- return menuPanel
-}
-
-function removeMenuPanel() {
- if (menuPanel) {
- homeViewer.value.container?.removeChild(menuPanel)
- menuPanel = null
- }
-}
-
-function drawCustomPolygon(point) {
- if (curPolygonPosition.length == 0) {
- curPolygonPosition.push(point.surfacePosition.clone())
- curPolygon.positions.push(point.surfacePosition.clone())
- }
-
- savePolygonPosition.push(point.wgs84SurfacePosition)
- curPolygonPosition.push(point.surfacePosition.clone())
- curPolygon.positions.push(point.surfacePosition.clone())
-
- if (!curPolygonObj) {
- curPolygonEntity.polyline = {
- width: 2,
- material: Cesium.Color.WHITE,
- clampToGround: false,
- }
-
- curPolygonEntity.polyline.positions = new Cesium.CallbackProperty(function () {
- return curPolygonPosition
- }, false)
-
- curPolygonEntity.polygon = {
- hierarchy: new Cesium.CallbackProperty(function () {
- return curPolygon
- }, false),
-
- material: Cesium.Color.fromCssColorString('#00ffff').withAlpha(0.4),
- clampToGround: false,
- }
- curPolygonEntity.name = 'customProofPolygon'
-
- curPolygonEntity._id = 'customProofPolygon'
- curPolygonObj = homeViewer.value.entities.add(curPolygonEntity)
- }
-}
-
-function clearPlanar() {
- homeViewer.value.entities.remove(curPolygonObj)
- curPolygonObj = null
- curPolygon = null
- curPolygonEntity = null
- curPolygonPosition = []
- savePolygonPosition = []
-}
-
-function remove() {
- viewInstance.value.removeLeftClickEvent('drawCustomPolygon')
- viewInstance.value.removeRightClickEvent('drawCustomPolygon')
- viewInstance.value.removeMouseHandler('drawCustomPolygon')
-}
-
-function cancel() {
- remove()
- removeMenuPanel()
- clearPlanar()
-
- init()
-}
-
-onMounted(() => {
- document.addEventListener('contextmenu', preventDefault)
-
- init()
-})
-
-onBeforeUnmount(() => {
- document.removeEventListener('contextmenu', preventDefault)
-
- remove()
- removeMenuPanel()
- removeSaveMenuPanel()
- clearPlanar()
- homeViewer.value.scene.globe.depthTestAgainstTerrain = false
-})
-</script>
-
-<style lang="scss" scoped>
-p {
- text-indent: 2em;
- color: #ffffff;
- font-size: 18px;
-}
-
-.export-btns {
- margin-top: 44px;
- display: flex;
- align-items: center;
- justify-content: space-around;
-
- .el-button {
- background-color: transparent !important;
- }
-}
-</style>
diff --git a/applications/drone-command/src/views/resource/components/DrawPolygon.vue b/applications/drone-command/src/views/resource/components/DrawPolygon.vue
deleted file mode 100644
index ee8dfe1..0000000
--- a/applications/drone-command/src/views/resource/components/DrawPolygon.vue
+++ /dev/null
@@ -1,312 +0,0 @@
-<template>
- <div></div>
-</template>
-
-<script setup>
-import * as Cesium from 'cesium';
-
-import { ElMessage } from 'element-plus';
-import { sdfwUpdate } from '@/api/patchManagement';
-
-let curPolygonPosition = [];
-let savePolygonPosition = [];
-let curPolygon = null;
-let curPolygonEntity = null;
-let curPolygonObj = null;
-
-let menuPanel = null;
-let saveMenuPanel = null;
-
-const selectionIds = inject('selectionIds');
-const clearSelect = inject('clearSelect');
-const getTableList = inject('getTableList')
-
-const viewInstance = inject('viewInstance');
-const homeViewer = inject('homeViewer');
-watch(
- () => selectionIds.value,
- (newValue, oldValue) => {
- if (newValue && oldValue && newValue !== oldValue) {
- cancel();
- }
- }
-);
-function preventDefault(event) {
- event.preventDefault();
-
- return;
-}
-
-function init() {
- // let draw = new Draw(homeViewer.value);
- // draw.drawPlane();
- curPolygon = new Cesium.PolygonHierarchy();
- curPolygonEntity = new Cesium.Entity();
- homeViewer.value.scene.globe.depthTestAgainstTerrain = true;
-
- viewInstance.value.addLeftClickEvent(null, addPlanerPointEvent, 'drawCustomPolygon');
- viewInstance.value.addRightClickEvent(null, addPlanarMenuEvent, 'drawCustomPolygon');
- viewInstance.value.addMouseHandler(null, mouseMoveEvent, 'drawCustomPolygon');
-}
-
-function mouseMoveEvent(movement, viewer) {
- const mouseInfo = viewInstance.value.getMouseInfoAll(movement.endPosition);
-
- const { x, y } = mouseInfo.windowPosition;
-
- if (!menuPanel) {
- menuPanel = createMenuPanel();
- viewer.container.appendChild(menuPanel);
- }
-
- menuPanel.style.transform = `translate3d(${x}px, ${y}px, 0)`;
-
- if (
- curPolygonObj &&
- mouseInfo.surfacePosition &&
- mouseInfo.surfacePosition != null &&
- curPolygonPosition.length >= 1
- ) {
- curPolygonPosition.pop();
- curPolygonPosition.push(mouseInfo.surfacePosition);
-
- curPolygon.positions.pop();
- curPolygon.positions.push(mouseInfo.surfacePosition);
- }
-}
-
-function addPlanerPointEvent(click, pick) {
- const { position } = click;
-
- const mouseInfo = viewInstance.value.getMouseInfoAll(position);
-
- if (mouseInfo.surfacePosition && mouseInfo.surfacePosition != null) drawCustomPolygon(mouseInfo);
-}
-
-function addPlanarMenuEvent(click, pick, viewer) {
- if (savePolygonPosition.length <= 2) {
- ElMessage.warning('当前绘制无法形成面,请继续绘制或取消绘制!!');
-
- return;
- }
- const { position } = click;
-
- const mouseInfo = viewInstance.value.getMouseInfoAll(position);
-
- remove();
- removeMenuPanel();
-
- if (mouseInfo.surfacePosition && mouseInfo.surfacePosition != null) drawCustomPolygon(mouseInfo);
-
- const { x, y } = position;
- saveMenuPanel = createSaveMenuPanel();
- saveMenuPanel.addEventListener('click', saveMenuClickEvent);
- saveMenuPanel.style.transform = `translate3d(${x}px, ${y}px, 0)`;
- viewer.container.appendChild(saveMenuPanel);
-}
-
-function createSaveMenuPanel() {
- const menuPanel = document.createElement('div');
- menuPanel.className = 'planar-menu-panel';
-
- const arr = [
- { title: '提交绘制', class: 'save-draw' },
- { title: '重新绘制', class: 'anew-draw' },
- ];
-
- arr.forEach(item => {
- const title = document.createElement('div');
- title.innerText = item.title;
- title.className = item.class;
- menuPanel.appendChild(title);
- });
-
- return menuPanel;
-}
-
-function saveMenuClickEvent(e) {
- const className = e.target.className;
- if (className === 'save-draw') {
- updatePolygon();
- }
- if (className == 'anew-draw') {
- cancel();
- }
-
- removeSaveMenuPanel();
-}
-
-function removeSaveMenuPanel() {
- if (saveMenuPanel) {
- homeViewer.value.container?.removeChild(saveMenuPanel);
- saveMenuPanel.removeEventListener('click', saveMenuClickEvent);
- saveMenuPanel = null;
- }
-}
-
-function createMenuPanel() {
- const menuPanel = document.createElement('div');
- menuPanel.className = 'planar-menu-panel';
-
- const title = document.createElement('div');
- title.innerText = '左击选择点位,右击结束';
- title.className = 'proof-custom-add-polygon';
- menuPanel.appendChild(title);
-
- return menuPanel;
-}
-
-function removeMenuPanel() {
- if (menuPanel) {
- homeViewer.value.container?.removeChild(menuPanel);
- menuPanel = null;
- }
-}
-
-function drawCustomPolygon(point) {
- if (curPolygonPosition.length == 0) {
- curPolygonPosition.push(point.surfacePosition.clone());
- curPolygon.positions.push(point.surfacePosition.clone());
- }
-
- savePolygonPosition.push(point.wgs84SurfacePosition);
- curPolygonPosition.push(point.surfacePosition.clone());
- curPolygon.positions.push(point.surfacePosition.clone());
-
- if (!curPolygonObj) {
- curPolygonEntity.polyline = {
- width: 2,
- material: Cesium.Color.WHITE,
- clampToGround: true,
- };
-
- curPolygonEntity.polyline.positions = new Cesium.CallbackProperty(function () {
- return curPolygonPosition;
- }, false);
-
- curPolygonEntity.polygon = {
- hierarchy: new Cesium.CallbackProperty(function () {
- return curPolygon;
- }, false),
-
- material: Cesium.Color.fromCssColorString('#00ffff').withAlpha(0.4),
- clampToGround: false,
- };
- curPolygonEntity.name = 'customProofPolygon';
-
- curPolygonEntity._id = 'customProofPolygon';
- curPolygonObj = homeViewer.value.entities.add(curPolygonEntity);
- }
-}
-
-function clearPlanar() {
- homeViewer.value.entities.remove(curPolygonObj);
- curPolygonObj = null;
- curPolygon = null;
- curPolygonEntity = null;
- curPolygonPosition = [];
- savePolygonPosition = [];
-}
-
-function remove() {
- viewInstance.value.removeLeftClickEvent('drawCustomPolygon');
- viewInstance.value.removeRightClickEvent('drawCustomPolygon');
- viewInstance.value.removeMouseHandler('drawCustomPolygon');
-}
-
-const emit = defineEmits(['upDateDrawState',]);
-
-function updatePolygon() {
- let polygon = savePolygonPosition.reduce((pre, cur) => {
- pre.push(`${cur.lng} ${cur.lat}`);
- return pre;
- }, []);
- polygon.push(polygon[0]);
-
- // 接口
- sdfwUpdate({
- ids: selectionIds.value,
- sdfw: `POLYGON((${polygon.join(',')}))`,
- })
- .then(res => {
- if (selectionIds.value) {
- emit('upDateDrawState')
- selectionIds.value = null
- clearSelect()
- }
-
- if (res.data.code !== 0) return ElMessage.error(res.message)
- ElMessage.success('重新绘制图斑成功!!')
- getTableList()
- })
- .catch(e => {
- cancel()
- })
-}
-
-
-function cancel() {
- remove();
- removeMenuPanel();
- clearPlanar();
- removeSaveMenuPanel();
- init();
-}
-
-onMounted(() => {
- document.addEventListener('contextmenu', preventDefault);
-
- init();
-});
-
-onBeforeUnmount(() => {
- document.removeEventListener('contextmenu', preventDefault);
-
- remove();
- removeMenuPanel();
- removeSaveMenuPanel();
- clearPlanar();
-
- homeViewer.value.scene.globe.depthTestAgainstTerrain = false;
-});
-</script>
-
-<style lang="scss" scoped>
-p {
- text-indent: 2em;
- color: #ffffff;
- font-size: 18px;
-}
-
-.export-btns {
- margin-top: 44px;
- display: flex;
- align-items: center;
- justify-content: space-around;
-
- .el-button {
- background-color: transparent !important;
- }
-}
-.proof-custom-add-polygon {
- position: absolute;
- left: 20px;
- background: rgba(0, 0, 0, 0.6);
- white-space: nowrap;
- border-radius: 4px;
-pointer-events: none;
- &::after {
- content: '';
- position: absolute;
- left: -3px;
- top: calc(50% - 2px);
- width: 0;
- height: 0;
- border-top: 4px solid rgba(0, 0, 0, 0.6);
- border-left: 4px solid rgba(0, 0, 0, 0.6);
- border-right: 4px solid transparent;
- border-bottom: 4px solid transparent;
- transform: rotate(-45deg);
- }
-}
-</style>
diff --git a/applications/drone-command/src/views/resource/components/FunButton.vue b/applications/drone-command/src/views/resource/components/FunButton.vue
deleted file mode 100644
index 4a4c38e..0000000
--- a/applications/drone-command/src/views/resource/components/FunButton.vue
+++ /dev/null
@@ -1,151 +0,0 @@
-<template>
- <div class="fun-button-container">
- <template v-for="(item, index) in tooltipList" :key="index">
- <el-popover
- effect="dark"
- placement="right"
- :trigger="item.isClick ? 'click' : 'hover'"
- popper-class="function-popover"
- v-if="item.show"
- >
- <div>
- <div>{{ item.label[Number(item.isSelected)] }}</div>
- </div>
- <template #reference v-if="item.show">
- <div
- :class="['currency-box', { 'actived-blue': item.isSelected && item.isSelectColor && item.showActive }]"
- @click="item.event(item, index)"
- >
- <img :src="item.icon[Number(item.isSelected)]" alt="_icon" />
- </div>
- </template>
- </el-popover>
- </template>
- </div>
-
- <BoxSelect v-if="isShowBoxSelect" @upDateBoxSelect="upDateBoxSelect" />
- <DrawPolygon v-if="isShowDrawPolygon" @upDateDrawState="upDateDrawState" />
-</template>
-
-<script setup>
-import { useStore } from 'vuex'
-import drawPng from '@/assets/images/home/territory/draw.png'
-import noDrawPng from '@/assets/images/home/territory/no-draw.png'
-import boxSelectPng from '@/assets/images/home/territory/box-select.png'
-
-import BoxSelect from './BoxSelect.vue'
-import DrawPolygon from './DrawPolygon.vue'
-
-const isBoxSelect = defineModel('isBoxSelect')
-const isDrawPolygon = defineModel('isDrawPolygon')
-const isShowBoxSelect = ref(false)
-const isShowDrawPolygon = ref(false)
-
-const isDrawPolygonSelect = ref(false)
-
-watch(isBoxSelect, newVal => {
- if (newVal === false) {
- isShowBoxSelect.value = newVal
-
- setBoxSelect(null, 1, newVal)
- }
-})
-
-watch(isDrawPolygon, newVal => {
- if (newVal === false) {
- isShowDrawPolygon.value = newVal
-
- setDrawState(null, 0, newVal)
- }
-})
-
-const tooltipList = ref([
- {
- showActive: true,
- label: ['重新绘制', '取消绘制'],
- isSelectColor: true,
- isSelected: false,
- icon: [drawPng, noDrawPng],
- event: setDrawState,
- show: isDrawPolygon,
- },
-
- {
- showActive: true,
- label: ['框选', '取消框选'],
- isSelectColor: true,
- isSelected: false,
- icon: [boxSelectPng, boxSelectPng],
- event: setBoxSelect,
- show: isBoxSelect,
- },
-])
-
-function setDrawState(value, index, show = null) {
- if (show != null) {
- tooltipList.value[index].isSelected = show
- } else {
- tooltipList.value[index].isSelected = !tooltipList.value[index].isSelected
- }
-
- isShowDrawPolygon.value = tooltipList.value[index].isSelected
- isDrawPolygonSelect.value = tooltipList.value[index].isSelected
-}
-
-function upDateDrawState(show = false) {
- setDrawState(null, 0, show)
-}
-
-function setBoxSelect(value, index, show = null) {
- if (show != null) {
- tooltipList.value[index].isSelected = show
- } else {
- tooltipList.value[index].isSelected = !tooltipList.value[index].isSelected
- }
-
- isShowBoxSelect.value = tooltipList.value[index].isSelected
-}
-
-function upDateBoxSelect(show = false) {
- setBoxSelect(null, 1, show)
-}
-
-defineExpose({
- upDateDrawState,
- isDrawPolygonSelect,
-})
-</script>
-
-<style lang="scss" scoped>
-.fun-button-container {
- position: absolute;
- top: 50px;
- left: 23%;
- transform: translate(100%, 0);
-}
-
-.currency-box {
- width: 45px;
- height: 45px;
- border-radius: 3px;
- background: url('@/assets/images/home/territory/newcon_box.png');
- display: flex;
- align-items: center;
- justify-content: center;
- overflow: hidden;
- cursor: pointer;
- margin-bottom: 8px;
- pointer-events: all;
-
- img {
- width: 31px;
- // height: 31px;
- }
-}
-
-.actived-blue {
- background-image: none;
- // background-color: #409eff;
- background-color: rgba(23, 124, 198, 0.7);
-}
-</style>
diff --git a/applications/drone-command/src/views/resource/components/patchDetails.vue b/applications/drone-command/src/views/resource/components/patchDetails.vue
deleted file mode 100644
index 343df2c..0000000
--- a/applications/drone-command/src/views/resource/components/patchDetails.vue
+++ /dev/null
@@ -1,15 +0,0 @@
-<template>
- <el-dialog append-to-body v-model="patchDetailsShow">
- <el-tabs v-model="activeTab" type="border-card">
- <el-tab-pane label="图斑详情" name="first">图斑详情</el-tab-pane>
- <el-tab-pane label="图斑类型" name="second">图斑类型</el-tab-pane>
- <el-tab-pane label="图斑区域" name="third">图斑区域</el-tab-pane>
- </el-tabs>
- </el-dialog>
-</template>
-
-<script setup>
-const patchDetailsShow = ref(true)
-</script>
-
-<style lang="scss" scoped></style>
\ No newline at end of file
diff --git a/applications/drone-command/src/views/resource/components/spotDetails.vue b/applications/drone-command/src/views/resource/components/spotDetails.vue
deleted file mode 100644
index c5bcbc4..0000000
--- a/applications/drone-command/src/views/resource/components/spotDetails.vue
+++ /dev/null
@@ -1,955 +0,0 @@
-<template>
- <el-dialog
- class="spotDialog command-dialog-mange"
- :title="props.title"
- v-model="uploadPatchDialog"
- width="78%"
- align-center
-
- >
- <div class="container">
- <!-- 信息展示区 -->
- <div class="infoBox">
- <div class="itemBoxLeft">
- <div v-for="(item, index) in infoList" :key="index" class="itemCon">
- <div class="itemBox">
- <div class="itemTitle">
- <span
- v-if="
- props.title === '图斑编辑' &&
- (item.name === '文件名称' || item.name === '图斑类型')
- "
- style="color: red"
- >*</span
- >{{ item.name }}:
- </div>
- <div class="itemContent">
- <template v-if="props.title === '图斑编辑' && item.editable">
- <template v-if="item.name === '图斑类型'">
- <el-select
- v-model="item.value"
- placeholder="请选择图斑类型"
- style="width: 102%"
-
- >
- <el-option
- v-for="opt in spotTypeOptions"
- :key="opt.value"
- :label="opt.label"
- :value="opt.value"
- />
- </el-select>
- </template>
- <template v-else-if="item.name === '文件名称'">
- <el-input style="width: 102%" v-model="item.value" />
- </template>
- </template>
- <template v-else>
- <div class="itemValue" :class="{ 'error-text': item.name === '异常图斑数量' }">
- {{ item.value }}
- </div>
- </template>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <!-- 地图和表格容器 -->
- <div class="map-container">
- <!-- 图斑列表 -->
- <div class="table-overlay">
- <div class="table-content">
- <div class="tabname">图斑列表</div>
- <div class="tabBoxLoading"
- v-loading="tableLoading"
- element-loading-text="加载中..."
- element-loading-background="rgba(0, 0, 0, 0.1)"
- >
- <el-table
- v-if="tableData.length > 0"
-
- ref="polygonTableEle"
- highlight-current-row
- :row-class-name="tableRowClassName"
- :data="tableData"
- @row-click="handleLocationPolygon"
-
- >
- <el-table-column type="index" align="center" :width="pxToRemNum(30)" label="序号">
- <template #default="{ $index }">
- {{ ($index + 1).toString().padStart(2, '0') }}
- </template>
- </el-table-column>
- <el-table-column prop="dkbh" align="center" label="图斑名称" show-overflow-tooltip />
- <el-table-column prop="is_exception" :width="pxToRemNum(50)" align="center" label="图斑状态">
- <template #default="scope">
- <span>{{ scope.row.is_exception === 2 ? '异常' : '正常' }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" v-if="props.title === '图斑编辑'">
- <template #default="scope">
- <!-- <span class="operationspan" @click="handleDelete(scope.row)">删除</span> -->
- <el-button icon="el-icon-delete" link @click="handleDelete(scope.row)"></el-button>
- <!-- <span
- class="operationspan"
- v-if="scope.row.is_exception == 2"
- @click.stop="handleSelectionChange(scope.row)"
- >
- {{ isEditing && selectionIds === scope.row.id ? '取消编辑' : '编辑' }}
- </span> -->
- <template v-if="scope.row.is_exception == 2">
- <el-button
- v-if="!isEditing || selectionIds !== scope.row.id"
- icon="el-icon-edit"
- link
- @click.stop="handleSelectionChange(scope.row)"
- />
- <el-button
- v-else
- icon="el-icon-circle-close"
- link
- @click.stop="handleSelectionChange(scope.row)"
-
- />
- </template>
- </template>
- </el-table-column>
- </el-table>
- </div>
-
- </div>
- </div>
- <!--绘制按钮-->
-
- <DrawPolygon
- ref="drawPolygonRef"
- v-if="isEditing"
- @upDateDrawState="handleUpDateDrawState"
-
- />
- <!-- 完成/取消 -->
- <div class="btnGroups" v-if="props.title === '图斑编辑'">
- <img @click="handleSave" src="@/assets/images/home/territory/savebtn.png" alt="" />
- <img @click="handleCancel" src="@/assets/images/home/territory/cancelbtn.png" alt="" />
- </div>
- <!-- 地图 -->
- <div id="spotMap" v-loading="loading" element-loading-text="加载中..." element-loading-background="rgba(0, 0, 0, 0.7)" class="command-cesium" v-show="uploadPatchDialog"></div>
- </div>
- </div>
- </el-dialog>
-</template>
-
-<script setup>
-import { flyVisual } from '@ztzf/utils'
-import { pxToRem, pxToRemNum } from '@/utils/rem'
-import DrawPolygon from '@/views/resource/components/DrawPolygon.vue';
-import { ElMessage, ElMessageBox } from 'element-plus';
-import { findAreaName } from '@/utils/areaUtils';
-import {
- patchEditApi,
- tableMapListApi,
- deletePatches,
- AlltableMapListApi,
- spotManagementTableApi,
-} from '@/api/patchManagement/index';
-import { getCenterPoint } from '@/utils/cesium/mapUtil.js';
-
-import * as Cesium from 'cesium';
-import { PublicCesium } from '@/utils/cesium/publicCesium';
-import { ref, watch, onBeforeUnmount, onMounted } from 'vue';
-// 标记地图是否初始化完成
-const isMapReady = ref(false);
-const uploadPatchDialog = defineModel('show');
-const props = defineProps(['title', 'detailid', 'detailList', 'spotTypeOption', 'regionalData']);
-const polygonTableEle = ref(null);
-let publicCesiumInstance = null;
-let viewer = null;
-const viewInstance = shallowRef(null);
-const homeViewer = shallowRef(null);
-let tbJwdList = [];
-const loading = ref(true);
-const tableLoading = ref(true);
-const tableData = ref([]);
-const AlltableData = ref([]);
-let total = ref(0);
-const refreshonload = inject('searchReset');
-const initialFileName = ref('');
-const initialSpotTypeId = ref('');
-const initialSpotTypeLabel = ref('');
-const spotManagementData = ref(null);
-const isEditing = ref(false);
-const drawPolygonRef = ref(null);
-// 记录上一次点击高亮
-let lastHighlightRow = null;
-// 功能按钮区域相关:编辑图斑等
-const funButtonEle = ref(null);
-const isBoxSelect = ref(false);
-const isDrawPolygon = ref(false);
-// 选中了哪些图斑
-const selectionIds = ref(null);
-const selectionList = ref([]);
-// 当前在编辑状态的异常图斑
-let curCustomPolygon = null;
-let lastEntity = null;
-// 表格隔行变色
-const tableRowClassName = ({ rowIndex }) => {
- return rowIndex % 2 === 1 ? 'oddNumberRow' : 'even-row';
-};
-const spotTypeOptions = ref([]);
-const infoList = ref([
- { name: '文件名称', value: '', field: 'file_name', editable: true },
- { name: '图斑类型', value: '', field: 'lot_type_id', editable: true },
- { name: '图斑数量', value: '', field: 'patches_num', editable: false },
- { name: '异常图斑数量', value: '', field: 'exception_num', editable: false },
- { name: '行政区划', value: '', field: 'areaName', editable: false },
- { name: '数据来源', value: '', field: 'dataFrom', editable: false },
- { name: '创建时间', value: '', field: 'create_time', editable: false },
- { name: '创建人', value: '', field: 'user_name', editable: false },
-]);
-watch(
- () => props.spotTypeOption,
- newOptions => {
- if (newOptions) {
- spotTypeOptions.value = newOptions.map(opt => ({
- label: opt.label,
- value: opt.value,
- }));
- }
- },
- { immediate: true }
-);
-watch(
- () => spotManagementData.value,
- newVal => {
- if (newVal) updateInfoList(newVal);
- },
- { immediate: true }
-);
-
-// 图斑编辑详情
-const getspotManagementTableApi = () => {
- spotManagementTableApi({ id: props.detailid }).then(res => {
- spotManagementData.value = {
- ...res.data.data.records[0],
- dataFrom: res.data.data.records[0].date_from === 0 ? '本地上传' : '国土调查云',
- areaName: findAreaName(res.data.data.records[0].area_code, props.regionalData, true),
- };
- });
-};
-
-// 将 lot_type_id 转换为对应的 label
-const getPatchTypeLabel = lotTypeId => {
- const option = spotTypeOptions.value.find(opt => opt.value === String(lotTypeId));
- return option ? option.label : '';
-};
-const updateInfoList = detailData => {
- if (!detailData) return;
- if (initialFileName.value === '' || initialSpotTypeId.value === '') {
- initialFileName.value = detailData.file_name || '';
- initialSpotTypeId.value = detailData.lot_type_id || '';
- initialSpotTypeLabel.value =
- detailData.patches_type_desc || getPatchTypeLabel(detailData.lot_type_id);
- }
- infoList.value = infoList.value.map(item => {
- const value = detailData[item.field] ?? item.value;
- if (item.name === '图斑类型') {
- return {
- ...item,
- value: detailData.patches_type_desc || getPatchTypeLabel(detailData.lot_type_id),
- originalValue: detailData.lot_type_id,
- };
- }
- return { ...item, value };
- });
-};
-const params = ref({
- page: 1,
- pageSize: 10,
-});
-const isInit = ref(true);
-// 图斑管理表格
-const getTableList = () => {
- tableLoading.value = true;
- const requestParams = {
- patchesInfoId: props.detailid,
- };
- AlltableMapListApi(requestParams).then(res => {
- tableData.value = res.data.data?.map(item => ({
- ...item,
- dkfw: item.sdfw && item.is_exception == 1 ? item.sdfw : item.dkfw,
- }));
- total.value = res.data.data.total || res.data.data.length;
- tbJwdList = [];
- viewer?.entities.removeAll();
- if (!tableData.value) {
- viewInstance.value?.flyToContour();
- } else {
- entitiesAddSpot();
- }
- }).finally(() => {
- tableLoading.value = false;
- });
-};
-
-
-
-// 地图
-const initMap = () => {
- if (!document.getElementById('spotMap') || isMapReady.value) return;
-
- publicCesiumInstance = new PublicCesium({
- dom: 'spotMap',
- flatMode: false,
- terrain: true,
- layerMode: 4,
- contour: false,
- });
-
- homeViewer.value = publicCesiumInstance.getViewer();
- viewer = publicCesiumInstance.getViewer();
- viewInstance.value = publicCesiumInstance;
- viewer.scene.globe.depthTestAgainstTerrain = true;
- viewInstance.value.switchContour(true);
-
- // 确保 readyPromise 存在
- if (viewer.readyPromise) {
- viewer.readyPromise.then(() => {
- isMapReady.value = true;
- getTableList();
- }).catch((error) => {
- console.error('地图加载失败:', error);
- ElMessage.error('地图加载失败,请刷新重试');
- });
- } else {
-
- // 如果没有 readyPromise
- setTimeout(() => {
- isMapReady.value = true;
- getTableList();
- }, 1000);
- }
-};
-
-
-// 仅弹框初始化时执行的定位逻辑
-const initMapLocation = () => {
- if (tbJwdList.length === 0 || !homeViewer.value) return;
-
- // 计算所有图斑的包围球(用于初始化定位)
- const allPositions = tbJwdList.flatMap(item =>
- Cesium.Cartesian3.fromDegreesArray(item.grouped)
- );
- const boundingSphere = Cesium.BoundingSphere.fromPoints(allPositions);
-
- // 初始化定位(仅执行一次)
- homeViewer.value.camera.flyToBoundingSphere(boundingSphere, {
- duration: 0,
- offset: new Cesium.HeadingPitchRange(
- Cesium.Math.toRadians(0),
- Cesium.Math.toRadians(-90)
- ),
- });
-};
-// 初始化所有图斑
-const entitiesAddSpot = () => {
-if (!isMapReady.value || !viewer) return;
- viewer?.entities.removeAll();
- tbJwdList = []; // 重置经纬度列表
-
- tableData.value.forEach(item => {
- const numbersWithCommas = item.dkfw.match(/\d+(\.\d+)?/g);
- if (!numbersWithCommas) return;
-
- const grouped = numbersWithCommas.map(Number);
- tbJwdList.push({ ...item, grouped }); // 存储经纬度用于后续操作
-
- // 绘制图斑(保留原有逻辑,仅移除定位相关代码)
- const fillColor = item.is_exception === 2
- ? Cesium.Color.RED.withAlpha(0.5)
- : Cesium.Color.YELLOW.withAlpha(0.5);
- const outlineColor = item.is_exception === 2
- ? Cesium.Color.RED
- : Cesium.Color.YELLOW;
-
- homeViewer.value?.entities?.add({
- id: `polygon_dk${item.id}`,
- customType: 'pattern_spot_polygon',
- customInfo: item,
- polygon: {
- hierarchy: new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray(grouped)),
- material: fillColor,
- outline: true,
- outlineColor: outlineColor,
- outlineWidth: 2,
- clampToGround: true,
- outlineDepthFailColor: outlineColor,
- },
- polyline: {
- positions: Cesium.Cartesian3.fromDegreesArray(grouped),
- width: 2,
- material: outlineColor,
- clampToGround: true,
- },
- zIndex: 99,
- });
- });
-
- // 仅在初始化阶段执行定位(关键:通过isInit控制)
- if (isInit.value) {
- initMapLocation();
- isInit.value = false; // 初始化完成,后续不再执行定位
- }
-
- // 保留图斑点击高亮事件(原有逻辑不变)
- viewInstance.value?.removeLeftClickEvent('spotHighlighting');
- viewInstance.value?.addLeftClickEvent(null, spotHighlighting, 'spotHighlighting');
-};
-
-// 高亮当前选中图斑,并定位
-const getEntityByDataId = dataId => {
- if (!homeViewer.value) return null;
- const entityId = `polygon_dk${dataId}`;
- return homeViewer.value.entities.getById(entityId);
-};
-const handleLocationPolygon = data => {
- if (!data) return;
-
- // 取消任何现有的绘制状态(与编辑取消逻辑一致)
- if (isEditing.value) {
- isEditing.value = false;
- handleUpDateDrawState(false);
- selectionIds.value = null;
- selectionList.value = [];
- }
-
- const targetEntity = getEntityByDataId(data.id);
- if (targetEntity) {
- updateMapSpotInfo(targetEntity);
- // 同步表格选中状态
- const clickTableID = tableData.value.findIndex(i => i.id === data.id);
- const rows = polygonTableEle?.value.$el.querySelectorAll('.el-table__body tr');
- const targetRow = rows[clickTableID];
-
- nextTick(() => {
- const table = polygonTableEle?.value;
- if (table && targetRow) {
- table.setCurrentRow(tableData.value[clickTableID]);
- targetRow.scrollIntoView({ behavior: 'smooth', block: 'center' });
- }
- });
- }
-};
-
-// 鼠标触发点击图斑高亮 pick:可以获取当前图斑数据
-function spotHighlighting(click, pick, viewer) {
- let entities = viewer?.scene
- .drillPick(click.position)
- .filter(item => item.id)
- .map(i => i.id)
- .filter(i => i._customType === 'pattern_spot_polygon');
- if (!pick || !(pick.id?.customType == 'pattern_spot_polygon')) return;
- const nowEntity = entities?.[0];
- const nowData = nowEntity.customInfo;
- const clickTableID = tableData.value.findIndex(i => i.id === nowData.id);
- const rows = polygonTableEle?.value.$el.querySelectorAll('.el-table__body tr');
- const targetRow = rows[clickTableID];
-
- nextTick(() => {
- const table = polygonTableEle?.value;
- if (!table || !targetRow) return;
- // 表格滚动到中间位置
- targetRow.scrollIntoView({ behavior: 'smooth', block: 'center' });
- // 同步表格选中状态
- table.setCurrentRow(tableData.value[clickTableID]);
- });
-
- updateMapSpotInfo(nowEntity);
-}
-function updateMapSpotInfo(nowEntity) {
- const nowData = nowEntity.customInfo;
- if (!nowEntity) return;
- if (nowEntity.customInfo.id === lastEntity?.customInfo.id) return;
- nowEntity.polygon.material = Cesium.Color.RED.withAlpha(0);
- nowEntity.polyline.material = Cesium.Color.RED;
- if (lastEntity) {
- const lastData = lastEntity.customInfo;
- const originalFillColor =
- lastData.is_exception === 2
- ? Cesium.Color.RED.withAlpha(0.5)
- : Cesium.Color.YELLOW.withAlpha(0.5);
- const originalOutlineColor =
- lastData.is_exception == 2 ? Cesium.Color.RED : Cesium.Color.YELLOW;
- lastEntity.polygon.material = originalFillColor;
- lastEntity.polygon.outlineColor = originalOutlineColor;
- lastEntity.polyline.material = originalOutlineColor;
- }
- lastEntity = nowEntity;
- const numbersWithCommas = nowData.dkfw.match(/\d+(\.\d+)?/g);
- if (numbersWithCommas) {
-
- const positionsData = [];
- for (let i = 0; i < numbersWithCommas.length; i += 2) {
- const lon = Number(numbersWithCommas[i]);
- const lat = Number(numbersWithCommas[i + 1]);
- positionsData.push([lon, lat, 10]);
- }
- flyVisual({
- positionsData: positionsData,
- viewer: homeViewer.value,
- multiple: 15,
-
- });
- }
-}
-// 清空选中的数据
-const clearSelect = () => {
- lastHighlightRow = null;
- selectionList.value = [];
- viewer?.entities.removeAll();
-};
-// 编辑
-
-const handleSelectionChange = row => {
- // 如果是同一个图斑且正在编辑,则取消编辑
- if (selectionIds.value === row.id && isEditing.value) {
- isEditing.value = false;
- handleUpDateDrawState(false);
- selectionIds.value = null;
- selectionList.value = [];
- return;
- }
-
- // 定位到选中的图斑
- handleLocationPolygon(row);
-
- // 仅异常图斑可编辑
- if (row.is_exception !== 2) {
- ElMessage.warning('仅异常图斑支持编辑绘制');
- return;
- }
-
- // 设置编辑状态
- selectionIds.value = row.id;
- selectionList.value = row;
- isEditing.value = true;
- handleUpDateDrawState(true);
-};
-const handleUpDateDrawState = show => {
- isEditing.value = show; // 同步编辑状态
- if (!show) {
- // 绘制关闭时,清空选中的编辑行
- selectionIds.value = null;
- selectionList.value = [];
- }
-};
-// 删除
-const handleDelete = (row) => {
- ElMessageBox.confirm('确认删除当前行图斑?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- }).then(() => {
- deletePatches({ ids: row.id }).then(res => {
- if (res.data.code !== 0) return ElMessage.warning('删除失败');
- ElMessage.success('删除成功');
- tableData.value = tableData.value.filter(item => item.id !== row.id);
- //从地图上移除对应的图斑实体
- const entityId = `polygon_dk${row.id}`;
- viewer?.entities.removeById(entityId);
- const exceptionCountItem = infoList.value.find(item => item.name === '异常图斑数量');
- if (exceptionCountItem && row.is_exception === 2) {
- exceptionCountItem.value = Math.max(0, parseInt(exceptionCountItem.value) - 1);
- }
- const totalCountItem = infoList.value.find(item => item.name === '图斑数量');
- if (totalCountItem) {
- totalCountItem.value = Math.max(0, parseInt(totalCountItem.value) - 1);
- }
-
- // 清除选中状态
- if (selectionIds.value === row.id) {
- selectionIds.value = null;
- selectionList.value = [];
- isEditing.value = false;
- handleUpDateDrawState(false);
- }
-
- });
- });
-};
-
-// 保存
-const handleSave = () => {
- const fileNameItem = infoList.value.find(item => item.name === '文件名称');
- const patchTypeItem = infoList.value.find(item => item.name === '图斑类型');
- let lotTypeId;
- // 检查value是否为数字类型(包括字符串形式的数字)
- const isValueNumber =
- !isNaN(Number(patchTypeItem.value)) &&
- patchTypeItem.value !== '' &&
- patchTypeItem.value !== null &&
- patchTypeItem.value !== undefined;
- if (isValueNumber) {
- // 转换为数字类型
- lotTypeId = Number(patchTypeItem.value);
- } else {
- // 使用原始值
- lotTypeId = patchTypeItem.originalValue;
- }
- // 构建请求参数
- const updateParams = {
- file_name: fileNameItem.value,
- lot_type_id: lotTypeId,
- type: lotTypeId,
- id: props.detailList.id,
- };
- patchEditApi(updateParams).then(res => {
- ElMessage.success(res.data.data);
- refreshonload();
- uploadPatchDialog.value = false;
- });
-};
-// 取消
-const handleCancel = () => {
- const fileNameItem = infoList.value.find(item => item.name === '文件名称');
- const spotTypeItem = infoList.value.find(item => item.name === '图斑类型');
- if (fileNameItem) {
- fileNameItem.value = initialFileName.value;
- }
- if (spotTypeItem) {
- spotTypeItem.value = initialSpotTypeLabel.value;
- spotTypeItem.originalValue = initialSpotTypeId.value;
- }
- if (isEditing.value) {
- isEditing.value = false;
- handleUpDateDrawState(false);
- }
- clearSelect();
- isDrawPolygon.value = false; // 关闭地图绘制状态
- uploadPatchDialog.value = false;
-};
-provide('selectionIds', selectionIds);
-provide('homeViewer', homeViewer);
-provide('viewInstance', viewInstance);
-provide('clearSelect', clearSelect);
-provide('getTableList', getTableList);
-// 销毁
-const destroyMap = () => {
- if (viewer) {
- viewer.destroy();
- viewer = null;
- }
- publicCesiumInstance = null;
-};
-
-
-watch(uploadPatchDialog, newVal => {
- if (newVal) {
- isInit.value = true;
- isMapReady.value = false;
- setTimeout(() => {
- initMap();
- getspotManagementTableApi();
- }, 0);
- } else {
- tableLoading.value = false;
- tableData.value = [];
- isEditing.value = false;
- handleUpDateDrawState(false);
- destroyMap();
- isInit.value = false;
- clearSelect();
- isMapReady.value = false;
- }
- refreshonload();
-});
-onMounted(() => {});
-onBeforeUnmount(() => {
- destroyMap();
-});
-</script>
-
-<style scoped lang="scss">
-:global(.spotDialog .el-dialog__header span) {
- padding-left: 16px !important;
- display: inline-block;
-}
-:global(.spotDialog .el-dialog__header) .el-dialog__title {
- font-family: 'Source Han Sans CN' !important;
- font-weight: bold !important;
- font-size: 16px !important;
- color: #363636 !important;
-}
-:global(.spotDialog .el-dialog__body) {
- padding: 2rem 2rem 0 !important;
-
- }
-.container {
- display: flex;
- flex-direction: column;
- height: 100%;
- padding: 10px 20px 23px 20px;
-}
-
-.infoBox {
- display: flex;
- justify-content: space-between;
- margin-bottom: 16px;
- border: 1px solid;
- border: 1px solid #e8e8e8;
- border-radius: 4px;
- background: #fff;
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
-
- .itemBoxLeft {
- flex: 1;
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- row-gap: 0;
- padding: 0;
- font-size: 14px;
- }
-
- .itemCon {
- border-bottom: 1px solid #e8e8e8;
-
- &:nth-child(2n) {
- .itemBox {
- border-right: none;
- }
- }
-
- &:nth-last-child(-n + 2) {
- border-bottom: none;
- }
- }
-
- .itemBox {
- display: flex;
- align-items: center;
- height: 33px;
- padding: 0 10px;
- border-right: 1px solid #e8e8e8;
- border-bottom: none;
-
- .itemTitle {
- width: 202px;
- font-family: Source Han Sans CN, Source Han Sans CN;
- font-weight: 400;
- font-size: 14px;
- color: #383838;
- text-align: right;
- background: #fafafa;
- height: 100%;
- line-height: 33px;
- padding-right: 10px;
- margin: 0 -10px 0 -10px;
- border-right: 1px solid #e8e8e8;
- }
-
- .itemContent {
- flex: 1;
- padding-left: 10px;
- .itemValue {
- padding-left: 6px;
- color: #7b7b7b;
- }
- .error-text {
- color: #ff0a0a;
- }
- }
- }
-}
-
-.map-container {
- position: relative;
- height: 620px;
- width: 100%;
-}
-.table-overlay {
- position: absolute;
- top: 0;
- left: 0;
- height: 99%;
- z-index: 99;
- width: 277px;
- overflow: hidden;
- background: rgba(0, 0, 0, 0.8);
-
- border-radius: 8px 8px 8px 8px;
- padding: 6px 10px 0 10px;
- display: flex;
- flex-direction: column;
-}
-
-.table-content {
- width: 100%;
- display: flex;
- flex-direction: column;
- height: 99%;
- .tabname {
- font-family: Source Han Sans CN, Source Han Sans CN;
- font-weight: bold;
- font-size: 14px;
- color: #ffffff;
- }
-
- // 表格样式
- :deep(.el-table) {
- // 清除表格内部横线和竖线
- &::before,
- &::after,
- .el-table__inner-wrapper::before,
- .el-table__inner-wrapper::after {
- background-color: transparent !important;
- // display: none !important; // 彻底隐藏伪元素边框
- }
- .el-table__header-wrapper th {
- border: none !important;
- }
- --el-table-bg-color: transparent !important;
- --el-table-tr-bg-color: transparent !important;
-
- --el-table-row-hover-bg-color: rgba(30, 58, 138, 0.5) !important;
- --el-table-current-row-bg-color: rgba(30, 58, 138, 0.7) !important;
- color: #fff !important;
- .cell {
- padding: 0px !important;
- font-size: 12px !important;
- }
- // 隔行变色
- .even-row {
- background-color: rgba(255, 255, 255, 0.17) !important;
- }
- .oddNumberRow {
- background-color: rgba(255, 255, 255, 0.08) !important;
- }
-
- // 表头样式
- .el-table__header {
- th {
- background: rgba(51, 51, 51, 0.32) !important;
- font-family: Source Han Sans CN;
- font-weight: 500;
- font-size: 14px;
- color: #ffffff;
- .cell {
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- }
- }
-
- // 表格主体
- .el-table__body {
- tr:hover > td {
- background-color: rgba(64, 158, 255,0.3) !important;
- }
-
- td {
- border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
- }
- }
-
- // 选中行
- .current-row td {
-
- background-color: rgba(64, 158, 255,0.3) !important;
- }
- }
- :deep(.el-table__body) {
- tr {
- height: 46px;
- }
- td {
- padding: 8px 0;
- }
- }
- .operationspan {
- cursor: pointer;
- color: #409eff;
- }
- .operationspan:first-child {
- margin-right: 5px;
- }
-
- // 分页
- :deep(.pagination-container) {
- background: transparent !important;
- }
- :deep(.el-pagination) {
- .btn-prev,
- .btn-next {
- padding: 5px 6px;
- }
- }
- :deep(.el-pager li) {
- margin: 0 0.1rem;
- background: rgba(34, 34, 34, 0.9) !important;
- box-shadow: 0px 4px 72px 0px rgba(0, 0, 0, 0.25) !important;
- border-radius: 8px 8px 8px 8px !important;
-
- font-family: Source Han Sans CN, Source Han Sans CN;
- font-weight: 400;
- font-size: 14px;
- color: #ededed !important;
- }
- :deep(.el-pager li.is-active) {
- border: 1px solid rgba(255, 255, 255, 0.99) !important;
- }
- :deep(.el-pagination button) {
- background: rgba(34, 34, 34, 0.9) !important;
- color: #ededed !important;
- border-radius: 8px 8px 8px 8px !important;
- }
- .pagination-container {
- margin-top: auto;
- padding: 8px 5px !important;
- background: white;
- display: flex;
- justify-content: center;
- height: auto; // 取消固定高度20px,避免内容被截断
- margin: 24px 0 14px 0;
- width: 100%;
- box-sizing: border-box;
- }
-}
-:deep(.el-tooltip__popper) {
- z-index: 9999 !important;
- max-width: 300px;
-}
-.tabBoxLoading {
-height: 100%;
-
-}
-
-.el-table {
-height: 98%;
-overflow: auto;
-
-}
-.btnGroups {
- position: absolute;
- bottom: 49px;
- left: 50%;
- transform: translate(-50%);
- img {
- width: 125px;
- height: 45px;
- cursor: pointer;
- }
-}
-.btnGroups img:first-child {
- margin-right: 21px;
-}
-#spotMap {
- height: 100%;
- width: 100%;
-}
-.el-button {
- padding: 0;
- color: #fff;
- width: 17px;
-}
-</style>
diff --git a/applications/drone-command/src/views/resource/media.vue b/applications/drone-command/src/views/resource/media.vue
deleted file mode 100644
index a49c4b4..0000000
--- a/applications/drone-command/src/views/resource/media.vue
+++ /dev/null
@@ -1,361 +0,0 @@
-<template>
- <basic-container>
- <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" :permission="permissionList"
- v-model="form" ref="crud" @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset"
- @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
- @refresh-change="refreshChange" @on-load="onLoad">
- <template #menu-left>
- <el-button type="primary" icon="el-icon-download" plain :loading="isDownloading" @click="handleZipDownload">{{
- isDownloading ? '压缩下载中...' : '压缩下载' }}</el-button>
- </template>
- <template #menu="scope">
- <el-button type="primary" text icon="el-icon-view" v-if="permission.attach_delete"
- @click="handleRowView(scope.row)">查看
- </el-button>
- <el-button type="success" text icon="el-icon-download" v-if="permission.attach_delete"
- @click="handleRowDownload(scope.row)">下载
- </el-button>
- <el-button type="danger" text icon="el-icon-delete" v-if="permission.attach_delete"
- @click="handleRowDelete(scope.row)">删除
- </el-button>
- </template>
- </avue-crud>
- <el-dialog title="媒体文件" append-to-body v-model="taskBox" width="555px">
- <avue-form ref="form" :option="taskOption" v-model="taskForm" :upload-after="uploadAfter">
- </avue-form>
- </el-dialog>
- </basic-container>
-</template>
-
-<script>
-import JSZip from 'jszip'
-import { getMedia, deleteAllFile } from '@/api/resource/media'
-import { getAirportList } from '@/api/device/device'
-import { mapGetters } from 'vuex'
-import func from '@/utils/func'
-
-export default {
- data () {
- const endDate = new Date()
- const startDate = new Date()
- startDate.setMonth(startDate.getMonth() - 1)
- const defaultStartDate = `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}`
- const defaultEndDate = `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}`
-
- return {
- form: {},
- query: {
- daterange: [defaultStartDate, defaultEndDate]
- },
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- taskBox: false,
- selectionList: [],
- selectedWorkspaceId: null,
- option: {
- tip: false,
- searchShow: true,
- searchGutter: 30,
- searchMenuPosition: 'left',
- searchMenuSpan: 4,
- border: true,
- index: true,
- viewBtn: true,
- selection: true,
- dialogClickModal: false,
- delBtn: false,
- addBtn: false,
-
- height: 'auto',
- calcHeight: 20,
- column: [
- { label: '机场选择', prop: 'airportNickname', type: 'select', search: true, searchSpan: 4, dicData: [], props: { label: 'nickname', value: 'nickname' }, hide: true, change: (value) => {
- this.searchChange({ ...this.query,airportNickname:value.value}, () => {});
- } },
- { label: '创建日期', prop: 'daterange', type: 'daterange', search: true, searchRange: true, searchSpan: 8, format: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD', startPlaceholder: '开始时间', endPlaceholder: '结束时间', viewDisplay: false, hide: true, searchValue: [defaultStartDate, defaultEndDate]
- , change: (value) => {
- this.searchChange({ ...this.query,daterange:value.value}, () => {});
- }
- },
- { label: '任务名称', prop: 'job_name' },
- { label: '文件名称', prop: 'file_name' },
- { label: '拍摄时间', prop: 'create_time' },
- { label: '文件路径', prop: 'object_key' },
- { label: '设备负载', prop: 'payload' },
- ],
- },
- data: [],
- taskForm: {},
- taskOption: {
- submitBtn: false,
- emptyBtn: false,
- column: [
- { label: '任务上传', prop: 'taskFile', type: 'upload', drag: true, loadText: '任务上传中,请稍等', span: 24, propsHttp: { res: 'data' }, action: '/blade-resource/oss/endpoint/put-file-task' },
- ],
- },
- domainUrl: '',
- isDownloading: false, // 控制按钮加载状态
- }
- },
- computed: {
- func () { return func },
- ...mapGetters(['permission']),
- permissionList () {
- return {
- addBtn: false,
- editBtn: false,
- viewBtn: this.validData(this.permission.attach_view, false),
- delBtn: this.validData(this.permission.attach_delete, false),
- }
- },
- ids () { return this.selectionList.map(ele => ele.id).join(',') },
- },
- mounted () {
- this.loadAirportList()
- this.$refs.crud.setSearch({ daterange: this.query.daterange })
- this.onLoad(this.page, this.query)
- },
- methods: {
- loadAirportList () {
- getAirportList().then(res => {
- const airportData = res.data.data || []
- const airportColumn = this.option.column.find(col => col.prop === 'airportNickname')
- if (airportColumn) {
- airportColumn.dicData = airportData.map(item => ({
- nickname: item.nickname,
- workspace_id: item.workspace_id,
- }))
- }
- }).catch(error => {
- console.error('加载机场列表时出错:', error)
- })
- },
- handleUpload () {
- this.taskBox = true
- },
- uploadAfter (res, done) {
- this.taskBox = false
- this.refreshChange()
- done()
- },
- async handleRowDownload (row) {
- const mediaUrl = this.domainUrl + row.object_key
- try {
- const response = await fetch(mediaUrl)
- if (!response.ok) throw new Error('文件下载失败')
- const blob = await response.blob()
- const url = window.URL.createObjectURL(blob)
- const link = document.createElement('a')
- link.href = url
- link.download = row.file_name || 'download'
- document.body.appendChild(link)
- link.click()
- document.body.removeChild(link)
- window.URL.revokeObjectURL(url)
- this.$message({ type: 'success', message: '文件下载成功: ' + row.file_name })
- } catch (error) {
- console.error('下载文件时出错:', error)
- this.$message({ type: 'error', message: '下载失败: ' + error.message })
- }
- },
- handleRowDelete (row) {
- this.$confirm('确定删除此文件?', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
- .then(() => deleteAllFile(row.id))
- .then(() => {
- this.onLoad(this.page)
- this.$message({ type: 'success', message: '删除成功!' })
- })
- .catch(error => {
- console.error('删除文件时出错:', error)
- this.$message({ type: 'error', message: '删除失败,请稍后重试!' })
- })
- },
- rowDel (row) {
- this.$confirm('确定将选择数据及对应的文件删除?', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
- .then(() => deleteAllFile(row.id))
- .then(() => {
- this.onLoad(this.page)
- this.$message({ type: 'success', message: '操作成功!' })
- })
- },
- searchReset () {
- const endDate = new Date()
- const startDate = new Date()
- startDate.setMonth(startDate.getMonth() - 1)
- const defaultStartDate = `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}`
- const defaultEndDate = `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}`
- this.query = { daterange: [defaultStartDate, defaultEndDate] }
- this.selectedWorkspaceId = null
- this.$refs.crud.setSearch({ daterange: this.query.daterange })
- this.onLoad(this.page, this.query)
- },
- searchChange (params, done) {
- this.query = params
- this.page.currentPage = 1
- const airportColumn = this.option.column.find(col => col.prop === 'airportNickname')
- const selectedAirport = airportColumn.dicData.find(item => item.nickname === params.airportNickname)
- this.selectedWorkspaceId = selectedAirport ? selectedAirport.workspace_id : null
- this.onLoad(this.page, params)
- done()
- },
- selectionChange (list) {
- this.selectionList = list
- },
- selectionClear () {
- this.selectionList = []
- this.$refs.crud.toggleSelection()
- },
- currentChange (currentPage) {
- this.page.currentPage = currentPage
- this.onLoad(this.page, this.query)
- },
- sizeChange (pageSize) {
- this.page.pageSize = pageSize
- this.onLoad(this.page, this.query)
- },
- refreshChange () {
- this.onLoad(this.page, this.query)
- },
- onLoad (page, params = {}) {
- this.loading = true
- const { daterange } = params
- let create_time = null
- let end_time = null
-
- if (daterange && Array.isArray(daterange) && daterange.length === 2) {
- const startStr = daterange[0]
- const endStr = daterange[1]
- const startDate = new Date(startStr + ' 00:00:00').getTime()
- const endDate = new Date(endStr + ' 23:59:59').getTime()
- if (!isNaN(startDate) && !isNaN(endDate)) {
- create_time = startDate
- end_time = endDate
- }
- }
-
- let values = { ...params, ...this.query }
- if (daterange) values.daterange = null
-
- getMedia(page.currentPage, page.pageSize, this.selectedWorkspaceId || null, create_time, end_time)
- .then(res => {
- const data = res.data
- if (data && data.data && data.data.list) {
- this.page.total = data.data.pagination.total
- this.data = data.data.list.map(item => ({
- job_name: item.job_name,
- file_name: item.file_name,
- create_time: this.formatCreateTime(item.create_time),
- object_key: item.object_key,
- payload: item.payload,
- airportNickname: item.airportNickname,
- id: item.id,
- }))
- this.domainUrl = data.data.list.length > 0 ? data.data.list[0].domain_url : 'http://localhost:2888/manage/resource'
- } else {
- this.data = []
- }
- this.loading = false
- this.selectionClear()
- this.$refs.crud.refreshTable()
- })
- .catch(error => {
- this.loading = false
- console.error('加载媒体数据时出错:', error)
- })
- },
- formatCreateTime (createTime) {
- if (typeof createTime !== 'number' || isNaN(createTime)) return ''
- const timestamp = createTime < 10000000000 ? createTime * 1000 : createTime
- const date = new Date(timestamp)
- if (isNaN(date.getTime())) return ''
- const year = date.getFullYear()
- const month = String(date.getMonth() + 1).padStart(2, '0')
- const day = String(date.getDate()).padStart(2, '0')
- const hours = String(date.getHours()).padStart(2, '0')
- const minutes = String(date.getMinutes()).padStart(2, '0')
- const seconds = String(date.getSeconds()).padStart(2, '0')
- return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
- },
- handleRowView (row) {
- const mediaUrl = this.domainUrl + row.object_key
- const mediaType = this.getMediaType(row.object_key)
- if (mediaType === 'image' || mediaType === 'video') {
- window.open(mediaUrl, '_blank')
- }
- },
- getMediaType (objectKey) {
- const extension = objectKey.split('.').pop().toLowerCase()
- if (['jpg', 'jpeg', 'png', 'gif'].includes(extension)) return 'image'
- if (['mp4', 'avi', 'mov'].includes(extension)) return 'video'
- return 'unknown'
- },
- showVideo (url) {
- this.taskBox = true
- this.taskForm = { videoUrl: url }
- this.taskOption = {
- submitBtn: false,
- emptyBtn: false,
- column: [
- { label: '视频播放', prop: 'videoUrl', type: 'video', span: 24, props: { controls: true, autoplay: false } },
- ],
- }
- },
- validData (val, def) {
- return typeof val !== 'undefined' ? val : def
- },
- async handleZipDownload () {
- if (this.selectionList.length === 0) {
- this.$message({ type: 'warning', message: '请先选择需要下载的文件' })
- return
- }
-
- this.isDownloading = true
-
- try {
- const zip = new JSZip()
- const files = this.selectionList.map(item => ({
- url: this.domainUrl + item.object_key,
- name: item.file_name
- }))
-
- const fetchPromises = files.map(async file => {
- const response = await fetch(file.url, { cache: 'force-cache' })
- if (!response.ok) throw new Error(`下载文件 ${file.name} 失败`)
- const blob = await response.blob()
- zip.file(file.name, blob)
- })
-
- await Promise.all(fetchPromises)
-
- const content = await zip.generateAsync({
- type: 'blob',
- compression: 'DEFLATE',
- compressionOptions: { level: 1 }
- })
-
- const url = window.URL.createObjectURL(content)
- const link = document.createElement('a')
- link.href = url
- link.download = `media_files_${new Date().toISOString().slice(0, 10)}_${new Date().getTime()}.zip`
- document.body.appendChild(link)
- link.click()
- document.body.removeChild(link)
- window.URL.revokeObjectURL(url)
-
- this.$message({ type: 'success', message: `成功下载 ${this.selectionList.length} 个文件` })
- } catch (error) {
- console.error('压缩下载失败:', error)
- this.$message({ type: 'error', message: '压缩下载失败: ' + error.message })
- } finally {
- this.isDownloading = false
- }
- },
- },
-}
-</script>
-
-<style scoped lang="scss"></style>
diff --git a/applications/drone-command/src/views/resource/oss.vue b/applications/drone-command/src/views/resource/oss.vue
deleted file mode 100644
index 8e76346..0000000
--- a/applications/drone-command/src/views/resource/oss.vue
+++ /dev/null
@@ -1,479 +0,0 @@
-<template>
- <basic-container>
- <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" :permission="permissionList"
- v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel" :before-open="beforeOpen"
- @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
- @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
- <template #menu-left>
- <el-button type="danger" icon="el-icon-delete" plain v-if="permission.oss_delete" @click="handleDelete">删 除
- </el-button>
- </template>
- <template #menu="scope">
- <el-button type="primary" text icon="el-icon-video-play" v-if="userInfo.role_name.includes('admin')"
- @click="handleDebug(scope.row)">调试
- </el-button>
- <el-button type="primary" text icon="el-icon-circle-check" v-if="scope.row.status == 1 && permission.oss_enable"
- @click.stop="handleEnable(scope.row)">启用
- </el-button>
- <el-button type="primary" text icon="VideoPause" v-if="scope.row.status == 2 && permission.oss_enable"
- @click.stop="handleDisable(scope.row)">禁用
- </el-button>
- </template>
- <template #status="{ row }">
- <el-tag>{{ row.statusName }}</el-tag>
- </template>
- <template #category="{ row }">
- <el-tag>{{ row.categoryName }}</el-tag>
- </template>
- </avue-crud>
- <el-dialog title="对象存储上传调试" append-to-body v-model="box" width="550px">
- <avue-form ref="form" :option="debugOption" v-model="debugForm" @submit="handleSubmit" />
- </el-dialog>
- </basic-container>
-</template>
-
-<script>
-import { getListPage, getDetail, add, update, remove, enable, disable } from '@/api/resource/oss'
-import { mapGetters } from 'vuex'
-import func from '@/utils/func'
-
-export default {
- data () {
- return {
- form: {},
- query: {},
- loading: true,
- box: false,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- selectionList: [],
- option: {
- emptyBtnText: '重置',
- emptyBtnIcon: 'el-icon-refresh',
- tip: false,
- searchShow: true,
- searchGutter: 30,
- searchMenuPosition: 'left',
- searchMenuSpan: 4,
- border: true,
- index: true,
- viewBtn: true,
- selection: true,
- grid: false,
- menuWidth: 350,
- labelWidth: 100,
- dialogWidth: 880,
- dialogClickModal: false,
-
- height: 'auto',
- calcHeight: 20,
- column: [
- {
- label: '存储分类',
- type: 'radio',
- value: 1,
- span: 24,
- width: 120,
- // searchLabelWidth: 50,
- searchSpan: 4,
- row: true,
- dicUrl: '/blade-system/dict/dictionary?code=oss',
- props: {
- label: 'dictValue',
- value: 'dictKey',
- },
- dataType: 'number',
- slot: true,
- prop: 'category',
- search: true,
- rules: [
- {
- required: true,
- message: '请选择分类',
- trigger: 'blur',
- },
- ],
- change: (value) => {
- this.searchChange({ ...this.query,category:value.value}, () => {});
- }
- },
- {
- label: '存储名称',
- prop: 'name',
- span: 24,
- search: true,
- searchSpan: 4,
- rules: [
- {
- required: true,
- message: '请输入名称',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '资源编号',
- prop: 'ossCode',
- span: 24,
- width: 120,
- // searchLabelWidth: 100,
- search: true,
- searchSpan: 4,
- rules: [
- {
- required: true,
- message: '请输入资源编号',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '资源地址',
- labelTip: '对象存储通用资源地址,可以是内网也可以是外网',
- prop: 'endpoint',
- span: 24,
- rules: [
- {
- required: true,
- message: '请输入资源地址',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '外网地址',
- labelTip: '资源地址设置为内网上传,则外部访问需要配置外网映射地址',
- prop: 'transformEndpoint',
- span: 24,
- },
- {
- label: '空间名',
- prop: 'bucketName',
- span: 24,
- width: 120,
- rules: [
- {
- required: true,
- message: '请输入空间名',
- trigger: 'blur',
- },
- ],
- },
- {
- label: 'accessKey',
- prop: 'accessKey',
- span: 24,
- search: true,
- searchSpan: 4,
- // searchLabelWidth: 100,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请输入accessKey',
- trigger: 'blur',
- },
- ],
- },
- {
- label: 'secretKey',
- prop: 'secretKey',
- span: 24,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请输入secretKey',
- trigger: 'blur',
- },
- ],
- },
- {
- label: 'appId',
- prop: 'appId',
- span: 24,
- hide: true,
- display: false,
- },
- {
- label: '过期时间',
- prop: 'expire',
- type: "number",
- span: 24,
- hide: true,
- rules: [
- {
- required: true,
- message: '请输入过期时间',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '地域简称',
- prop: 'region',
- span: 24,
- hide: true,
- rules: [
- {
- required: true,
- message: '请输入地域简称',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '是否启用',
- prop: 'status',
- span: 24,
- width: 85,
- align: 'center',
- slot: true,
- addDisplay: false,
- editDisplay: false,
- viewDisplay: false,
- },
- {
- label: '备注',
- prop: 'remark',
- span: 24,
- hide: true,
- },
- ],
- },
- data: [],
- debugForm: {
- code: '',
- },
- debugOption: {
- submitText: '提交',
- column: [
- {
- label: '资源编号',
- prop: 'code',
- disabled: true,
- span: 24,
- },
- {
- label: '上传背景',
- prop: 'backgroundUrl',
- type: 'upload',
- listType: 'picture-img',
- dataType: 'string',
- action: '/blade-resource/oss/endpoint/put-file',
- propsHttp: {
- res: 'data',
- url: 'link',
- },
- span: 24,
- },
- ],
- },
- }
- },
- watch: {
- 'form.category' () {
- const category = func.toInt(this.form.category)
- this.$refs.crud.option.column.filter(item => {
- if (item.prop === 'appId') {
- item.display = category === 4
- }
- // if (item.prop === 'region') {
- // item.display = category === 4 || category === 5;
- // }
- })
- },
- 'debugForm.code' () {
- const column = this.findObject(this.debugOption.column, 'backgroundUrl')
- column.action = `/blade-resource/oss/endpoint/put-file?code=${this.debugForm.code}`
- },
- },
- computed: {
- ...mapGetters(['userInfo', 'permission']),
- permissionList () {
- return {
- addBtn: this.validData(this.permission.oss_add),
- viewBtn: this.validData(this.permission.oss_view),
- delBtn: this.validData(this.permission.oss_delete),
- editBtn: this.validData(this.permission.oss_edit),
- }
- },
- ids () {
- let ids = []
- this.selectionList.forEach(ele => {
- ids.push(ele.id)
- })
- return ids.join(',')
- },
- },
- methods: {
- rowSave (row, done, loading) {
- add(row).then(
- () => {
- this.onLoad(this.page)
- this.$message({
- type: 'success',
- message: '操作成功!',
- })
- done()
- },
- error => {
- window.console.log(error)
- loading()
- }
- )
- },
- rowUpdate (row, index, done, loading) {
- update(row).then(
- () => {
- this.onLoad(this.page)
- this.$message({
- type: 'success',
- message: '操作成功!',
- })
- done()
- },
- error => {
- window.console.log(error)
- loading()
- }
- )
- },
- rowDel (row) {
- this.$confirm('确定将选择数据删除?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => {
- return remove(row.id)
- })
- .then(() => {
- this.onLoad(this.page)
- this.$message({
- type: 'success',
- message: '操作成功!',
- })
- })
- },
- searchReset () {
- this.query = {}
- this.onLoad(this.page)
- },
- searchChange (params, done) {
- this.query = params
- this.page.currentPage = 1
- this.onLoad(this.page, params)
- done()
- },
- selectionChange (list) {
- this.selectionList = list
- },
- selectionClear () {
- this.selectionList = []
- this.$refs.crud.toggleSelection()
- },
- handleEnable (row) {
- this.$confirm('是否确定启用这条配置?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => {
- return enable(row.id)
- })
- .then(() => {
- this.onLoad(this.page)
- this.$message({
- type: 'success',
- message: '操作成功!',
- })
- this.$refs.crud.toggleSelection()
- })
- },
- handleDisable (row) {
- this.$confirm('是否确定禁用用这条配置?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => {
- return disable(row.id)
- })
- .then(() => {
- this.onLoad(this.page)
- this.$message({
- type: 'success',
- message: '操作成功!',
- })
- this.$refs.crud.toggleSelection()
- })
- },
- handleDebug (row) {
- this.box = true
- this.debugForm.code = row.ossCode
- this.debugForm.backgroundUrl = ''
- },
- handleSubmit (form, done) {
- this.$message({
- type: 'success',
- message: `获取到图片地址:[${form.backgroundUrl}]`,
- })
- done()
- },
- handleDelete () {
- if (this.selectionList.length === 0) {
- this.$message.warning('请选择至少一条数据')
- return
- }
- this.$confirm('确定将选择数据删除?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => {
- return remove(this.ids)
- })
- .then(() => {
- this.onLoad(this.page)
- this.$message({
- type: 'success',
- message: '操作成功!',
- })
- this.$refs.crud.toggleSelection()
- })
- },
- beforeOpen (done, type) {
- if (['edit', 'view'].includes(type)) {
- getDetail(this.form.id).then(res => {
- this.form = res.data.data
- })
- }
- done()
- },
- currentChange (currentPage) {
- this.page.currentPage = currentPage
- },
- sizeChange (pageSize) {
- this.page.pageSize = pageSize
- },
- refreshChange () {
- this.onLoad(this.page, this.query)
- },
- onLoad (page, params = {}) {
- this.loading = true
- getListPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data
- this.page.total = data.total
- this.data = data.records
- this.loading = false
- this.selectionClear()
- })
- },
- },
-}
-</script>
-<style scoped lang="scss"></style>
\ No newline at end of file
diff --git a/applications/drone-command/src/views/resource/patchManagement.vue b/applications/drone-command/src/views/resource/patchManagement.vue
deleted file mode 100644
index ec96730..0000000
--- a/applications/drone-command/src/views/resource/patchManagement.vue
+++ /dev/null
@@ -1,569 +0,0 @@
-<template>
- <basic-container>
- <avue-crud
- :option="option"
- :table-loading="loading"
- :data="data"
- v-model:page="page"
- :permission="permissionList"
- v-model="form"
- ref="crud"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- :before-open="beforeOpen"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad"
- >
- <template #menu-left>
- <el-button type="primary" icon="el-icon-upload" @click="handleDebug"> 上传图斑 </el-button>
- <el-button type="primary" icon="el-icon-setting" @click="goTypeManagement">
- 类型管理
- </el-button>
- <el-button type="success" icon="el-icon-download" @click="downloadPatch"> 导出 </el-button>
- </template>
-
- <template #menu="scope">
- <el-button type="primary" text icon="el-icon-view" @click="uploadPatch(scope.row, 'detail')"
- >详情
- </el-button>
- <el-button type="primary" text icon="el-icon-edit" @click="uploadPatch(scope.row, 'edit')"
- >编辑
- </el-button>
- <el-button :disabled="scope.row.patches_type_desc==='综合类'" type="primary" text icon="el-icon-delete" @click="rowDel(scope.row)"
- >删除
- </el-button>
- </template>
- </avue-crud>
-
- <el-dialog title="上传图斑" class="command-dialog-mange" append-to-body align-center v-model="box" width="550px">
- <el-form
- ref="ruleFormRef"
- style="max-width: 600px"
- :model="ruleForm"
- :rules="rules"
- label-width="auto"
- >
- <el-form-item label="文件名称" prop="name">
- <el-input v-model="ruleForm.name" />
- </el-form-item>
- <el-form-item label="图斑类型" prop="region">
- <el-select v-model="ruleForm.region" placeholder="请选择图斑类型">
- <el-option
- v-for="item in allspotTypeOption"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item class="center-align">
- <el-upload
- action="#"
- :show-file-list="false"
- :before-upload="e => uploadFlightFile(e, '1')"
- accept=".kmz, .kml, .zip"
- >
- <el-button type="primary"> 图斑上传 </el-button>
- </el-upload>
- </el-form-item>
- <el-form-item class="center-align">
- <span>注:仅支持gis平台导出的zip压缩文件</span>
- </el-form-item>
- </el-form>
- </el-dialog>
- <!-- 图斑详情 -->
- <SpotDetails
- v-model:show="uploadPatchDialog"
- :title="spotDetailsTitle"
- :detailid="detailid"
- :detailList="detailList"
- :spotTypeOption="allspotTypeOption"
- :regionalData="regionalData"
- ></SpotDetails>
- </basic-container>
-</template>
-<script setup>
-import { findAreaName } from '@/utils/areaUtils';
-import {
- spotManagementTableApi,
- searchManagementApi,
- uploadManagementApi,
- tableMapListApi,
- exportExcel,
- patchDeleteApi,
- listOfSpotTypesApi,
-} from '@/api/patchManagement/index';
-import { getRegionTreeAll } from '@/api/job/task';
-import { ref, computed, watch } from 'vue';
-import { useStore } from 'vuex';
-import { useRouter } from 'vue-router';
-import { ElMessage, ElMessageBox } from 'element-plus';
-import { getListPage, getDetail, add, update, remove, enable, disable } from '@/api/resource/oss';
-import func from '@/utils/func';
-import patchDetails from '@/views/resource/components/patchDetails.vue';
-import SpotDetails from '@/views/resource/components/spotDetails.vue';
-const spotDetailsTitle = ref('');
-const detailList = ref('');
-const store = useStore();
-const router = useRouter();
-const ruleFormRef = ref(null);
-let deptTreeData = ref([]);
-const regionalScope = ref([]);
-const spotTypeOption = ref([]);
-const creatorOption = ref([]);
-const userAreaCode = computed(() => store.getters.userInfo.detail.areaCode);
-const ruleForm = reactive({
- name: '',
- region: '',
-});
-const rules = reactive({
- name: [{ required: true, message: '请输入', trigger: 'blur' }, { trigger: 'blur' }],
- region: [
- {
- required: true,
- message: '请选择',
- trigger: 'change',
- },
- ],
-});
-
-// ===== state =====
-const form = ref({});
-const query = ref({});
-const loading = ref(true);
-const box = ref(false);
-
-const page = ref({
- pageSize: 20,
- currentPage: 1,
- total: 0,
- lotTypeId: '',
- createUser: '',
- areaCode: '',
- fileName: '',
-});
-
-const selectionList = ref([]);
-const option = ref({
- emptyBtnText: '重置',
- emptyBtnIcon: 'el-icon-refresh',
- align: 'center',
- headerAlign: 'center',
- addBtn: false,
- tip: false,
- searchShow: true,
- searchGutter: 30,
- searchMenuPosition: 'left',
- searchMenuSpan: 4,
- border: true,
- index: true,
- indexLabel: '序号',
- indexWidth: 60,
- selection: true,
- grid: false,
- menuWidth: 240,
- labelWidth: 100,
- dialogWidth: 880,
- dialogClickModal: false,
- height: 'auto',
- calcHeight: 20,
- refreshBtn: false,
- gridBtn: false,
- searchShowBtn: false,
- columnBtn: false,
- viewBtn: false,
- editBtn: false,
- delBtn: false,
- column: [
- {
- label: '文件名称',
- prop: 'file_name',
- span: 24,
- search: true,
- overHidden: true,
- showOverflowTooltip: true,
- searchSpan: 4,
- rules: [{ required: true, message: '请输入文件名称', trigger: 'blur' }],
- },
- {
- label: '图斑类型',
- prop: 'patches_type_desc',
- span: 24,
- // searchLabelWidth: 100,
- search: true,
- searchSpan: 4,
- type: 'select',
- dicData: spotTypeOption,
- props: {
- label: 'label',
- value: 'value',
- },
- rules: [{ required: true, message: '请选择图斑类型', trigger: 'blur' }],
- },
- {
- label: '图斑数量',
- prop: 'patches_num',
- span: 24,
- rules: [{ required: true, message: '请输入图斑数量', trigger: 'blur' }],
- },
- {
- label: '异常图斑数量',
- prop: 'exception_num',
- span: 24,
- rules: [{ required: true, message: '请输入异常图斑数量', trigger: 'blur' }],
- },
- {
- label: '行政区划',
- prop: 'areaName',
- span: 24,
- width: 180,
- // searchLabelWidth: 100,
- search: true,
- searchSpan: 4,
- type: 'tree',
- dicData: deptTreeData,
- props: {
- label: 'name',
- value: 'id',
- children: 'childrens',
- },
- rules: [{ required: true, message: '请选择行政区划', trigger: 'blur' }],
- },
- {
- label: '数据来源',
- prop: 'dataFrom',
- span: 24,
- rules: [{ required: true, message: '请输入数据来源', trigger: 'blur' }],
- },
- {
- label: '创建时间',
- prop: 'create_time',
- span: 24,
- rules: [{ required: true, message: '请输入创建时间', trigger: 'blur' }],
- },
- {
- label: '创建人',
- prop: 'user_name',
- span: 24,
- // searchLabelWidth: 100,
- search: true,
- searchSpan: 4,
- type: 'select',
- dicData: creatorOption,
- props: {
- label: 'label',
- value: 'value',
- },
- rules: [{ required: true, message: '请输入创建人', trigger: 'blur' }],
- },
- ],
-});
-
-const data = ref([]);
-const crudRef = ref(null);
-const uploadPatchDialog = ref(null);
-const detailid = ref(null);
-// ===== computed =====
-const userInfo = computed(() => store.getters.userInfo);
-const permission = computed(() => store.getters.permission);
-const permissionList = computed(() => ({
- addBtn: !!permission.value.oss_add,
- viewBtn: !!permission.value.oss_view,
- delBtn: !!permission.value.oss_delete,
- editBtn: !!permission.value.oss_edit,
-}));
-
-const ids = computed(() => selectionList.value.map(ele => ele.id).join(','));
-// 获取行政区划
-const regionalData = ref([]);
-const requestDockInfo = () => {
- getRegionTreeAll({ parentCode: userAreaCode.value }).then(res => {
- const rawData = res.data.data ? [res.data.data] : [];
- regionalData.value = rawData;
- const filterTree = nodes => {
- return nodes.filter(node => {
- const nodeCodeStr = node.id.toString();
- const isMatched = regionalScope.value.some(
- code => nodeCodeStr.startsWith(code.toString()) || code.toString().startsWith(nodeCodeStr)
- );
-
- if (node.childrens && node.childrens.length) {
- node.childrens = filterTree(node.childrens);
- if (node.childrens.length) return true;
- }
-
- return isMatched;
- });
- };
- deptTreeData.value = filterTree(rawData);
- onLoad(page.value);
- });
-};
-// 获取搜索数据
-const getsearchManagementApi = () => {
- searchManagementApi().then(res => {
- const uniqueMap = new Map();
- res.data.data.lot_values.forEach(item => {
- const [key, value] = Object.entries(item)[0];
- if (!uniqueMap.has(key)) {
- uniqueMap.set(key, value);
- }
- });
- const creatorOptionuniqueMap = new Map();
- res.data.data.user_names.forEach(item => {
- const [key, value] = Object.entries(item)[0];
- if (!creatorOptionuniqueMap.has(key)) {
- creatorOptionuniqueMap.set(key, value);
- }
- });
- spotTypeOption.value = Array.from(uniqueMap).map(([key, value]) => ({
- label: value,
- value: key,
- }));
- creatorOption.value = Array.from(creatorOptionuniqueMap).map(([key, value]) => ({
- label: value,
- value: key,
- }));
- regionalScope.value = res.data.data.area_codes;
- requestDockInfo();
- });
-};
-const allspotTypeOption = ref([]);
-// 获取上传图斑类型
-const getlistOfSpotTypesApi = () => {
- const searchparams = {
- current: 1,
- size: 9999,
- };
- listOfSpotTypesApi(searchparams).then(res => {
- allspotTypeOption.value = res.data.data.records.map(item => ({
- label: item.patches_type,
- value: item.id,
- }));
- });
-};
-// ===== watch =====
-watch(
- () => form.value.category,
- () => {
- const category = func.toInt(form.value.category);
- option.value.column.forEach(item => {
- if (item.prop === 'appId') {
- item.display = category === 4;
- }
- });
- }
-);
-// ===== methods =====
-const rowSave = (row, done, loading) => {
- add(row).then(
- () => {
- onLoad(page.value);
- ElMessage.success('操作成功!');
- done();
- },
- error => {
- console.log(error);
- loading();
- }
- );
-};
-
-const rowUpdate = (row, index, done, loading) => {
- update(row).then(
- () => {
- onLoad(page.value);
- ElMessage.success('操作成功!');
- done();
- },
- error => {
- console.log(error);
- loading();
- }
- );
-};
-
-const rowDel = row => {
- ElMessageBox.confirm('确定将选择数据删除?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => patchDeleteApi(row.id)) // 直接传递ID
- .then(() => {
- onLoad(page.value);
- ElMessage.success('操作成功!');
- });
-};
-
-const searchReset = () => {
- page.value.areaCode = '';
- page.value.createUser = '';
- page.value.fileName = '';
- page.value.lotTypeId = '';
- page.value.currentPage = 1;
- page.value.pageSize = 20;
- onLoad(page.value);
-};
-
-const searchChange = (params, done) => {
- page.value.currentPage = 1;
- page.value.lotTypeId = params.patches_type_desc;
- page.value.createUser = params.user_name;
- page.value.fileName = params.file_name;
- page.value.areaCode = params.areaName;
- page.value.createUser = params.user_name;
- onLoad(page.value);
- done();
-};
-const selectionChange = list => {
- selectionList.value = list;
-};
-
-const selectionClear = () => {
- selectionList.value = [];
- crudRef.value?.toggleSelection();
-};
-
-const handleDebug = row => {
- box.value = true;
-};
-const beforeOpen = (done, type) => {
- // if (['edit', 'view'].includes(type)) {
- // getDetail(form.value.id).then(res => {
- // form.value = res.data.data
- // })
- // }
- done();
-};
-
-const currentChange = currentPage => {
- page.value.currentPage = currentPage;
-};
-
-const sizeChange = pageSize => {
- page.value.pageSize = pageSize;
-};
-
-const refreshChange = () => {
- onLoad(page.value);
-};
-
-const onLoad = (pageInfo, params = {}) => {
- const searchparams = {
- current: pageInfo.currentPage,
- size: pageInfo.pageSize,
- lotTypeId: pageInfo.lotTypeId,
- fileName: pageInfo.fileName,
- areaCode: pageInfo.areaCode,
- createUser: pageInfo.createUser,
- };
- loading.value = true;
- spotManagementTableApi(searchparams).then(res => {
- const d = res.data.data;
- page.value.total = d.total;
- data.value = d.records.map(i => ({
- ...i,
- dataFrom: i.date_from === 0 ? '本地上传' : '国土调查云',
- areaName: findAreaName(i.area_code, regionalData.value, true),
- }));
- loading.value = false;
- selectionClear();
- });
-};
-
-// 图斑详情/编辑
-const uploadPatch = (row, type = 'detail') => {
- detailid.value = row.id;
- uploadPatchDialog.value = true;
- spotDetailsTitle.value = type === 'detail' ? '图斑详情' : '图斑编辑';
- detailList.value = row;
-};
-
-// 跳转至图斑类型管理页面
-const goTypeManagement = () => {
- router.push({ path: '/resource/patchTypeManagement' });
-};
-
-// 下载图斑
-const downloadPatch = () => {
- if (!selectionList.value.length) {
- return ElMessage.warning('请选择需要导出的数据');
- }
- const a = selectionList.value.map(i => Number(i.id));
- exportExcel(a).then(res => {
- const elink = document.createElement('a');
- elink.download = new Date().getTime() + '.xls';
- elink.style.display = 'none';
- const blob = new Blob([res.data], {
- type: 'application/x-msdownload',
- });
- elink.href = URL.createObjectURL(blob);
- document.body.appendChild(elink);
- elink.click();
- document.body.removeChild(elink);
- loading.value = false;
- });
-};
-// 图斑上传
-const uploadFlightFile = async (file, t) => {
- loading.value = true;
- try {
- const fileSuffix = file.name.substring(file.name.lastIndexOf('.') + 1);
- if (!['kmz', 'kml', 'zip'].includes(fileSuffix)) {
- ElMessage.error('请上传zip/kmz/kml格式的文件');
- return;
- }
- box.value = false;
- let data = new FormData();
- let type = t === '3' ? '' : t;
- const params = {
- file: file,
- fileName: ruleForm.name,
- LotTypeId: ruleForm.region,
- };
-
- Object.keys(params).forEach(key => {
- data.append(key, params[key]);
- });
-
- const res = await uploadManagementApi(data);
- if (res.data.code !== 0) {
- ElMessage.error('上传失败');
- return;
- }
-
- ElMessage.success('上传成功');
-
- // 重置表单
- ruleForm.name = '';
- ruleForm.region = '';
- if (ruleFormRef.value) {
- ruleFormRef.value.resetFields();
- }
-
- searchReset();
- } catch (error) {
- loading.value = false;
- } finally {
- loading.value = false;
- }
-};
-provide('searchReset', searchReset);
-onMounted(() => {
- getsearchManagementApi();
- getlistOfSpotTypesApi();
-});
-</script>
-
-<style scoped lang="scss">
-.center-align :deep(.el-form-item__content) {
- justify-content: center !important;
-}
-</style>
diff --git a/applications/drone-command/src/views/resource/patchTypeManagement.vue b/applications/drone-command/src/views/resource/patchTypeManagement.vue
deleted file mode 100644
index 1ea4aa5..0000000
--- a/applications/drone-command/src/views/resource/patchTypeManagement.vue
+++ /dev/null
@@ -1,331 +0,0 @@
-<template>
- <basic-container>
- <avue-crud
- :option="option"
- :table-loading="loading"
- :data="data"
- v-model:page="page"
- :permission="permissionList"
- v-model="form"
- ref="crud"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- :before-open="beforeOpen"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad"
- >
- <template #search-menu="{ row, size }">
- <el-button icon="el-icon-back" @click="goPatchManagement" type="primary"> 返回 </el-button>
- </template>
- <template #status="{ row }">
- <el-tag>{{ row.statusName }}</el-tag>
- </template>
- <template #category="{ row }">
- <el-tag>{{ row.categoryName }}</el-tag>
- </template>
- <template #menu="{ row }">
- <el-button
- :disabled="row.patches_type === '综合类'"
- type="primary"
- text
- icon="el-icon-delete"
- @click="rowDel(row)"
- >
- 删除
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
-</template>
-
-<script setup>
-import {
- searchManagementApi,
- listOfSpotTypesApi,
- spotTypesCreateApi,
- editSpotTypeApi,
- deleteSpotTypeApi,
-} from '@/api/patchManagement/index';
-import { ref, computed, watch } from 'vue';
-import { enable, disable } from '@/api/resource/oss';
-import { useStore } from 'vuex';
-import func from '@/utils/func';
-import { useRouter } from 'vue-router';
-import { ElMessage, ElMessageBox, ElLoading } from 'element-plus';
-const store = useStore();
-const router = useRouter();
-// ---------------- data ----------------
-const form = ref({});
-const query = ref({});
-const creatorOption = ref([]);
-const loading = ref(true);
-const page = ref({
- pageSize: 20,
- currentPage: 1,
- total: 0,
- lotValue: '',
- userName: '',
-});
-const selectionList = ref([]);
-const option = ref({
- emptyBtnText: '重置',
- emptyBtnIcon: 'el-icon-refresh',
- addBtn: true,
- addBtnText: '新增类型',
- tip: false,
- searchShow: true,
- searchGutter: 30,
- searchMenuPosition: 'left',
- searchMenuSpan: 4,
- border: true,
- index: true,
- indexLabel: '序号',
- indexWidth: 60,
- selection: false,
- grid: false,
- menuWidth: 180,
- labelWidth: 90,
- dialogWidth: 600,
- dialogClickModal: false,
- height: 'auto',
- calcHeight: 20,
- refreshBtn: false,
- gridBtn: false,
- searchShowBtn: false,
- columnBtn: false,
- delBtn: false,
- column: [
- {
- label: '类型名称',
- prop: 'patches_type',
- search: true,
- searchSpan: 4,
- span: 24,
- rules: [{ required: true, message: '请输入类型名称', trigger: 'blur' }],
- },
- {
- label: '创建时间',
- prop: 'create_time',
- addDisplay: false,
- editDisplay: false,
- rules: [{ required: true, message: '请输入创建时间', trigger: 'blur' }],
- },
- {
- label: '创建人',
- prop: 'user_name',
- search: true,
- addDisplay: false,
- editDisplay: false,
- searchSpan: 4,
- type: 'select',
- dicData: creatorOption,
- props: {
- label: 'label',
- value: 'value',
- },
- rules: [{ required: true, message: '请输入创建人', trigger: 'blur' }],
- },
- ],
-});
-
-const data = ref([]);
-// 获取搜索数据
-const getsearchManagementApi = () => {
- searchManagementApi().then(res => {
- const creatorOptionuniqueMap = new Map();
- res.data.data.user_names.forEach(item => {
- const [key, value] = Object.entries(item)[0];
- if (!creatorOptionuniqueMap.has(key)) {
- creatorOptionuniqueMap.set(key, value);
- }
- });
- creatorOption.value = Array.from(creatorOptionuniqueMap).map(([key, value]) => ({
- label: value,
- value: value,
- }));
- });
-};
-
-// ---------------- watch ----------------
-watch(
- () => form.value.category,
- () => {
- const category = func.toInt(form.value.category);
- option.value.column.filter(item => {
- if (item.prop === 'appId') {
- item.display = category === 4;
- }
- });
- }
-);
-
-// ---------------- computed ----------------
-const permission = computed(() => store.getters.permission);
-const permissionList = computed(() => ({
- addBtn: validData(permission.value.oss_add),
- viewBtn: validData(permission.value.oss_view),
- delBtn: validData(permission.value.oss_delete),
- editBtn: validData(permission.value.oss_edit),
-}));
-
-const ids = computed(() => {
- return selectionList.value.map(ele => ele.id).join(',');
-});
-
-// ---------------- methods ----------------
-const rowSave = (row, done, loadingFn) => {
- const createParams = {
- patches_type: row.patches_type,
- };
- spotTypesCreateApi(createParams).then(
- () => {
- onLoad(page.value);
- ElMessage.success('操作成功!');
- done();
- },
- error => {
- console.log(error);
- loadingFn();
- }
- );
-};
-
-const rowUpdate = (row, index, done, loadingFn) => {
- editSpotTypeApi(row).then(
- res => {
- onLoad(page.value);
- ElMessage.success('操作成功!');
- done();
- },
- error => {
- console.log(error);
- loadingFn();
- }
- );
-};
-
-const rowDel = row => {
- ElMessageBox.confirm('确定将选择数据删除?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => deleteSpotTypeApi([row.id]))
- .then(() => {
- onLoad(page.value);
- ElMessage.success('操作成功!');
- });
-};
-
-const searchReset = () => {
- page.value.userName = '';
- page.value.lotValue = '';
- page.value.currentPage = 1;
- page.value.pageSize = 20;
- onLoad(page.value);
-};
-
-const searchChange = (params, done) => {
- page.value.currentPage = 1;
- page.value.lotValue = params.patches_type;
- page.value.userName = params.user_name;
- onLoad(page.value);
- done();
-};
-
-const selectionChange = list => {
- // selectionList.value = list
-};
-
-const selectionClear = () => {
- selectionList.value = [];
- // crudRef.value.toggleSelection()
-};
-
-const handleEnable = row => {
- ElMessageBox.confirm('是否确定启用这条配置?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => enable(row.id))
- .then(() => {
- onLoad(page.value);
- ElMessage.success('操作成功!');
- // crudRef.value.toggleSelection()
- });
-};
-
-const handleDisable = row => {
- ElMessageBox.confirm('是否确定禁用这条配置?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => disable(row.id))
- .then(() => {
- onLoad(page.value);
- ElMessage.success('操作成功!');
- // crudRef.value.toggleSelection()
- });
-};
-
-const beforeOpen = (done, type) => {
- // if (['edit', 'view'].includes(type)) {
- // // getDetail(form.value.id).then(res => {
- // // form.value = res.data.data
- // // })
- // }
- done();
-};
-
-const currentChange = currentPage => {
- page.value.currentPage = currentPage;
-};
-
-const sizeChange = pageSize => {
- page.value.pageSize = pageSize;
-};
-const refreshChange = () => {
- onLoad(page.value, query.value);
-};
-
-const onLoad = (pageParam, params = {}) => {
- const searchparams = {
- current: pageParam.currentPage,
- size: pageParam.pageSize,
- lotValue: pageParam.lotValue,
- userName: pageParam.userName,
- };
- loading.value = true;
- listOfSpotTypesApi(searchparams).then(res => {
- const resData = res.data.data;
- page.value.total = resData.total;
- data.value = resData.records;
- loading.value = false;
- selectionClear();
- });
-};
-
-// ---------------- extra ----------------
-const goPatchManagement = () => {
- router.push({ path: '/resource/patchManagement' });
-};
-
-// ---------------- utils ----------------
-function validData(value) {
- return value !== undefined && value !== null && value !== false;
-}
-
-onMounted(() => {
- getsearchManagementApi();
-});
-</script>
-
-<style scoped lang="scss"></style>
diff --git a/applications/drone-command/src/views/resource/sms.vue b/applications/drone-command/src/views/resource/sms.vue
deleted file mode 100644
index 3854e6b..0000000
--- a/applications/drone-command/src/views/resource/sms.vue
+++ /dev/null
@@ -1,459 +0,0 @@
-<template>
- <basic-container>
- <avue-crud
- :option="option"
- :table-loading="loading"
- :data="data"
- v-model:page="page"
- :permission="permissionList"
- :before-open="beforeOpen"
- v-model="form"
- ref="crud"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad"
- >
- <template #menu-left>
- <el-button
- type="danger"
- icon="el-icon-delete"
- plain
- v-if="permission.sms_delete"
- @click="handleDelete"
- >删 除
- </el-button>
- </template>
- <template #menu="scope">
- <el-button
- type="primary"
- text
- icon="el-icon-video-play"
- v-if="userInfo.role_name.includes('admin')"
- @click="handleDebug(scope.row)"
- >调试
- </el-button>
- <el-button
- type="primary"
- text
- icon="el-icon-circle-check"
- v-if="permission.sms_enable"
- @click.stop="handleEnable(scope.row)"
- >启用
- </el-button>
- </template>
- <template #status="{ row }">
- <el-tag>{{ row.statusName }}</el-tag>
- </template>
- <template #category="{ row }">
- <el-tag>{{ row.categoryName }}</el-tag>
- </template>
- </avue-crud>
- <el-dialog title="手机短信发送调试" append-to-body v-model="box" width="550px">
- <avue-form :option="debugOption" v-model="debugForm" @submit="handleSend" />
- </el-dialog>
- </basic-container>
-</template>
-
-<script>
-import { getList, getDetail, add, update, remove, enable, send } from '@/api/resource/sms';
-import { mapGetters } from 'vuex';
-import func from '@/utils/func';
-
-export default {
- data() {
- return {
- form: {},
- query: {},
- loading: true,
- box: false,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- selectionList: [],
- option: {
- tip: false,
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- viewBtn: true,
- selection: true,
- grid: true,
- menuWidth: 350,
- labelWidth: 100,
- dialogWidth: 880,
- dialogClickModal: false,
- column: [
- {
- label: '分类',
- type: 'radio',
- value: 1,
- span: 24,
- width: 100,
- searchLabelWidth: 50,
- row: true,
- dicUrl: '/blade-system/dict/dictionary?code=sms',
- props: {
- label: 'dictValue',
- value: 'dictKey',
- },
- dataType: 'number',
- slot: true,
- prop: 'category',
- search: true,
- rules: [
- {
- required: true,
- message: '请选择分类',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '资源编号',
- prop: 'smsCode',
- span: 24,
- width: 200,
- search: true,
- rules: [
- {
- required: true,
- message: '请输入资源编号',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '模版ID',
- prop: 'templateId',
- span: 24,
- width: 200,
- search: true,
- rules: [
- {
- required: true,
- message: '请输入模版ID',
- trigger: 'blur',
- },
- ],
- },
- {
- label: 'accessKey',
- prop: 'accessKey',
- span: 24,
- overHidden: true,
- rules: [
- {
- required: true,
- message: '请输入accessKey',
- trigger: 'blur',
- },
- ],
- },
- {
- label: 'secretKey',
- prop: 'secretKey',
- span: 24,
- overHidden: true,
- display: true,
- hide: true,
- rules: [
- {
- required: true,
- message: '请输入secretKey',
- trigger: 'blur',
- },
- ],
- },
- {
- label: 'regionId',
- prop: 'regionId',
- span: 24,
- value: 'cn-hangzhou',
- hide: true,
- display: false,
- },
- {
- label: '短信签名',
- prop: 'signName',
- span: 24,
- width: 200,
- rules: [
- {
- required: true,
- message: '请输入短信签名',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '是否启用',
- prop: 'status',
- span: 24,
- width: 85,
- align: 'center',
- slot: true,
- addDisplay: false,
- editDisplay: false,
- viewDisplay: false,
- },
- {
- label: '备注',
- prop: 'remark',
- span: 24,
- hide: true,
- },
- ],
- },
- data: [],
- debugForm: {
- code: '',
- },
- debugOption: {
- submitText: '发送',
- column: [
- {
- label: '资源编号',
- prop: 'code',
- disabled: true,
- span: 24,
- },
- {
- label: '发送手机',
- prop: 'phones',
- span: 24,
- },
- {
- label: '发送参数',
- prop: 'params',
- span: 24,
- placeholder: "例: {'code':2333,'title':'通知标题'}",
- },
- ],
- },
- };
- },
- watch: {
- 'form.category'() {
- const category = func.toInt(this.form.category);
- this.$refs.crud.option.column.filter(item => {
- if (item.prop === 'templateId') {
- if (category === 1) {
- item.label = '模版内容';
- } else {
- item.label = '模版ID';
- }
- }
- if (item.prop === 'accessKey') {
- if (category === 1) {
- item.label = 'apiKey';
- } else if (category === 4) {
- item.label = 'appId';
- } else {
- item.label = 'accessKey';
- }
- }
- if (item.prop === 'secretKey') {
- item.display = category !== 1;
- if (category === 4) {
- item.label = 'appKey';
- } else {
- item.label = 'secretKey';
- }
- }
- if (item.prop === 'regionId') {
- if (category === 3) {
- item.display = true;
- item.value = 'cn-hangzhou';
- } else {
- item.display = false;
- }
- }
- });
- },
- },
- computed: {
- ...mapGetters(['userInfo', 'permission']),
- permissionList() {
- return {
- addBtn: this.validData(this.permission.sms_add, false),
- viewBtn: this.validData(this.permission.sms_view, false),
- delBtn: this.validData(this.permission.sms_delete, false),
- editBtn: this.validData(this.permission.sms_edit, false),
- };
- },
- ids() {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(',');
- },
- },
- methods: {
- rowSave(row, done, loading) {
- add(row).then(
- () => {
- this.onLoad(this.page);
- this.$message({
- type: 'success',
- message: '操作成功!',
- });
- done();
- },
- error => {
- window.console.log(error);
- loading();
- }
- );
- },
- rowUpdate(row, index, done, loading) {
- update(row).then(
- () => {
- this.onLoad(this.page);
- this.$message({
- type: 'success',
- message: '操作成功!',
- });
- done();
- },
- error => {
- window.console.log(error);
- loading();
- }
- );
- },
- rowDel(row) {
- this.$confirm('确定将选择数据删除?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => {
- return remove(row.id);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: 'success',
- message: '操作成功!',
- });
- });
- },
- handleEnable(row) {
- this.$confirm('是否确定启用这条配置?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => {
- return enable(row.id);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: 'success',
- message: '操作成功!',
- });
- this.$refs.crud.toggleSelection();
- });
- },
- handleDebug(row) {
- this.box = true;
- this.debugForm.code = row.smsCode;
- },
- handleSend(form, done, loading) {
- send(form.code, form.phones, form.params).then(
- res => {
- this.$message({
- type: 'success',
- message: '发送成功!',
- });
- done();
- window.console.log(res);
- this.box = false;
- },
- error => {
- window.console.log(error);
- loading();
- }
- );
- },
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning('请选择至少一条数据');
- return;
- }
- this.$confirm('确定将选择数据删除?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => {
- return remove(this.ids);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: 'success',
- message: '操作成功!',
- });
- this.$refs.crud.toggleSelection();
- });
- },
- beforeOpen(done, type) {
- if (['edit', 'view'].includes(type)) {
- getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
- }
- done();
- },
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- onLoad(page, params = {}) {
- this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
- });
- },
- },
-};
-</script>
diff --git a/applications/drone-command/src/views/resource/wayline.vue b/applications/drone-command/src/views/resource/wayline.vue
deleted file mode 100644
index 52ea83f..0000000
--- a/applications/drone-command/src/views/resource/wayline.vue
+++ /dev/null
@@ -1,308 +0,0 @@
-<template>
- <basic-container>
- <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" :permission="permissionList"
- v-model="form" ref="crud" @search-change="searchChange" @search-reset="searchReset"
- @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
- @refresh-change="refreshChange" @on-load="onLoad">
- </avue-crud>
- </basic-container>
-</template>
-
-<script>
-import { getJobsByUser } from '@/api/resource/wayline'
-import { getAirportList } from '@/api/device/device'
-import { mapGetters } from 'vuex'
-import func from '@/utils/func'
-
-export default {
- data () {
- // 计算默认的开始和结束日期
- const endDate = new Date() // 当前日期
- const startDate = new Date() // 一个月前的日期
- startDate.setMonth(startDate.getMonth() - 1)
-
- // 格式化为 YYYY-MM-DD 字符串
- const defaultStartDate = `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}`
- const defaultEndDate = `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}`
-
- return {
- form: {},
- // 初始化 query,设置默认时间范围
- query: {
- daterange: [defaultStartDate, defaultEndDate]
- },
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- selectionList: [],
- selectedWorkspaceId: null,
- option: {
- tip: false,
- searchShow: true,
- searchGutter: 30,
- searchMenuPosition: 'left',
- searchMenuSpan: 4,
- border: true,
- index: true,
- // selection: true,
- dialogClickModal: false,
- menu: false, // 禁用默认操作列
-
- height: 'auto',
- calcHeight: 20,
- column: [
- {
- label: '机场选择',
- prop: 'dock_name',
- type: 'select',
- search: true,
- searchSpan: 4,
- dicData: [],
- props: {
- label: 'nickname',
- value: 'nickname',
- },
- hide: true,
- change: (value) => {
- this.searchChange({ ...this.query,dock_name:value.value}, () => {});
- }
- },
- {
- label: '任务名称',
- prop: 'job_name',
- search: true,
- searchSpan: 4,
- },
- {
- label: '时间范围',
- prop: 'daterange',
- type: 'daterange',
- search: true,
- searchRange: true,
- searchSpan: 8,
- format: 'YYYY-MM-DD', // 显示格式
- valueFormat: 'YYYY-MM-DD', // 值格式
- startPlaceholder: '开始时间',
- endPlaceholder: '结束时间',
- searchValue: [defaultStartDate, defaultEndDate], // 设置搜索表单默认值
- hide: true ,// 隐藏在表格中,只保留在搜索框
- change: (value) => {
- this.searchChange({ ...this.query,daterange:value.value}, () => {});
- }
- },
- {
- label: '机场名称',
- prop: 'dock_name',
- },
- {
- label: '用户名',
- prop: 'username',
- },
- {
- label: '执行时间',
- prop: 'begin_time',
- formatter: (row) => this.formatTime(row.begin_time),
- },
- {
- label: '完成时间',
- prop: 'completed_time',
- formatter: (row) => this.formatTime(row.completed_time),
- },
- {
- label: '错误原因',
- prop: 'reason',
- formatter: (row) => {
- return [4, 5].includes(row.status) ? row.reason || '未知' : ''
- },
- },
- ],
- },
- data: [],
- }
- },
- computed: {
- ...mapGetters(['permission']),
- permissionList () {
- return {
- addBtn: false,
- editBtn: false,
- viewBtn: this.validData(this.permission.attach_view, false),
- delBtn: this.validData(this.permission.attach_delete, false),
- }
- },
- ids () {
- let ids = []
- this.selectionList.forEach(ele => {
- ids.push(ele.job_id)
- })
- return ids.join(',')
- },
- },
- mounted () {
- this.loadAirportList()
- // 初始化时手动触发搜索,以确保默认值生效
- this.$refs.crud.searchChange(this.query)
- this.onLoad(this.page, this.query)
- },
- methods: {
- loadAirportList () {
- getAirportList().then(res => {
- const airportData = res.data.data || []
- const airportColumn = this.option.column.find(col => col.prop === 'dock_name')
- if (airportColumn) {
- airportColumn.dicData = airportData.map(item => ({
- nickname: item.nickname,
- workspace_id: item.workspace_id,
- }))
- }
- }).catch(error => {
- // 处理错误
- })
- },
- searchReset () {
- // 重置时恢复默认时间范围
- const endDate = new Date()
- const startDate = new Date()
- startDate.setMonth(startDate.getMonth() - 1)
- const defaultStartDate = `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}`
- const defaultEndDate = `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}`
- this.query = {
- daterange: [defaultStartDate, defaultEndDate]
- }
- this.selectedWorkspaceId = null
- // 更新 searchValue 以确保界面重置后显示默认值
- const daterangeColumn = this.option.column.find(col => col.prop === 'daterange')
- daterangeColumn.searchValue = [defaultStartDate, defaultEndDate]
- this.onLoad(this.page, this.query)
- },
- searchChange (params, done) {
- this.query = params
- this.page.currentPage = 1
-
- const airportColumn = this.option.column.find(col => col.prop === 'dock_name')
- const selectedAirport = airportColumn.dicData.find(item => item.nickname === params.dock_name)
- this.selectedWorkspaceId = selectedAirport ? selectedAirport.workspace_id : null
-
- const { daterange } = params
- let startTime = null
- let endTime = null
- if (daterange && Array.isArray(daterange) && daterange.length === 2) {
- startTime = this.formatTime(daterange[0])
- endTime = this.formatTime(daterange[1])
- }
-
- if (startTime && isNaN(new Date(startTime).getTime())) {
- startTime = null
- }
- if (endTime && isNaN(new Date(endTime).getTime())) {
- endTime = null
- }
-
- this.onLoad(this.page, params)
- if (done) done()
- },
- selectionChange (list) {
- this.selectionList = list
- },
- selectionClear () {
- this.selectionList = []
- this.$refs.crud.toggleSelection()
- },
- currentChange (currentPage) {
- this.page.currentPage = currentPage
- this.onLoad(this.page, this.query)
- },
- sizeChange (pageSize) {
- this.page.pageSize = pageSize
- this.onLoad(this.page, this.query)
- },
- refreshChange () {
- this.onLoad(this.page, this.query)
- },
- onLoad (page, params = {}) {
- this.loading = true
-
- const workspaceId = this.selectedWorkspaceId || null
- const { daterange } = params
- let startTime = null
- let endTime = null
-
- if (daterange && Array.isArray(daterange) && daterange.length === 2) {
- startTime = this.formatTime(daterange[0])
- endTime = this.formatTime(daterange[1])
- }
-
- if (startTime && isNaN(new Date(startTime).getTime())) {
- startTime = null
- }
- if (endTime && isNaN(new Date(endTime).getTime())) {
- endTime = null
- }
-
- getJobsByUser(
- workspaceId,
- page.currentPage,
- page.pageSize,
- params.status || '',
- startTime,
- endTime,
- params.job_name || null
- ).then(res => {
- const responseData = res.data
-
- if (responseData && responseData.data && Array.isArray(responseData.data.list)) {
- this.page.total = responseData.data.pagination.total || responseData.data.list.length
- this.data = responseData.data.list.map(item => ({
- job_id: item.job_id,
- job_name: item.job_name,
- dock_name: item.dock_name,
- status: item.status,
- username: item.username,
- workspace_id: item.workspace_id,
- reason: item.reason,
- begin_time: item.begin_time,
- completed_time: item.completed_time,
- }))
- } else {
- this.data = []
- this.page.total = 0
- }
-
- this.loading = false
- this.selectionClear()
- }).catch(error => {
- this.loading = false
- this.data = []
- this.page.total = 0
- })
- },
- formatTime (time) {
- if (!time) return ''
- let date
- if (typeof time === 'number') {
- date = new Date(time < 10000000000 ? time * 1000 : time)
- } else if (typeof time === 'string') {
- date = new Date(time)
- }
- if (isNaN(date.getTime())) {
- return null
- }
- const year = date.getFullYear()
- const month = String(date.getMonth() + 1).padStart(2, '0')
- const day = String(date.getDate()).padStart(2, '0')
- const hours = String(date.getHours()).padStart(2, '0')
- const minutes = String(date.getMinutes()).padStart(2, '0')
- const seconds = String(date.getSeconds()).padStart(2, '0')
- return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
- },
- validData (val, def) {
- return typeof val !== 'undefined' ? val : def
- },
- },
-}
-</script>
-
-<style scoped lang="scss"></style>
diff --git a/applications/drone-command/src/views/resource/waylineFile.vue b/applications/drone-command/src/views/resource/waylineFile.vue
deleted file mode 100644
index ceeedd1..0000000
--- a/applications/drone-command/src/views/resource/waylineFile.vue
+++ /dev/null
@@ -1,235 +0,0 @@
-<template>
- <basic-container>
- <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" v-model="form" ref="crud"
- @search-change="searchChange" @search-reset="searchReset" @current-change="currentChange"
- @size-change="sizeChange" @refresh-change="refreshChange">
- </avue-crud>
- </basic-container>
-</template>
-
-<script>
-import { getWaylineFileByUser } from '@/api/resource/waylineFile'
-import { getAirportList } from '@/api/device/device'
-
-export default {
- name: 'WaylineFile',
- data () {
- const { defaultStartDate, defaultEndDate } = this.getDefaultDates()
- return {
- form: {},
- query: { name: '', dock_name: '', daterange: [defaultStartDate, defaultEndDate] },
- loading: false,
- page: { pageSize: 10, currentPage: 1, total: 0 },
- selectedWorkspaceId: null,
- data: [],
- option: {
- tip: false,
- searchShow: true,
- searchGutter: 30,
- searchMenuPosition: 'left',
- searchMenuSpan: 4,
- border: true,
- index: true,
- menu: false,
- page: true,
-
- height: 'auto',
- calcHeight: 20,
- column: [
- {
- label: '机场选择',
- prop: 'dock_name',
- type: 'select',
- search: true,
- searchSpan: 4,
- dicData: [],
- props: { label: 'nickname', value: 'nickname' },
- hide: true,
- change: (value) => {
- this.searchChange({ ...this.query,dock_name:value.value}, () => {});
- }
- },
- {
- label: '航线名称',
- prop: 'name',
- search: true,
- searchSpan: 4,
- },
- {
- label: '时间范围',
- prop: 'daterange',
- type: 'daterange',
- search: true,
- searchRange: true,
- searchSpan: 8,
- format: 'YYYY-MM-DD',
- valueFormat: 'YYYY-MM-DD',
- startPlaceholder: '开始时间',
- endPlaceholder: '结束时间',
- searchValue: [defaultStartDate, defaultEndDate],
- hide: true,
- change: (value) => {
- this.searchChange({ ...this.query,daterange:value.value}, () => {});
- }
- },
- { label: '航线名称', prop: 'name' },
- {
- label: '航线类型',
- prop: 'wayline_type',
- formatter: (row) => this.formatWaylineType(row.wayline_type),
- },
- { label: '用户名', prop: 'user_name' },
- { label: '航线ID', prop: 'id' },
- {
- label: '更新时间',
- prop: 'update_time',
- formatter: (row) => this.formatTime(row.update_time),
- },
- ],
- },
- }
- },
- mounted () {
- this.fetchAirports()
- this.fetchData(this.page, this.query) // 初次加载包含默认时间范围
- },
- methods: {
- getDefaultDates () {
- const endDate = new Date()
- const startDate = new Date()
- startDate.setMonth(startDate.getMonth() - 1)
- // 结束时间设定为当天 23:59:59
- endDate.setHours(23, 59, 59, 999)
-
- return {
- defaultStartDate: `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}`,
- defaultEndDate: `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}`,
- }
- },
- async fetchAirports () {
- try {
- const res = await getAirportList()
- const airportData = res.data.data || []
- const airportColumn = this.option.column.find((col) => col.prop === 'dock_name')
- if (airportColumn) {
- airportColumn.dicData = airportData.map((item) => ({
- nickname: item.nickname,
- workspace_id: item.workspace_id,
- }))
- }
- } catch (error) {
- console.error('加载机场列表失败:', error)
- }
- },
- async fetchData (page, params = {}) {
- this.loading = true
- const { name, dock_name, daterange } = params
- const workspaceId = this.selectedWorkspaceId || null
-
- // 时间范围处理
- const startDate = new Date(daterange[0])
- let endDate = new Date(daterange[1])
- // 结束时间始终设定为当天 23:59:59
- endDate.setHours(23, 59, 59, 999)
-
- const startTime = isNaN(startDate.getTime()) ? null : startDate.getTime()
- const endTime = isNaN(endDate.getTime()) ? null : endDate.getTime()
-
- const requestParams = {
- workspaceId,
- waylineName: name || null,
- startTime,
- endTime,
- page: page.currentPage,
- pageSize: page.pageSize,
- }
-
- console.log('请求参数:', requestParams)
-
- try {
- const res = await getWaylineFileByUser(
- requestParams.workspaceId,
- requestParams.waylineName,
- requestParams.startTime,
- requestParams.endTime,
- requestParams.page,
- requestParams.pageSize
- )
- const responseData = res.data
-
- if (responseData?.code === 0 && Array.isArray(responseData.data?.list)) {
- this.data = responseData.data.list.map((item) => ({
- id: item.id,
- name: item.name,
- wayline_type: item.wayline_type,
- user_name: item.user_name,
- update_time: item.update_time,
- }))
- this.page.total = responseData.data.pagination?.total || responseData.data.list.length
- this.page.currentPage = page.currentPage
- console.log('返回数据条数:', this.data.length)
- console.log('当前页码:', this.page.currentPage)
- console.log('总条数:', this.page.total)
- } else {
- this.data = []
- this.page.total = 0
- }
- } catch (error) {
- console.error('加载数据失败:', error)
- this.data = []
- this.page.total = 0
- } finally {
- this.loading = false
- }
- },
- searchChange (params, done) {
- this.query = { ...params }
- const airportColumn = this.option.column.find((col) => col.prop === 'dock_name')
- const selectedAirport = airportColumn.dicData.find((item) => item.nickname === params.dock_name)
- this.selectedWorkspaceId = selectedAirport ? selectedAirport.workspace_id : null
- this.page.currentPage = 1
- this.fetchData(this.page, this.query)
- done()
- },
- searchReset () {
- const { defaultStartDate, defaultEndDate } = this.getDefaultDates()
- this.query = { name: '', dock_name: '', daterange: [defaultStartDate, defaultEndDate] }
- this.selectedWorkspaceId = null
- const daterangeColumn = this.option.column.find((col) => col.prop === 'daterange')
- daterangeColumn.searchValue = [defaultStartDate, defaultEndDate]
- this.page.currentPage = 1
- this.fetchData(this.page, this.query)
- },
- currentChange (currentPage) {
- console.log('切换页码至:', currentPage)
- this.page.currentPage = currentPage
- this.fetchData(this.page, this.query)
- },
- sizeChange (pageSize) {
- console.log('每页条数改为:', pageSize)
- this.page.pageSize = pageSize
- this.page.currentPage = 1
- this.fetchData(this.page, this.query)
- },
- refreshChange () {
- this.fetchData(this.page, this.query)
- },
- formatTime (time) {
- if (!time) return ''
- const date = new Date(time < 10000000000 ? time * 1000 : time)
- if (isNaN(date.getTime())) return '无效时间'
- return date.toLocaleString('zh-CN', { hour12: false }).replace(/\//g, '-')
- },
- formatWaylineType (type) {
- const typeMap = { '0': '普通航线', '1': '图斑举证航线', '2': '航测航线', '3': '航点航线', '4': '正射举证航线' }
- return typeMap[type] || '未知'
- },
- },
-}
-</script>
-
-<style scoped lang="scss">
-.avue-crud .el-table {
- max-height: none !important;
-}
-</style>
--
Gitblit v1.9.3