From 9cec9dacb174bbe00a7caad3b4ea974514f9e4ee Mon Sep 17 00:00:00 2001 From: yyy <2605810609@qq.com> Date: Tue, 15 Apr 2025 17:29:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=9C=B0=E5=9B=BE=20?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E8=8A=82=E7=82=B9=20=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E5=88=B0=E4=B8=AD=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.local | 4 +- src/assets/search.png | Bin 0 -> 3770 bytes src/views/mapPage/realTimeMap/editMap.vue | 752 ++++++++++++---------- 3 files changed, 405 insertions(+), 351 deletions(-) create mode 100644 src/assets/search.png diff --git a/.env.local b/.env.local index 78a5d223..2d26cfc9 100644 --- a/.env.local +++ b/.env.local @@ -4,9 +4,9 @@ NODE_ENV=development VITE_DEV=true # 请求路径 -VITE_BASE_URL='http://192.168.0.74:48080' +# VITE_BASE_URL='http://192.168.0.74:48080' # VITE_BASE_URL='http://192.168.0.153:48080' -# VITE_BASE_URL='http://192.168.0.45:48080' +VITE_BASE_URL='http://192.168.0.45:48080' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务 VITE_UPLOAD_TYPE=server diff --git a/src/assets/search.png b/src/assets/search.png new file mode 100644 index 0000000000000000000000000000000000000000..5e4e134537e1d3649869b5b397aa6ce4b146302b GIT binary patch literal 3770 zcma)9`8(9z|9;Py7!qSDTb7wIGciqB${xndU*Xvy8T<5y(`^B`fFgYY7Ed&6-Au5Gz z!;5|Y4Jbcvu6N*+@B%2*#)JrPhGjkhfJhjXY-k(lx?UV~bw&fmI57Rw?`lF?&VGX> z{13Xp(&hs?e6LV?;qICqssTi5Yr-*mXcChLTt~vPr+X$g^k+rs*%ucD;B?5a=`%wO z7Jv?R1p||Vbti59-4tl-Ct`( z(b;x}VVim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&7|I}k5@v4BC%IbAtVfW>pOiDY+$2VYxlMk$;}t}xvsF6W zw=?+LFE>ReKC}-gAH6Blz7hKTwvGeVDiT4nlpW-B^1Ms+DV!|)9Ua|gW-&$H$5iY| zn!P(?VAH|q;|uvecXcCV__t=4)x6MYfi8CEND1qd6#N@KP1-xMx0rS|=BmM&FWsv9 zo860BGF&O`o6mpVk%ZbvJ+Y;vfY4c*t&lP3aQg`7^L)%ubLizksooLWlEp8x?EX+D z>&St=+nS3yUno0x@fo8{!5n_-ZMylZ=X**= ze=YSEmJLElj&*6WYQ678(QWFUi%{C9A~SlWG{J(7YGq?D&8WuwtcHjrb^px6UF?I@ zk!)lUCU<9bK0d|Ho`*J^91h^hl{N@do9X8D%5SU>StPiP-Vv>^xt?m4)hHwgXurk% zZKfbDrTWdNqk1dG|AymDBMQ(bb#N%MNg+F5E+zY=EAhCWc8CDtU~@fGa?F*+)H)dj z2O7y0$2ni0{c_Vh_fGy$$Z(9526}hXQxjYLvHhRei(g@8FD@P6(QGR~6Sua0VfP@M z{j)M6$IC7itgHu)kCYl*W50R;8W3wA1)~A7`R-~Y6VgNi6LS5;CX!7Fr+J|5&gu;| zq>0D_{b3VKGlBvSbY7Q4kipXk5CS>f-AqM41E}8<-2NtlDDWIlmX)9ip=-NY0zlh_ zKGx5NppYKFar!`}`J7}jDo&E3^^|;sZq>xlpkfF&D}!eI{-kdp*p(^{&2R)E9(La; zfE~7oWQDo>eD>ACJCbF3YiO-eg4kvAd|M5Sus>O~6ea5B7_%MYJ9{O7C-27!K2(Wr zift*+t(JCwYTIyJ`W+3>rc70?g$M$$5HU|+fY)v1HYc^FngR6WR7pOETmWdO(;IYg z2J7 zyvhU9-Lo%v#2%wG5S~}rVO(zI)F}{vIz
-
-
- - - - - - - - - - -
- 确认 +
+
+ + + + + + - - - - - - - - -
- 取消 + + + +
+ 确认 +
+ + + + + + +
+ 确认 +
+
+ + + + + + + + + + + + + + + + + + + - - -
- -
{{ item.name }}
-
- -
+ + + + + + + + + + + + + + + + + + + +
+ 取消 + 确认 +
+
+
+
+ +
{{ item.name }}
+
+ +
+
- 确定确定 +
+
+
+ + + +
+
+
{{ item.name }}
@@ -350,7 +382,7 @@
@@ -840,6 +872,7 @@ const equipmentToolDialogRef = ref() //设备弹窗 const textFormToolDialogRef = ref() //文字输入弹窗 const editMapRouteDialogRef = ref() //编辑地图路线的弹窗 const mapBackgroundRef = ref() +const mapContainerRef = ref() const inputBoxRef = ref() //文字输入框 const message = useMessage() // 消息弹窗 @@ -1522,7 +1555,10 @@ const state = reactive({ }, routeWidthForm: { routeWidth: 3 - } + }, + isSearchSelectVisible: false, //是否显示选择框 + searchSelectedOption: '', + haveSortNumMapPointInfo: [] }) //网格的样式 const gradientBackground = computed(() => { @@ -2490,36 +2526,6 @@ const mapPointsToLine = (points, startPointId, endPointId) => { locationY: newY } }) - - // const dx = startPoint.locationX - endPoint.locationX - // const dy = startPoint.locationY - endPoint.locationY - - // // 处理垂直直线的情况 - // if (dx === 0) { - // return points.map((point) => { - // if (point === endPoint || point === startPoint) { - // return point - // } - // return { - // ...point, - // locationX: endPoint.locationX - // } - // }) - // } - - // const slope = dy / dx - // const intercept = endPoint.locationY - slope * endPoint.locationX - - // return points.map((point) => { - // if (point === endPoint || point === startPoint) { - // return point - // } - // const newY = slope * point.locationX + intercept - // return { - // ...point, - // locationY: newY - // } - // }) } //计算是不是在同一条直线的 @@ -3088,6 +3094,11 @@ const getAllNodeList = async () => { state.allMapPointInfo.push(item) }) + + //包含sortNumber的 + state.haveSortNumMapPointInfo = state.allMapPointInfo.filter((item) => { + return item.sortNum + }) } //获取所有的路线 const getAllMapRoute = async () => { @@ -3384,6 +3395,37 @@ const computedCurveTextY = (item) => { 4 ) } +//搜索 +const toggleSelect = () => { + state.isSearchSelectVisible = !state.isSearchSelectVisible + state.searchSelectedOption = '' +} +const searchSelectChange = (sortNum) => { + const currentIndex = state.allMapPointInfo.findIndex((item) => item.sortNum === sortNum) + const currentItem = state.allMapPointInfo.find((item) => item.sortNum === sortNum) + + // 计算并限制边界 滚动到指定位置 + const rect = mapContainerRef.value + const maxScrollLeft = rect.scrollWidth - rect.clientWidth + const maxScrollTop = rect.scrollHeight - rect.clientHeight + const scrollToX = Math.max( + 0, + Math.min(currentItem.locationX - rect.clientWidth / 2, maxScrollLeft) + ) + const scrollToY = Math.max( + 0, + Math.min(currentItem.locationY - rect.clientHeight / 2, maxScrollTop) + ) + + rect.scrollTo({ + left: scrollToX, + top: scrollToY, + behavior: 'smooth' + }) + + state.currentItemIndex = currentIndex +} + document.onmousedown = function (e) { //右击 if (e.button == 2) { @@ -3498,15 +3540,12 @@ onUnmounted(() => { position: relative; width: 100%; overflow: auto; - // height: 85vh; height: calc(100vh - 120px); .map-bg { background-size: contain; background-repeat: no-repeat; position: absolute; - // top: 1.125rem; - // left: 1.125rem; top: 0; left: 0; @@ -3519,48 +3558,56 @@ onUnmounted(() => { } .top-tool { - margin-bottom: 0.125rem; - .top-tool-list { + margin-bottom: 2px; + + .top-tool-list-container { display: flex; align-items: center; - text-align: center; + justify-content: space-between; background-color: #fff; - padding: 0 0.75rem; - height: 60px; box-shadow: rgba(0, 0, 0, 0.06) 0rem 0.125rem 0.1875rem; + height: 60px; + padding: 0 0.75rem; - .top-tool-item { + .top-tool-list { display: flex; align-items: center; + text-align: center; + position: relative; - .tool-item { - cursor: pointer; - width: 44px; - height: 60px; + .top-tool-item { display: flex; - flex-direction: column; align-items: center; - justify-content: center; - .name { + .tool-item { cursor: pointer; - font-family: - PingFangSC, - PingFang SC; - font-weight: 400; - font-size: 13px; - color: #0d162a; - line-height: 1.25rem; - text-align: center; - font-style: normal; - margin-top: 0.25rem; + width: 44px; + height: 60px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + + .name { + cursor: pointer; + font-family: + PingFangSC, + PingFang SC; + font-weight: 400; + font-size: 13px; + color: #0d162a; + line-height: 1.25rem; + text-align: center; + font-style: normal; + margin-top: 0.25rem; + } + } + .line { + margin: 0 4px; + width: 0.0625rem; + height: 2.9375rem; + border: 0.0625rem solid #cccccc; } - } - .line { - margin: 0 4px; - width: 0.0625rem; - height: 2.9375rem; - border: 0.0625rem solid #cccccc; } } } @@ -3673,4 +3720,11 @@ onUnmounted(() => { font-size: 0.875rem; user-select: none; } + +.search-select { + .search-icon { + widows: 20px; + height: 20px; + } +}