From bcb7b3f70a143d6f20389a8f09c3784a36b7805a Mon Sep 17 00:00:00 2001 From: suixy <2277317060@qq.com> Date: Wed, 19 Nov 2025 17:48:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9A=9C=E7=A2=8D=E7=89=A9?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/api.js | 8 +- src/components/ruler.vue | 68 +++++-- src/views/index.vue | 424 +++++++++++++++++++++++++++++---------- 3 files changed, 384 insertions(+), 116 deletions(-) diff --git a/src/api/api.js b/src/api/api.js index c222056..1d8067a 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -1,6 +1,10 @@ import request from '@/utils/request'; - +const test = () => { + return new Promise((resolve, reject) => { + resolve({}) + }) +} export function getParasPos(data) { return request({ url: '/api/ParasPos/GetParasPos', method: 'get', params: data @@ -32,6 +36,7 @@ export function getShildList(data) { } export function addShildData(data) { + return test() return request({ url: '/api/Fod/AddShild', method: 'post', data: data }); @@ -165,6 +170,7 @@ export function UpdateImage(data) { } export function InserDealObstacleModel(data) { + return test() return request({ url: '/api/Fod/InserDealObstacleModel', method: 'post', data: data }); diff --git a/src/components/ruler.vue b/src/components/ruler.vue index 8bbd1f5..b6d43a9 100644 --- a/src/components/ruler.vue +++ b/src/components/ruler.vue @@ -61,11 +61,30 @@ left: `${getDotX(dot.x)}%`, bottom: `${getDotY(dot.y)}%`, transform: `translate(-50%, 50%) `, - background: dot.type == 0 ? 'radial-gradient(circle at center, #ea1212 0%, rgba(228, 116, 116, 0.2) 100%)':(dot.type == 2?'radial-gradient(circle at center, #12ea12 0%, rgba(116, 228, 116, 0.2) 100%)':'') + background: 'radial-gradient(circle at center, #ea1212 0%, rgba(228, 116, 116, 0.2) 100%)' }" style="white-space: nowrap" > - + + {{ index + 1 }} + + +
+ + {{ index + 1 }} +
@@ -84,7 +103,9 @@ const props = defineProps({ height: {type: Number, required: true,}, boxPos: {type: Object, required: true,}, dots: {type: Array, required: true,}, - dotIndex: {type: Number, required: true,} + dotIndex: {type: Number, required: true,}, + dots1: {type: Array, required: true,}, + dotIndex1: {type: Number, required: true,} }) const boxContentX = ref(0) const boxContentY = ref(0) @@ -102,6 +123,9 @@ watch(() => JSON.stringify(props.boxPos), (newVal, oldVal) => { if (props.dotIndex >= 0) { getLineData('head', `dot${props.dotIndex + 1}`) } + if (props.dotIndex1 >= 0) { + getLineData('head', `dota${props.dotIndex1 + 1}`) + } }) onMounted(() => { getBoxPos() @@ -109,9 +133,12 @@ onMounted(() => { if (props.dotIndex >= 0) { getLineData('head', `dot${props.dotIndex + 1}`) } + if (props.dotIndex1 >= 0) { + getLineData('head', `dota${props.dotIndex1 + 1}`) + } }) }) -watch(() => props.dotIndex, (newVal, oldVal) => { +watch(() => JSON.stringify([props.dotIndex, props.dotIndex1]), (newVal, oldVal) => { getBoxPos() getDistanceAndZoom() if (distance1.value) { @@ -124,16 +151,14 @@ watch(() => props.dotIndex, (newVal, oldVal) => { } if (props.dotIndex >= 0) { getLineData('head', `dot${props.dotIndex + 1}`) + } else if (props.dotIndex1 >= 0) { + getLineData('head', `dota${props.dotIndex1 + 1}`) }else{ zoomScale(props.boxPos.y, 0) } }) const getDistanceAndZoom = () => { - if (props.dotIndex === -1) { - distance1.value = 0 - } else { - console.log(props.dots ) - console.log(props.dots[props.dotIndex]) + if (props.dotIndex >= 0) { let dotx = props.dots[props.dotIndex].x let doty = props.dots[props.dotIndex].y let carx = props.boxPos.x @@ -141,6 +166,16 @@ const getDistanceAndZoom = () => { let a = dotx - carx let b = doty - cary distance1.value = Math.sqrt(a * a + b * b); + } else if (props.dotIndex1 >= 0) { + let dotx = props.dots1[props.dotIndex1].x + let doty = props.dots1[props.dotIndex1].y + let carx = props.boxPos.x + let cary = props.boxPos.y + let a = dotx - carx + let b = doty - cary + distance1.value = Math.sqrt(a * a + b * b); + } else { + distance1.value = 0 } @@ -174,8 +209,8 @@ const getLineData = (fromId, toId) => { const x1 = Math.floor(fromRect.left) + Math.floor(window.scrollX) const y1 = Math.floor(fromRect.top) + Math.floor(window.scrollY) - const x2 = Math.floor(toRect.left) + Math.floor(window.scrollX) + 5 - const y2 = Math.floor(toRect.top) + Math.floor(window.scrollY) + 5 + const x2 = Math.floor(toRect.left) + Math.floor(window.scrollX) + 10 + const y2 = Math.floor(toRect.top) + Math.floor(window.scrollY) + 10 const dx = x2 - x1; @@ -195,7 +230,12 @@ function zoomScale(value, type) { centerValue.value = value zoomType.value = type setTimeout(() => { - getLineData('head', `dot${props.dotIndex + 1}`) + if (props.dotIndex >= 0) { + getLineData('head', `dot${props.dotIndex + 1}`) + } + if (props.dotIndex1 >= 0) { + getLineData('head', `dota${props.dotIndex1 + 1}`) + } }, 10) } @@ -395,8 +435,8 @@ const ticks = computed(() => { left: 40px; .dot { - width: 10px; - height: 10px; + width: 20px; + height: 20px; position: absolute; border-radius: 50%; } diff --git a/src/views/index.vue b/src/views/index.vue index cb25bce..835a0c6 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -53,6 +53,8 @@ :boxPos="boxPos" :dots="dots" :dotIndex="dotIndex" + :dots1="dots1" + :dotIndex1="dotIndex1" /> @@ -203,14 +205,14 @@ - + @@ -239,7 +241,7 @@ :pager-count="4" :page-sizes="[10,20,50,100, 200, 300, 400]" layout="total, sizes, prev, pager, next, jumper" - :total="tableData1.length" + :total="table1Data.length" /> @@ -247,28 +249,33 @@ - - - - - - - + + + + + + + + @@ -278,7 +285,7 @@ :pager-count="4" :page-sizes="[10,20,50,100, 200, 300, 400]" layout="total, sizes, prev, pager, next, jumper" - :total="total2" + :total="table2Data.length" @change="getShildTableList" /> @@ -599,22 +606,43 @@
- + + + - - + + + + + - - - +
@@ -727,7 +755,7 @@