فهرست منبع

Merge branch 'dev4.7.8' of http://192.168.3.207:8080/qmx/jy into dev4.7.8

zhangyuhan 3 سال پیش
والد
کامیت
9ca9623bb7

+ 3 - 3
src/jfw/front/swordfish.go

@@ -140,6 +140,7 @@ func (m *Front) PcAjaxReq() {
 	secondFlag := ""
 	secondKWS := ""
 	pcAjaxFlag := ""
+	second := ""
 	if len(s_word) > 0 || len(industry) > 0 {
 		//全文检索限制
 		if searchLimit {
@@ -150,14 +151,13 @@ func (m *Front) PcAjaxReq() {
 			}
 		}
 		if isLimit == 1 {
-			_, _, _, pcAjaxFlag, secondFlag, count, totalPage, list = bidsearch.SearchData("pc", m.Request, currentPage, util.ObjToString(m.GetSession("userId")), secondKWS, s_word, area, city, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, fileExists, start, bidsearch.SearchPageSize_PC, true, queryItems, field, notkey, isPayedUser)
+			second, _, _, pcAjaxFlag, secondFlag, count, totalPage, list = bidsearch.SearchData("pc", m.Request, currentPage, util.ObjToString(m.GetSession("userId")), secondKWS, s_word, area, city, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, fileExists, start, bidsearch.SearchPageSize_PC, true, queryItems, field, notkey, isPayedUser)
 		}
 	}
 	_secondList, _totalPage, _ := bidsearch.LisetData(1, currentPage, list, secondFlag, config.Seoconfig, isPayedUser) //只有前20条
 	if secondFlag == "T" {
 		secondList, totalPage = _secondList, _totalPage
 	}
-	// TODO
 	m.ServeJson(map[string]interface{}{
 		"limitFlag":     false,
 		"status":        isLimit,
@@ -166,7 +166,7 @@ func (m *Front) PcAjaxReq() {
 		"totalPage":     totalPage,
 		"interceptWord": a_word,
 		"keywords":      b_word,
-		"searchvalue":   s_word,
+		"searchvalue":   util.If(second != "", fmt.Sprintf("%s+%s", s_word, second), s_word).(string),
 		"secondFlag":    secondFlag,
 		"secondList":    secondList,
 		"pcAjaxFlag":    pcAjaxFlag,

+ 1 - 0
src/jfw/front/ws_dataExport.go

@@ -367,6 +367,7 @@ func (wd *WsDataExport) SearchExport() error {
 		SelectIds:    strings.TrimSpace(wd.GetString("selectIds")), //选择信息id
 		Notkey:       wd.GetString("notkey"),                       //排除词
 		City:         wd.GetString("city"),                         //城市
+		FileExists:   wd.GetString("fileExists"),                   //有无附件
 	}
 	saveData := reqData.PassBidSearchExport()
 	saveData["selectType"] = strings.Join(jy.GetVipState(public.Mysql, public.MQFW, userId).

+ 1 - 0
src/jfw/modules/app/src/app/front/ws_dataExport.go

@@ -350,6 +350,7 @@ func (wd *WsDataExport) SearchExport() error {
 		SelectIds:    strings.TrimSpace(wd.GetString("selectIds")), //选择信息id
 		Notkey:       wd.GetString("notkey"),                       //排除词
 		City:         wd.GetString("city"),                         //城市
+		FileExists:   wd.GetString("fileExists"),                   //有无附件
 	}
 
 	saveData := reqData.PassBidSearchExport()

+ 13 - 0
src/jfw/modules/common/src/qfw/util/dataexport/dataexport.go

@@ -48,6 +48,7 @@ type SieveCondition struct {
 	Subtype      string    `json:"subtype"`      //信息类型
 	SelectIds    []string  `json:"selectId"`     //选择信息导出
 	Comeinfrom   string    `json:"comeinfrom"`   //查询来源
+	FileExists   string    `json:"fileExists"`   //是否有附件
 }
 
 const (
@@ -292,6 +293,17 @@ func getDataExportSql(scd *SieveCondition) string {
 			musts = append(musts, fmt.Sprintf(query_missing, "winnertel"))
 		}
 	}
+
+	//搜索范围是否只有附件
+	//搜索范围只选择附件,是否有附件条件无效;
+	var isFileSearch = strings.ReplaceAll(scd.SelectType, ",", "\",\"") == "filetext"
+	if !isFileSearch && scd.FileExists != "" {
+		if scd.FileExists == "1" { //有附件
+			must_not = append(must_not, fmt.Sprintf(query_missing, "filetext"))
+		} else if scd.FileExists == "-1" { //无附件
+			musts = append(musts, fmt.Sprintf(query_missing, "filetext"))
+		}
+	}
 	qstr := fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(must_not, ","), strings.Join(bools, ","), boolsNum)
 	return qstr
 }
@@ -324,6 +336,7 @@ func GetSqlObjFromId(mongo mg.MongodbSim, _id string) *SieveCondition {
 		ComeInTime:   qutil.Int64All((*query)["comeintime"]),
 		Comeinfrom:   qutil.ObjToString((*query)["comeinfrom"]),
 		SelectIds:    getStringArrFromDbResult((*query)["selectIds"]),
+		FileExists:   qutil.ObjToString((*query)["fileExists"]),
 	}
 }
 

+ 10 - 4
src/jfw/modules/common/src/qfw/util/jy/subscribepush.go

@@ -421,10 +421,16 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 	}
 	//价格- 预算和中标金额
 	if spqp.Price != "" && strings.Contains(spqp.Price, "-") {
-		minPrice_str, maxPrice_str := strings.Split(spqp.Price, "-")[0], strings.Split(spqp.Price, "-")[1]
-		minPrice := Int64All(Float64All(minPrice_str) * 10000) //换成元
-		maxPrice := Int64All(Float64All(maxPrice_str) * 10000) //换成元
-		querys = append(querys, fmt.Sprintf("((bidamount>=%d and bidamount<=%d) or (budget>=%d and budget<=%d and bidamount is null))", minPrice, maxPrice, minPrice, maxPrice))
+		minPriceStr, maxPriceStr := strings.Split(spqp.Price, "-")[0], strings.Split(spqp.Price, "-")[1]
+		minPrice := Int64All(Float64All(minPriceStr) * 10000) //换成元
+		maxPrice := Int64All(Float64All(maxPriceStr) * 10000) //换成元
+		if minPriceStr != "" && maxPriceStr != "" {
+			querys = append(querys, fmt.Sprintf("((bidamount>=%d and bidamount<=%d) or (budget>=%d and budget<=%d and bidamount is null))", minPrice, maxPrice, minPrice, maxPrice))
+		} else if minPriceStr != "" {
+			querys = append(querys, fmt.Sprintf("(bidamount>=%d  or (budget>=%d and bidamount is null))", minPrice, minPrice))
+		} else if maxPriceStr != "" {
+			querys = append(querys, fmt.Sprintf("( bidamount<=%d or (budget<=%d and bidamount is null))", maxPrice, maxPrice))
+		}
 	}
 	//附件
 	if spqp.FileExists != "" {

+ 1 - 0
src/jfw/public/dataexport.go

@@ -184,6 +184,7 @@ func (this *BidSearchExport) PassBidSearchExport() (returnData map[string]interf
 		"winner":       winnerSave,
 		"hasBuyertel":  this.Hasbuyertel,
 		"hasWinnertel": this.Haswinnertel,
+		"fileExists":   this.FileExists,
 		"comeintime":   now.Unix(),
 	}
 	//选择信息id

+ 55 - 15
src/web/staticres/js/pur-search-index-pc.js

@@ -53,6 +53,7 @@ function ewmMoveHover() {
         })
     })
 }
+var selectDataIds = []
 var vm = new Vue({
     el: '#pur-search-container',
     delimiters: ['${', '}'],
@@ -485,17 +486,15 @@ var vm = new Vue({
             this.listState.pageNum = p
             let arrs = this.listState.listAll, arr1 = [], arr2 = []
             this.listState.loading = true
-            setTimeout(() => {
-                arr1 = arrs.slice((p - 1) * this.listState.pageSize, (p - 1) * this.listState.pageSize + this.listState.pageSize) || []
-                arr1.forEach(v => {
-                    arr2.push(v.Buyer)
-                })
-                if (arr1.length == 0) {
-                    this.listState.list = []
-                } else {
-                    this.attentionCheck(arr1, String(arr2))
-                }
-            }, 600)
+            arr1 = arrs.slice((p - 1) * this.listState.pageSize, (p - 1) * this.listState.pageSize + this.listState.pageSize) || []
+            arr1.forEach(v => {
+                arr2.push(v.Buyer)
+            })
+            if (arr1.length == 0) {
+                this.listState.list = []
+            } else {
+                this.attentionCheck(arr1, String(arr2))
+            }
         },
         goTitle(name) {
             // location.href = '/entpc/unit_portrayal/' + name
@@ -514,11 +513,20 @@ var vm = new Vue({
                     arrs2.push(v.Buyerclass)
                     arrs3.push(v.customerId)
                 })
+                selectDataIds = this.unique(selectDataIds.concat(arrs1))
             } else {
+              $('.custom-checkbox:not(".check-all"):checked').each(function(){
+                const dataName = $(this).attr('dataname')
+                selectDataIds.forEach(function(item) {
+                  if(dataName == item) {
+                    selectDataIds.remove(item)
+                  }
+                })
+              })
                 str2.prop('checked', false)
                 arrs1 = []
             }
-            this.selectName = arrs1
+            this.selectName = selectDataIds
             this.selectIndustry = arrs2
             this.selectId = arrs3
         },
@@ -532,12 +540,18 @@ var vm = new Vue({
                     arr3.push($(this).attr('dataid'))
                 }
             })
+            selectDataIds = this.unique(selectDataIds.concat(arr1))
+            $('.custom-checkbox:not(".check-all")').each(function(){
+              if (!$(this).prop('checked')) {
+                selectDataIds.remove($(this).attr('dataname'))
+              }
+            })
             if (arr1.length == this.listState.list.length) {
                 $('.check-all').prop('checked', true)
             } else {
                 $('.check-all').prop('checked', false)
             }
-            this.selectName = arr1
+            this.selectName = selectDataIds
             this.selectIndustry = arr2
             this.selectId = arr3
             // console.info(this.attentionName, this.claimcheckName)
@@ -560,6 +574,11 @@ var vm = new Vue({
                 this.claim = false
             }
         },
+        // 数组去重
+        unique(arr) {
+          const res = new Map();
+          return arr.filter((arr) => !res.has(arr) && res.set(arr, 1));
+        },
         // 是否关注企业
         attentionCheck(arrs, item) {
             const _this = this
@@ -613,6 +632,27 @@ var vm = new Vue({
                     })
                     this.listState.list = arrs
                     this.listState.loading = false
+                    this.$nextTick(function() {
+                      let checkNum = 0
+                      const inputs = $('.custom-checkbox:not(".check-all")')
+                      $('.check-all').prop('checked', false)
+                      $('.custom-checkbox:not(".check-all")').each(function(){
+                        $(this).prop('checked', false)
+                        const that = this
+                        const dataName = $(this).attr('dataname')
+                        selectDataIds.forEach(function(item) {
+                          if(dataName == item) {
+                            checkNum++
+                            $(that).prop('checked', true)
+                          }
+                        })
+                      })
+                      if(checkNum == arrs.length) {
+                        $('.check-all').prop('checked', true)
+                      } else {
+                        $('.check-all').prop('checked', false)
+                      }
+                    })
                 }.bind(this)
             })
         },
@@ -670,7 +710,7 @@ var vm = new Vue({
                       this.follow = false
                       this.claim = false
                       $('.custom-checkbox').prop('checked', false)
-                      _this.selectName = []
+                      _this.selectName = selectDataIds
                       _this.getList(_this.listState.pageNum)
                     }
                 }.bind(this)
@@ -1096,7 +1136,7 @@ var vm = new Vue({
                     _this.follow = false
                     _this.claim = false
                     $('.custom-checkbox').prop('checked', false)
-                    _this.selectName = []
+                    _this.selectName = selectDataIds
                     _this.claimcheckName = []
                     _this.getList(_this.listState.pageNum)
                     $('.tags-list').find('.disabled').removeClass('disabled')