Przeglądaj źródła

Merge branch 'dev/1.0.36_zsy' of jianyu/web into feature/v1.0.36

zhangsiya 1 rok temu
rodzic
commit
e52ad370ea

+ 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"

+ 76 - 18
apps/bigmember_pc/src/components/filter-items/OnecascadeContent.vue

@@ -2,7 +2,7 @@
   <Layout :type="type" :placeholder="placeholder" :trigger="trigger" :value="computedVal">
     <div class="cascade-content" slot="empty">
       <div class="cascade-content-module">
-        <header class="module-header">{{ placeholder }}</header>
+        <header class="module-header" v-if="showHeader">{{ placeholder }}</header>
         <div class="module-main">
           <ul>
             <li class="module-item" :class="{ 'active': fActive === fIndex }" v-for="(first, fIndex) in firstList"
@@ -46,8 +46,14 @@ export default {
       default: () => []
     },
     value: {
-      type: [Object, Array],
-      default: () => []
+      type: [Array,Object],
+      default: () => {
+        return null
+      }
+    },
+    showHeader: {
+      type: Boolean,
+      default: false
     }
   },
   data() {
@@ -64,13 +70,37 @@ export default {
     event: 'change'
   },
   computed: {
+    // 源数据是否带有【全部】选项
+    hadAll () {
+      return this.options.find(item => item.label === '全部') || false
+    },
+    // 源数据带有选项【全部】选项的值
+    hadAllValue () {
+      let result = ''
+      if(this.hadAll) {
+        this.options.forEach(item => {
+          if( item.label === '全部') {
+            result = item.value
+          }
+        })
+      }
+      return result
+    },
     computedVal() {
-      return this.value.length ? `${this.placeholder}${this.value.length}个` : ''
+      let result = ''
+      if(Array.isArray(this.value) && this.value.length) {
+        if(this.hadAllValue && this.value.includes(this.hadAllValue)) {
+          result = ''
+        } else {
+          result = `${this.placeholder}${this.value.length}个`
+        }
+      }
+      return result
     }
   },
   watch: {
     value(val) {
-      // this.setState(val)
+      this.setState(val)
     }
   },
   mounted() {
@@ -80,39 +110,57 @@ export default {
     getArray() {
       const options = this.options
       const toArray = options.map(item => {
-        return {
+        const resultObj = {
           value: item.value,
           label: item.label,
           checked: false,
           indeterminate: false,
           disabled: false
         }
+        if(this.hadAll && item.label === '全部') {
+          resultObj.all = true
+        }
+        return  resultObj
       })
       return toArray
     },
     initData() {
       const sourceList = this.getArray()
-      sourceList.unshift({
-        label: '全部',
-        value: '全部',
-        checked: false,
-        disabled: false,
-        indeterminate: false,
-        all: true
-      })
+      // 数据源无全部的时候,手动在数据头部插入一组全部数据
+      if(!this.hadAll) {
+        sourceList.unshift({
+          label: '全部',
+          value: '全部',
+          checked: false,
+          disabled: false,
+          indeterminate: false,
+          all: true
+        })
+      }
       this.firstList = sourceList
-      this.setState(this.value)
+      if(!this.value || this.value?.length === 0) {
+        this.setState(null)
+      } else {
+        this.setState(this.value)
+      }
     },
     onFirstChange(checked, first, fIndex) {
       if (first.all) {
         this.firstList.forEach(item => {
           item.checked = checked
+          item.indeterminate = false
         })
       } else {
         first.checked = checked
       }
       this.checkFirstAllStatus()
-      this.$emit('change', this.getState())
+
+      // 会返回null和array两种数据类型!!!!!!
+      if (first.all) {
+        this.$emit('change', first.checked ? this.getState() : null)
+      } else {
+        this.$emit('change', this.getState())
+      }
     },
     restState() {
       this.firstList.forEach(item => {
@@ -140,7 +188,9 @@ export default {
           arr.push(item.value)
         }
       })
-      if (arr.includes('全部')) {
+      if(this.hadAll && arr.includes(this.hadAllValue)){
+        return [this.hadAllValue]
+      } else if (arr.includes('全部')) {
         return []
       } else {
         return arr
@@ -148,11 +198,18 @@ export default {
     },
     setState(value) {
       this.restState()
-      if (!value || value.length === 0) {
+      if (!value) {
         this.firstList.forEach(item => {
           item.checked = false
           item.indeterminate = false
         })
+        return
+      }
+      if(Array.isArray(value) && value.length === 0) {
+        this.firstList.forEach(item => {
+          item.checked = true
+          item.indeterminate = false
+        })
       } else {
         this.firstList.forEach(item => {
           if (value.includes(item.value)) {
@@ -162,6 +219,7 @@ export default {
         })
       }
       this.checkFirstAllStatus()
+      this.firstLoad = false
     }
   }
 }

+ 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
   }
 }

+ 3 - 3
apps/bigmember_pc/src/views/search/ent/model/base.js

@@ -104,12 +104,12 @@ export default function () {
     }
     // 地区数据格式处理结束
     const params = {
-      matchType: filterState.value.matchType.join(','),
+      matchType: filterState.value.matchType?.join(','),
       entArea: entArea.join(','),
       entCity: entCity.join(','),
       entCapital: filterState.value.entCapital,
-      entType: filterState.value.entType.join(','),
-      entStatus: filterState.value.entStatus.join(',')
+      entType: filterState.value.entType?.join(','),
+      entStatus: filterState.value.entStatus?.join(',')
     }
 
     return params