Compare commits

..

No commits in common. "82eff5bf8470ba7d65d01d75a2cfc54e08aa656f" and "a6dd271e211954994c1316b70f1d8a77840979a6" have entirely different histories.

6 changed files with 72 additions and 343 deletions

View File

@ -90,18 +90,6 @@ const remainingRouter: AppRouteRecordRaw[] = [
icon: 'ep:edit',
title: '地图编辑'
}
},
{
path: 'test',
component: () => import('@/views/mapPage/realTimeMap/test.vue'),
name: 'testMapPageRealTimeMap',
meta: {
noCache: true, // 需要缓存
hidden: true,
canTo: true,
icon: 'ep:edit',
title: '测试'
}
}
]
},

View File

@ -1,65 +0,0 @@
<template>
<Dialog v-model="dialogFormVisible" title="文字设置" width="400" class="text-form-dialog">
<el-form :model="form">
<el-form-item label="字体">
<el-select v-model="form.fontType" placeholder="请选择">
<el-option label="宋体" value="SimSun" />
<el-option label="黑体" value="SimHei" />
<el-option label="微软雅黑" value="Microsoft Yahei" />
<el-option label="楷体" value="KaiTi" />
<el-option label="新宋体" value="NSimSun" />
<el-option label="仿宋" value="FangSong" />
</el-select>
</el-form-item>
<el-form-item label="字号">
<el-input-number
v-model="form.fontSize"
:step="1"
:min="10"
:max="30"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="颜色">
<el-color-picker v-model="form.fontColor" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button type="primary" @click="dialogFormVisible = false"> 确认 </el-button>
</div>
</template>
</Dialog>
</template>
<script setup>
import { reactive, ref } from 'vue'
const dialogFormVisible = ref(false)
const formLabelWidth = '140px'
const form = reactive({
fontType: 'SimSun',
fontSize: '14',
fontColor: '#000000'
})
const open = (item) => {
dialogFormVisible.value = true
}
defineExpose({ open }) // open
</script>
<style lang="scss">
.text-form-dialog {
.el-dialog__header {
border-bottom: none;
}
.el-dialog__footer {
border-top: none !important;
}
}
</style>

View File

@ -1,6 +1,6 @@
<template>
<Dialog v-model="dialogFormVisible" title="节点属性" width="540" class="node-form-dialog">
<el-form :model="form" label-width="auto">
<el-dialog v-model="dialogFormVisible" title="节点属性" width="540">
<el-form :model="form" label-width="75">
<el-form-item label="X" prop="locationX" required>
<el-input v-model="form.locationX" placeholder="请输入" />
</el-form-item>
@ -99,7 +99,7 @@
<el-button type="primary" @click="submit"> 确认 </el-button>
</div>
</template>
</Dialog>
</el-dialog>
</template>
<script setup>
@ -212,15 +212,3 @@ const deviceTypeChange = () => {
defineExpose({ open }) // open
</script>
<style lang="scss">
.node-form-dialog {
.el-dialog__header {
border-bottom: none;
}
.el-dialog__footer {
border-top: none !important;
}
}
</style>

View File

@ -1,6 +0,0 @@
let cursorCollection = {
node: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAACv9JREFUeF7tnTuobdUVhn/R2iopJDEGtDABtTBFUqiFoBG9hU1ioSCIDzApEvIoLMTCIhpiEQM+EAQtTBqLqxgFC7XQwhQqJCkU8hILrayVZI3cdRGPZ5899txzPfb4v9ncW8zX+P75n7XXXPNxjkgQgMBGAufABgIQ2EwAgzA6IHACAQzC8IAABmEMQKCNAE+QNm6UMiGAQUyEJsw2AhikjRulTAhgEBOhCbONAAZp40YpEwIYxERowmwjgEHauFHKhAAGMRGaMNsIYJA2bpQyIYBBTIQmzDYCGKSNG6VMCGAQE6EJs40ABmnjRikTAhjERGjCbCOAQdq4UcqEAAYxEZow2whgkDZulDIhgEFMhCbMNgIYpI0bpUwIYBAToQmzjQAGaeNGKRMCGMREaMJsI4BB2rhRyoQABjERmjDbCGCQNm6UMiGAQUyEJsw2AhikjRulTAhgEBOhCbONAAZp40YpEwIYxERowmwjgEHauFHKhAAGMRGaMNsIYJA2bpQyIYBBTIQmzDYCGKSNG6VMCGAQE6EJs40ABmnjRikTAhjERGjCbCOAQdq4UcqEAAYxEZow2whgkDZulDIhgEFMhCbMNgIYpI0bpUwIYBAToQmzjQAGaeNGKRMCGGQ+ob8h6TJJ35F0saSLJF0g6Wvj/4/ryT8lfSLp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A0dP4AmcLSUUhI6Ozs5epA5NpKBQ1Ni0tAThZUxe8r735Z9A4CYC5wcDsAGngTiOJ8aYRR+HVEp5StP09m0tJwARLQEc+wAAsNJaJ38NsDXGnOsVSCnnAHbPvqbxTgam1tp1lUAIcdBaX+sAb1v0kYCIfs5/rdX5GjYB+J4dBmADbIANsIHWBpRSs7IspeszyrLsAsAO9hQT0R3AyJWgKIpxnudVjFdrbSA4gFJqY62NXOVFUbRPkqT0Kr/66n0Dh4pjADYQ3MADakKSIQVRq+oAAAAASUVORK5CYII='
}
export default cursorCollection

View File

@ -6,7 +6,7 @@
placement="bottom"
:width="80"
trigger="click"
v-if="item.id === 5 || item.id === 6"
v-if="item.id === 5"
:disabled="currentItemIndex === -1"
>
<template #reference>
@ -25,8 +25,7 @@
<div class="name"> {{ item.name }} </div>
</div>
</template>
<!-- 位置 -->
<el-form :model="state.moveForm" v-if="item.id === 5">
<el-form :model="state.moveForm">
<el-form-item label="X">
<el-input v-model="state.moveForm.x" placeholder="请输入" />
</el-form-item>
@ -37,28 +36,9 @@
<el-button size="small" color="#00329F" @click="moveFormSubmit">确认</el-button>
</div>
</el-form>
<!-- 旋转 -->
<el-form :model="state.rotationForm" v-if="item.id === 6">
<el-form-item label="角度">
<el-input v-model="state.rotationForm.angle" placeholder="请输入" />
</el-form-item>
<div style="text-align: right">
<el-button size="small" color="#00329F" @click="rotationFormSubmit">确认</el-button>
</div>
</el-form>
<!-- 字体 -->
<el-form :model="state.rotationForm" v-if="item.id === 13">
<el-form-item label="角度">
<el-input v-model="state.rotationForm.angle" placeholder="请输入" />
</el-form-item>
<div style="text-align: right">
<el-button size="small" color="#00329F" @click="rotationFormSubmit">确认</el-button>
</div>
</el-form>
</el-popover>
<div
v-else
v-if="item.id !== 5"
class="tool-item"
:class="
toolbarTypeIndex === item.id ? 'tool-active' : item.isActive ? 'right-tool-active' : ''
@ -68,10 +48,10 @@
<Icon :icon="item.icon" :size="24" />
<div class="name"> {{ item.name }} </div>
</div>
<div class="line" v-if="item.id === 3 || item.id === 10 || item.id === 17"></div>
<div class="line" v-if="item.id === 3 || item.id === 10 || item.id === 19"></div>
</div>
</div>
<div class="right-tool-list" v-if="state.isShowToolbar">
<div class="right-tool-list">
<div
v-for="item in state.rightToolList"
:key="item.id"
@ -86,21 +66,10 @@
</div>
</div>
</div>
<div
class="map-box"
ref="imgWrap"
@mousewheel.prevent="rollImg"
style="overflow: hidden"
:style="{ cursor: state.cursorStyle }"
>
<div class="map-box" ref="imgWrap" @mousewheel.prevent="rollImg" style="overflow: hidden">
<div class="map-box-inner" ref="image" @mousedown.prevent="moveImg">
<img :src="imgBgObj.imgUrl" class="map-box-img" id="mapBg" />
<div
class="map-box-inner-dot"
@click="mapClick"
:class="state.isShowGrid ? 'grid-show' : ''"
v-if="test"
>
<div class="map-box-inner-dot" @click="mapClick" :class="state.isShowGrid ? 'grid-show' : ''">
<VueDragResizeRotate
v-for="(item, index) in allHistoryList[currentIndex]"
:key="index"
@ -118,16 +87,9 @@
:draggable="item.draggable"
:resizable="item.resizable"
:rotatable="item.rotatable"
:lock-aspect-ratio="item.lockAspectRatio"
:handles="['tl', 'tr', 'bl', 'br', 'rot']"
style="border: none"
:lockAspectRatio="item.lockAspectRatio"
>
<div
class="sdiv"
:style="
currentItemIndex === index ? 'border: 1px dashed #000;box-sizing: border-box;' : ''
"
>
<div class="sdiv">
<img
v-if="item.labelType === 'icon'"
:src="item.img"
@ -144,27 +106,21 @@
</div>
</div>
</div>
<!-- 节点编辑 -->
<editNodeProperties
ref="editNodePropertiesRef"
:positionMapId="imgBgObj.positionMapId"
@submitNodeSuccess="submitNodeSuccess"
/>
<!-- 文字输入弹窗 -->
<textFormToolDialog ref="textFormToolDialogRef" />
</template>
<script setup>
import { ref, defineComponent, reactive, nextTick, onMounted } from 'vue'
import editNodeProperties from './components-tool/editNodeProperties.vue'
import textFormToolDialog from './components-tool/textFormToolDialog.vue'
import editNodeProperties from './components/editNodeProperties.vue'
import * as MapApi from '@/api/map/map'
import cursorCollection from './cursorCollection'
defineOptions({ name: 'editMapPageRealTimeMap' })
const textFormToolDialogRef = ref() //
const message = useMessage() //
const formLoading = ref(false)
@ -177,8 +133,8 @@ const imgBgObj = reactive({
}) //
const imgList = ref([]) //
//
const list = ref([])
//
const getList = async () => {
let data = await MapApi.getPositionMapGetMap()
let mapList = []
@ -209,18 +165,13 @@ const getMapData = async (item) => {
}
//
const test = ref(true)
const resizeEnd = (x, y, w, h, item, index) => {
test.value = false
console.log('缩放', w, h)
nextTick(() => {
imgList.value[index].x = x
imgList.value[index].y = y
imgList.value[index].w = w
imgList.value[index].h = h
addEditHistory()
})
console.log('缩放')
imgList.value[index].x = x
imgList.value[index].y = y
imgList.value[index].w = w
imgList.value[index].h = h
addEditHistory()
}
//
const dragEnd = (x, y, item, index) => {
@ -240,10 +191,10 @@ const rotateEnd = (angle, item, index) => {
//
const editNodePropertiesRef = ref()
const activatedHandle = (item, index) => {
// console.log('', item, index)
console.log('选中', item)
currentItemIndex.value = index
if (item.labelType === 'node') {
if (toolbarTypeIndex.value === 23) {
if (toolbarTypeIndex.value === 25) {
editNodePropertiesRef.value.open(item)
}
}
@ -261,15 +212,9 @@ const addEditHistory = () => {
currentIndex.value = allHistoryList.value.length
allHistoryList.value.push(JSON.parse(JSON.stringify(imgList.value)))
} else {
allHistoryList.value.push(JSON.parse(JSON.stringify(imgList.value)))
currentIndex.value++
console.log(currentIndex.value)
console.log(
allHistoryList.value[currentIndex.value][currentItemIndex.value],
allHistoryList.value[currentIndex.value][currentItemIndex.value]
)
allHistoryList.value.push(JSON.parse(JSON.stringify(imgList.value)))
}
test.value = true
console.log(allHistoryList.value, 'allHistoryList')
}
@ -296,7 +241,7 @@ const backNextStep = () => {
//
const mapClick = (e) => {
if (toolbarTypeIndex.value === 22) {
if (toolbarTypeIndex.value === 24) {
//
imgList.value.push({
x: e.offsetX,
@ -307,7 +252,6 @@ const mapClick = (e) => {
draggable: false,
resizable: false,
rotatable: false,
lockAspectRatio: false, //
img: '',
labelType: 'node'
})
@ -435,48 +379,60 @@ const state = reactive({
},
{
id: 14,
name: '测距',
name: '设备',
icon: 'ep:folder-add',
isActive: false
},
{
id: 15,
name: '图层',
name: '车辆',
icon: 'ep:folder-add',
isActive: false
},
{
id: 16,
name: '标记',
name: '测距',
icon: 'ep:folder-add',
isActive: false
},
{
id: 17,
name: '网格',
name: '图层',
icon: 'ep:folder-add',
isActive: false
},
{
id: 18,
name: '标记',
icon: 'ep:folder-add',
isActive: false
},
{
id: 19,
name: '网格',
icon: 'ep:folder-add',
isActive: false
},
{
id: 20,
name: '放大',
icon: 'ep:zoom-in',
isActive: false
},
{
id: 19,
id: 21,
name: '缩小',
icon: 'ep:zoom-out',
isActive: false
},
{
id: 20,
id: 22,
name: '撤回',
icon: 'ep:top-left',
isActive: false
},
{
id: 21,
id: 23,
name: '重做',
icon: 'ep:top-right',
isActive: false
@ -484,59 +440,48 @@ const state = reactive({
],
rightToolList: [
{
id: 22,
id: 24,
name: '绘制节点',
icon: 'ep:circle-plus-filled',
isActive: false
},
{
id: 23,
id: 25,
name: '编辑节点',
icon: 'ep:circle-plus-filled',
isActive: false
},
{
id: 24,
id: 26,
name: '绘制路线',
icon: 'ep:semi-select',
isActive: false
},
{
id: 25,
id: 27,
name: '编辑路线',
icon: 'ep:semi-select',
isActive: false
}
],
isShowToolbar: false, //
isShowGrid: false, //
isShowGrid: false,
moveForm: {
x: '',
y: ''
}, //
rotationForm: {
angle: ''
}, //
copyMapItem: '', //
cursorStyle: 'auto'
}
})
const toolbarClick = (item) => {
let type = item.id
if (currentItemIndex.value === -1 && (type === 5 || type === 6 || type === 7 || type === 9)) {
message.warning('请先选择要操作的对象')
return
}
if (type === 8 && !state.copyMapItem) {
message.warning('请先复制对象')
if (currentItemIndex.value === -1 && type === 5) {
message.warning('请先选择要操作的图标')
return
}
if ((type === 10 || type === 13 || type === 17) && toolbarTypeIndex.value === type) {
if (toolbarTypeIndex.value === type) {
toolbarTypeIndex.value = 0
} else {
toolbarTypeIndex.value = type
}
switch (type) {
case 1:
break
@ -552,43 +497,18 @@ const toolbarClick = (item) => {
case 6:
break
case 7:
//
state.copyMapItem = allHistoryList.value[currentIndex.value][currentItemIndex.value]
break
case 8:
//
let item = JSON.parse(JSON.stringify(state.copyMapItem))
item.x = item.x + 50
item.y = item.y + 50
imgList.value.push(item)
addEditHistory()
break
case 9:
//
imgList.value.splice(currentItemIndex.value, 1)
addEditHistory()
break
case 10:
//
if (toolbarTypeIndex.value === 10) {
state.isShowToolbar = true
} else {
state.isShowToolbar = false
}
break
case 11:
break
case 12:
break
case 13:
//
textFormToolDialogRef.value.open()
// if (toolbarTypeIndex.value === 13) {
// state.cursorStyle = `url('${cursorCollection.input}'),auto`
// } else {
// state.cursorStyle = `auto`
// }
break
case 14:
break
@ -597,8 +517,12 @@ const toolbarClick = (item) => {
case 16:
break
case 17:
break
case 18:
break
case 19:
//
if (toolbarTypeIndex.value === 17) {
if (toolbarTypeIndex.value === 19) {
state.isShowGrid = true
item.isActive = true
} else {
@ -606,27 +530,29 @@ const toolbarClick = (item) => {
item.isActive = false
}
break
case 18:
break
case 19:
break
case 20:
break
case 21:
break
case 22:
//
backPreviousStep()
break
case 21:
case 23:
//
backNextStep()
break
case 22:
case 24:
drawNodes()
break
case 23:
break
case 24:
break
case 25:
break
case 26:
break
case 27:
break
default:
break
}
}
@ -635,10 +561,6 @@ const moveFormSubmit = () => {
allHistoryList.value[currentIndex.value][currentItemIndex.value].x = state.moveForm.x
allHistoryList.value[currentIndex.value][currentItemIndex.value].y = state.moveForm.y
}
//
const rotationFormSubmit = () => {
allHistoryList.value[currentIndex.value][currentItemIndex.value].angle = state.rotationForm.angle
}
onMounted(() => {
imgList.value = [
@ -651,7 +573,6 @@ onMounted(() => {
draggable: true,
resizable: true,
rotatable: true,
lockAspectRatio: true, //
img: 'https://sys.znkjfw.com/imgs/process/%E8%AF%B7%E5%81%87.png',
labelType: 'icon'
},
@ -664,7 +585,6 @@ onMounted(() => {
draggable: true,
resizable: true,
rotatable: true,
lockAspectRatio: false, //
img: 'https://sys.znkjfw.com/imgs/process/%E8%AF%B7%E5%81%87.png',
labelType: 'icon'
}
@ -699,8 +619,8 @@ onMounted(() => {
background: linear-gradient(-90deg, rgba(0, 0, 0, 0.1) 1px, transparent 1px),
linear-gradient(rgba(0, 0, 0, 0.1) 1px, transparent 1px);
background-size:
10px 10px,
10px 10px;
20px 20px,
20px 20px;
}
}
}
@ -708,7 +628,6 @@ onMounted(() => {
.sdiv {
width: 100%;
height: 100%;
box-sizing: border-box;
}
.top-tool-list {
@ -730,8 +649,6 @@ onMounted(() => {
.tool-item {
cursor: pointer;
// cursor: url('https://api.znkjfw.com/admin-api/infra/file/4/get/_png_179_1738982726561.png'),
// auto;
width: 52px;
height: 70px;
display: flex;

View File

@ -1,93 +0,0 @@
<template>
<div
@mousedown="startSelection"
@mousemove="updateSelection"
@mouseup="endSelection"
style="position: relative; width: 100%; height: 900px"
>
<!-- 绘制框选区域 -->
<div
v-if="isSelecting"
:style="{
position: 'absolute',
left: `${selectionBox.x}px`,
top: `${selectionBox.y}px`,
width: `${selectionBox.width}px`,
height: `${selectionBox.height}px`,
border: '1px solid blue',
backgroundColor: 'rgba(0, 0, 255, 0.1)'
}"
></div>
<!-- 绘制点位 -->
<div
v-for="(point, index) in points"
:key="index"
:style="{
position: 'absolute',
left: `${point.x}px`,
top: `${point.y}px`,
width: '100px',
height: '100px',
backgroundColor: selectedPoints.includes(point) ? 'red' : '#fff'
}"
>设备{{ index }}</div
>
</div>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const points = ref([
{ x: 210, y: 210 },
{ x: 330, y: 500 },
{ x: 840, y: 440 },
{ x: 230, y: 400 },
{ x: 750, y: 640 }
])
const isSelecting = ref(false)
const selectionBox = ref({ x: 0, y: 0, width: 0, height: 0 })
const startPos = ref({ x: 0, y: 0 })
const selectedPoints = ref([])
const startSelection = (event) => {
isSelecting.value = true
startPos.value = { x: event.offsetX, y: event.offsetY }
selectionBox.value = { x: event.offsetX, y: event.offsetY, width: 0, height: 0 }
}
const updateSelection = (event) => {
if (isSelecting.value) {
selectionBox.value.width = event.offsetX - startPos.value.x
selectionBox.value.height = event.offsetY - startPos.value.y
}
}
const endSelection = () => {
isSelecting.value = false
selectedPoints.value = points.value.filter((point) => {
return (
point.x >= Math.min(startPos.value.x, startPos.value.x + selectionBox.value.width) &&
point.x <= Math.max(startPos.value.x, startPos.value.x + selectionBox.value.width) &&
point.y >= Math.min(startPos.value.y, startPos.value.y + selectionBox.value.height) &&
point.y <= Math.max(startPos.value.y, startPos.value.y + selectionBox.value.height)
)
})
}
return {
points,
isSelecting,
selectionBox,
selectedPoints,
startSelection,
updateSelection,
endSelection
}
}
}
</script>