|
@@ -0,0 +1,1495 @@
|
|
|
+import { computed, reactive, ref, toRefs, onMounted,onBeforeMount, onBeforeUnmount, getCurrentInstance } from 'vue'
|
|
|
+import { without, throttle } from 'lodash'
|
|
|
+import { useStore } from '@/store'
|
|
|
+import { useRoute, useRouter } from 'vue-router/composables'
|
|
|
+import { MessageBox } from 'element-ui'
|
|
|
+import {
|
|
|
+ FilterHistoryAjaxModelRestore,
|
|
|
+ FilterHistoryAjaxModel2ViewModel,
|
|
|
+ getParam,
|
|
|
+ openLinkInWorkspace,
|
|
|
+ InContainer
|
|
|
+} from '@/utils'
|
|
|
+import $bus from '@/utils/bus'
|
|
|
+// 筛选条件动态组件方法
|
|
|
+import { getCreateSearchSchema } from '@/views/search/bidding/constant/index'
|
|
|
+// API 业务模型
|
|
|
+import useQuickSearchModel from '@jy/data-models/modules/quick-search/model'
|
|
|
+// 扩展业务模型
|
|
|
+import { useSearchFilterModel } from './modules/filter'
|
|
|
+import { useSearchInputKeywordsModel } from './modules/filter-keywords'
|
|
|
+import { useSearchListHeaderActionsModel } from './modules/list-header-actions'
|
|
|
+import { useSearchTabsModel } from './modules/tabs'
|
|
|
+// 保存、重置、查看筛选条件业务
|
|
|
+import { saveFilterActionsModel } from './modules/save-filter-actions'
|
|
|
+// 数据导出业务
|
|
|
+import { dataExportActionsModel } from './modules/data-export-actions'
|
|
|
+// 标讯收藏业务
|
|
|
+import { dataCollectActionModel } from './modules/data-collect-actions'
|
|
|
+// 企业分发业务
|
|
|
+import { dataDistributeActionsModel } from './modules/data-distribute-actions'
|
|
|
+// 参标业务
|
|
|
+import { joinBidActionsModel } from './modules/join-bid-actions'
|
|
|
+// 收录业务
|
|
|
+import { dataEmployActionsModel } from './modules/data-employ-actions'
|
|
|
+// 添加业务
|
|
|
+import { dataAddActionsModel } from './modules/data-add-actions'
|
|
|
+// 进行搜索前业务判断
|
|
|
+import { beforeSearchModel } from './modules/before-search'
|
|
|
+// 潜在客户引流--市场分析报告&&超前项目推荐数据请求
|
|
|
+import { recommendCardModel } from './modules/recommend-card'
|
|
|
+
|
|
|
+export default function () {
|
|
|
+ const that = getCurrentInstance().proxy
|
|
|
+
|
|
|
+ const router = useRouter()
|
|
|
+ // 是否是免费用户
|
|
|
+ const isFree = computed(() => {
|
|
|
+ return useStore().getters['user/isFree']
|
|
|
+ })
|
|
|
+ // 企业管理员
|
|
|
+ const isEntAdmin = computed(() => {
|
|
|
+ return useStore().getters['user/isEntAdmin']
|
|
|
+ })
|
|
|
+ // 部门管理员
|
|
|
+ const isDepartmentAdmin = computed(() => {
|
|
|
+ return useStore().getters['user/isDepartmentAdmin']
|
|
|
+ })
|
|
|
+ // 是否登录
|
|
|
+ const isLogin = computed(() => {
|
|
|
+ return useStore().getters['user/loginFlag']
|
|
|
+ })
|
|
|
+ // 用户权限
|
|
|
+ const userPowerInfo = computed(() => {
|
|
|
+ return useStore().getters['user/getInfo']
|
|
|
+ })
|
|
|
+ // 是否是vip
|
|
|
+ const isVip = computed (() => {
|
|
|
+ const { entniche, memberStatus, vipStatus } = userPowerInfo.value
|
|
|
+ return entniche || memberStatus > 0 || vipStatus > 0
|
|
|
+ })
|
|
|
+ // 是否是老用户
|
|
|
+ const isOld = computed (() => {
|
|
|
+ const { isOld } = userPowerInfo.value
|
|
|
+ return isOld
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ // 是否在工作台内
|
|
|
+ // 本地调试,可改为工作台内isInApp = ref(true), isInWeb = ref(false) 提交记得改回!
|
|
|
+ const isInApp = ref(InContainer.inApp)
|
|
|
+ const isInWeb = ref(InContainer.inWeb)
|
|
|
+
|
|
|
+ // 是否是渠道商
|
|
|
+ const cooperateCode = ref(false)
|
|
|
+ // 一切都好渠道商,是否是渠道商
|
|
|
+ const cookieInfo = document.cookie.split('; ')
|
|
|
+ cooperateCode.value = cookieInfo.some(item => item.indexOf('channelCode') > -1)
|
|
|
+ onMounted(() => {
|
|
|
+ window.addEventListener('scroll', watchScroll)
|
|
|
+ })
|
|
|
+
|
|
|
+ // 物业专版
|
|
|
+ const inBIPropertyIframe = useRoute().query.property === 'BIProperty'
|
|
|
+ // 营销BI嵌套
|
|
|
+ const inResourceBIIframe = useRoute().query.resource === 'BI'
|
|
|
+
|
|
|
+ // 是否山川应用嵌入环境 添加操作按钮 (个人年终报告嵌套)
|
|
|
+ const inInjectBI = useRoute().query.report === 'bi' || (location.href.indexOf('/jylab/bi/index') !== -1)
|
|
|
+
|
|
|
+ // 是否是BI嵌套页面
|
|
|
+ const isInBI = computed(() => {
|
|
|
+ return inResourceBIIframe || inResourceBIIframe || inInjectBI
|
|
|
+ })
|
|
|
+
|
|
|
+ // 是否是领域化页面(医械通)
|
|
|
+ const isBidField = location.href.includes('/jylab/medical/index')
|
|
|
+
|
|
|
+ // 缓存存储配置
|
|
|
+ const storageConfig = {
|
|
|
+ listTab: {
|
|
|
+ key: 'pc_search_bidding_listTabActive',
|
|
|
+ _storage: localStorage
|
|
|
+ },
|
|
|
+ // 筛选条件上次搜索筛选项缓存key
|
|
|
+ filter: {
|
|
|
+ key: 'pc_search_bidding_lastFilters',
|
|
|
+ _storage: localStorage
|
|
|
+ },
|
|
|
+ // 页面tab(筛选项的searchGroup)
|
|
|
+ searchGroup: {
|
|
|
+ key: 'pc_search_bidding_lastSearchGroup',
|
|
|
+ _storage: localStorage
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 解构基础业务
|
|
|
+ const APIModel = useQuickSearchModel({
|
|
|
+ type: 'search-bid'
|
|
|
+ })
|
|
|
+ /**
|
|
|
+ * 列表相关model
|
|
|
+ */
|
|
|
+ const {
|
|
|
+ list,
|
|
|
+ total,
|
|
|
+ loading,
|
|
|
+ finished,
|
|
|
+ selectIds,
|
|
|
+ listIds,
|
|
|
+ searchResultCount,
|
|
|
+ isSelectSomeCheckbox,
|
|
|
+ selectCheckboxCount,
|
|
|
+ isSelectListAllCheckbox,
|
|
|
+ doToggleItemSelection,
|
|
|
+ doToggleListSelection,
|
|
|
+ doClearAllSelection,
|
|
|
+ doQuery: doRunQuery
|
|
|
+ } = APIModel
|
|
|
+ /**
|
|
|
+ * 关键词搜索相关
|
|
|
+ */
|
|
|
+ const {
|
|
|
+ inputKeywordsState,
|
|
|
+ searchModelOptions,
|
|
|
+ getFormatAPIParams: getFormatOfInputKeywords,
|
|
|
+ updateInputKeywordsState,
|
|
|
+ } = useSearchInputKeywordsModel()
|
|
|
+ /**
|
|
|
+ * 筛选v-model数据
|
|
|
+ */
|
|
|
+ const {
|
|
|
+ filterState,
|
|
|
+ filterBase,
|
|
|
+ getFormatAPIParams: getFormatOfFilter,
|
|
|
+ updateFilterBase
|
|
|
+ } = useSearchFilterModel({ inBIPropertyIframe, isFree, isInApp, isBidField })
|
|
|
+ /**
|
|
|
+ * 列表头操作
|
|
|
+ */
|
|
|
+ const {
|
|
|
+ limitActions,
|
|
|
+ headerActions,
|
|
|
+ listItemStyleType,
|
|
|
+ activeItemStyleType,
|
|
|
+ activeHeaderActions,
|
|
|
+ disabledHeaderActions
|
|
|
+ } = useSearchListHeaderActionsModel()
|
|
|
+
|
|
|
+ $bus.$on('bidding:updateInputKeywords', function (obj) {
|
|
|
+ updateInputKeywordsState(obj)
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 搜索前校验
|
|
|
+ */
|
|
|
+ const { keywords: urlKeywords } = useRoute().query
|
|
|
+ const {
|
|
|
+ getWhiteList,
|
|
|
+ onTheWhiteList,
|
|
|
+ checkAndClearTextIncludesCommonWords
|
|
|
+ } = beforeSearchModel({ inputKeywordsState, urlKeywords })
|
|
|
+
|
|
|
+ onBeforeMount( async() => {
|
|
|
+ try{
|
|
|
+ await getWhiteList()
|
|
|
+ } catch (e){
|
|
|
+ console.warn('e')
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 页面tab切换Model
|
|
|
+ */
|
|
|
+ const SearchTabsModel = useSearchTabsModel({ showTabs2: !isInApp.value, inInjectBI })
|
|
|
+ const { activeTab, doChangeTab } = SearchTabsModel
|
|
|
+ // tab切换处理
|
|
|
+ function onChangeTab (item) {
|
|
|
+ filterState.value = Object.assign(filterState.value, {
|
|
|
+ subtype: []
|
|
|
+ })
|
|
|
+ if(isInApp.value) {
|
|
|
+ doChangeTab(item)
|
|
|
+ doQuery({}, 'tab')
|
|
|
+ } else {
|
|
|
+ if(item.link) {
|
|
|
+ location.replace(item.link)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 筛选条件动态配置处理
|
|
|
+ */
|
|
|
+ const {
|
|
|
+ createSearchBidBaseSchema,
|
|
|
+ createSearchBidMoreSchema
|
|
|
+ } = getCreateSearchSchema({ bi: inBIPropertyIframe })
|
|
|
+ // 处理当前信息类型--展示数据类型
|
|
|
+ const infoTypeDataType = computed(() => {
|
|
|
+ let result = 'all'
|
|
|
+ switch (activeTab.value) {
|
|
|
+ case 0:
|
|
|
+ result = 'all'
|
|
|
+ break
|
|
|
+ case 1:
|
|
|
+ result = 'base'
|
|
|
+ break
|
|
|
+ case 2:
|
|
|
+ result = 'advance'
|
|
|
+ break
|
|
|
+ }
|
|
|
+ return result
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ // 筛选条件动态配置处理
|
|
|
+ function disposeFilterSchema() {
|
|
|
+ const conf = computed(() => {
|
|
|
+ return {
|
|
|
+ isLogin: isLogin.value,
|
|
|
+ vipUser: isVip.value && isInApp.value,
|
|
|
+ oldUser: isOld.value && isInApp.value,
|
|
|
+ showVip: isLogin.value && isInApp.value,
|
|
|
+ infoType: infoTypeDataType.value,
|
|
|
+ isBidField: isBidField,
|
|
|
+ inInjectBI: inInjectBI,
|
|
|
+ isVip: isVip.value
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 标准筛选
|
|
|
+ const SearchBidBaseSchema = ref([])
|
|
|
+ const SearchBidMoreSchema = ref([])
|
|
|
+ // 更多筛选
|
|
|
+ const searchBidMoreFreeSchema = ref([])
|
|
|
+ const searchBidMoreVipSchema = ref([])
|
|
|
+
|
|
|
+ SearchBidBaseSchema.value = createSearchBidBaseSchema(conf.value)
|
|
|
+ SearchBidMoreSchema.value = createSearchBidMoreSchema(null, conf.value)
|
|
|
+
|
|
|
+ searchBidMoreFreeSchema.value = SearchBidMoreSchema.value?.filter(
|
|
|
+ (s) => !s.vipMark
|
|
|
+ )
|
|
|
+ searchBidMoreVipSchema.value = SearchBidMoreSchema.value?.filter(
|
|
|
+ (s) => s.vipMark
|
|
|
+ )
|
|
|
+
|
|
|
+
|
|
|
+ function doUpdateData(schema, type) {
|
|
|
+ const payload = schema || conf.value
|
|
|
+ if(type === 'more') {
|
|
|
+ SearchBidMoreSchema.value = createSearchBidMoreSchema(schema, conf.value)
|
|
|
+ } else {
|
|
|
+ SearchBidBaseSchema.value = createSearchBidBaseSchema(payload)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ SearchBidBaseSchema,
|
|
|
+ SearchBidMoreSchema,
|
|
|
+ searchBidMoreFreeSchema,
|
|
|
+ searchBidMoreVipSchema,
|
|
|
+ doUpdateData
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 列表状态
|
|
|
+ const listState = reactive({
|
|
|
+ finished,
|
|
|
+ loading,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 50,
|
|
|
+ total,
|
|
|
+ pageTotal: 0
|
|
|
+ })
|
|
|
+ // 当前展示的列表
|
|
|
+ const activeList = computed(() => {
|
|
|
+ let arr = []
|
|
|
+ if(list.value && list.value.length > 0) {
|
|
|
+ arr = list.value.map((v) => {
|
|
|
+ v._id = v.id
|
|
|
+ v.checked = selectIds.value.includes(v.id)
|
|
|
+ // 中标单位联系方式处理
|
|
|
+ if(!v.winnerTel && v.winnerInfo && v.winnerInfo.length > 0) {
|
|
|
+ v.winnerTel = v.winnerInfo[0].winnerTel || ''
|
|
|
+ v.winnerPerson = v.winnerInfo[0].winnerPerson || ''
|
|
|
+ }
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return arr
|
|
|
+ })
|
|
|
+ // 表格展示的数据
|
|
|
+ const tableList = ref([])
|
|
|
+
|
|
|
+ // 搜索关键词限制
|
|
|
+ const interceptKeywords = reactive({
|
|
|
+ interceptOtherWords: '',
|
|
|
+ interceptLimit: 0
|
|
|
+ })
|
|
|
+
|
|
|
+ // 根据权限处理列表头部的操作按钮展示
|
|
|
+ const limitFilterHeaderActions = computed(() => {
|
|
|
+ // 数据导出-非营销都展示
|
|
|
+ if(!inResourceBIIframe) {
|
|
|
+ limitActions.value['data-export'] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ // BI营销以及个人分析报告不展示以下操作
|
|
|
+ if(!inResourceBIIframe && !inInjectBI) {
|
|
|
+ limitActions.value['refined-list'] = true
|
|
|
+ limitActions.value['table'] = true
|
|
|
+ limitActions.value['collect-bid'] = true
|
|
|
+ // 登录后才展示详细列表
|
|
|
+ if(isLogin.value) {
|
|
|
+ limitActions.value['detailed-list'] = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 展示收录
|
|
|
+ if(canBatchEmploy.value && inResourceBIIframe) {
|
|
|
+ limitActions.value['employ-bid'] = true
|
|
|
+ }
|
|
|
+ // 展示分发
|
|
|
+ if((isEntAdmin.value || isDepartmentAdmin.value) && !inBIPropertyIframe && !inResourceBIIframe) {
|
|
|
+ limitActions.value['distribute-bid'] = true
|
|
|
+ }
|
|
|
+ return headerActions.value
|
|
|
+ })
|
|
|
+
|
|
|
+ // search-list 组件所需参数
|
|
|
+ const searchListProps = computed(() => {
|
|
|
+ return {
|
|
|
+ isSelectAllCheckbox: isSelectListAllCheckbox.value,
|
|
|
+ isSelectSomeCheckbox: isSelectSomeCheckbox.value,
|
|
|
+ selectCheckboxCount: selectCheckboxCount.value,
|
|
|
+ searchResultCount: searchResultCount.value,
|
|
|
+ headerActions: limitFilterHeaderActions.value,
|
|
|
+ list: activeList.value,
|
|
|
+ listState: listState
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 切换列表展示风格
|
|
|
+ * @param type - 可选风格 ['refined-list', 'detailed-list', 'table']
|
|
|
+ */
|
|
|
+ function doChangeItemStyleType(type) {
|
|
|
+ const styleTypes = ['refined-list', 'detailed-list', 'table']
|
|
|
+ if (!styleTypes.includes(type)) {
|
|
|
+ return console.warn('Not find style type!')
|
|
|
+ }
|
|
|
+ listItemStyleType.value = type
|
|
|
+ activeHeaderActions.value = without(
|
|
|
+ activeHeaderActions.value,
|
|
|
+ ...styleTypes
|
|
|
+ )
|
|
|
+ activeHeaderActions.value.push(type)
|
|
|
+ // 记录列表风格切换--存到缓存
|
|
|
+ if(type !== 'table') {
|
|
|
+ const { _storage, key } = storageConfig['listTab']
|
|
|
+ _storage.setItem(key, type)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 恢复以前选过的tab
|
|
|
+ */
|
|
|
+ function restoreListTabActive() {
|
|
|
+ const { _storage, key } = storageConfig['listTab']
|
|
|
+ const storage = _storage.getItem(key)
|
|
|
+ if (storage) {
|
|
|
+ if(storage === 'detailed-list' && isVip.value && isLogin.value) {
|
|
|
+ doChangeItemStyleType('detailed-list')
|
|
|
+ } else {
|
|
|
+ doChangeItemStyleType('refined-list')
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ _storage.setItem(key, 'refined-list')
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 列表顶部按钮操作事件统一入口
|
|
|
+ * @param item - 按钮原型
|
|
|
+ * @param item.key - 按钮标识
|
|
|
+ */
|
|
|
+ function doListHeaderAction(item, $event) {
|
|
|
+ const { key } = item
|
|
|
+ switch (key) {
|
|
|
+ case 'refined-list': {
|
|
|
+ doChangeItemStyleType(key)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'detailed-list': {
|
|
|
+ detailListClick(key)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'table': {
|
|
|
+ doChangeItemStyleType(key)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'data-export': {
|
|
|
+ onClickDataExport()
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'collect-bid' : {
|
|
|
+ onClickDataCollect($event)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'distribute-bid': {
|
|
|
+ onClickDataDistribute()
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'employ-bid' : {
|
|
|
+ onClickDataEmploy()
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function detailListClick (key) {
|
|
|
+ if(isFree.value) {
|
|
|
+ openListVipDialog()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ doChangeItemStyleType(key)
|
|
|
+ }
|
|
|
+ // 全选复选框事件
|
|
|
+ function doChangeAllSelect(type) {
|
|
|
+ doToggleListSelection(type)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 单个复选框事件
|
|
|
+ function doChangeSelect(item) {
|
|
|
+ doToggleItemSelection(item.id)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 分页事件
|
|
|
+ function doChangePageNum(page) {
|
|
|
+ listState.pageNum = page
|
|
|
+ doQuery({}, 'pageNumChange', page)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 分页大小事件
|
|
|
+ function doChangePageSize(size) {
|
|
|
+ listState.pageSize = size
|
|
|
+ listState.pageNum = 1
|
|
|
+ doQuery({}, 'pageNumChange', 1)
|
|
|
+ }
|
|
|
+ // 登录
|
|
|
+ $bus.$on('bidding:goLogin', goLogin)
|
|
|
+ function goLogin () {
|
|
|
+ that.$showLoginDialog()
|
|
|
+ }
|
|
|
+ // 跳转详情页
|
|
|
+ function toDetail(item) {
|
|
|
+ let aHref = ".html"
|
|
|
+ if (inputKeywordsState.value.input){
|
|
|
+ aHref+= '?kds=' + encodeURIComponent(inputKeywordsState.value.input)
|
|
|
+ }
|
|
|
+ if (getParam('resource') === 'BI') {
|
|
|
+ if(getParam('property') === 'BIProperty') {
|
|
|
+ aHref += aHref.indexOf('?') > -1 ? '&resource=BI&property=BIProperty' : '?resource=BI&property=BIProperty'
|
|
|
+ } else {
|
|
|
+ aHref += aHref.indexOf('?') > -1 ? '&resource=BI' : '?resource=BI'
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const id = item.id
|
|
|
+ try {
|
|
|
+ that.$visited.push({
|
|
|
+ type: 'articleContent',
|
|
|
+ id: id
|
|
|
+ })
|
|
|
+ item.visited = true
|
|
|
+ } catch(e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(isLogin.value) {
|
|
|
+ const prefix = isInApp.value ? '/article/content/' : '/nologin/content/'
|
|
|
+ const targetLink = `${prefix}${id}${aHref}`
|
|
|
+
|
|
|
+ // 在iframe里,往工作桌面跳转。不在iframe里,正常跳转
|
|
|
+ openLinkInWorkspace(isInApp.value, {
|
|
|
+ url: targetLink,
|
|
|
+ newTab: true,
|
|
|
+ })
|
|
|
+ } else{//没有登录跳转新的详情
|
|
|
+ // 一切都好渠道合作页,未登录跳转需要弹出登录,重置到已登录后的详情页
|
|
|
+ if(cooperateCode.value) {
|
|
|
+ window.location.href = '/notin/page'
|
|
|
+ // openLoginDig(null, "/article/content/"+thisId+aHref)
|
|
|
+ } else {
|
|
|
+ const targetLink = `/nologin/content/${id}${aHref}`
|
|
|
+ window.open(targetLink)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 列表tag跳转处理
|
|
|
+ function tagToDetail (item, label) {
|
|
|
+ if(label === 'subtype' && (item['subtype'] === '拟建' || item['subtype'] === '采购意向')) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let link = ''
|
|
|
+ if(label === 'subtype') {
|
|
|
+ link = item['subtypeUrl']
|
|
|
+ } else if(label === 'area'){
|
|
|
+ link = item['areaUrl']
|
|
|
+ }
|
|
|
+ if(link) {
|
|
|
+ window.open(link)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取 store getters
|
|
|
+ const userType = computed(() => {
|
|
|
+ return useStore().getters['user/userType']
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 变更搜索模式
|
|
|
+ * @type {boolean}
|
|
|
+ */
|
|
|
+ // P260需求精准搜索无结果时 自动切换到模糊搜索(查询) 模糊搜索也无结果时再切回精准(不查询)
|
|
|
+ // 条件:1.精准搜索模式 2.返回无数据 3.有主关键词或附加词
|
|
|
+ let autoSwitchModel = false
|
|
|
+ const { goback } = useRoute().query
|
|
|
+ function changeSearchMode () {
|
|
|
+ const total = listState.total
|
|
|
+ const { searchMode, additionalWords, input } = inputKeywordsState.value
|
|
|
+ const jzModel = searchMode === '0' && (additionalWords || input)
|
|
|
+ const mhModel = searchMode === '1' && (additionalWords || input)
|
|
|
+ if(!autoSwitchModel && jzModel && total === 0) {
|
|
|
+ autoSwitchModel = true
|
|
|
+ inputKeywordsState.value.searchMode = '1'
|
|
|
+ doQuery()
|
|
|
+ }
|
|
|
+ if(mhModel && autoSwitchModel) {
|
|
|
+ if( total > 0) {
|
|
|
+ if(!goback) {
|
|
|
+ that.$toast('精准搜索无结果,已为您自动切换到模糊搜索')
|
|
|
+ }
|
|
|
+ autoSwitchModel = false
|
|
|
+ } else {
|
|
|
+ // 模糊搜索无结果时 再切回精准
|
|
|
+ inputKeywordsState.value.searchMode = '0'
|
|
|
+ autoSwitchModel = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 格式化请求参数
|
|
|
+ * @param [params] - 可选值,部分情况会提供,默认会和该函数返回值进行合并
|
|
|
+ */
|
|
|
+
|
|
|
+ function getParams(params = {}) {
|
|
|
+ // 合并所有模型的搜索筛选项
|
|
|
+ const result = Object.assign(
|
|
|
+ {
|
|
|
+ searchGroup: activeTab.value,
|
|
|
+ reqType: 'lastNews', // cache:空搜索缓存数据;lastNews:最新数据
|
|
|
+ pageNum: listState.pageNum,
|
|
|
+ pageSize: listState.pageSize,
|
|
|
+ // 该接口与用户身份有关
|
|
|
+ _expand: {
|
|
|
+ type: userType.value
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getFormatOfInputKeywords(),
|
|
|
+ getFormatOfFilter(),
|
|
|
+ params
|
|
|
+ )
|
|
|
+ return result
|
|
|
+ }
|
|
|
+
|
|
|
+ function beforeSearchCheck (searchType) {
|
|
|
+ // 第一次搜索或者tab切换不校验白名单规则
|
|
|
+ if (searchType) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ // 如果在反爬白名单,则空搜索刷新搜索结果(即允许空搜索)
|
|
|
+ // 不在,则不允许空搜索(此处空搜索指的是主搜索框是否为空)
|
|
|
+ if (!onTheWhiteList.value) {
|
|
|
+ const searchKeywords = inputKeywordsState.value.input
|
|
|
+ const hasOneKey = (filterState.value.buyer?.length || filterState.value.winner?.length || filterState.value.agency?.length) > 0
|
|
|
+ // 切换三种筛选类型时候判断(切换tab时不弹窗)
|
|
|
+ // if (!searchKeywords && !hasOneKey) {
|
|
|
+ // if (from.indexOf('tab-') !== -1) {
|
|
|
+ // return false
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // 关键词去两边空格后为空
|
|
|
+ if (!searchKeywords && inputKeywordsState.value.additionalWords.length === 0) {
|
|
|
+ if (!hasOneKey) {
|
|
|
+ that.$toast('请先输入关键词')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 判断关键词中是否有通用词,并清空对应通用词的项
|
|
|
+ const hasCommonWords = checkAndClearTextIncludesCommonWords(searchKeywords)
|
|
|
+ if (hasCommonWords) {
|
|
|
+ that.$toast('请输入项目名称等关键词')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ // 搜索前 处理一些事情
|
|
|
+ function beforeSearch (pageNum) {
|
|
|
+ // 列表清空
|
|
|
+ list.value = []
|
|
|
+ listState.total = 0
|
|
|
+ // 列表重新获取时
|
|
|
+ if(!pageNum) {
|
|
|
+ listState.pageNum = 1
|
|
|
+ // 清空已选中数据
|
|
|
+ doClearAllSelection()
|
|
|
+ // 清空表格数据
|
|
|
+ tableList.value = []
|
|
|
+ }
|
|
|
+ // 如果列表展示状态为table,将列表展现形式换成详细列表或者精简列表
|
|
|
+ if(activeItemStyleType.value === 'T') {
|
|
|
+ restoreListTabActive()
|
|
|
+ }
|
|
|
+ // 存储筛选条件
|
|
|
+ if(isInApp.value && isLogin.value && listState.pageNum === 1 && !inBIPropertyIframe) {
|
|
|
+ saveSearchGroupToLocal()
|
|
|
+
|
|
|
+ if(inputKeywordsState.value.input) {
|
|
|
+ saveFilterToLocal()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //P271需求--潜客圈进引流需求
|
|
|
+ if(!advancedInfo.show && !getShowChart.value && inputKeywordsState.value.input) {
|
|
|
+ getCustomReportData({ keywords: inputKeywordsState.value.input })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 统一查询入口
|
|
|
+ * - 拦截 doQuery 进行一些返回值处理
|
|
|
+ * @param [params] - 可选值,默认会和 getParams(params) 返回值进行合并
|
|
|
+ */
|
|
|
+ function doQuery(params = {}, searchType, pageNum) {
|
|
|
+ const bSearch = beforeSearchCheck(searchType)
|
|
|
+ if(!bSearch) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ beforeSearch (pageNum)
|
|
|
+ // Ajax请求
|
|
|
+ return doRunQuery(getParams(params)).then((res) => {
|
|
|
+ afterQueryAjax(res)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 处理查询请求后的数据以及其他业务
|
|
|
+ function afterQueryAjax (res) {
|
|
|
+ // 变更搜索模式
|
|
|
+ changeSearchMode()
|
|
|
+
|
|
|
+ const { origin } = res
|
|
|
+
|
|
|
+ listState.pageTotal = origin?.count || 0
|
|
|
+ // 限制关键词
|
|
|
+ interceptKeywords.interceptOtherWords = origin?.interceptOtherWords
|
|
|
+ interceptKeywords.interceptLimit = origin?.interceptLimit
|
|
|
+
|
|
|
+ let matchKeys = []
|
|
|
+ if(inputKeywordsState.value.input) {
|
|
|
+ matchKeys.push(inputKeywordsState.value.input)
|
|
|
+ }
|
|
|
+ if(inputKeywordsState.value.selectMoreKey) {
|
|
|
+ if(inputKeywordsState.value.additionalWords?.length) {
|
|
|
+ matchKeys = matchKeys.concat(inputKeywordsState.value.additionalWords)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 用于搜索关键词高亮
|
|
|
+ inputKeywordsState.value.matchKeys = res.origin?.keyWords?.split(' ') || matchKeys
|
|
|
+
|
|
|
+ //表格列表数据--只取第一页的前20条展示
|
|
|
+ if(listState.pageNum === 1) {
|
|
|
+ if(listState.total > 0) {
|
|
|
+ tableList.value = list.value.slice(0, 20)
|
|
|
+ } else {
|
|
|
+ tableList.value = []
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 列表无数据,禁用数据导出按钮
|
|
|
+ if(listState.total === 0) {
|
|
|
+ disabledHeaderActions.value = ['data-export']
|
|
|
+ } else {
|
|
|
+ disabledHeaderActions.value = []
|
|
|
+ }
|
|
|
+
|
|
|
+ if(isLogin.value) {
|
|
|
+ // 获取参标的数据
|
|
|
+ getJoinBidInfo(listIds.value)
|
|
|
+ // BI 是否批量收录,获取收录数据
|
|
|
+ if(inBIPropertyIframe || inResourceBIIframe) {
|
|
|
+ getEmployData(listIds.value)
|
|
|
+ }
|
|
|
+ // 个人报告嵌套BI页面
|
|
|
+ if(inInjectBI) {
|
|
|
+ getBidAddInfos()
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ list.value = list.value.map(item => {
|
|
|
+ // 是否已读字段
|
|
|
+ const visited = that.$visited.check({
|
|
|
+ type: 'articleContent',
|
|
|
+ id: item.id
|
|
|
+ })
|
|
|
+ that.$set(item, 'visited', visited)
|
|
|
+
|
|
|
+ // 收藏字段显示
|
|
|
+ that.$set(item, 'collection', item.isCollected ? 1 : 0)
|
|
|
+
|
|
|
+ // 收录字段
|
|
|
+ that.$set(item, 'isEmploy', false)
|
|
|
+
|
|
|
+ return item
|
|
|
+ })
|
|
|
+
|
|
|
+ // 列表底部-是否展示需要切换模糊搜索的tip
|
|
|
+ checkToggleSearchMode({
|
|
|
+ pageNum: 1,
|
|
|
+ count: origin?.total || 0,
|
|
|
+ blurCount: origin?.bCount || 0,
|
|
|
+ searchMode: Number(inputKeywordsState.value.searchMode)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 是否展示筛选条件
|
|
|
+ const showFilter = ref(true)
|
|
|
+ // 展开收起筛选条件
|
|
|
+ function toggleFilter() {
|
|
|
+ showFilter.value = !showFilter.value
|
|
|
+ }
|
|
|
+
|
|
|
+ // 组合好的组件格式的筛选条件
|
|
|
+ function packageFilter () {
|
|
|
+ const originParams = Object.assign(
|
|
|
+ {
|
|
|
+ searchGroup: activeTab.value,
|
|
|
+ },
|
|
|
+ filterState.value,
|
|
|
+ inputKeywordsState.value
|
|
|
+ )
|
|
|
+
|
|
|
+ return originParams
|
|
|
+ }
|
|
|
+
|
|
|
+// P271需求,潜客圈进,展示超前项目or分析报告引流
|
|
|
+ const recommendCardCircleModel = recommendCardModel({ that })
|
|
|
+ const {
|
|
|
+ getShowChart,
|
|
|
+ advancedInfo,
|
|
|
+ getCustomReportData,
|
|
|
+ } = recommendCardCircleModel
|
|
|
+
|
|
|
+ /******开通超级订阅弹窗start**********/
|
|
|
+
|
|
|
+ // 开通超级订阅弹窗配置
|
|
|
+ const vipDialogConfig = reactive({
|
|
|
+ type: 'filter',
|
|
|
+ show: false,
|
|
|
+ text: '立享更多搜索权限,寻找商机更精准'
|
|
|
+ })
|
|
|
+
|
|
|
+ // 筛选条件打开超级订阅弹窗
|
|
|
+ function openFilterVipDialog () {
|
|
|
+ vipDialogConfig.type = 'filter'
|
|
|
+ vipDialogConfig.show = true
|
|
|
+ vipDialogConfig.text = '立享更多搜索权限,寻找商机更精准'
|
|
|
+ }
|
|
|
+ // 关闭超级订阅弹窗
|
|
|
+ function closeVipDialog () {
|
|
|
+ vipDialogConfig.show = false
|
|
|
+ }
|
|
|
+ // 数据列表--开通超级订阅弹窗
|
|
|
+ function openListVipDialog () {
|
|
|
+ vipDialogConfig.type = 'list'
|
|
|
+ vipDialogConfig.show = true
|
|
|
+ vipDialogConfig.text = '立享列表展示更多公告关键信息,例如:采购单位、中标单位、招标代理机构等,提高公告查看效率'
|
|
|
+ }
|
|
|
+
|
|
|
+ const vipDialogConf = toRefs(vipDialogConfig)
|
|
|
+
|
|
|
+ // 筛选条件无权限提示开通超级订阅弹窗
|
|
|
+ $bus.$on('search:filter:no-power', openFilterVipDialog)
|
|
|
+
|
|
|
+ /******开通超级订阅弹窗end**********/
|
|
|
+
|
|
|
+ /** 保存、重置筛选条件部分 start ****/
|
|
|
+
|
|
|
+ const disposeFilterActionModel = saveFilterActionsModel()
|
|
|
+ const {
|
|
|
+ historyFilterDialogVisible, //已存筛选条件弹窗
|
|
|
+ getFilterHistoryList, // 已存筛选条件列表
|
|
|
+ checkFilterPass, // 检测是否可以保存筛选条件
|
|
|
+ } = disposeFilterActionModel
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存筛选条件
|
|
|
+ */
|
|
|
+ async function onSaveFilter() {
|
|
|
+ const originParams = packageFilter()
|
|
|
+ const config = { filter: originParams }
|
|
|
+ await checkFilterPass(config)
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 恢复筛选条件
|
|
|
+ * @param item
|
|
|
+ */
|
|
|
+ function onSelectedFilter (item) {
|
|
|
+ const { isPay } = item
|
|
|
+ // 恢复选中状态
|
|
|
+ if (isFree?.value && isPay) {
|
|
|
+ MessageBox.confirm('已存筛选条件包含仅限会员用户可用的筛选条件,如需使用请开通超级订阅', '',{
|
|
|
+ confirmButtonText: '开通超级订阅',
|
|
|
+ cancelButtonText: '使用免费条件',
|
|
|
+ center: true,
|
|
|
+ showClose: false,
|
|
|
+ customClass: 'filter-delete-messagebox',
|
|
|
+ confirmButtonClass: 'btn-group confirm-btn',
|
|
|
+ cancelButtonClass: 'btn-group cancel-btn',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ router.push({
|
|
|
+ path: '/common/order/create/svip'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ // 之前是付费用户,现在变成普通用户了,需要重置一些vip选项!!!!
|
|
|
+ const params = Object.assign(item,{
|
|
|
+ bidField: isBidField ? 'medical' : '',
|
|
|
+ publishTime: 'thisyear',
|
|
|
+ selectType: ['title'],
|
|
|
+ subtype: item.subtype,
|
|
|
+ regionMap: {},
|
|
|
+ industry: item.industry,
|
|
|
+ fileExists: item.fileExists,
|
|
|
+ price: item.price,
|
|
|
+ buyerclass: {},
|
|
|
+ buyertel: '',
|
|
|
+ winnertel: '',
|
|
|
+ notkey: '',
|
|
|
+ buyer: '',
|
|
|
+ winner: '',
|
|
|
+ agency: ''
|
|
|
+ })
|
|
|
+ restoreFilter(params, 'saveBack')
|
|
|
+ historyFilterDialogVisible.value = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ restoreFilter(item, 'saveBack')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function restoreFilter (viewFilter, type) {
|
|
|
+ let resultFilter = {}
|
|
|
+ if(type === 'saveBack') {
|
|
|
+ resultFilter = FilterHistoryAjaxModelRestore.formatAll(viewFilter)
|
|
|
+ } else {
|
|
|
+ resultFilter = viewFilter
|
|
|
+ }
|
|
|
+ doChangeTab({ key: resultFilter.searchGroup })
|
|
|
+ filterState.value = {
|
|
|
+ bidField: isBidField ? 'medical' : '',
|
|
|
+ publishTime: resultFilter.publishTime,
|
|
|
+ selectType: resultFilter.selectType,
|
|
|
+ subtype: resultFilter.subtype,
|
|
|
+ regionMap: resultFilter.regionMap,
|
|
|
+ industry: resultFilter.industry,
|
|
|
+ fileExists: resultFilter.fileExists,
|
|
|
+ price: resultFilter.price,
|
|
|
+ buyerclass: resultFilter.buyerclass,
|
|
|
+ buyertel: resultFilter.buyertel,
|
|
|
+ winnertel: resultFilter.winnertel,
|
|
|
+ notkey: resultFilter.notkey,
|
|
|
+ buyer: resultFilter.buyer,
|
|
|
+ winner: resultFilter.winner,
|
|
|
+ agency: resultFilter.agency
|
|
|
+ }
|
|
|
+ inputKeywordsState.value = {
|
|
|
+ input: resultFilter.input,
|
|
|
+ // 关键词筛选模式
|
|
|
+ searchMode: resultFilter.searchMode,
|
|
|
+ matchKeys: resultFilter.matchKeys,
|
|
|
+ // 附加关键词筛选模式
|
|
|
+ wordsMode: resultFilter.wordsMode,
|
|
|
+ // 附件关键词组
|
|
|
+ additionalWords: resultFilter.additionalWords,
|
|
|
+ selectMoreKey: resultFilter.additionalWords?.length > 0
|
|
|
+ }
|
|
|
+ if(type === 'saveBack') {
|
|
|
+ historyFilterDialogVisible.value = false
|
|
|
+ }
|
|
|
+ doQuery({}, 'not-filter')
|
|
|
+ }
|
|
|
+
|
|
|
+ // 重置筛选条件
|
|
|
+ function onResetFilter () {
|
|
|
+ updateFilterBase()
|
|
|
+ doQuery({}, 'not-filter')
|
|
|
+ }
|
|
|
+ /**保存、重置、查看筛选条件end******/
|
|
|
+
|
|
|
+ /*** 筛选条件头部、列表头部滚动start *****/
|
|
|
+
|
|
|
+ // 页面滚动方法 用于悬浮吸顶,将【筛选条件】置顶
|
|
|
+ const fixedTop = ref(false)
|
|
|
+ // 表格顶部操作方法滚动吸顶
|
|
|
+ const tableFixedTop = ref(false)
|
|
|
+
|
|
|
+ function watchScroll () {
|
|
|
+ const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
|
|
|
+ const watchFilter = document.querySelector('.searchTender').offsetTop - 25// 25为margin-top值
|
|
|
+ const watchTable = document.querySelector('.search-bidding-list-container').offsetTop - 15 // 15为margin-top值
|
|
|
+ if (scrollTop >= watchFilter) {
|
|
|
+ fixedTop.value = true
|
|
|
+ tableFixedTop.value = false
|
|
|
+ } else {
|
|
|
+ fixedTop.value = false
|
|
|
+ }
|
|
|
+ if (scrollTop >= watchTable) {
|
|
|
+ tableFixedTop.value = true
|
|
|
+ fixedTop.value = false
|
|
|
+ } else {
|
|
|
+ tableFixedTop.value = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /*** 筛选条件头部、列表头部滚动end *****/
|
|
|
+
|
|
|
+ /*******数据导出 start **********/
|
|
|
+ const {
|
|
|
+ dataExport,
|
|
|
+ setExport,
|
|
|
+ exportDialogChange,
|
|
|
+ showDataExportDialog,
|
|
|
+ toPayDataExport
|
|
|
+ } = dataExportActionsModel ()
|
|
|
+
|
|
|
+ // 数据导出操作
|
|
|
+ function onClickDataExport (table) {
|
|
|
+ if(!isLogin.value) {
|
|
|
+ goLogin()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ const originParams = packageFilter()
|
|
|
+ const params = {
|
|
|
+ listState: listState,
|
|
|
+ selectCheckboxCount: selectCheckboxCount.value,
|
|
|
+ selectIds: selectIds.value,
|
|
|
+ filter: originParams
|
|
|
+ }
|
|
|
+ if(table) {
|
|
|
+ toPayDataExport(params)
|
|
|
+ } else {
|
|
|
+ dataExport(params)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /*******数据导出 end ***********/
|
|
|
+
|
|
|
+
|
|
|
+ /********* 标讯收藏部分start ********/
|
|
|
+ const {
|
|
|
+ onCollect
|
|
|
+ } = dataCollectActionModel({ that })
|
|
|
+
|
|
|
+ // 批量标讯收藏
|
|
|
+ function onClickDataCollect (e) {
|
|
|
+ const config = {
|
|
|
+ total: listState.total,
|
|
|
+ isSelectSomeCheckbox: isSelectSomeCheckbox.value,
|
|
|
+ event: e,
|
|
|
+ selectIds: selectIds.value,
|
|
|
+ }
|
|
|
+ onCollect(config, 'batch')
|
|
|
+ }
|
|
|
+
|
|
|
+ // 单个标讯收藏
|
|
|
+ function onClickSingleCollect (data) {
|
|
|
+ const config = {
|
|
|
+ item: data.item,
|
|
|
+ total: listState.total,
|
|
|
+ event: data.event
|
|
|
+ }
|
|
|
+ onCollect(config, 'single')
|
|
|
+ }
|
|
|
+
|
|
|
+ // 挂载搜索事件,供模块js回调
|
|
|
+ /**
|
|
|
+ * params: {
|
|
|
+ * type: C存储, R取消
|
|
|
+ * ids: 要操作的id数组
|
|
|
+ * }
|
|
|
+ */
|
|
|
+ $bus.$on('bidding:updateListCollectStatus', function (obj) {
|
|
|
+ const { type, ids } = obj
|
|
|
+ list.value = list.value.map(temp => {
|
|
|
+ if (type === 'R' && ids.includes(temp.id)) {
|
|
|
+ that.$set(temp, 'collection', 0)
|
|
|
+ } else if(type === 'C' && ids.includes(temp.id)){
|
|
|
+ that.$set(temp, 'collection', 1)
|
|
|
+ }
|
|
|
+ return temp
|
|
|
+ })
|
|
|
+ })
|
|
|
+ /********* 标讯收藏部分end ********/
|
|
|
+
|
|
|
+ /********* 分发部分start ********/
|
|
|
+ const {
|
|
|
+ usePowerRef,
|
|
|
+ openDistribute,
|
|
|
+ doSubmitDistribute
|
|
|
+ } = dataDistributeActionsModel()
|
|
|
+
|
|
|
+ function onClickDataDistribute () {
|
|
|
+ openDistribute(selectIds.value)
|
|
|
+ }
|
|
|
+ /*********分发部分end ********/
|
|
|
+
|
|
|
+ /********参标start *********/
|
|
|
+ // 参标只有莱茵有权限
|
|
|
+ const {
|
|
|
+ BidrenewalDialogRef,
|
|
|
+ getJoinBidInfo,
|
|
|
+ onJoinBid
|
|
|
+ } = joinBidActionsModel ()
|
|
|
+
|
|
|
+ // 窗口切换刷新参标数据
|
|
|
+ document.addEventListener('visibilitychange', function () {
|
|
|
+ if (document.visibilityState === 'visible') {
|
|
|
+ that.$visited.refreshVisited()
|
|
|
+ if(isLogin.value) {
|
|
|
+ getJoinBidInfo(listIds.value)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 变更列表数据的参标状态
|
|
|
+ $bus.$on('bidding:updateListJoinStatus', function (obj) {
|
|
|
+ const {item, joinData } = obj
|
|
|
+ if(joinData) {
|
|
|
+ for (const temp of joinData) {
|
|
|
+ list.value = list.value.map(v => {
|
|
|
+ if (temp.id === v.id) {
|
|
|
+ that.$set(v, 'joinBid', Boolean(temp.value))
|
|
|
+ }
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list.value = list.value.map((temp) => {
|
|
|
+ if (temp.id === item?.id) {
|
|
|
+ that.$set(temp, 'joinBid', true)
|
|
|
+ }
|
|
|
+ return temp
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ /*******参标end ***********/
|
|
|
+
|
|
|
+ /*******收录start *********/
|
|
|
+ const {
|
|
|
+ showPropertyDialog,
|
|
|
+ propertyIframeSrc,
|
|
|
+ canBatchEmploy,
|
|
|
+ getEmployData,
|
|
|
+ onSingleEmploy,
|
|
|
+ onBatchEmploy
|
|
|
+ } = dataEmployActionsModel({ inBIPropertyIframe })
|
|
|
+
|
|
|
+ // 变更列表收录状态
|
|
|
+ $bus.$on('bidding:updateDateEmployStatus', function (obj) {
|
|
|
+ const { type, employIds } = obj
|
|
|
+ list.value = list.value.map(function (item) {
|
|
|
+ // 添加收录
|
|
|
+ if(type === 'add' && employIds.includes(item.id)) {
|
|
|
+ item.isEmploy = true
|
|
|
+ }
|
|
|
+ // 取消收录
|
|
|
+ if(type === 'cancel' && employIds.includes(item.id)) {
|
|
|
+ item.isEmploy = false
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ // 批量收录
|
|
|
+ function onClickDataEmploy() {
|
|
|
+ onBatchEmploy(selectIds.value)
|
|
|
+ }
|
|
|
+ /*******收录end ***********/
|
|
|
+
|
|
|
+ /*****BI添加操作start*********/
|
|
|
+ const {
|
|
|
+ getBidAddInfos,
|
|
|
+ doAddInfoOfBI
|
|
|
+ } = dataAddActionsModel()
|
|
|
+
|
|
|
+ $bus.$on('bidding:updateDataAddStatus', function(params) {
|
|
|
+ const { type, ids } = params
|
|
|
+ list.value = list.value.map(function (item) {
|
|
|
+ // 添加收录
|
|
|
+ if(type === 'add' && ids.includes(item.id)) {
|
|
|
+ item.isAdd = true
|
|
|
+ }
|
|
|
+ // 取消收录
|
|
|
+ if(type === 'cancel' && ids.includes(item.id)) {
|
|
|
+ item.isAdd = false
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ // 批量添加
|
|
|
+ function onAddInfoOfBI () {
|
|
|
+ doAddInfoOfBI({ ids: selectIds.value })
|
|
|
+ }
|
|
|
+ // 单个添加
|
|
|
+ function onSingleAddInfo (item) {
|
|
|
+ doAddInfoOfBI({ item })
|
|
|
+ }
|
|
|
+ /*****BI添加操作end*********/
|
|
|
+
|
|
|
+ // 处理数据列表为空时,需要展示的提示文案包含时间
|
|
|
+ const timeSelectorText = computed(() => {
|
|
|
+ const publishTime = filterState.value.publishTime
|
|
|
+ const split = inBIPropertyIframe ? '-' : '_'
|
|
|
+ const { publishTimeText } = FilterHistoryAjaxModel2ViewModel.formatTime(publishTime, split)
|
|
|
+ let result = ''
|
|
|
+ if(publishTimeText) {
|
|
|
+ if(publishTimeText.includes('最')) {
|
|
|
+ result = publishTimeText.replace('最', '')
|
|
|
+ } else if(publishTimeText.includes('以后')){
|
|
|
+ result = publishTimeText.replace('以后', '')
|
|
|
+ }else if(publishTimeText.includes('以前')) {
|
|
|
+ result = publishTimeText.replace('以前', '')
|
|
|
+ } else {
|
|
|
+ result = publishTimeText
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result = inBIPropertyIframe ? '近5年' : '近一年'
|
|
|
+ }
|
|
|
+
|
|
|
+ return result
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ /*********页面留资相关************/
|
|
|
+ // 打开留资弹窗
|
|
|
+ const collectElementRef = ref(null)
|
|
|
+ // 免费用户点免费体验留资
|
|
|
+ function onFreeTaste () {
|
|
|
+ if( collectElementRef.value) {
|
|
|
+ collectElementRef.value.isNeedSubmit('jylab_see500_plus', () => {
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /*******工作台跳转start***********/
|
|
|
+ function guideGoWorkSpace () {
|
|
|
+ if (!isLogin.value) {
|
|
|
+ goLogin()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ goWorkSpace()
|
|
|
+ }
|
|
|
+ // 跳转到工作台
|
|
|
+ function goWorkSpace () {
|
|
|
+ const { key, _storage } = storageConfig.filter
|
|
|
+ const goHref_ = location.origin + '/jylab/supsearch/index.html'
|
|
|
+ // 组件筛选条件
|
|
|
+ const originParams = packageFilter()
|
|
|
+ _storage.setItem(key, JSON.stringify(originParams))
|
|
|
+
|
|
|
+ // window.location.replace('/swordfish/page_big_pc/search/bidding?goback=true')
|
|
|
+ window.location.replace(`/page_workDesktop/work-bench/page?link=${encodeURIComponent(goHref_ + '?goback=true')}`)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 监听路由事件
|
|
|
+ function backRouteParams () {
|
|
|
+ const { searchGroup, subtype } = useRoute().query
|
|
|
+ if(searchGroup) {
|
|
|
+ // 进入页面,默认回显tab
|
|
|
+ const key = Number(searchGroup)
|
|
|
+ doChangeTab({ key})
|
|
|
+ } else if(subtype && subtype ==='采购意向' && inBIPropertyIframe) {
|
|
|
+ // 物业专版,采购意向回显
|
|
|
+ filterState.value.subtype = {采购意向: ['采购意向']}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*******工作台跳转end***********/
|
|
|
+
|
|
|
+ /***页面缓存回显相关*******/
|
|
|
+ /**
|
|
|
+ * searchGroup筛选项缓存
|
|
|
+ */
|
|
|
+ function saveSearchGroupToLocal() {
|
|
|
+ const { key, _storage } = storageConfig.searchGroup
|
|
|
+ const params = {
|
|
|
+ searchGroup: activeTab.value
|
|
|
+ }
|
|
|
+ _storage.setItem(key, JSON.stringify(params))
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 从缓存恢复searchGroup筛选项
|
|
|
+ */
|
|
|
+ function restoreSearchGroupFromLocal() {
|
|
|
+ const { key, _storage } = storageConfig.searchGroup
|
|
|
+ const params =_storage.getItem(key)
|
|
|
+ const jParams = JSON.parse(params)
|
|
|
+ if (jParams) {
|
|
|
+ doChangeTab({ key: jParams.searchGroup })
|
|
|
+ filterState.value.searchGroup = jParams.searchGroup
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 从缓存中恢复搜索范围
|
|
|
+ */
|
|
|
+ function restoreSelectTypeFromLocal () {
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 恢复和保存筛选条件到本地业务说明:
|
|
|
+ * 工作台内 1、所有用户都存 2、只有付费用户回显上次筛选
|
|
|
+ * 工作台外:所有用户不存不会回显
|
|
|
+ *
|
|
|
+ * 补充业务:
|
|
|
+ * 付费用户回显筛选条件逻辑:
|
|
|
+ * 本地缓存有,则恢复本地缓存
|
|
|
+ * 本地缓存无,则恢复保存的筛选条件第一条
|
|
|
+ * 本地缓存无,已存筛选条件无,不处理回显
|
|
|
+ *
|
|
|
+ * 搜索范围缓存单独处理
|
|
|
+ * 工作台内外:本地有缓存有则回显,无则默认选中标题
|
|
|
+ */
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存筛选条件到本地
|
|
|
+ * @param replace
|
|
|
+ */
|
|
|
+ function saveFilterToLocal(replace = {}) {
|
|
|
+ const { key, _storage } = storageConfig.filter
|
|
|
+ const originParams = packageFilter()
|
|
|
+ let params = originParams
|
|
|
+ if (replace && Object.keys(replace).length) {
|
|
|
+ params = Object.assign(params, replace)
|
|
|
+ }
|
|
|
+ _storage.setItem(key, JSON.stringify(params))
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 从本地缓存恢复筛选条件
|
|
|
+ *
|
|
|
+ */
|
|
|
+ function restoreFilterFromLocal () {
|
|
|
+ const { key, _storage } = storageConfig.filter
|
|
|
+ const params =_storage.getItem(key)
|
|
|
+ if (params) {
|
|
|
+ restoreFilter(JSON.parse(params), 'localBack')
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 恢复筛选条件
|
|
|
+ // 恢复优先级、外边跳转进工作台的最高、其次是本地缓存、最后是已存筛选条件第一条
|
|
|
+ function getLastFilter () {
|
|
|
+ const { goback, searchGroup, subtype } = useRoute().query
|
|
|
+ if(isLogin.value) {
|
|
|
+ const { key, _storage } = storageConfig.filter
|
|
|
+ const params =_storage.getItem(key)
|
|
|
+ const jParams = params ? JSON.parse(params) : null
|
|
|
+ // 工作台内
|
|
|
+ if(isInApp.value) {
|
|
|
+ // 免费用户恢复tab,搜索范围默认标题和正文
|
|
|
+ if(isFree.value) {
|
|
|
+ restoreSearchGroupFromLocal()
|
|
|
+ const defaultSelectType = ['title', 'content']
|
|
|
+ filterState.value.selectType = defaultSelectType
|
|
|
+ }
|
|
|
+
|
|
|
+ // vip 或者 桌面跳转回显筛选条件
|
|
|
+ if(goback || (isVip.value && jParams)) {
|
|
|
+ restoreFilterFromLocal()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取已存筛选条件的列表
|
|
|
+ getFilterHistoryList(null,function (arr) {
|
|
|
+ if(isVip.value) {
|
|
|
+ // 付费用户,优先恢复本地缓存,本地无缓存,则恢复已存筛选第一条数据
|
|
|
+ if(!jParams && Array.isArray(arr) && arr.length > 0){
|
|
|
+ restoreFilter(arr[0], 'saveBack')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 检查是否需要切换模糊搜索、是否展示提示
|
|
|
+ * 1. 精准搜索无数据 (自动切换模糊搜索)
|
|
|
+ * 2. 精准搜索有数据,< 50,提示手动切换搜索模式
|
|
|
+ */
|
|
|
+
|
|
|
+ const toggleSearchBlurData = reactive( {
|
|
|
+ show: false,
|
|
|
+ count: ''
|
|
|
+ })
|
|
|
+ function checkToggleSearchMode(params) {
|
|
|
+ const searchMode = params.searchMode
|
|
|
+ const pageNum = params.pageNum
|
|
|
+ const count = params.count || 0
|
|
|
+ const blurCount = params.blurCount || 0
|
|
|
+
|
|
|
+ if (pageNum === 1) {
|
|
|
+ // 重置变量
|
|
|
+ toggleSearchBlurData.show = false
|
|
|
+ toggleSearchBlurData.count = ''
|
|
|
+
|
|
|
+ if (searchMode === 0) {
|
|
|
+ const canShowToggleBlurModeTip = count >= 1 && count < 50 && blurCount > count
|
|
|
+
|
|
|
+ if (canShowToggleBlurModeTip) {
|
|
|
+ toggleSearchBlurData.show = true
|
|
|
+ toggleSearchBlurData.count = blurCount
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 切换到模糊搜索
|
|
|
+ function doToggleSearchBlurMode() {
|
|
|
+ inputKeywordsState.value.searchMode = '1'
|
|
|
+ setTimeout(function() {
|
|
|
+ scrollToTop(572)
|
|
|
+ }, 50)
|
|
|
+ doQuery()
|
|
|
+ }
|
|
|
+ // 滚动到某个位置
|
|
|
+ function scrollToTop(scrollTop) {
|
|
|
+ document.scrollingElement.scrollTop = scrollTop || 0
|
|
|
+ }
|
|
|
+ // 切换模糊搜索
|
|
|
+ const toggleBlurModeTip = computed( () => {
|
|
|
+ const isBlurMode = Number(inputKeywordsState.value.searchMode) === 1
|
|
|
+ let canShow = isBlurMode ? false : toggleSearchBlurData.show
|
|
|
+ if(listState.loading) {
|
|
|
+ canShow = false
|
|
|
+ }
|
|
|
+ const result = {
|
|
|
+ show: canShow,
|
|
|
+ count: toggleSearchBlurData.count
|
|
|
+ }
|
|
|
+ return result
|
|
|
+ })
|
|
|
+ /**********切换模糊搜索end*********/
|
|
|
+
|
|
|
+ // 页面初始化
|
|
|
+ function initPage () {
|
|
|
+ const { searchGroup } = useRoute().query
|
|
|
+ // 路由所带参数回显
|
|
|
+ backRouteParams()
|
|
|
+ // 恢复以前选过的tab
|
|
|
+ if(!searchGroup) {
|
|
|
+ restoreListTabActive()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ initPage()
|
|
|
+
|
|
|
+ // // 恢复上次筛选条件
|
|
|
+ onMounted(() => {
|
|
|
+ if(!inBIPropertyIframe) {
|
|
|
+ getLastFilter()
|
|
|
+ }
|
|
|
+ // P271潜客圈进--客户引流请求
|
|
|
+ if(inputKeywordsState.value.input) {
|
|
|
+ getCustomReportData({ keywords: inputKeywordsState.value.input})
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ return {
|
|
|
+ isLogin,
|
|
|
+ isInApp,
|
|
|
+ isInWeb,
|
|
|
+ inResourceBIIframe,
|
|
|
+ inBIPropertyIframe,
|
|
|
+ inInjectBI,
|
|
|
+ isInBI,
|
|
|
+ isFree,
|
|
|
+ isVip,
|
|
|
+ isBidField,
|
|
|
+ goLogin,
|
|
|
+ guideGoWorkSpace,
|
|
|
+ cooperateCode,
|
|
|
+ list,
|
|
|
+ tableList,
|
|
|
+ searchModelOptions,
|
|
|
+ searchListProps,
|
|
|
+ SearchTabsModel,
|
|
|
+ inputKeywordsState,
|
|
|
+ filterState,
|
|
|
+ updateFilterBase,
|
|
|
+ listState,
|
|
|
+ interceptKeywords,
|
|
|
+ activeItemStyleType,
|
|
|
+ disposeFilterSchema,
|
|
|
+ doQuery,
|
|
|
+ doListHeaderAction,
|
|
|
+ doChangeAllSelect,
|
|
|
+ doChangeSelect,
|
|
|
+ doChangePageNum,
|
|
|
+ doChangePageSize,
|
|
|
+ onChangeTab,
|
|
|
+ activeTab,
|
|
|
+ vipDialogConf,
|
|
|
+ closeVipDialog,
|
|
|
+ onSaveFilter, // 以下存筛选条件相关
|
|
|
+ disposeFilterActionModel,
|
|
|
+ historyFilterDialogVisible,
|
|
|
+ onSelectedFilter,
|
|
|
+ onResetFilter,
|
|
|
+ toggleFilter,
|
|
|
+ showFilter,
|
|
|
+ fixedTop,
|
|
|
+ tableFixedTop,
|
|
|
+ toDetail,
|
|
|
+ tagToDetail,
|
|
|
+ onClickDataExport, // 以下为导出相关
|
|
|
+ setExport,
|
|
|
+ exportDialogChange,
|
|
|
+ showDataExportDialog,
|
|
|
+ onClickSingleCollect, // 收藏
|
|
|
+ usePowerRef, // 以下分发相关
|
|
|
+ doSubmitDistribute,
|
|
|
+ onJoinBid,//以下 参标
|
|
|
+ BidrenewalDialogRef,
|
|
|
+ showPropertyDialog,// 以下收录
|
|
|
+ propertyIframeSrc,
|
|
|
+ onSingleEmploy,
|
|
|
+ onAddInfoOfBI,
|
|
|
+ onSingleAddInfo,
|
|
|
+ goWorkSpace,
|
|
|
+ timeSelectorText,
|
|
|
+ collectElementRef,
|
|
|
+ onFreeTaste,
|
|
|
+ getLastFilter,
|
|
|
+ toggleBlurModeTip,
|
|
|
+ doToggleSearchBlurMode,
|
|
|
+ recommendCardCircleModel,
|
|
|
+ getWhiteList
|
|
|
+ }
|
|
|
+}
|