diff --git a/front/src/api/home.js b/front/src/api/home.js index fdf6774b..5f8e986a 100644 --- a/front/src/api/home.js +++ b/front/src/api/home.js @@ -2,7 +2,7 @@ * @Author: hisense.wuhongjian * @Date: 2022-04-01 19:19:40 * @LastEditors: hisense.liangjunhua - * @LastEditTime: 2022-08-09 10:37:31 + * @LastEditTime: 2022-08-13 14:54:04 * @Description: 告诉大家这是什么 */ import request from '@/utils/request' @@ -353,6 +353,14 @@ export function getIntegrationServicesList(params) { params, }) } +// 全局搜索 +export function getCountByFuzzyQuery(params) { + return request({ + url: '/resource/getCountByFuzzyQuery?keyWorld=' + params, + method: 'get', + params, + }) +} // 融合服务--详情 export function getIntegrationDetail(id) { diff --git a/front/src/views/home/DetailsPageconetent.vue b/front/src/views/home/DetailsPageconetent.vue index 9b7ec2b5..47244ec0 100644 --- a/front/src/views/home/DetailsPageconetent.vue +++ b/front/src/views/home/DetailsPageconetent.vue @@ -9,6 +9,37 @@
+
+
+ 模糊搜索 + + + + +
+
+
- {{ item.name }} -
-
-
-
- 模糊搜索 - - - -
+ + {{ + item.name + + '(' + + (globalData.data.filter((val) => val.type === item.name)[0] + .count || '0') + + ')' + }} + + + {{ item.name }} +
@@ -160,46 +178,7 @@
-
-
- - {{ item.name }} -
-
-
- -
-
-
-
-
- - {{ item.name }} -
-
-
+
模糊搜索 + +
+
+
+
+
+ + + {{ + item.name + + '(' + + (globalData.data.filter((val) => val.type === item.name)[0] + .count || '0') + + ')' + }} + + + {{ item.name }} + +
+
+
+ +
+
+
+
+
+ 模糊搜索 + + + +
+
+
+
+
+ + + {{ + item.name + + '(' + + (globalData.data.filter((val) => val.type === item.name)[0] + .count || '0') + + ')' + }} + + + {{ item.name }} +
- +
@@ -721,6 +796,7 @@ pageWithAttrs, getDataResource, getIntegrationServicesList, + getCountByFuzzyQuery, } from '@/api/home.js' import { getSgcList } from '@/api/personalCenter' import { useRouter } from 'vue-router' @@ -866,10 +942,14 @@ } // 重置数据 - const chongzhi = () => { + const chongzhi = (flag) => { loading.value = true // 重置模糊查字段 - searchValue.value = '' + if (!flag) { + searchValue.value = '' + globalFlag.value = false + globalData.data = [] + } paramsGetResources.name = searchValue.value // 重置筛选条件 ListContent.records.forEach((val) => { @@ -1009,9 +1089,45 @@ const resourceList = reactive({ data: [] }) const videoList = reactive({ data: [] }) const resourceTotal = ref('') + // 全局搜索 + const camera = ref(null) + const globalData = reactive({ data: [] }) + const globalFlag = ref(false) + const globalSearch = () => { + if (searchValue.value) { + globalFlag.value = true + getCountByFuzzyQuery(searchValue.value || '').then((res) => { + console.log('全局搜索==========》', res.data.data) + globalData.data = res.data.data + if (paramsGetResources.type == '基础设施') { + console.log('camera1', camera.value) + camera.value.getCamera(true, searchValue.value) + } else { + getAppResources() + } + }) + } else { + message.warning('全局搜索必须输入关键词!') + } + } // 校验 const re = /^[0-9\u4E00-\u9FA5]*$/ + const getAppResources2 = () => { + globalFlag.value = false + if ( + whoShow1.value.itShowQingDao && + paramsGetResources.type == '基础设施' + ) { + console.log('camera2', camera) + camera.value.getCamera(true, searchValue.value) + } else { + getAppResources() + } + } const getAppResources = (switchIndex) => { + if (!globalFlag.value) { + globalData.data = [] + } if (searchValue.value) { let str = '' let r = null @@ -1308,7 +1424,11 @@ getNewList() if (!tecHnosphere && !appLiCation) { - getAppResources() + if (searchValue.value) { + globalSearch() + } else { + getAppResources2() + } } }) // 全部申请 @@ -1369,7 +1489,7 @@ ) // router.currentRoute.value.query.select tagFlag.value = false - chongzhi() + chongzhi(true) getNewList() }) } @@ -1428,6 +1548,7 @@ Cardsname, getNewList, getAppResources, + getAppResources2, chongzhi, onSearch, onShowSizeChange, @@ -1460,6 +1581,9 @@ abilitySquareFunction, abilitySquareFunctionData, showAbilitySquareNum, + globalData, + globalSearch, + camera, } }, components: { @@ -1761,13 +1885,13 @@ .top-title { display: flex; - justify-content: space-between; + justify-content: space-around; align-items: center; font-size: 0.2rem; font-family: 'Alibaba PuHuiTi'; color: #000000; line-height: 0.34rem; - + margin-bottom: 0.2rem; .photo { display: inline-block; height: 0.44rem; @@ -1776,7 +1900,7 @@ } div { - margin: 0 0.2rem; + // margin: 0 0.2rem; padding: 0 0.1rem; cursor: pointer; display: flex; diff --git a/front/src/views/home/infrastructurePage.vue b/front/src/views/home/infrastructurePage.vue index 909bbf12..a2d7392e 100644 --- a/front/src/views/home/infrastructurePage.vue +++ b/front/src/views/home/infrastructurePage.vue @@ -408,7 +408,7 @@
-
+
{ if (jcssType.value) { @@ -1369,7 +1382,11 @@ // console.log('添加至购物车') // } const wrjFlag = ref(false) - const getCamera = () => { + const getCamera = (flag, str) => { + if (flag) { + mapSearchParam.value.cameraName = str + console.log('赋值===============》', str, mapSearchParam.value) + } console.log('初始化调用') console.log('不选左侧树的时候不调用接口', mapSearchParam.value) if (!whoShow1.value.itShowXiHaiAn) { @@ -1419,6 +1436,9 @@ }) } } + defineExpose({ + getCamera, + }) //加入申购车 const addShoppingCart = () => { if (selectedList.value.length > 0) { diff --git a/front/src/views/newHome/components/Navigation.vue b/front/src/views/newHome/components/Navigation.vue index 4892fd73..07fa850a 100644 --- a/front/src/views/newHome/components/Navigation.vue +++ b/front/src/views/newHome/components/Navigation.vue @@ -2,14 +2,14 @@