吉安感知网项目-前端
shuishen
2026-02-02 aa928b41890197f746d306289f4294c4b833ace9
feat:区域划分逻辑调整
2 files modified
1 files deleted
54 ■■■■ changed files
applications/drone-command/src/views/areaManage/partition/1.json patch | view | raw | blame | history
applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue 50 ●●●● patch | view | raw | blame | history
packages/utils/map/MapTooltip.js 4 ●●●● patch | view | raw | blame | history
applications/drone-command/src/views/areaManage/partition/1.json
applications/drone-command/src/views/areaManage/partition/FormDiaLog.vue
@@ -23,22 +23,26 @@
                </div>
                <div class="map-toolbar">
                    <el-tooltip content="多边形" placement="left">
                        <button class="tool-btn" type="button" @click="handleDraw('polygon')">
                        <button class="tool-btn" :class="{ active: currentShapeType === 'polygon' }" type="button"
                            @click="handleDraw('polygon')">
                            <img class="tool-icon-image" :src="polygonIcon" alt="多边形" />
                        </button>
                    </el-tooltip>
                    <el-tooltip content="矩形" placement="left">
                        <button class="tool-btn" type="button" @click="handleDraw('rectangle')">
                        <button class="tool-btn" :class="{ active: currentShapeType === 'rectangle' }" type="button"
                            @click="handleDraw('rectangle')">
                            <img class="tool-icon-image" :src="rectIcon" alt="矩形" />
                        </button>
                    </el-tooltip>
                    <el-tooltip content="椭圆" placement="left">
                        <button class="tool-btn" type="button" @click="handleDraw('ellipse')">
                        <button class="tool-btn" :class="{ active: currentShapeType === 'ellipse' }" type="button"
                            @click="handleDraw('ellipse')">
                            <img class="tool-icon-image" :src="ellipseIcon" alt="椭圆" />
                        </button>
                    </el-tooltip>
                    <el-tooltip content="缓冲圆" placement="left">
                        <button class="tool-btn" type="button" @click="handleDraw('buffer')">
                        <button class="tool-btn" :class="{ active: currentShapeType === 'buffer' }" type="button"
                            @click="handleDraw('buffer')">
                            <img class="tool-icon-image" :src="bufferIcon" alt="缓冲圆" />
                        </button>
                    </el-tooltip>
@@ -870,7 +874,8 @@
}
// 绘制完成回调
const drawFinished = async data => {
const drawFinished = async (data, options = {}) => {
    const shouldContinueDraw = options?.continueDraw || activeToolMode.value === 'draw'
    const positions = Array.isArray(data?.positions) ? data.positions : data
    if (!Array.isArray(positions) || positions.length < 3) {
        pointList = []
@@ -949,6 +954,12 @@
        shapeList.value.splice(targetIndex, 1, shapePayload)
    }
    renderShapeList()
    if (shouldContinueDraw && !readonly.value) {
        activeShapeId.value = null
        pointList = []
        clearActiveTool()
        startDraw(currentShapeType.value || 'polygon')
    }
}
function getDetectAreaTypeKey () {
@@ -1049,11 +1060,13 @@
    const positions = activeTool?.getPositions?.()
    if (Array.isArray(positions) && positions.length >= 3) {
        suppressTypePanelOnce.value = true
        drawFinished(positions)
        drawFinished(positions, { continueDraw: true })
        return
    }
    if (positions?.positions?.length >= 3) {
        suppressTypePanelOnce.value = true
        drawFinished(positions)
        drawFinished(positions, { continueDraw: true })
        return
    }
    clearActiveTool()
}
@@ -1123,15 +1136,17 @@
function handleClearShape () {
    if (readonly.value) return
    clearActiveTool()
    viewEntity && viewer?.entities?.remove(viewEntity)
    viewEntity = null
    pointList = []
    shapeList.value = []
    activeShapeId.value = null
    activeAreaType.value = ''
    hideTypePanel()
    clearShapeDisplay()
    clearActiveTool()
    if (viewer && currentShapeType.value) {
        startDraw(currentShapeType.value)
    }
}
function handleShapeEdit (row) {
@@ -1334,10 +1349,19 @@
    clearActiveTool()
    if (dialogMode.value === 'add') {
        mapRef.value?.zoomToAdminBoundary?.()
        // default no draw mode
        handleDraw('polygon')
    } else if (dialogMode.value === 'edit') {
        await loadDetail()
        viewPolygon()
        activeShapeId.value = null
        pointList = []
        currentShapeType.value = 'polygon'
        const defaultAreaType = getDetectAreaTypeKey()
        if (defaultAreaType) {
            activeAreaType.value = defaultAreaType
        }
        clearActiveTool()
        startDraw('polygon')
    } else {
        await loadDetail()
        viewPolygon()
@@ -1457,6 +1481,12 @@
    transform: translateY(-1px);
}
.tool-btn.active {
    border-color: rgba(40, 79, 227, 0.9);
    box-shadow: 0 0 0 1px rgba(40, 79, 227, 0.45), 0 6px 14px rgba(40, 79, 227, 0.35);
    background: rgba(40, 79, 227, 0.18);
}
.tool-btn:active {
    transform: translateY(0);
}
packages/utils/map/MapTooltip.js
@@ -38,6 +38,10 @@
    move(position) {
        if (!this.tooltipEl || !position) return
        if (!this.isVisible) {
            this.tooltipEl.style.display = 'block'
            this.isVisible = true
        }
        const width = this.container?.clientWidth ?? 0
        const height = this.container?.clientHeight ?? 0
        if (!width || !height || position.x < 0 || position.y < 0 || position.x > width || position.y > height) {