Browse Source

bug修复

master
menghao 2 months ago
parent
commit
6a853c53e1
  1. 2
      ruoyi-admin/src/main/resources/application-druid.yml
  2. 2
      ruoyi-ui/.env.development
  3. 48
      ruoyi-ui/src/views/cesiumMap/index.vue
  4. 2
      ruoyi-ui/vue.config.js

2
ruoyi-admin/src/main/resources/application-druid.yml

@ -8,7 +8,7 @@ spring:
master: master:
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: A20040303ctw! password: 123456
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭

2
ruoyi-ui/.env.development

@ -8,7 +8,7 @@ ENV = 'development'
VUE_APP_BASE_API = '/dev-api' VUE_APP_BASE_API = '/dev-api'
# 访问地址(绕过 /dev-api 代理,用于解决静态资源/图片访问 401 认证问题) # 访问地址(绕过 /dev-api 代理,用于解决静态资源/图片访问 401 认证问题)
VUE_APP_BACKEND_URL = 'http://192.168.50.30:8080' VUE_APP_BACKEND_URL = 'http://192.168.50.145:8080'
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

48
ruoyi-ui/src/views/cesiumMap/index.vue

@ -35,7 +35,7 @@
@delete="deleteEntityFromContextMenu" @delete="deleteEntityFromContextMenu"
@update-property="updateEntityProperty" @update-property="updateEntityProperty"
/> />
<!-- 定位弹窗 --> <!-- 定位弹窗 -->
<locate-dialog <locate-dialog
:visible="locateDialogVisible" :visible="locateDialogVisible"
@ -43,7 +43,7 @@
@confirm="handleLocateConfirm" @confirm="handleLocateConfirm"
@cancel="handleLocateCancel" @cancel="handleLocateCancel"
/> />
<!-- 地图右下角比例尺 + 经纬度 --> <!-- 地图右下角比例尺 + 经纬度 -->
<div class="map-info-panel"> <div class="map-info-panel">
<div class="scale-bar"> <div class="scale-bar">
@ -358,7 +358,7 @@ export default {
const backendUrl = process.env.VUE_APP_BACKEND_URL || ''; const backendUrl = process.env.VUE_APP_BACKEND_URL || '';
return backendUrl + cleanPath; return backendUrl + cleanPath;
}, },
//线style waypoint { pixelSize, color, outlineColor, outlineWidth }line { style, width, color, gapColor, dashLength } //线
renderRouteWaypoints(waypoints, routeId = 'default', platformId, platform, style) { renderRouteWaypoints(waypoints, routeId = 'default', platformId, platform, style) {
if (!waypoints || waypoints.length < 1) return; if (!waypoints || waypoints.length < 1) return;
// 线 // 线
@ -367,6 +367,12 @@ export default {
if (existingLine) { if (existingLine) {
this.viewer.entities.remove(existingLine); this.viewer.entities.remove(existingLine);
} }
// 线
const platformBillboardId = `route-platform-${routeId}`;
const existingPlatform = this.viewer.entities.getById(platformBillboardId);
if (existingPlatform) {
this.viewer.entities.remove(existingPlatform);
}
// 线 // 线
waypoints.forEach((wp,index) => { waypoints.forEach((wp,index) => {
const waypointEntityId = `wp_${routeId}_${wp.id}`; const waypointEntityId = `wp_${routeId}_${wp.id}`;
@ -2785,7 +2791,7 @@ export default {
handleLocate() { handleLocate() {
this.locateDialogVisible = true this.locateDialogVisible = true
}, },
handleLocateConfirm(location) { handleLocateConfirm(location) {
const { lng, lat } = location const { lng, lat } = location
if (this.viewer) { if (this.viewer) {
@ -2801,29 +2807,29 @@ export default {
this.$message.success(`已定位到经度 ${lng.toFixed(4)},纬度 ${lat.toFixed(4)}`) this.$message.success(`已定位到经度 ${lng.toFixed(4)},纬度 ${lat.toFixed(4)}`)
} }
}, },
handleLocateCancel() { handleLocateCancel() {
this.$message.info('已取消定位') this.$message.info('已取消定位')
}, },
updateSelectOptions(refName, dataList, labelField) { updateSelectOptions(refName, dataList, labelField) {
const select = document.querySelector(`select[ref="${refName}"]`) const select = document.querySelector(`select[ref="${refName}"]`)
if (!select) return if (!select) return
const currentValue = select.value const currentValue = select.value
select.innerHTML = '' select.innerHTML = ''
const defaultOption = document.createElement('option') const defaultOption = document.createElement('option')
defaultOption.value = '' defaultOption.value = ''
defaultOption.textContent = refName === 'routeSelect' ? '请选择航线' : '请选择航点' defaultOption.textContent = refName === 'routeSelect' ? '请选择航线' : '请选择航点'
select.appendChild(defaultOption) select.appendChild(defaultOption)
dataList.forEach(item => { dataList.forEach(item => {
const option = document.createElement('option') const option = document.createElement('option')
option.value = item.id option.value = item.id
option.textContent = typeof labelField === 'function' ? labelField(item) : item[labelField] option.textContent = typeof labelField === 'function' ? labelField(item) : item[labelField]
select.appendChild(option) select.appendChild(option)
}) })
select.value = currentValue select.value = currentValue
}, },
initScaleBar() { initScaleBar() {
@ -3071,25 +3077,25 @@ export default {
if (!positions || positions.length < 2) { if (!positions || positions.length < 2) {
return -1; return -1;
} }
let closestDistance = Number.MAX_VALUE; let closestDistance = Number.MAX_VALUE;
let closestSegmentIndex = -1; let closestSegmentIndex = -1;
// 线 // 线
for (let i = 0; i < positions.length - 1; i++) { for (let i = 0; i < positions.length - 1; i++) {
const startPoint = positions[i]; const startPoint = positions[i];
const endPoint = positions[i + 1]; const endPoint = positions[i + 1];
// 线 // 线
const distance = this.distanceToSegment(mousePosition, startPoint, endPoint); const distance = this.distanceToSegment(mousePosition, startPoint, endPoint);
// //
if (distance < closestDistance) { if (distance < closestDistance) {
closestDistance = distance; closestDistance = distance;
closestSegmentIndex = i; closestSegmentIndex = i;
} }
} }
// //
const threshold = 10; // const threshold = 10; //
return closestDistance < threshold ? closestSegmentIndex : -1; return closestDistance < threshold ? closestSegmentIndex : -1;
@ -3099,30 +3105,30 @@ export default {
// 3D // 3D
const startScreen = this.viewer.scene.cartesianToCanvasCoordinates(startPoint); const startScreen = this.viewer.scene.cartesianToCanvasCoordinates(startPoint);
const endScreen = this.viewer.scene.cartesianToCanvasCoordinates(endPoint); const endScreen = this.viewer.scene.cartesianToCanvasCoordinates(endPoint);
if (!startScreen || !endScreen) { if (!startScreen || !endScreen) {
return Number.MAX_VALUE; return Number.MAX_VALUE;
} }
// 线 // 线
const lineVec = [endScreen.x - startScreen.x, endScreen.y - startScreen.y]; const lineVec = [endScreen.x - startScreen.x, endScreen.y - startScreen.y];
// 线 // 线
const mouseVec = [mousePosition.x - startScreen.x, mousePosition.y - startScreen.y]; const mouseVec = [mousePosition.x - startScreen.x, mousePosition.y - startScreen.y];
// 线 // 线
const lineLengthSquared = lineVec[0] * lineVec[0] + lineVec[1] * lineVec[1]; const lineLengthSquared = lineVec[0] * lineVec[0] + lineVec[1] * lineVec[1];
if (lineLengthSquared === 0) { if (lineLengthSquared === 0) {
// 线0线 // 线0线
return Math.sqrt(mouseVec[0] * mouseVec[0] + mouseVec[1] * mouseVec[1]); return Math.sqrt(mouseVec[0] * mouseVec[0] + mouseVec[1] * mouseVec[1]);
} }
// 线t // 线t
const t = Math.max(0, Math.min(1, (mouseVec[0] * lineVec[0] + mouseVec[1] * lineVec[1]) / lineLengthSquared)); const t = Math.max(0, Math.min(1, (mouseVec[0] * lineVec[0] + mouseVec[1] * lineVec[1]) / lineLengthSquared));
// //
const projection = [startScreen.x + t * lineVec[0], startScreen.y + t * lineVec[1]]; const projection = [startScreen.x + t * lineVec[0], startScreen.y + t * lineVec[1]];
// //
const distanceVec = [mousePosition.x - projection[0], mousePosition.y - projection[1]]; const distanceVec = [mousePosition.x - projection[0], mousePosition.y - projection[1]];
return Math.sqrt(distanceVec[0] * distanceVec[0] + distanceVec[1] * distanceVec[1]); return Math.sqrt(distanceVec[0] * distanceVec[0] + distanceVec[1] * distanceVec[1]);

2
ruoyi-ui/vue.config.js

@ -15,7 +15,7 @@ const CompressionPlugin = require('compression-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin') const CopyWebpackPlugin = require('copy-webpack-plugin')
const name = process.env.VUE_APP_TITLE || '若依管理系统' // 网页标题 const name = process.env.VUE_APP_TITLE || '若依管理系统' // 网页标题
const baseUrl = 'http://192.168.50.30:8080' // 后端接口 const baseUrl = 'http://192.168.50.145:8080' // 后端接口
const port = process.env.port || process.env.npm_config_port || 80 // 端口 const port = process.env.port || process.env.npm_config_port || 80 // 端口
// 定义 Cesium 源码路径 // 定义 Cesium 源码路径

Loading…
Cancel
Save