全局搜索 搜索逻辑修改

This commit is contained in:
a0049873 2022-10-26 10:39:32 +08:00
parent d8a08c6470
commit 330f8de5e4
2 changed files with 106 additions and 7 deletions

View File

@ -2,7 +2,7 @@
* @Author: hisense.wuhongjian
* @Date: 2022-04-01 19:19:40
* @LastEditors: Light
* @LastEditTime: 2022-10-25 09:51:56
* @LastEditTime: 2022-10-26 10:35:36
* @Description: 告诉大家这是什么
*/
import request from '@/utils/request'
@ -419,11 +419,14 @@ export function updateIntegrationServices(data) {
}
//
export function getCountByFuzzyQuery(params) {
export function getCountByFuzzyQuery(params, flag) {
return request({
url: '/resource/getCountByFuzzyQuery?keyWorld=' + params,
url:
'/resource/getCountByFuzzyQuery?keyWorld=' +
params +
'&nonChinese=' +
flag,
method: 'get',
params,
})
}
@ -513,6 +516,6 @@ export function getGisByArea(data) {
return request({
url: '/resource/getSquareList',
method: 'post',
data
data,
})
}

View File

@ -1140,7 +1140,25 @@
const globalSearch = () => {
if (searchValue.value) {
globalFlag.value = true
getCountByFuzzyQuery(searchValue.value || '').then((res) => {
let flag = true
let str = ''
let r = null
if (
searchValue.value.length >= 2 &&
paramsGetResources.type !== '基础设施'
) {
str = searchValue.value.substring(0, 2)
r = re.test(str)
}
if (
(searchValue.value.length > 1 && r) ||
paramsGetResources.type === '基础设施'
) {
flag = false
} else {
flag = true
}
getCountByFuzzyQuery(searchValue.value || '', flag).then((res) => {
console.log('全局搜索==========》', res.data.data)
globalData.data = res.data.data
let mapFlag = true
@ -1240,6 +1258,7 @@
(searchValue.value.length > 1 && r) ||
paramsGetResources.type === '基础设施'
) {
paramsGetResources.nonChinese = false
paramsGetResources.name = searchValue.value
paramsGetResources.type = Cardsname.value
if (
@ -1317,7 +1336,84 @@
paramsGetResources2.value.name = paramsGetResources.name
}
} else {
message.error('请以两位以上汉字或数字开头')
paramsGetResources.nonChinese = true
paramsGetResources.name = searchValue.value
paramsGetResources.type = Cardsname.value
if (
!whoShow1.value.itShowBaoTou &&
paramsGetResources.type === '数据资源'
) {
if (switchIndex != '分页查询') {
paramsGetResources.pageNum = 1
}
let dataResourceParams = {
serviceName: paramsGetResources.name || '', //
orderField: whoShow1.value.itShowQingDao
? paramsGetResources.orderField == 'applyCount'
? 'syqk'
: 'fbrq'
: paramsGetResources.orderField == 'applyCount'
? 'requestCount'
: 'createTime', //
orderType: paramsGetResources.orderType.toLowerCase(), //descasc
pageNum: paramsGetResources.pageNum, //
pageSize: paramsGetResources.pageSize, //
}
getDataResource(dataResourceParams).then((res) => {
loading.value = false
console.log('res.data.data----874-------->', res.data.data)
if (whoShow1.value.itShowQingDao) {
if (whoShow1.value.itShowZhanTingDev) {
// itShowZhanTingDev: 西
console.log('999----->', res.data.data.list)
getXiHaiAn(res)
} else {
getQingDao(res)
}
} else if (whoShow1.value.itShowXiHaiAn) {
getXiHaiAn(res)
}
})
} else if (
paramsGetResources.type !== '数据资源' &&
(paramsGetResources.type !== '基础设施' ||
!whoShow1.value.itShowXiHaiAn)
) {
if (switchIndex != '分页查询') {
paramsGetResources.pageNum = 1
}
pageWithAttrs(paramsGetResources).then((res) => {
if (res.data.code != 0) {
return message.error(res.data.msg)
}
console.log(
'查询列表====22========>',
resourceList,
res.data.data
)
resourceList.data = []
videoList.data = []
if (Cardsname.value === '基础设施') {
resourceList.data = res.data.data.records || []
resourceTotal.value = res.data.data.total || ''
loading.value = false
} else {
resourceTotal.value = res.data.data.total || ''
resourceList.data = res.data.data.records || []
}
})
} else if (
paramsGetResources.type === '基础设施' &&
whoShow1.value.itShowXiHaiAn
) {
if (switchIndex != '分页查询') {
paramsGetResources.pageNum = 1
}
paramsGetResources2.value.pageNum = paramsGetResources.pageNum
paramsGetResources2.value.pageSize = paramsGetResources.pageSize
paramsGetResources2.value.name = paramsGetResources.name
}
// message.error('')
}
} else {
//switchIndex