This commit is contained in:
yyy 2025-02-27 18:03:13 +08:00
commit 8093e70d6e
2 changed files with 118 additions and 57 deletions

View File

@ -26,7 +26,7 @@
/> />
<el-option <el-option
:label="'手动充电'" :label="'手动充电'"
:value="2" :value="0"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>

View File

@ -22,8 +22,9 @@
<div class="indexpage-container-box-point"> <div class="indexpage-container-box-point">
<!-- 连线 --> <!-- 连线 -->
<div v-if="legendObj.driveLineShow"> <div v-if="legendObj.driveLineShow">
<div class="line-box" v-for="(item, index) in lineList" :key="index"> <div class="line-box">
<svg id="svg" :width="widthVal" :height="heightVal"> <svg id="svg" :width="widthVal" :height="heightVal">
<template v-for="(item, index) in lineList" :key="index">
<!-- 定义箭头 --> <!-- 定义箭头 -->
<defs> <defs>
<marker id="forward-arrow" viewBox="0 0 10 10" refX="10" refY="5" orient="auto"> <marker id="forward-arrow" viewBox="0 0 10 10" refX="10" refY="5" orient="auto">
@ -36,14 +37,15 @@
</defs> </defs>
<template v-if="item.method == 0"> <template v-if="item.method == 0">
<line <line
:x1="(Number(item.startPointX) + Number(item.beginWidth) / 2) * radio" :x1="Number(item.startPointX) * radio"
:y1="(Number(item.startPointY) + Number(item.beginHigh) / 2) * radio" :y1="Number(item.startPointY) * radio"
:x2="(Number(item.endPointX) + Number(item.endWidth) / 2) * radio" :x2="Number(item.endPointX) * radio"
:y2="(Number(item.endPointY) + Number(item.endHigh) / 2) * radio" :y2="Number(item.endPointY) * radio"
stroke="#00329F" :stroke="item.isSelect ? '#f48924' : '#00329F'"
:stroke-width="5 * radio" :stroke-width="5 * radio"
:marker-start="item.direction === 2 ? 'url(#double-arrow-start)' : ''" :marker-start="item.direction === 2 ? 'url(#double-arrow-start)' : ''"
marker-end="url(#single-arrow)" marker-end="url(#single-arrow)"
@click="handleChooseRoute(item, index)"
/> />
<path <path
:d="getLineMidArrowPath(item)" :d="getLineMidArrowPath(item)"
@ -59,15 +61,17 @@
<template v-else> <template v-else>
<path <path
:d="getCurvePath(item)" :d="getCurvePath(item)"
:stroke="'#00329F'" :stroke="item.isSelect ? '#f48924' : '#00329F'"
:stroke-width="5 * radio" :stroke-width="5 * radio"
fill="none" fill="none"
:marker-start="item.direction === 2 ? 'url(#backward-arrow)' : ''" :marker-start="item.direction === 2 ? 'url(#backward-arrow)' : ''"
:marker-end=" :marker-end="
item.direction === 2 ? 'url(#forward-arrow)' : 'url(#forward-arrow)' item.direction === 2 ? 'url(#forward-arrow)' : 'url(#forward-arrow)'
" "
@click="handleChooseRoute(item, index)"
/> />
</template> </template>
</template>
</svg> </svg>
</div> </div>
</div> </div>
@ -94,7 +98,16 @@
class="indexpage-container-box-point-item" class="indexpage-container-box-point-item"
v-for="(item, index) in pointList" v-for="(item, index) in pointList"
:key="index" :key="index"
:style="{ left: item.locationX * radio + 'px', top: item.locationY * radio + 'px' }" :style="{
left:
(item.locationX - item.locationWide / 2 / nowObject.showYamlJson.resolution / 100) *
radio +
'px',
top:
(item.locationY - item.locationDeep / 2 / nowObject.showYamlJson.resolution / 100) *
radio +
'px'
}"
> >
<!-- 库位点 --> <!-- 库位点 -->
<div <div
@ -225,8 +238,8 @@
class="indexpage-container-box-point-item-inner" class="indexpage-container-box-point-item-inner"
v-if="item.type == 5" v-if="item.type == 5"
:style="{ :style="{
width: 40 * radio + 'px', width: 150 * radio + 'px',
height: 40 * radio + 'px' height: 150 * radio + 'px'
}" }"
> >
<div> <div>
@ -246,8 +259,8 @@
class="indexpage-container-box-point-item-inner" class="indexpage-container-box-point-item-inner"
v-if="item.type == 6" v-if="item.type == 6"
:style="{ :style="{
width: 40 * radio + 'px', width: 150 * radio + 'px',
height: 40 * radio + 'px' height: 150 * radio + 'px'
}" }"
> >
<div> <div>
@ -335,7 +348,7 @@
class="affix-container-left-box-item-bottom" class="affix-container-left-box-item-bottom"
@click="legendObj.legendShow = !legendObj.legendShow" @click="legendObj.legendShow = !legendObj.legendShow"
> >
<div class="affix-container-left-box-item-bottom-left"> </div> <div class="affix-container-left-box-item-bottom-left"> </div>
<img <img
src="@/assets/imgs/indexPage/zhankai@2x.png" src="@/assets/imgs/indexPage/zhankai@2x.png"
alt="" alt=""
@ -404,6 +417,7 @@ import { color } from 'echarts'
import { resetDragPosition } from '@/utils/drag' import { resetDragPosition } from '@/utils/drag'
import carDialog from './carDialog.vue' import carDialog from './carDialog.vue'
import { is } from 'bpmn-js/lib/util/ModelUtil' import { is } from 'bpmn-js/lib/util/ModelUtil'
import JSONBigInt from 'json-bigint'
const imgUrl = ref('') const imgUrl = ref('')
const carDialogRef = ref(null) const carDialogRef = ref(null)
const socketClient = ref(null) const socketClient = ref(null)
@ -446,12 +460,36 @@ const changeIsDrag = () => {
} }
}) })
} }
const handleChooseRoute = (val, i) => {
// console.log('============================', val)
if (lineList.value.length) {
if (val.isSelect) {
lineList.value.forEach((item, index) => {
if (index == i) {
item.isSelect = false
} else {
item.isSelect = false
}
})
} else {
lineList.value.forEach((item, index) => {
if (index == i) {
item.isSelect = true
} else {
item.isSelect = false
}
})
}
}
}
// 线 // 线
const getCurvePath = (curve) => { const getCurvePath = (curve) => {
let startPointX = (Number(curve.startPointX) + Number(curve.beginWidth) / 2) * radio.value let startPointX = Number(curve.startPointX) * radio.value
let startPointY = (Number(curve.startPointY) + Number(curve.beginHigh) / 2) * radio.value let startPointY = Number(curve.startPointY) * radio.value
let endPointX = (Number(curve.endPointX) + Number(curve.endWidth) / 2) * radio.value let endPointX = Number(curve.endPointX) * radio.value
let endPointY = (Number(curve.endPointY) + Number(curve.endHigh) / 2) * radio.value let endPointY = Number(curve.endPointY) * radio.value
return `M ${startPointX} ${startPointY} C ${curve.beginControlX * radio.value} ${curve.beginControlY * radio.value}, ${curve.endControlX * radio.value} ${curve.endControlY * radio.value}, ${endPointX} ${endPointY}` return `M ${startPointX} ${startPointY} C ${curve.beginControlX * radio.value} ${curve.beginControlY * radio.value}, ${curve.endControlX * radio.value} ${curve.endControlY * radio.value}, ${endPointX} ${endPointY}`
} }
@ -621,7 +659,30 @@ const getPositionMapListFun = async (positionMapId) => {
// console.log(data) // console.log(data)
pointList.value = data pointList.value = data
// console.log(pointList.value) console.log('=======================', pointList.value)
pointList.value.forEach((item) => {
if (item.type === 1) {
item.locationDeep = 40
item.locationWide = 40
} else if (item.type === 5 || item.type === 6) {
item.locationDeep = 150
item.locationWide = 150
} else if (item.type === 2) {
//
item.dataList = JSONBigInt({ storeAsString: true }).parse(item.dataJson)
item.locationDeep = item.dataList[0].locationDeep
item.locationWide = item.dataList[0].locationWide
} else if (item.type === 3) {
item.dataObj = JSONBigInt({ storeAsString: true }).parse(item.dataJson)
item.locationDeep = item.dataObj.locationDeep
item.locationWide = item.dataObj.locationWide
} else if (item.type === 4) {
item.dataObj = JSONBigInt({ storeAsString: true }).parse(item.dataJson)
item.locationDeep = item.dataObj.locationDeep
item.locationWide = item.dataObj.locationWide
} else if (item.type === 7) {
}
})
// let lineStyle = calculateDistanceAndAngle( // let lineStyle = calculateDistanceAndAngle(
// { // {
// left: pointList.value[0].locationX, // left: pointList.value[0].locationX,
@ -747,7 +808,7 @@ const disconnect = () => {
} }
// //
const getMapData = async (item) => { const getMapData = async (item) => {
console.log('============', JSON.parse(item.yamlJson)) // console.log('============', JSON.parse(item.yamlJson))
nowObject.value = JSON.parse(JSON.stringify(item)) nowObject.value = JSON.parse(JSON.stringify(item))
nowObject.value.showYamlJson = JSON.parse(item.yamlJson) nowObject.value.showYamlJson = JSON.parse(item.yamlJson)
let websoketUrl = `${replaceHttpWithWs(import.meta.env.VITE_BASE_URL)}/infra/ws?type=map&floor=${nowObject.value.floor}&area=${nowObject.value.area}` let websoketUrl = `${replaceHttpWithWs(import.meta.env.VITE_BASE_URL)}/infra/ws?type=map&floor=${nowObject.value.floor}&area=${nowObject.value.area}`