搜索无数据不请求

This commit is contained in:
2023-08-10 17:00:54 +08:00
parent 2e90d54610
commit 8926f3d3b6
4 changed files with 39 additions and 15 deletions

View File

@@ -226,7 +226,7 @@ let selectPage = (type) => {
})
tabType.value = type
seachAllType['tabType'] = type
seachAllType['searchid'] = setPageKey()
seachAllType['searchid'] = setPageKey().searchid
//根据类型初始化筛选参数
if (type === 'person') {
seachAllType['intermediary'] = 0
@@ -250,8 +250,9 @@ let selectPage = (type) => {
if (tabType.value != 'need') {
setSeachVal()
}
if ((seachVal.value && !setPageKey())) return
getDataList(seachAllType)
if ((seachVal.value && !setPageKey().searchid)) return
let seachObj=setSeachId()
getDataList(seachAllType,seachObj.count==0?false:true)
}
let getDataList = props.getDataList
@@ -286,7 +287,8 @@ let checkPageType = () => {
} else {
seachAllType['intermediary'] = ''
}
getDataList(seachAllType)
let seachObj=setSeachId()
getDataList(seachAllType,seachObj.count==0?false:true)
}
@@ -298,6 +300,9 @@ let seachKey = reactive({
studentapartment: {}
}
})
let seachInfoData=shallowReactive({
data:{}
})
//搜索数据
let seachAllType = reactive({
@@ -315,7 +320,7 @@ if (isNeedHousing.value) {
//切换选项重置输入框内容
let setSeachVal = () => {
seachAllType['searchid'] = setPageKey()
seachAllType['searchid'] = setPageKey().searchid
seachVal.value = seachKey.key.keyword
}
@@ -371,12 +376,17 @@ let setSeachConditions = (type, data) => {
seachAllType['isverified'] = 0
seachAllType['isintermediary'] = 0
}
getDataList(seachAllType)
let seachObj=setSeachId()
getDataList(seachAllType,seachObj.count==0?false:true)
}
//设置当前搜索key
let setPageKey = () => {
return tabType.value === 'person' ? seachKey.key.personal.searchid : tabType.value === 'intermediary' ? seachKey.key.intermediary.searchid : tabType.value === 'apartment' ? seachKey.key.studentapartment.searchid : ''
return tabType.value === 'person' ? seachKey.key.personal : tabType.value === 'intermediary' ? seachKey.key.intermediary : tabType.value === 'apartment' ? seachKey.key.studentapartment : ''
}
let setSeachId=()=>{
return tabType.value === 'person' ? seachInfoData.data.personal : tabType.value === 'intermediary' ? seachInfoData.data.intermediary : tabType.value === 'apartment' ? seachInfoData.data.studentapartment : ''
}
//搜索初始化
@@ -384,8 +394,10 @@ let searchInit = (data) => {
api.search({ keyword: data }).then(res => {
if (res.code === 200) {
seachKey.key = res.data
seachAllType.searchid = setPageKey()
getDataList(seachAllType)
seachInfoData.data=JSON.parse(JSON.stringify(res.data))
let seachObj=setSeachId()
seachAllType.searchid = seachObj.searchid
getDataList(seachAllType,seachObj.count==0?false:true)
} else {
ElMessage({
message: res.message,
@@ -403,7 +415,8 @@ let seachList = (item) => {
}
if (seachAllType['intermediary'] === 6) {
seachAllType['keyword'] = seachVal.value
getDataList(seachAllType)
let seachObj=setSeachId()
getDataList(seachAllType,seachObj.count==0?false:true)
} else {
searchInit(seachVal.value)
}

View File

@@ -416,6 +416,7 @@ let setSelectData = (id, data = [], title) => {
setLocation('location', [selectTabCheck.id + ''])
if (id === '') {
selectData.data = []
loactionArr.data=null
setSeachCondition('location', [])
}
}
@@ -455,7 +456,7 @@ let selectSeach = (data = []) => {
}
schoolSelectObj.id = ''
schoolSelectObj.title = ''
console.log(loactionArr.data,data)
if(loactionArr.data&&(loactionArr.data.toString()===data.toString()))return
loactionArr.data=JSON.parse(JSON.stringify(data))