|
@@ -5,10 +5,10 @@ import {
|
|
|
ajaxGetPower,
|
|
|
ajaxGetUserInfo, ajaxSetClickMessages,
|
|
|
ajaxSetMenuType, ajaxSetReadMessages,
|
|
|
- ajaxSetSignOut
|
|
|
+ ajaxSetSignOut, ajaxNavbarConvergeSearch
|
|
|
} from '../../api/modules'
|
|
|
import { storeModules } from '@jy/work-bench-frame'
|
|
|
-import { clearStorage } from '@/utils'
|
|
|
+import { clearStorage, replaceKeyword } from '@/utils'
|
|
|
|
|
|
/**
|
|
|
* 搜索页面
|
|
@@ -69,8 +69,52 @@ export default {
|
|
|
state: () => ({
|
|
|
custom: {
|
|
|
'nav-user-info': true
|
|
|
+ },
|
|
|
+ // 聚合搜索信息
|
|
|
+ searchInfo: {
|
|
|
+ ent: {
|
|
|
+ title: '企业列表',
|
|
|
+ list: [],
|
|
|
+ count: 0,
|
|
|
+ isLink: true,
|
|
|
+ url: '/jylab/entSearch/index.html?searchvalue=',
|
|
|
+ appType: 'iframe',
|
|
|
+ showEmpty: true
|
|
|
+ },
|
|
|
+ menu: {
|
|
|
+ title: '功能列表',
|
|
|
+ list: [],
|
|
|
+ isLink: false,
|
|
|
+ showEmpty: true
|
|
|
+ },
|
|
|
+ buyer: {
|
|
|
+ title: '采购单位列表',
|
|
|
+ list: [],
|
|
|
+ count: 0,
|
|
|
+ isLink: true,
|
|
|
+ url: '/jylab/purSearch/index.html?searchvalue=',
|
|
|
+ appType: 'iframe',
|
|
|
+ showEmpty: true
|
|
|
+ },
|
|
|
+ bidding: {
|
|
|
+ title: '查看的标讯搜索结果',
|
|
|
+ list: [],
|
|
|
+ isLink: true,
|
|
|
+ url: '/jylab/supsearch/index.html?keywords=',
|
|
|
+ appType: 'iframe',
|
|
|
+ showEmpty: false
|
|
|
+ }
|
|
|
}
|
|
|
}),
|
|
|
+ mutations: {
|
|
|
+ changeSearchInfo (state, data = {}) {
|
|
|
+ const { ent, buyer, menu, bidding } = data
|
|
|
+ Object.assign(state.searchInfo.ent, ent)
|
|
|
+ Object.assign(state.searchInfo.buyer, buyer)
|
|
|
+ Object.assign(state.searchInfo.menu, menu)
|
|
|
+ Object.assign(state.searchInfo.bidding, bidding)
|
|
|
+ }
|
|
|
+ },
|
|
|
actions: {
|
|
|
/**
|
|
|
* 获取菜单数据源
|
|
@@ -266,12 +310,84 @@ export default {
|
|
|
}
|
|
|
commit('user/changeCustomerInfo', target || {})
|
|
|
}
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 导航栏聚合查询
|
|
|
+ * @param {*} param0
|
|
|
+ * @param {*} payload
|
|
|
+ */
|
|
|
+ async navbarConvergeSearch ({ commit }, payload) {
|
|
|
+ try {
|
|
|
+ const { searchCode } = payload
|
|
|
+ const bidding = {
|
|
|
+ title: `查看<span class="highlight-text">“${searchCode}”</span>的标讯搜索结果`
|
|
|
+ }
|
|
|
+ const { error_code: code, data = {} } = await ajaxNavbarConvergeSearch(payload)
|
|
|
+ if (code === 0) {
|
|
|
+ const { entList, procureList, menuList } = data
|
|
|
+ const ent = {}
|
|
|
+ const buyer = {}
|
|
|
+ const menu = {}
|
|
|
+ if (Object.keys(entList)?.length) {
|
|
|
+ ent.list = entList?.data.map(v => {
|
|
|
+ return {
|
|
|
+ ...v,
|
|
|
+ value: replaceKeyword(v.title, searchCode),
|
|
|
+ appType: 'outer',
|
|
|
+ openType: '_blank',
|
|
|
+ usable: true,
|
|
|
+ url: `/swordfish/page_big_pc/free/loading/ent/${v.url}`
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ent.count = entList?.count
|
|
|
+ } else {
|
|
|
+ ent.list = []
|
|
|
+ ent.count = 0
|
|
|
+ }
|
|
|
+ if (Object.keys(procureList)?.length) {
|
|
|
+ buyer.list = procureList?.data.map(v => {
|
|
|
+ return {
|
|
|
+ ...v,
|
|
|
+ value: replaceKeyword(v.title, searchCode),
|
|
|
+ appType: 'outer',
|
|
|
+ openType: '_blank',
|
|
|
+ usable: true,
|
|
|
+ url: `/swordfish/page_big_pc/free/loading/buyer/${v.title}`
|
|
|
+ }
|
|
|
+ })
|
|
|
+ buyer.count = procureList?.count
|
|
|
+ } else {
|
|
|
+ buyer.list = []
|
|
|
+ buyer.count = 0
|
|
|
+ }
|
|
|
+ if (Array.isArray(menuList)) {
|
|
|
+ menu.list = menuList.map(v => {
|
|
|
+ return {
|
|
|
+ ...v,
|
|
|
+ title: v.name.replace(/<br\s*\/?>/g, ''),
|
|
|
+ value: replaceKeyword(v.name.replace(/<br\s*\/?>/g, ''), searchCode),
|
|
|
+ label: v.path.replace(/<br\s*\/?>/g, ''),
|
|
|
+ url: v.url
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ menu.list = []
|
|
|
+ }
|
|
|
+ commit('changeSearchInfo', { ent, buyer, menu, bidding })
|
|
|
+ }
|
|
|
+ // 标讯搜索纯展示,不依赖请求
|
|
|
+ commit('changeSearchInfo', { bidding })
|
|
|
+ } catch (error) {
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
modules: storeModules,
|
|
|
getters: {
|
|
|
useCustomStatus (state) {
|
|
|
return state.custom
|
|
|
+ },
|
|
|
+ navBarSearchInfo (state) {
|
|
|
+ return state.searchInfo
|
|
|
}
|
|
|
}
|
|
|
}
|