在线搜索问题修改

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