在线搜索问题修改

This commit is contained in:
2025-10-20 13:56:35 +08:00
parent 30531019dd
commit 2a7eda5ee3

View File

@ -124,8 +124,8 @@ const treeMouseOver = () => {
} }
const selectChange = (val) => { const selectChange = (val) => {
let input = document.getElementById('keyword'); let input = document.getElementById('keyword')
(window as any).treeSearchCb('') ;(window as any).treeSearchCb('')
if (val == 'poi') { if (val == 'poi') {
searchKey.value = '' searchKey.value = ''
// input.value = '' // input.value = ''
@ -136,39 +136,27 @@ const selectChange = (val) => {
// input.value = '' // input.value = ''
} }
if ((window as any).searchPlaceEntity) { if ((window as any).searchPlaceEntity) {
(window as any).searchPlaceEntity.remove() ;(window as any).searchPlaceEntity.remove()
} }
} }
const clearResult = () => { const clearResult = () => {
// if (select.value == 'tree') {
// let string = searchKey.value.trim()
// if (string == '') {
// let arr = []
// if (window.searchPlaceMap) {
// arr = Array.from(window.searchPlaceMap)
// }
// if (arr.length) {
// window.searchPlaceMap.get(arr[0][0]).remove()
// window.searchPlaceMap.clear()
// }
// poiOptions.value = []
// value.value = ''
// window.treeSearchCb('')
// }
// }
let string = searchKey.value.trim() let string = searchKey.value.trim()
if (string == '') { if (string == '') {
let arr = [] let arr = []
if ((window as any).searchPlaceMap) { if ((window as any).searchPlaceMap) {
arr = Array.from((window as any).searchPlaceMap) arr = Array.from((window as any).searchPlaceMap)
} }
if (arr.length) { if (arr.length) {
(window as any).searchPlaceMap.get(arr[0][0]).remove() const target = (window as any).searchPlaceMap.get(arr[0][0])
(window as any).searchPlaceMap.clear() if (target && typeof target.remove === 'function') {
target.remove()
;(window as any).searchPlaceMap.clear()
}
} }
poiOptions.value = [] poiOptions.value = []
value.value = ''; value.value = ''
(window as any).treeSearchCb('') ;(window as any) && (window as any).treeSearchCb('')
} }
} }
const cancel = () => { const cancel = () => {
@ -177,7 +165,7 @@ const cancel = () => {
var mapModule var mapModule
var key = var key =
// @ts-ignore // @ts-ignore
(localStorage.getItem('AMapKey') && localStorage.getItem('AMapKey').split('|')[0]) || (localStorage.getItem('AMapKey') && localStorage.getItem('AMapKey').split('|')[0]) ||
'd88fcc689d1aa99866b2d0d83fd36677' 'd88fcc689d1aa99866b2d0d83fd36677'
var isOnline = false var isOnline = false
@ -210,7 +198,7 @@ const searchPlace = debounce(function () {
value.value = '' value.value = ''
let way = localStorage.getItem('searchWay') let way = localStorage.getItem('searchWay')
if (way == 'net') { if (way == 'net') {
(window as any).treeSearchCb() ;(window as any).treeSearchCb()
loading.value = true loading.value = true
const doSearch = () => { const doSearch = () => {
mapModule.plugin(['AMap.PlaceSearch', 'AMap.AutoComplete'], () => { mapModule.plugin(['AMap.PlaceSearch', 'AMap.AutoComplete'], () => {
@ -295,8 +283,8 @@ const searchPlace = debounce(function () {
} }
} else { } else {
poiOptions.value = [] poiOptions.value = []
value.value = ''; value.value = ''
(window as any).treeSearchCb(searchKey.value) ;(window as any).treeSearchCb(searchKey.value)
} }
}, 500) }, 500)
@ -575,4 +563,7 @@ defineExpose({
.el-dialog__footer { .el-dialog__footer {
padding: 10px !important; padding: 10px !important;
} }
.el-select-dropdown__wrap {
max-height: 260px !important;
}
</style> </style>