瀏覽代碼

feat:新增中国移动融创动态添加筛选条件相关

zhangsiya 1 年之前
父節點
當前提交
be0a0f0bac

+ 8 - 0
apps/bigmember_pc/src/api/modules/search.js

@@ -34,3 +34,11 @@ export function deleteBiddingFilter(data) {
     data
   })
 }
+
+// 获取中国移动融创
+export function getCMCustomInfo () {
+  return request({
+    url: '/jylab/supsearch/searchPower',
+    method: 'post'
+  })
+}

+ 1 - 0
apps/bigmember_pc/src/components/filter-items/KeywordTagsSelector.vue

@@ -4,6 +4,7 @@
     :type='type'
     :trigger="trigger"
     :placeholder="placeholder"
+    placement="bottom"
   >
     <KeywordTagsSelectorContent
       slot="empty"

+ 25 - 0
apps/bigmember_pc/src/views/search/bidding/components/search-bid-filter.vue

@@ -2,6 +2,7 @@
 import { computed, watch } from 'vue'
 import { SearchBidModel } from '../model/index'
 import { getPropertyFilters } from '@/api/modules/bi'
+import { getCMCustomInfo } from '@/api/modules/'
 import SearchSchemaFilter from '@/views/search/components/search-schema-filter.vue'
 import SelectorWithBasePower from '@/components/filter-items/SelectorWithBasePower.vue'
 import $bus from '@/utils/bus'
@@ -15,6 +16,7 @@ const {
   activeTab,
   guideGoWorkSpace,
   filterState,
+  updateFilterBase,
   doQuery,
   showFilter,
   goLogin,
@@ -57,6 +59,29 @@ if(inBIPropertyIframe) {
   getBiPropertyFilters()
 }
 
+// 中国移动定制搜索条件-融创
+async function getCustomInfo () {
+  const { error_code:code, data = [] } = await getCMCustomInfo()
+  if(code === 0) {
+    if (data) {
+      const expandSearchParams = {}
+      data.forEach(item => {
+        if(item.key && item.defaultVal) {
+          const par = {
+            key: item.key,
+            value: item.defaultVal
+          }
+          expandSearchParams[item.key] = item.defaultVal
+          updateFilterBase(par)
+        }
+      })
+      doUpdateData(data, 'more')
+      doQuery(expandSearchParams)
+    }
+  }
+}
+getCustomInfo()
+
 const customMoreSchema = computed(() => {
   return {
     vipModuleShow: true,

+ 42 - 4
apps/bigmember_pc/src/views/search/bidding/constant/search-filters.js

@@ -9,8 +9,10 @@ import IndustrySelector from '@/components/filter-items/IndustrySelector.vue'
 import KeywordTagsSelector from '@/components/filter-items/KeywordTagsSelector'
 import RegionSelector from '@/components/filter-items/RegionSelector'
 import SelectorWithBasePower from '@/components/filter-items/SelectorWithBasePower.vue'
+import OnecascadeContent from '@/components/filter-items/OnecascadeContent.vue'
 import { calcSearchScope } from '@/assets/js/selector/scope.js'
 import $bus from '@/utils/bus'
+import { findIndex } from 'lodash'
 
 function noPower() {
   $bus.$emit('search:filter:no-power')
@@ -54,8 +56,6 @@ const moreFiltersNeedVipKeyList = [
   'buyer',
   'winner',
   'agency',
-  'buyer',
-  'buyer',
 ]
 
 
@@ -170,8 +170,8 @@ function createSearchBidBaseSchema(conf = {}) {
   return SearchBidBaseSchema
 }
 
-function createSearchBidMoreSchema() {
-  const SearchBidMoreSchema = [
+function createSearchBidMoreSchema(filterItems) {
+  let SearchBidMoreSchema = [
     {
       key: 'regionMap',
       label: '地区',
@@ -324,6 +324,44 @@ function createSearchBidMoreSchema() {
     }
   ]
 
+  // 移动端融创,动态添加筛选条件(支持多个筛选条件插入)
+  if(Array.isArray(filterItems)) {
+    const resultFilter = []
+    filterItems.forEach(fTemp => {
+      const { key, defaultVal, label, options, type } = fTemp
+      let obj  = {}
+      if(type === 'multiple') {
+       const formatOptions = options.map(o => {
+         return {
+           ...o,
+           label: o.label,
+           value: o.key,
+         }
+       })
+        obj = {
+          key: key,
+          label: label,
+          defaultVal: defaultVal,
+          _name: 'type',
+          _type: 'component',
+          expand: {
+          component: OnecascadeContent,
+            props: {
+            options: formatOptions,
+              placeholder: label
+            },
+            hooks: {}
+          }
+        }
+      }
+      resultFilter.push(obj)
+    })
+    const index = findIndex(SearchBidMoreSchema, function (o) {
+      return o.label === '采购单位类型'
+    })
+    SearchBidMoreSchema.splice(index, 0, ...resultFilter)
+  }
+
   SearchBidMoreSchema.forEach((schema) => {
     const key = schema.key
     if (moreFiltersNeedVipKeyList.includes(key)) {

+ 10 - 32
apps/bigmember_pc/src/views/search/bidding/model/base.js

@@ -68,6 +68,7 @@ export default function () {
 
 
   // 是否在工作台内
+  // 本地调试,可改为工作台内isInApp = ref(true),  isInWeb = ref(false) 提交记得改回!
   const isInApp = ref(InContainer.inApp)
   const isInWeb = ref(InContainer.inWeb)
 
@@ -130,6 +131,7 @@ export default function () {
   const {
     filterState,
     getFormatAPIParams: getFormatOfFilter,
+    updateFilterBase
   } = useSearchFilterModel({ inBIPropertyIframe })
   const {
     limitActions,
@@ -211,9 +213,13 @@ export default function () {
     )
 
 
-    function doUpdateData(schema) {
+    function doUpdateData(schema, type) {
       const payload = schema || conf.value
-      SearchBidBaseSchema.value = createSearchBidBaseSchema(payload)
+      if(type === 'more') {
+        SearchBidMoreSchema.value = createSearchBidMoreSchema(payload)
+      } else {
+        SearchBidBaseSchema.value = createSearchBidBaseSchema(payload)
+      }
     }
 
     return {
@@ -736,36 +742,7 @@ export default function () {
 
   // 重置筛选条件
   function onResetFilter () {
-    filterState.value = {
-      // 发布时间
-      publishTime: 'thisyear',
-      // 搜索范围
-      selectType: ['content', 'title'],
-      // 信息类型
-      subtype: [],
-      // 地区
-      regionMap: {},
-      // 行业
-      industry: null,
-      // 附件
-      fileExists: '',
-      // 金额区间
-      price: null,
-      // 采购单位类型
-      buyerclass: {},
-      // 采购单位联系方式
-      buyertel: '',
-      // 中标企业联系方式
-      winnertel: '',
-      // 排除词
-      notkey: [],
-      // 采购单位
-      buyer: [],
-      // 中标企业
-      winner: [],
-      // 招标代理机构
-      agency: []
-    }
+    updateFilterBase()
     doQuery()
   }
  /**保存、重置、查看筛选条件end******/
@@ -1000,6 +977,7 @@ export default function () {
     SearchTabsModel,
     inputKeywordsState,
     filterState,
+    updateFilterBase,
     listState,
     activeItemStyleType,
     disposeFilterSchema,

+ 21 - 10
apps/bigmember_pc/src/views/search/bidding/model/modules/filter.js

@@ -71,17 +71,16 @@ export function useSearchFilterModel(conf) {
   } else {
     filterState.value = filterBase.value
   }
-
-  function getFormatAPIParams() {
-    if(!inBIPropertyIframe) {
+ // 搜索接口需要的格式化后的数据
+ function getFormatAPIParams (){
+   if(!inBIPropertyIframe) {
      return getFormatApiBaseParams()
-    } else {
-      return getFormatAPIPropertyParams()
-    }
-
-  }
+   } else {
+     return getFormatAPIPropertyParams()
+   }
+ }
   // 格式化招标采购基础筛选条件
-  function getFormatApiBaseParams () {
+  function getFormatApiBaseParams (expendObj = {}) {
     const { publishTime, regionMap, industry, notkey, buyerclass, subtype } = filterState.value
     const { area, city, district } = FilterHistoryViewModel2AjaxModel.formatAreaCity(regionMap)
     const rPublishTime = publishTime?.indexOf('_') > -1 ? publishTime.replace(/_/g, '-') :  FilterHistoryViewModel2AjaxModel.formatTime(publishTime, true, '-')
@@ -112,11 +111,23 @@ export function useSearchFilterModel(conf) {
   function getFormatAPIPropertyParams() {
     return filterState.value
   }
+  // 动态更新筛选条件
+  function updateFilterBase (keyObj = {}) {
+    const {key, value } = keyObj
+    filterBase.value = Object.assign(filterBase.value, {
+      [key]: value
+    })
+    if(!inBIPropertyIframe) {
+      filterState.value = filterBase.value
+    }
+  }
 
   return {
     filterState,
     filterProperty,
+    filterBase,
     getFormatAPIParams,
-    getFormatAPIPropertyParams
+    getFormatAPIPropertyParams,
+    updateFilterBase
   }
 }