Sfoglia il codice sorgente

Merge branch 'feature/v4.8.43' into feature/v4.8.41

lizhikun 2 anni fa
parent
commit
ad8fffa395

+ 37 - 0
src/jfw/modules/app/src/web/templates/big-member/page_report_analysis.html

@@ -92,6 +92,7 @@
                         </div>
                         <van-cell-group class="filters-list">
                             <van-cell center title="分析内容" is-link value-class="ellipsis" :value="resolveSelected('keys')" @click="clickCell('keys')"></van-cell>
+                            <van-cell center title="匹配方式" is-link value-class="ellipsis" :value="resolveSelected('matchway')" @click="clickCell('matchway')"></van-cell>
                             <van-cell center title="区域" is-link value-class="ellipsis" :value="resolveSelected('area')" @click="clickCell('area')"></van-cell>
                             <van-cell center title="行业" is-link value-class="ellipsis" :value="resolveSelected('industry')" @click="clickCell('industry')"></van-cell>
                             <van-cell center title="采购单位类型" value-class="ellipsis" is-link :value="resolveSelected('buyerclass')" @click="clickCell('buyerclass')"></van-cell>
@@ -551,6 +552,42 @@
                 </div>
             </div>
         </van-popup>
+        <van-popup
+            v-model="filterDialogShow.matchway"
+            closeable
+            round
+            position="bottom"
+            close-icon="clear"
+            class="j-popup collection"
+            overlay-class="j-overlay"
+            :lazy-render="false"
+            :style="{ height: '36%' }"
+            get-container="body">
+            <div class="j-container matchway-popup">
+                <div class="popup-header header-title">请选择匹配方式</div>
+                <div class="j-main">
+                    <van-radio-group v-model="filtersCache.matchway">
+                        <van-cell-group>
+                          <van-cell
+                            v-for="item in matchWayList"
+                            :key="item.label"
+                            :title="item.name"
+                            clickable
+                            @click="filtersCache.matchway = item.label">
+                            <template #right-icon>
+                              <van-radio checked-color="#2ABED1" :name="item.label" />
+                            </template>
+                          </van-cell>
+                    </van-radio-group>
+                </div>
+                <div class="j-footer">
+                    <div class="j-button-group">
+                        <button class="j-button-cancel" @click="filtersCache.matchway = 'title'">重置</button>
+                        <button class="j-button-confirm" @click="filters.matchway = filtersCache.matchway;filterDialogShow.matchway = false">确认</button>
+                      </div>
+                </div>
+            </div>
+        </van-popup>
         <van-popup
             v-model="filterDialogShow.area"
             closeable

+ 10 - 4
src/jfw/modules/bigmember/src/entity/marketAnalysis/commonSearch.go

@@ -7,7 +7,6 @@ import (
 )
 
 const (
-	localMultiMatch     = `{"multi_match": {"query": %s,"type": "phrase", "fields": ["purchasing","projectname.pname"]}}`
 	query_bool_must_and = `{"bool": {"must": [%s]%s}}`
 	PSearch_DecMust     = `"bidstatus": ["中标","成交","合同","单一"]`
 	query_bool_must     = `{"terms": {%s}}`
@@ -41,7 +40,7 @@ func (mae *MarketAnalysisEntity) GetCommonQuerySql() string {
 	musts = append(musts, fmt.Sprintf(query_bool_must, PSearch_DecMust))
 	//订阅词
 	for _, v := range getAllKeywordArr(mae.FormatParam.KeysItems) {
-		if sql := getKeyWordSql(v); sql != "" {
+		if sql := getKeyWordSql(v, mae.BaseParam.MatchingMode); sql != "" {
 			bools = append(bools, sql)
 		}
 	}
@@ -92,8 +91,15 @@ func getAllKeywordArr(res []keyWordGroup) (rData []viewKeyWord) {
 	return
 }
 
-func getKeyWordSql(v viewKeyWord) string {
-	var shoulds, must_not []string
+func getKeyWordSql(v viewKeyWord, matchingMode string) string {
+	var (
+		shoulds, must_not []string
+		//默认查询项目名称与标的物
+		localMultiMatch = `{"multi_match": {"query": %s,"type": "phrase", "fields": ["purchasing","projectname.pname"]}}`
+	)
+	if matchingMode == "title" { //只匹配项目名称
+		localMultiMatch = `{"multi_match": {"query": %s,"type": "phrase", "fields": ["projectname.pname"]}}`
+	}
 	//附加词
 	for _, vv := range v.Keyword {
 		vv = strings.TrimSpace(vv)

+ 5 - 0
src/jfw/modules/bigmember/src/entity/marketAnalysis/marketAnalysisEntity.go

@@ -53,6 +53,7 @@ type AnalysisRequestParam struct {
 	PageSize       int    //默认每页10条
 	PageNum        int    //默认当前第一页
 	IsDetail       bool   //是否是项目明细请求
+	MatchingMode   string //匹配方式 title:标题 content:项目名称/标的物
 }
 
 type viewKeyWord struct {
@@ -239,6 +240,7 @@ func (mae *MarketAnalysisEntity) SaveAnalysisRecord() error {
 		"s_area":           mae.BaseParam.Area,
 		"s_industry":       mae.BaseParam.Industry,
 		"s_buyerClass":     mae.BaseParam.BuyerClass,
+		"s_matchingMode":   mae.BaseParam.MatchingMode,
 		"s_userId":         mae.UId,
 		"s_parentId":       mae.Pid,
 		"l_createTime":     time.Now().Unix(),
@@ -273,6 +275,7 @@ func (mae *MarketAnalysisEntity) GetAnalysisFromMgoDb() error {
 	mae.BaseParam.Area, _ = (*res)["s_area"].(string)
 	mae.BaseParam.Industry, _ = (*res)["s_industry"].(string)
 	mae.BaseParam.BuyerClass, _ = (*res)["s_buyerClass"].(string)
+	mae.BaseParam.MatchingMode, _ = (*res)["s_matchingMode"].(string)
 	return nil
 }
 
@@ -324,6 +327,7 @@ func (mae *MarketAnalysisEntity) GetRecordList(pageNum, PageSize int) (total int
 			"rangeTime":        qutil.ObjToString(row["s_rangeTime"]),
 			"s_rangeTimeExtra": qutil.ObjToString(row["s_rangeTimeExtra"]),
 			"createTime":       qutil.Int64All(row["l_createTime"]),
+			"matchingMode":     qutil.ObjToString(row["s_matchingMode"]), //项目匹配方式
 		})
 	}
 	return
@@ -338,6 +342,7 @@ func (mae *MarketAnalysisEntity) getQueryItem() (map[string]interface{}, error)
 		"buyerclass":       mae.BaseParam.BuyerClass,
 		"rangeTime":        mae.BaseParam.RangeTime,
 		"s_rangeTimeExtra": mae.BaseParam.RangeTimeExtra,
+		"matchingMode":     mae.BaseParam.MatchingMode,
 	}, nil
 }
 

+ 1 - 1
src/jfw/modules/bigmember/src/entity/marketAnalysis/scaleRefineQuery.go

@@ -89,7 +89,7 @@ func (mae *MarketAnalysisEntity) marketScaleRefineQuery() (rMap map[string]inter
 	for _, group := range mae.FormatParam.KeysItems {
 		var bools []string
 		for _, v := range getGroupKeywordArr(group.A_Key) {
-			if sql := getKeyWordSql(v); sql != "" {
+			if sql := getKeyWordSql(v, mae.BaseParam.MatchingMode); sql != "" {
 				bools = append(bools, sql)
 			}
 		}

+ 2 - 0
src/jfw/modules/bigmember/src/service/report/marketAnalysis.go

@@ -53,6 +53,7 @@ func (this *MarketAnalysis) ProjectInfo() {
 			BuyerClass:     this.GetString("buyerclass"),     //采购单位类型【字符串】多个采购单位类型用逗号拼接
 			Buyer:          this.GetString("buyer"),          //采购单位
 			Winner:         this.GetString("winner"),         //中标单位
+			MatchingMode:   this.GetString("matchingMode"),   //匹配方式
 			Sort:           sort,                             //排序
 			PageSize:       pageSize,                         //每页数据量
 			PageNum:        pageNum,                          //当前页码
@@ -123,6 +124,7 @@ func (this *MarketAnalysis) DoAnalysis() {
 			Area:           this.GetString("area"),           //省份【字符串】多个省份用逗号拼接
 			Industry:       this.GetString("industry"),       //行业【字符串】多个行业用逗号拼接
 			BuyerClass:     this.GetString("buyerclass"),     //采购单位类型【字符串】多个采购单位类型用逗号拼接
+			MatchingMode:   this.GetString("matchingMode"),   //匹配方式
 		}
 		mae := &marketAnalysis.MarketAnalysisEntity{BaseParam: bParam, UId: userId, Pid: pid}
 		if err := mae.ForMatData(); err != nil {

+ 8 - 0
src/web/staticres/common-module/collection/js/keyword-mobile.js

@@ -349,12 +349,20 @@ var keywordComponent = {
             _this.setInitList(_this.tablist)
           }
           _this.checkNoKey()
+          _this.emitRequestRes(res)
         },
         error: function(err){
           console.log(err)
         }
       })
     },
+    emitRequestRes: function (res) {
+      try {
+        if (res && res.data) {
+          subscribeRequestSuccess && subscribeRequestSuccess(res.data)
+        }
+      } catch (error) {}
+    },
     setInitList: function(arr) {
       arr.forEach((v) => {
         const ownKey = {

+ 15 - 0
src/web/staticres/common-module/diy-report/js/report-list.js

@@ -31,6 +31,13 @@ var reportListTemplate = `
                             v-html="formatKeys(item.keysItems, item.open)">
                         </div>
                     </div>
+                    <div class="info-flex-r-box filters">
+                        <span class="info-content-label">匹配方式:</span>
+                        <div class="info-content-box"
+                            :class="{'van-ellipsis': !item.open}"
+                            v-html="formatMatchWay(item.matchingMode, item.open)">
+                        </div>
+                    </div>
                     <div class="info-flex-r-box filters">
                         <span class="info-content-label">时间:</span>
                         <div class="info-content-box" :class="{'van-ellipsis': !item.open}">
@@ -187,6 +194,14 @@ var reportListMobileComponent = {
                 }.bind(this)
             })
         },
+        formatMatchWay: function (m, open) {
+            var map = {
+                title: '按标题匹配',
+                content: '按全文匹配'
+            }
+            const text = map[m] || map.content
+            return text
+        },
         formatKeys: function (keys, open) {
             var tempStr = '-'
             if (!keys) return tempStr

+ 51 - 1
src/web/staticres/common-module/report-analysis/js/report_analysis.js

@@ -1,6 +1,10 @@
 function dateFormatter (date, pattern) {
   return new Date(date).pattern(pattern)
 }
+function subscribeRequestSuccess (res) {
+  vm.subscribeInfo = res
+}
+
 var vm = new Vue({
   delimiters: ['${', '}'],
   el: '#analysis',
@@ -25,6 +29,7 @@ var vm = new Vue({
   data: {
     sessStorageKey: '$data-report_analysis',
     tabActiveName: 'analysis', // analysis/history
+    subscribeInfo: {},
     tabList: [
       {
         label: '市场分析报告',
@@ -35,6 +40,16 @@ var vm = new Vue({
         name: 'history'
       }
     ],
+    matchWayList: [
+      {
+        name: '按标题匹配',
+        label: 'title'
+      },
+      {
+        name: '按全文匹配',
+        label: 'content'
+      }
+    ],
     tabConf: {
       titleActiveColor: '#2ABED1',
       titleInactiveColor: '#5F5E64',
@@ -70,8 +85,12 @@ var vm = new Vue({
     ],
     scrollTop: 0,
     filtersPageShow: true,
+    filtersCache: {
+      matchway: 'title'
+    },
     filters: {
       selectKeysArr: [], // 关键词简单数组,用于恢复选择状态
+      matchway: 'title',
       keys: [], // 关键词详细数组,用于提交数据
       area: {},
       industry: [],
@@ -85,6 +104,7 @@ var vm = new Vue({
     },
     filterDialogShow: {
       keys: false,
+      matchway: false,
       area: false,
       industry: false,
       buyerclass: false,
@@ -343,7 +363,12 @@ var vm = new Vue({
           this.calcStickyOffset()
         }
       }
-    }
+    },
+    subscribeInfo (n) {
+      if (!this.rid && n && n.member_jy && n.member_jy.i_matchway) {
+        this.setDefaultMatchWay(n.member_jy.i_matchway)
+      }
+    },
   },
   created () {
     this.calcLastTimeText()
@@ -373,6 +398,17 @@ var vm = new Vue({
     utils.iosBackRefresh()
   },
   methods: {
+    setDefaultMatchWay: function (matchWay) {
+      // matchWay 1按标题匹配title 2按全文匹配content
+      var map = {
+        1: 'title',
+        2: 'content'
+      }
+      var defaultMatchWay = map[matchWay]
+      if (defaultMatchWay) {
+        this.filters.matchway = defaultMatchWay
+      }
+    },
     // 设置排序方式
     setsortType (data) {
       this.sections.areaScatter.sortType = data
@@ -622,9 +658,18 @@ var vm = new Vue({
         text = this.resolveSelectIndustryText(filters.industryDetail)
       } else if (type === 'buyerclass') {
         text = this.resolveSelectBuyerclassText(filters.buyerclass)
+      } else if (type === 'matchway') {
+        text = this.resolveSelectMatchWayText(filters.matchway)
       }
       return prefix + text
     },
+    resolveSelectMatchWayText: function (m) {
+      var map = {
+        title: '按标题匹配',
+        content: '按全文匹配'
+      }
+      return map[m]
+    },
     resolveSelectKeysText: function (keys) {
       if (Array.isArray(keys)) {
         if (keys.length === 0) {
@@ -748,6 +793,8 @@ var vm = new Vue({
         setTimeout(function () {
           _this.$refs.industrySelector.setState()
         }, 0)
+      } else if (key = 'matchway') {
+        this.filtersCache[key] = this.filters[key]
       }
       dialog[key] = true
     },
@@ -800,6 +847,7 @@ var vm = new Vue({
 
       const query = {
         keysItems: this.getSelectedKeys(),
+        matchingMode: this.filters.matchway,
         rangeTime: `${parseInt(this.filters.rangeTime.start / 1000)}-${parseInt(this.filters.rangeTime.end / 1000)}`,
         rangeTimeExtra: this.filters.rangeTime.exact,
         area: JSON.stringify(this.filters.area),
@@ -1067,6 +1115,8 @@ var vm = new Vue({
         this.reportFilters.buyerclass = data.buyerclass.split(',')
         this.filters.buyerclass = this.reportFilters.buyerclass
       }
+      console.log(data)
+      this.filters.matchway = data.matchingMode || 'content'
     },
     // 市场概况
     sortMarketOverview (profile) {

+ 37 - 0
src/web/templates/big-member/wx/page_report_analysis.html

@@ -100,6 +100,7 @@
                       </div>
                       <van-cell-group class="filters-list">
                           <van-cell center title="分析内容" is-link value-class="ellipsis" :value="resolveSelected('keys')" @click="clickCell('keys')"></van-cell>
+                          <van-cell center title="匹配方式" is-link value-class="ellipsis" :value="resolveSelected('matchway')" @click="clickCell('matchway')"></van-cell>
                           <van-cell center title="区域" is-link value-class="ellipsis" :value="resolveSelected('area')" @click="clickCell('area')"></van-cell>
                           <van-cell center title="行业" is-link value-class="ellipsis" :value="resolveSelected('industry')" @click="clickCell('industry')"></van-cell>
                           <van-cell center title="采购单位类型" value-class="ellipsis" is-link :value="resolveSelected('buyerclass')" @click="clickCell('buyerclass')"></van-cell>
@@ -559,6 +560,42 @@
               </div>
           </div>
       </van-popup>
+      <van-popup
+            v-model="filterDialogShow.matchway"
+            closeable
+            round
+            position="bottom"
+            close-icon="clear"
+            class="j-popup collection"
+            overlay-class="j-overlay"
+            :lazy-render="false"
+            :style="{ height: '36%' }"
+            get-container="body">
+            <div class="j-container matchway-popup">
+                <div class="popup-header header-title">请选择匹配方式</div>
+                <div class="j-main">
+                    <van-radio-group v-model="filtersCache.matchway">
+                        <van-cell-group>
+                          <van-cell
+                            v-for="item in matchWayList"
+                            :key="item.label"
+                            :title="item.name"
+                            clickable
+                            @click="filtersCache.matchway = item.label">
+                            <template #right-icon>
+                              <van-radio checked-color="#2ABED1" :name="item.label" />
+                            </template>
+                          </van-cell>
+                    </van-radio-group>
+                </div>
+                <div class="j-footer">
+                    <div class="j-button-group">
+                        <button class="j-button-cancel" @click="filtersCache.matchway = 'title'">重置</button>
+                        <button class="j-button-confirm" @click="filters.matchway = filtersCache.matchway;filterDialogShow.matchway = false">确认</button>
+                      </div>
+                </div>
+            </div>
+      </van-popup>
       <van-popup
           v-model="filterDialogShow.area"
           closeable