diff --git a/ruoyi-ui/src/views/cesiumMap/DrawingToolbar.vue b/ruoyi-ui/src/views/cesiumMap/DrawingToolbar.vue index c23a904..de6a0f0 100644 --- a/ruoyi-ui/src/views/cesiumMap/DrawingToolbar.vue +++ b/ruoyi-ui/src/views/cesiumMap/DrawingToolbar.vue @@ -30,17 +30,21 @@ export default { hasEntities: { type: Boolean, default: false + }, + toolMode: { + type: String, + default: 'airspace' // 'airspace' or 'ranging' } }, data() { return { - toolbarItems: [ - { id: 'point', name: '点', icon: 'el-icon-location' }, - { id: 'line', name: '线', icon: 'el-icon-edit-outline' }, - { id: 'polygon', name: '面', icon: 'el-icon-s-grid' }, - { id: 'rectangle', name: '矩形', icon: 'el-icon-s-data' }, + // 完整工具列表(空域模式,移除点和线) + allToolbarItems: [ + { id: 'mouse', name: '鼠标', icon: 'el-icon-position' }, + { id: 'polygon', name: '面', icon: 'el-icon-house' }, + { id: 'rectangle', name: '矩形', icon: 'el-icon-crop' }, { id: 'circle', name: '圆形', icon: 'el-icon-circle-plus-outline' }, - { id: 'sector', name: '扇形', icon: 'el-icon-s-operation' }, + { id: 'sector', name: '扇形', icon: 'el-icon-pie-chart' }, { id: 'arrow', name: '箭头', icon: 'el-icon-right' }, { id: 'text', name: '文本', icon: 'el-icon-document' }, { id: 'image', name: '图片', icon: 'el-icon-picture-outline' }, @@ -48,9 +52,25 @@ export default { { id: 'clear', name: '清除', icon: 'el-icon-delete' }, { id: 'import', name: '导入', icon: 'el-icon-upload' }, { id: 'export', name: '导出', icon: 'el-icon-download' } + ], + // 测距模式工具列表 + rangingToolbarItems: [ + { id: 'mouse', name: '鼠标', icon: 'el-icon-position' }, + { id: 'point', name: '点', icon: 'el-icon-location' }, + { id: 'line', name: '线', icon: 'el-icon-edit-outline' }, + { id: 'clear', name: '清除', icon: 'el-icon-delete' } ] } }, + computed: { + toolbarItems() { + if (this.toolMode === 'ranging') { + return this.rangingToolbarItems; + } else { + return this.allToolbarItems; + } + } + }, methods: { handleItemClick(item) { if (item.id === 'clear') { @@ -61,6 +81,8 @@ export default { this.$emit('import-data') } else if (item.id === 'locate') { this.$emit('locate') + } else if (item.id === 'mouse') { + this.$emit('toggle-drawing', null) } else { this.$emit('toggle-drawing', item.id) } diff --git a/ruoyi-ui/src/views/cesiumMap/index.vue b/ruoyi-ui/src/views/cesiumMap/index.vue index b51244f..3ffe8d4 100644 --- a/ruoyi-ui/src/views/cesiumMap/index.vue +++ b/ruoyi-ui/src/views/cesiumMap/index.vue @@ -6,6 +6,7 @@ :draw-dom-click="drawDomClick" :drawing-mode="drawingMode" :has-entities="allEntities.length > 0" + :tool-mode="toolMode" @toggle-drawing="toggleDrawing" @clear-all="clearAll" @export-data="exportData" @@ -65,6 +66,10 @@ export default { return isBoolean } }, + toolMode: { + type: String, + default: 'airspace' // 'airspace' or 'ranging' + }, }, watch: { drawDomClick: { @@ -684,7 +689,11 @@ export default { }, // ================== 绘制功能 ================== toggleDrawing(mode) { - if (this.drawingMode === mode) { + if (mode === null) { + // 当模式为null时,直接停止绘制 + this.stopDrawing() + this.drawingMode = null + } else if (this.drawingMode === mode) { // 停止当前绘制 this.stopDrawing() this.drawingMode = null diff --git a/ruoyi-ui/src/views/childRoom/index.vue b/ruoyi-ui/src/views/childRoom/index.vue index c7f6792..d15f557 100644 --- a/ruoyi-ui/src/views/childRoom/index.vue +++ b/ruoyi-ui/src/views/childRoom/index.vue @@ -4,7 +4,9 @@