From 63b32d09fbe69f82bf7d55b4097d649b3cfd3577 Mon Sep 17 00:00:00 2001 From: sd <1504629600@qq.com> Date: Mon, 2 Feb 2026 15:12:16 +0800 Subject: [PATCH 1/3] 1 --- ruoyi-ui/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index c150917..9f0562f 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -37,6 +37,7 @@ "js-beautify": "1.13.0", "js-cookie": "3.0.1", "jsencrypt": "3.0.0-rc.1", + "mammoth": "^1.11.0", "nprogress": "0.2.0", "quill": "2.0.2", "screenfull": "5.0.2", From 9c0ddf79557551f6e6372dd00e50ccd2cbfa3a82 Mon Sep 17 00:00:00 2001 From: sd <1504629600@qq.com> Date: Tue, 3 Feb 2026 11:12:32 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=88=AA=E7=82=B9=E5=AE=9A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/views/cesiumMap/index.vue | 217 ++++++++++++++++++++++++++++++++- 1 file changed, 214 insertions(+), 3 deletions(-) diff --git a/ruoyi-ui/src/views/cesiumMap/index.vue b/ruoyi-ui/src/views/cesiumMap/index.vue index 47a57ae..031f9f2 100644 --- a/ruoyi-ui/src/views/cesiumMap/index.vue +++ b/ruoyi-ui/src/views/cesiumMap/index.vue @@ -60,6 +60,9 @@ import ContextMenu from './ContextMenu.vue' import axios from 'axios' import request from '@/utils/request' import { getToken } from '@/utils/auth' +import { listScenario } from '@/api/system/scenario' +import { listRoutes } from '@/api/system/routes' +import { listWaypoints } from '@/api/system/waypoints' export default { name: 'CesiumMap', props: { @@ -138,7 +141,14 @@ export default { coordinatesText: '经度: --, 纬度: --', // 比例尺(高德风格) scaleBarText: '--', - scaleBarWidthPx: 80 + scaleBarWidthPx: 80, + // 定位相关 + scenarioList: [], + routeList: [], + waypointList: [], + selectedScenario: null, + selectedRoute: null, + selectedWaypoint: null } }, components: { @@ -2706,12 +2716,187 @@ export default { }) } }, - handleLocate() { + async handleLocate() { const h = this.$createElement + + // 每次打开弹窗时重置所有状态 + this.scenarioList = [] + this.routeList = [] + this.waypointList = [] + this.selectedScenario = null + this.selectedRoute = null + this.selectedWaypoint = null + + try { + const scenarioRes = await listScenario({}) + this.scenarioList = scenarioRes.rows || [] + } catch (error) { + console.error('加载方案列表失败:', error) + } + + const getSelectByClass = (className) => { + return document.querySelector(`.${className}`) + } + + const resetSelects = () => { + const scenarioSelect = getSelectByClass('scenario-select') + const routeSelect = getSelectByClass('route-select') + const waypointSelect = getSelectByClass('waypoint-select') + + if (scenarioSelect) scenarioSelect.value = '' + if (routeSelect) { + routeSelect.disabled = true + routeSelect.innerHTML = '' + } + if (waypointSelect) { + waypointSelect.disabled = true + waypointSelect.innerHTML = '' + } + } + + const handleScenarioChange = async (e) => { + const value = parseInt(e.target.value) + console.log('方案变化:', value) + this.selectedScenario = value + this.selectedRoute = null + this.selectedWaypoint = null + this.routeList = [] + this.waypointList = [] + + const routeSelect = getSelectByClass('route-select') + const waypointSelect = getSelectByClass('waypoint-select') + + if (routeSelect) { + routeSelect.disabled = true + routeSelect.innerHTML = '' + } + + if (waypointSelect) { + waypointSelect.disabled = true + waypointSelect.innerHTML = '' + } + + if (value) { + try { + const routeRes = await listRoutes({ scenarioId: value }) + this.routeList = routeRes.rows || [] + console.log('航线列表:', this.routeList) + + if (routeSelect) { + routeSelect.disabled = false + routeSelect.innerHTML = '' + this.routeList.forEach(item => { + const option = document.createElement('option') + option.value = item.id + option.textContent = item.callSign + routeSelect.appendChild(option) + }) + } + } catch (error) { + console.error('加载航线列表失败:', error) + } + } + } + + const handleRouteChange = async (e) => { + const value = parseInt(e.target.value) + console.log('航线变化:', value) + this.selectedRoute = value + this.selectedWaypoint = null + this.waypointList = [] + + const waypointSelect = getSelectByClass('waypoint-select') + + if (waypointSelect) { + waypointSelect.disabled = true + waypointSelect.innerHTML = '' + } + + if (value) { + try { + const waypointRes = await listWaypoints({ routeId: value }) + this.waypointList = waypointRes.rows || [] + console.log('航点列表:', this.waypointList) + + if (waypointSelect) { + waypointSelect.disabled = false + waypointSelect.innerHTML = '' + this.waypointList.forEach(item => { + const option = document.createElement('option') + option.value = item.id + option.textContent = `${item.name} (${item.lng}, ${item.lat})` + waypointSelect.appendChild(option) + }) + } + } catch (error) { + console.error('加载航点列表失败:', error) + } + } + } + + const handleWaypointChange = (e) => { + const value = parseInt(e.target.value) + console.log('航点变化:', value) + this.selectedWaypoint = value + const waypoint = this.waypointList.find(w => w.id === value) + if (waypoint) { + const lngInput = document.querySelector('input[placeholder="例如 116.40"]') + const latInput = document.querySelector('input[placeholder="例如 39.90"]') + if (lngInput) lngInput.value = waypoint.lng + if (latInput) latInput.value = waypoint.lat + console.log('填充经纬度:', waypoint.lng, waypoint.lat) + } + } + this.$msgbox({ title: '定位', message: h('div', {style: 'padding: 10px 0;'}, [ h('div', {style: 'margin-bottom: 15px;'}, [ + h('label', {style: 'display: block; margin-bottom: 5px; color: #606266;'}, '方案:'), + h('select', { + attrs: { + class: 'scenario-select', + style: 'width: 100%; padding: 8px; border: 1px solid #dcdfe6; border-radius: 4px; box-sizing: border-box;' + }, + on: { + change: handleScenarioChange + } + }, [ + h('option', { attrs: { value: '' } }, '请选择方案'), + ...this.scenarioList.map(item => h('option', { attrs: { value: item.id } }, item.name)) + ]) + ]), + h('div', {style: 'margin-bottom: 15px;'}, [ + h('label', {style: 'display: block; margin-bottom: 5px; color: #606266;'}, '航线:'), + h('select', { + attrs: { + class: 'route-select', + disabled: true, + style: 'width: 100%; padding: 8px; border: 1px solid #dcdfe6; border-radius: 4px; box-sizing: border-box;' + }, + on: { + change: handleRouteChange + } + }, [ + h('option', { attrs: { value: '' } }, '请选择航线') + ]) + ]), + h('div', {style: 'margin-bottom: 15px;'}, [ + h('label', {style: 'display: block; margin-bottom: 5px; color: #606266;'}, '航点:'), + h('select', { + attrs: { + class: 'waypoint-select', + disabled: true, + style: 'width: 100%; padding: 8px; border: 1px solid #dcdfe6; border-radius: 4px; box-sizing: border-box;' + }, + on: { + change: handleWaypointChange + } + }, [ + h('option', { attrs: { value: '' } }, '请选择航点') + ]) + ]), + h('div', {style: 'margin-bottom: 15px;'}, [ h('label', {style: 'display: block; margin-bottom: 5px; color: #606266;'}, '经度:'), h('input', { attrs: { @@ -2757,7 +2942,7 @@ export default { } if (this.viewer) { this.viewer.camera.flyTo({ - destination: Cesium.Cartesian3.fromDegrees(lng, lat, 5000), + destination: Cesium.Cartesian3.fromDegrees(lng, lat, 100000), orientation: { heading: Cesium.Math.toRadians(0.0), pitch: Cesium.Math.toRadians(-90.0), @@ -2773,9 +2958,35 @@ export default { done() } } + }).then(() => { + // 弹窗关闭后重置所有选择状态 + resetSelects() }).catch(() => { this.$message.info('已取消定位') + // 弹窗关闭后重置所有选择状态 + resetSelects() + }) + }, + updateSelectOptions(refName, dataList, labelField) { + const select = document.querySelector(`select[ref="${refName}"]`) + if (!select) return + + const currentValue = select.value + select.innerHTML = '' + + const defaultOption = document.createElement('option') + defaultOption.value = '' + defaultOption.textContent = refName === 'routeSelect' ? '请选择航线' : '请选择航点' + select.appendChild(defaultOption) + + dataList.forEach(item => { + const option = document.createElement('option') + option.value = item.id + option.textContent = typeof labelField === 'function' ? labelField(item) : item[labelField] + select.appendChild(option) }) + + select.value = currentValue }, initScaleBar() { const that = this From a647d56b8ae949378f866d89059ab8df95301002 Mon Sep 17 00:00:00 2001 From: sd <1504629600@qq.com> Date: Tue, 3 Feb 2026 13:34:38 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=88=AA=E7=82=B9=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=EF=BC=8C=E4=BB=A3=E7=A0=81=E5=88=86=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/views/cesiumMap/LocateDialog.vue | 257 ++++++++++++++++++++++ ruoyi-ui/src/views/cesiumMap/index.vue | 293 +++----------------------- 2 files changed, 291 insertions(+), 259 deletions(-) create mode 100644 ruoyi-ui/src/views/cesiumMap/LocateDialog.vue diff --git a/ruoyi-ui/src/views/cesiumMap/LocateDialog.vue b/ruoyi-ui/src/views/cesiumMap/LocateDialog.vue new file mode 100644 index 0000000..63419b0 --- /dev/null +++ b/ruoyi-ui/src/views/cesiumMap/LocateDialog.vue @@ -0,0 +1,257 @@ + + + + + \ No newline at end of file diff --git a/ruoyi-ui/src/views/cesiumMap/index.vue b/ruoyi-ui/src/views/cesiumMap/index.vue index 031f9f2..a84b523 100644 --- a/ruoyi-ui/src/views/cesiumMap/index.vue +++ b/ruoyi-ui/src/views/cesiumMap/index.vue @@ -35,6 +35,15 @@ @delete="deleteEntityFromContextMenu" @update-property="updateEntityProperty" /> + + + +
@@ -57,12 +66,10 @@ import DrawingToolbar from './DrawingToolbar.vue' import MeasurementPanel from './MeasurementPanel.vue' import HoverTooltip from './HoverTooltip.vue' import ContextMenu from './ContextMenu.vue' +import LocateDialog from './LocateDialog.vue' import axios from 'axios' import request from '@/utils/request' import { getToken } from '@/utils/auth' -import { listScenario } from '@/api/system/scenario' -import { listRoutes } from '@/api/system/routes' -import { listWaypoints } from '@/api/system/waypoints' export default { name: 'CesiumMap', props: { @@ -143,19 +150,15 @@ export default { scaleBarText: '--', scaleBarWidthPx: 80, // 定位相关 - scenarioList: [], - routeList: [], - waypointList: [], - selectedScenario: null, - selectedRoute: null, - selectedWaypoint: null + locateDialogVisible: false } }, components: { DrawingToolbar, MeasurementPanel, HoverTooltip, - ContextMenu + ContextMenu, + LocateDialog }, mounted() { console.log(this.drawDomClick,999999) @@ -2716,256 +2719,28 @@ export default { }) } }, - async handleLocate() { - const h = this.$createElement - - // 每次打开弹窗时重置所有状态 - this.scenarioList = [] - this.routeList = [] - this.waypointList = [] - this.selectedScenario = null - this.selectedRoute = null - this.selectedWaypoint = null - - try { - const scenarioRes = await listScenario({}) - this.scenarioList = scenarioRes.rows || [] - } catch (error) { - console.error('加载方案列表失败:', error) - } - - const getSelectByClass = (className) => { - return document.querySelector(`.${className}`) - } - - const resetSelects = () => { - const scenarioSelect = getSelectByClass('scenario-select') - const routeSelect = getSelectByClass('route-select') - const waypointSelect = getSelectByClass('waypoint-select') - - if (scenarioSelect) scenarioSelect.value = '' - if (routeSelect) { - routeSelect.disabled = true - routeSelect.innerHTML = '' - } - if (waypointSelect) { - waypointSelect.disabled = true - waypointSelect.innerHTML = '' - } - } - - const handleScenarioChange = async (e) => { - const value = parseInt(e.target.value) - console.log('方案变化:', value) - this.selectedScenario = value - this.selectedRoute = null - this.selectedWaypoint = null - this.routeList = [] - this.waypointList = [] - - const routeSelect = getSelectByClass('route-select') - const waypointSelect = getSelectByClass('waypoint-select') - - if (routeSelect) { - routeSelect.disabled = true - routeSelect.innerHTML = '' - } - - if (waypointSelect) { - waypointSelect.disabled = true - waypointSelect.innerHTML = '' - } - - if (value) { - try { - const routeRes = await listRoutes({ scenarioId: value }) - this.routeList = routeRes.rows || [] - console.log('航线列表:', this.routeList) - - if (routeSelect) { - routeSelect.disabled = false - routeSelect.innerHTML = '' - this.routeList.forEach(item => { - const option = document.createElement('option') - option.value = item.id - option.textContent = item.callSign - routeSelect.appendChild(option) - }) - } - } catch (error) { - console.error('加载航线列表失败:', error) - } - } - } - - const handleRouteChange = async (e) => { - const value = parseInt(e.target.value) - console.log('航线变化:', value) - this.selectedRoute = value - this.selectedWaypoint = null - this.waypointList = [] - - const waypointSelect = getSelectByClass('waypoint-select') - - if (waypointSelect) { - waypointSelect.disabled = true - waypointSelect.innerHTML = '' - } - - if (value) { - try { - const waypointRes = await listWaypoints({ routeId: value }) - this.waypointList = waypointRes.rows || [] - console.log('航点列表:', this.waypointList) - - if (waypointSelect) { - waypointSelect.disabled = false - waypointSelect.innerHTML = '' - this.waypointList.forEach(item => { - const option = document.createElement('option') - option.value = item.id - option.textContent = `${item.name} (${item.lng}, ${item.lat})` - waypointSelect.appendChild(option) - }) - } - } catch (error) { - console.error('加载航点列表失败:', error) - } - } - } - - const handleWaypointChange = (e) => { - const value = parseInt(e.target.value) - console.log('航点变化:', value) - this.selectedWaypoint = value - const waypoint = this.waypointList.find(w => w.id === value) - if (waypoint) { - const lngInput = document.querySelector('input[placeholder="例如 116.40"]') - const latInput = document.querySelector('input[placeholder="例如 39.90"]') - if (lngInput) lngInput.value = waypoint.lng - if (latInput) latInput.value = waypoint.lat - console.log('填充经纬度:', waypoint.lng, waypoint.lat) - } + handleLocate() { + this.locateDialogVisible = true + }, + + handleLocateConfirm(location) { + const { lng, lat } = location + if (this.viewer) { + this.viewer.camera.flyTo({ + destination: Cesium.Cartesian3.fromDegrees(lng, lat, 100000), + orientation: { + heading: Cesium.Math.toRadians(0.0), + pitch: Cesium.Math.toRadians(-90.0), + roll: 0.0 + }, + duration: 2 + }) + this.$message.success(`已定位到经度 ${lng.toFixed(4)},纬度 ${lat.toFixed(4)}`) } - - this.$msgbox({ - title: '定位', - message: h('div', {style: 'padding: 10px 0;'}, [ - h('div', {style: 'margin-bottom: 15px;'}, [ - h('label', {style: 'display: block; margin-bottom: 5px; color: #606266;'}, '方案:'), - h('select', { - attrs: { - class: 'scenario-select', - style: 'width: 100%; padding: 8px; border: 1px solid #dcdfe6; border-radius: 4px; box-sizing: border-box;' - }, - on: { - change: handleScenarioChange - } - }, [ - h('option', { attrs: { value: '' } }, '请选择方案'), - ...this.scenarioList.map(item => h('option', { attrs: { value: item.id } }, item.name)) - ]) - ]), - h('div', {style: 'margin-bottom: 15px;'}, [ - h('label', {style: 'display: block; margin-bottom: 5px; color: #606266;'}, '航线:'), - h('select', { - attrs: { - class: 'route-select', - disabled: true, - style: 'width: 100%; padding: 8px; border: 1px solid #dcdfe6; border-radius: 4px; box-sizing: border-box;' - }, - on: { - change: handleRouteChange - } - }, [ - h('option', { attrs: { value: '' } }, '请选择航线') - ]) - ]), - h('div', {style: 'margin-bottom: 15px;'}, [ - h('label', {style: 'display: block; margin-bottom: 5px; color: #606266;'}, '航点:'), - h('select', { - attrs: { - class: 'waypoint-select', - disabled: true, - style: 'width: 100%; padding: 8px; border: 1px solid #dcdfe6; border-radius: 4px; box-sizing: border-box;' - }, - on: { - change: handleWaypointChange - } - }, [ - h('option', { attrs: { value: '' } }, '请选择航点') - ]) - ]), - h('div', {style: 'margin-bottom: 15px;'}, [ - h('label', {style: 'display: block; margin-bottom: 5px; color: #606266;'}, '经度:'), - h('input', { - attrs: { - type: 'number', - placeholder: '例如 116.40', - step: '0.000001', - value: '116.3974' - }, - style: 'width: 100%; padding: 8px; border: 1px solid #dcdfe6; border-radius: 4px; box-sizing: border-box;', - ref: 'lngInput' - }) - ]), - h('div', null, [ - h('label', {style: 'display: block; margin-bottom: 5px; color: #606266;'}, '纬度:'), - h('input', { - attrs: { - type: 'number', - placeholder: '例如 39.90', - step: '0.000001', - value: '39.9093' - }, - style: 'width: 100%; padding: 8px; border: 1px solid #dcdfe6; border-radius: 4px; box-sizing: border-box;', - ref: 'latInput' - }) - ]) - ]), - showCancelButton: true, - confirmButtonText: '确定', - cancelButtonText: '取消', - beforeClose: (action, instance, done) => { - if (action === 'confirm') { - const lngInput = instance.$el.querySelector('input[placeholder="例如 116.40"]') - const latInput = instance.$el.querySelector('input[placeholder="例如 39.90"]') - const lng = parseFloat(lngInput.value) - const lat = parseFloat(latInput.value) - if (!lng || !lat || isNaN(lng) || isNaN(lat)) { - this.$message.error('请输入有效的经度和纬度!') - return - } - if (lng < -180 || lng > 180 || lat < -90 || lat > 90) { - this.$message.error('经纬度超出有效范围!') - return - } - if (this.viewer) { - this.viewer.camera.flyTo({ - destination: Cesium.Cartesian3.fromDegrees(lng, lat, 100000), - orientation: { - heading: Cesium.Math.toRadians(0.0), - pitch: Cesium.Math.toRadians(-90.0), - roll: 0.0 - }, - duration: 2 - }) - this.$message.success(`已定位到经度 ${lng.toFixed(4)},纬度 ${lat.toFixed(4)}`) - } - done() - } else { - this.$message.info('已取消定位') - done() - } - } - }).then(() => { - // 弹窗关闭后重置所有选择状态 - resetSelects() - }).catch(() => { - this.$message.info('已取消定位') - // 弹窗关闭后重置所有选择状态 - resetSelects() - }) + }, + + handleLocateCancel() { + this.$message.info('已取消定位') }, updateSelectOptions(refName, dataList, labelField) { const select = document.querySelector(`select[ref="${refName}"]`)