全局搜索 搜索逻辑修改
This commit is contained in:
parent
d8a08c6470
commit
330f8de5e4
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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(), //排序方式:desc,asc
|
||||
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这个参数是下面的分页传过来的参数
|
||||
|
|
Loading…
Reference in New Issue