Преглед изворни кода

预算金额限制es修改

jiaojiao7 пре 4 година
родитељ
комит
3c0de826a9

+ 3 - 2
src/models/tag.go

@@ -15,8 +15,8 @@ type Tag struct {
 	Sarea                string        `json:"s_area" bson:"s_area"`
 	Scity                string        `json:"s_city" bson:"s_city"`
 	Sdistrict            string        `json:"s_district" bson:"s_district"`
-	Sbudget				 string		   `json:"s_budgetlimit" bson:"s_budgetlimit"`
-	Sbidamount			 string		   `json:"s_bidamountlimit" bson:"s_bidamountlimit"`
+	Sbudget              string        `json:"s_budgetlimit" bson:"s_budgetlimit"`
+	Sbidamount           string        `json:"s_bidamountlimit" bson:"s_bidamountlimit"`
 	Sglobaladdkey        string        `json:"s_globaladdkey" bson:"s_globaladdkey"`
 	Sglobaladdkeymatch   string        `json:"s_globaladdkeymatch" bson:"s_globaladdkeymatch"`
 	Sglobalnotkey        string        `json:"s_globalnotkey" bson:"s_globalnotkey"`
@@ -37,6 +37,7 @@ type Tag struct {
 	Iupdatetime          int           `json:"i_updatetime" bson:"i_updatetime"`
 	Screateuser          string        `json:"s_createuser" bson:"s_createuser"`
 	Supdateuser          string        `json:"s_updateuser" bson:"s_updateuser"`
+	SbudgetFieldExist    int           `json:"i_budgetfieldexist" bson:"i_budgetfieldexist"`
 }
 type ORules struct {
 	Smatchkey      string `json:"s_matchkey"  bson:"s_matchkey"`

+ 4 - 3
src/service/customer_service.go

@@ -717,7 +717,7 @@ func (c *Customer) ProductData() {
 		// 限制multi_match 个数小于1000个
 		s_esquery := qu.ObjToString((*tag)["s_esquery"])
 		multi_match_count := strings.Count(s_esquery, "multi_match")
-		fmt.Println("multi_match",multi_match_count,s_esquery)
+		fmt.Println("multi_match", multi_match_count, s_esquery)
 		if multi_match_count > 1000 {
 			c.ServeJson(map[string]interface{}{
 				"rep": false,
@@ -1030,8 +1030,8 @@ func (c *Customer) CustomerHistory() {
 			"s_salesperson":  user_salesperson,
 			//"i_pushmodel":    push_model,
 			//"i_pushtype":     push_type,
-			"i_push":         i_push,
-			"s_appid":        appid,
+			"i_push":  i_push,
+			"s_appid": appid,
 		})
 		c.Redirect("/service/customer/history?id=" + id + "&hid=" + history_id)
 		return
@@ -1450,6 +1450,7 @@ func (c *Customer) HistoryTagEdit() {
 func (c *Customer) DelHistoryRule() {
 	id := c.GetString("id")
 	hid := c.GetString("hid")
+	log.Println(id, hid)
 	if hid != "" {
 		data, ok := Mgo.FindOne("historylog", bson.M{"_id": mongoutil.StringTOBsonId(hid)})
 		if ok && data != nil && *data != nil {

+ 45 - 2
src/util/utiltag.go

@@ -275,7 +275,7 @@ func Utiltags(tag map[string]interface{}) string {
 			Lt: tab.Iendtime,
 		}}})
 	}
-	if tab.Sbudget != "" {
+	/*if tab.Sbudget != "" {
 		if strings.Contains(tab.Sbudget, "大于") && strings.Contains(tab.Sbudget, "小于") {
 			arr := strings.Split(tab.Sbudget, ",")
 			limit := &sql.BudgetOrBidamount{
@@ -294,7 +294,7 @@ func Utiltags(tag map[string]interface{}) string {
 			}
 			ffBoolObject.Must = append(ffBoolObject.Must, sql.BudgetMust{BudgetObj: &sql.BudgetObj{Budget: limit}})
 		}
-	}
+	}*/
 	if tab.Sbidamount != "" {
 		if strings.Contains(tab.Sbidamount, "大于") && strings.Contains(tab.Sbidamount, "小于") {
 			arr := strings.Split(tab.Sbidamount, ",")
@@ -424,6 +424,42 @@ func Utiltags(tag map[string]interface{}) string {
 		}
 		torules.Should = append(torules.Should, tmpses)
 	}
+	budgetSql := sql.NewEsObject{}
+	if tab.Sbudget != "" {
+		if strings.Contains(tab.Sbudget, "大于") && strings.Contains(tab.Sbudget, "小于") {
+			arr := strings.Split(tab.Sbudget, ",")
+			limit := &sql.BudgetOrBidamount{
+				Gte: util.Float64All(strings.Replace(arr[0], "大于", "", -1)),
+				Lt:  util.Float64All(strings.Replace(arr[1], "小于", "", -1)),
+			}
+			budgetSql.Bool.Should = append(budgetSql.Bool.Should, sql.BudgetMust{BudgetObj: &sql.BudgetObj{Budget: limit}})
+		} else if strings.Contains(tab.Sbudget, "大于") {
+			limit := &sql.BudgetOrBidamount{
+				Gte: util.Float64All(strings.Replace(tab.Sbudget, "大于", "", -1)),
+			}
+			budgetSql.Bool.Should = append(budgetSql.Bool.Should, sql.BudgetMust{BudgetObj: &sql.BudgetObj{Budget: limit}})
+		} else if strings.Contains(tab.Sbudget, "小于") {
+			limit := &sql.BudgetOrBidamount{
+				Lt: util.Float64All(strings.Replace(tab.Sbudget, "小于", "", -1)),
+			}
+			budgetSql.Bool.Should = append(budgetSql.Bool.Should, sql.BudgetMust{BudgetObj: &sql.BudgetObj{Budget: limit}})
+		}
+		if tab.SbudgetFieldExist == 1 {
+			budgetSql.Bool.Should = append(budgetSql.Bool.Should, sql.ExistfieldsObjectMust{
+				ExistfieldsObject: &sql.ExistfieldsObject{Filter: struct {
+					Missing struct {
+						Field string `json:"field,omitempty"`
+					} `json:"missing,omitempty"`
+				}{
+					Missing: struct {
+						Field string `json:"field,omitempty"`
+					}{Field: "budget"},
+				},
+				},
+			})
+		}
+	}
+
 	if len(ffBoolObject.Must) > 0 || len(ffBoolObject.MustNot) > 0 || len(ffBoolObject.Should) > 0 {
 		QueryObjecct.Filtered.Filter = &sql.Filter{}
 		QueryObjecct.Filtered.Filter.Bool = &ffBoolObject
@@ -445,6 +481,13 @@ func Utiltags(tag map[string]interface{}) string {
 			"bool": torules,
 		})
 	}
+	if len(budgetSql.Bool.Should) > 0 && (len(fqBoolObject.Must) > 0 || len(fqBoolObject.MustNot) > 0 || len(fqBoolObject.Should) > 0) {
+		QueryObjecct.Filtered.Query.Bool.Must = append(QueryObjecct.Filtered.Query.Bool.Must, budgetSql)
+	} else {
+		QueryObjecct.Filtered.Query = &sql.Query{}
+		QueryObjecct.Filtered.Query.Bool = &fqBoolObject
+		QueryObjecct.Filtered.Query.Bool.Must = append(QueryObjecct.Filtered.Query.Bool.Must, budgetSql)
+	}
 	rdata := make(map[string]interface{})
 	rdata["query"] = QueryObjecct
 	esbytes, _ := json.Marshal(rdata)

+ 20 - 7
src/web/templates/client/cuser_rule_create.html

@@ -284,24 +284,28 @@
                                     <hr>
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label">预算限制</label>
-                                        <div class="col-sm-3">
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_budget_min"
                                                    placeholder="单位:元/大于">
                                         </div>
-                                        <label class="col-sm-2" style="text-align: center">___ ___</label>
-                                        <div class="col-sm-3">
+                                        <label class="col-sm-1" style="text-align: center">___ ___</label>
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_budget_max"
                                                    placeholder="单位:元/小于">
                                         </div>
+                                        <label class="col-sm-2 control-label">预算不存在</label>
+                                        <div class="col-sm-1">
+                                            <input style="margin-top: 10px;" type="checkbox" id="budgetExist">
+                                        </div>
                                     </div>
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label">中标金额限制</label>
-                                        <div class="col-sm-3" id="bidamountDiv">
+                                        <div class="col-sm-2" id="bidamountDiv">
                                             <input class="form-control" type="text" id="s_bidamount_min"
                                                    placeholder="单位:元/大于">
                                         </div>
-                                        <label class="col-sm-2" style="text-align: center">___ ___</label>
-                                        <div class="col-sm-3">
+                                        <label class="col-sm-1" style="text-align: center">___ ___</label>
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_bidamount_max"
                                                    placeholder="单位:元/小于">
                                         </div>
@@ -1095,7 +1099,16 @@
                 budget = budget + ",小于" + $('#s_budget_max').val()
             }
         }
-        dataMap["s_budgetlimit"] = budget
+        dataMap["s_budgetlimit"] = budget;
+        if (budget !== "") {
+            if ($('#budgetExist').prop('checked')) {
+                dataMap["i_budgetfieldexist"] = 1
+            } else {
+                dataMap["i_budgetfieldexist"] = 0
+            }
+        } else {
+            dataMap["i_budgetfieldexist"] = 0
+        }
         var bidamount = "";
         if ($('#s_bidamount_min').val() != "") {
             bidamount = "大于" + $('#s_bidamount_min').val()

+ 22 - 6
src/web/templates/client/cuser_rule_edit.html

@@ -287,24 +287,28 @@
                                     <hr>
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label">预算限制</label>
-                                        <div class="col-sm-3">
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_budget_min"
                                                    placeholder="单位:元/大于" onkeyup="limitNum(this)">
                                         </div>
-                                        <label class="col-sm-2" style="text-align: center">___ ___</label>
-                                        <div class="col-sm-3">
+                                        <label class="col-sm-1" style="text-align: center">___ ___</label>
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_budget_max"
                                                    placeholder="单位:元/小于" onkeyup="limitNum(this)">
                                         </div>
+                                        <label class="col-sm-2 control-label">预算不存在</label>
+                                        <div class="col-sm-1">
+                                            <input style="margin-top: 10px;" type="checkbox" id="budgetExist">
+                                        </div>
                                     </div>
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label">中标金额限制</label>
-                                        <div class="col-sm-3" id="bidamountDiv">
+                                        <div class="col-sm-2" id="bidamountDiv">
                                             <input class="form-control" type="text" id="s_bidamount_min"
                                                    placeholder="单位:元/大于" onkeyup="limitNum(this)">
                                         </div>
-                                        <label class="col-sm-2" style="text-align: center">___ ___</label>
-                                        <div class="col-sm-3">
+                                        <label class="col-sm-1" style="text-align: center">___ ___</label>
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_bidamount_max"
                                                    placeholder="单位:元/小于" onkeyup="limitNum(this)">
                                         </div>
@@ -604,6 +608,9 @@
         }
         $("#infoType").selectpicker("refresh");
         $("#existFieldSelect").selectpicker("refresh");
+        if (dataMap.i_budgetfieldexist === 1) {
+            $("#budgetExist").attr("checked", true)
+        }
 
         //匹配方式
         var btnMatchHtml1 = "";
@@ -1628,6 +1635,15 @@
             }
         }
         dataMap["s_budgetlimit"] = budget;
+        if (budget !== "") {
+            if ($('#budgetExist').prop('checked')) {
+                dataMap["i_budgetfieldexist"] = 1
+            } else {
+                dataMap["i_budgetfieldexist"] = 0
+            }
+        } else {
+            dataMap["i_budgetfieldexist"] = 0
+        }
         var bidamount = "";
         if ($('#s_bidamount_min').val() != "") {
             bidamount = "大于" + $('#s_bidamount_min').val()

+ 20 - 7
src/web/templates/private/cuser_rule_create.html

@@ -254,24 +254,28 @@
                                     <hr>
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label">预算限制</label>
-                                        <div class="col-sm-3">
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_budget_min"
                                                    placeholder="单位:元/大于">
                                         </div>
-                                        <label class="col-sm-2" style="text-align: center">___ ___</label>
-                                        <div class="col-sm-3">
+                                        <label class="col-sm-1" style="text-align: center">___ ___</label>
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_budget_max"
                                                    placeholder="单位:元/小于">
                                         </div>
+                                        <label class="col-sm-2 control-label">预算不存在</label>
+                                        <div class="col-sm-1">
+                                            <input style="margin-top: 10px;" type="checkbox" id="budgetExist">
+                                        </div>
                                     </div>
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label">中标金额限制</label>
-                                        <div class="col-sm-3" id="bidamountDiv">
+                                        <div class="col-sm-2" id="bidamountDiv">
                                             <input class="form-control" type="text" id="s_bidamount_min"
                                                    placeholder="单位:元/大于">
                                         </div>
-                                        <label class="col-sm-2" style="text-align: center">___ ___</label>
-                                        <div class="col-sm-3">
+                                        <label class="col-sm-1" style="text-align: center">___ ___</label>
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_bidamount_max"
                                                    placeholder="单位:元/小于">
                                         </div>
@@ -1468,7 +1472,16 @@
                 budget = budget + ",小于" + $('#s_budget_max').val()
             }
         }
-        dataMap["s_budgetlimit"] = budget
+        dataMap["s_budgetlimit"] = budget;
+        if (budget !== "") {
+            if ($('#budgetExist').prop('checked')) {
+                dataMap["i_budgetfieldexist"] = 1
+            } else {
+                dataMap["i_budgetfieldexist"] = 0
+            }
+        } else {
+            dataMap["i_budgetfieldexist"] = 0
+        }
         var bidamount = "";
         if ($('#s_bidamount_min').val() != "") {
             bidamount = "大于" + $('#s_bidamount_min').val()

+ 25 - 57
src/web/templates/private/cuser_rule_edit.html

@@ -259,24 +259,29 @@
                                     <hr>
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label">预算限制</label>
-                                        <div class="col-sm-3">
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_budget_min"
                                                    placeholder="单位:元/大于" onkeyup="limitNum(this)">
                                         </div>
-                                        <label class="col-sm-2" style="text-align: center">___ ___</label>
-                                        <div class="col-sm-3">
+                                        <label class="col-sm-1" style="text-align: center">___ ___</label>
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_budget_max"
                                                    placeholder="单位:元/小于" onkeyup="limitNum(this)">
                                         </div>
+                                        <label class="col-sm-2 control-label">预算不存在</label>
+                                        <div class="col-sm-1">
+                                            <input style="margin-top: 10px;" type="checkbox" id="budgetExist">
+                                        </div>
+
                                     </div>
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label">中标金额限制</label>
-                                        <div class="col-sm-3" id="bidamountDiv">
+                                        <div class="col-sm-2" id="bidamountDiv">
                                             <input class="form-control" type="text" id="s_bidamount_min"
                                                    placeholder="单位:元/大于" onkeyup="limitNum(this)">
                                         </div>
-                                        <label class="col-sm-2" style="text-align: center">___ ___</label>
-                                        <div class="col-sm-3">
+                                        <label class="col-sm-1" style="text-align: center">___ ___</label>
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_bidamount_max"
                                                    placeholder="单位:元/小于" onkeyup="limitNum(this)">
                                         </div>
@@ -428,6 +433,7 @@
     var buyerClass = {{.T.buyerClass}};
     var buyerClassMap = {{.T.buyerClassMap}};
     var scopeClass = {{.T.scopeClass}};
+    var budgetfieldexist = {{.T.i_budgetfieldexist}}
 
     var matchCode = [];     //匹配方式code
     var matchName = [];     //匹配名字
@@ -571,6 +577,9 @@
         $("#infoType").selectpicker("refresh");
         $("#existFieldSelect").selectpicker("refresh");
 
+        if (dataMap.i_budgetfieldexist === 1) {
+            $("#budgetExist").attr("checked", true)
+        }
         //匹配方式
         var btnMatchHtml1 = "";
         var btnMatchHtml2 = "";
@@ -883,38 +892,25 @@
             matchName.length = 0;
             if (val == 0) {
                 s_matchkey_str = dataMap["s_globaladdkeymatch"]
-
             } else if (val == 1) {
                 s_matchkey_str = dataMap["s_globalnotkeymatch"]
-
             } else if (val == 13) {
                 s_matchkey_str = dataMap["s_globalclearkeymatch"]
-
             }
-
             if (s_matchkey_str) {
-
                 s_matchkey_list = s_matchkey_str.split(",")
-
                 for (index_ in s_matchkey_list) {
-
                     //定位button 添加属性
                     $("#btnGroupMatch").find("input").each(function () {
-
-
                         if ($(this).attr("code") == s_matchkey_list[index_]) {
                             if (matchCode.indexOf(s_matchkey_list[index_]) == -1) {
                                 $(this).addClass("active-btn-match");
-
                                 matchCode.push($(this).attr("code"));
                                 matchName.push($(this).val())
                             }
                         }
-
                     });
                     $("#btnGroupMatch2").find("input").each(function () {
-
-
                         if ($(this).attr("code") == s_matchkey_list[index_]) {
                             if (matchCode.indexOf(s_matchkey_list[index_]) == -1) {
                                 $(this).addClass("active-btn-match");
@@ -923,11 +919,8 @@
                                 matchName.push($(this).val())
                             }
                         }
-
                     });
-
                 }
-
             }
             $('#modal-select-match').modal("show");
         } else {
@@ -939,114 +932,79 @@
                     if (s_matchkey_str) {
                         s_matchkey_list = s_matchkey_str.split(",")
                         for (index_ in s_matchkey_list) {
-
                             //定位button 添加属性
                             $("#btnGroupMatch").find("input").each(function () {
                                 if ($(this).attr("code") == s_matchkey_list[index_]) {
                                     if (matchCode.indexOf(s_matchkey_list[index_]) == -1) {
                                         $(this).addClass("active-btn-match");
-
                                         matchCode.push($(this).attr("code"));
                                         matchName.push($(this).val())
                                     }
                                 }
-
                             });
 
                             $("#btnGroupMatch2").find("input").each(function () {
                                 if ($(this).attr("code") == s_matchkey_list[index_]) {
                                     if (matchCode.indexOf(s_matchkey_list[index_]) == -1) {
                                         $(this).addClass("active-btn-match");
-
                                         matchCode.push($(this).attr("code"));
                                         matchName.push($(this).val())
                                     }
                                 }
-
                             });
-
-
                         }
-
                     }
-
-
                 } else if (val == 6) {
                     s_matchkey_str = o_rules[selectIndex[0] - 1]["s_addkeymatch"]
                     if (s_matchkey_str) {
-
                         s_matchkey_list = s_matchkey_str.split(",")
-
                         for (index_ in s_matchkey_list) {
-
                             //定位button 添加属性
                             $("#btnGroupMatch").find("input").each(function () {
-
-
                                 if ($(this).attr("code") == s_matchkey_list[index_]) {
                                     if (matchCode.indexOf(s_matchkey_list[index_]) == -1) {
                                         $(this).addClass("active-btn-match");
-
                                         matchCode.push($(this).attr("code"));
                                         matchName.push($(this).val())
                                     }
                                 }
-
                             });
                             $("#btnGroupMatch2").find("input").each(function () {
-
-
                                 if ($(this).attr("code") == s_matchkey_list[index_]) {
                                     if (matchCode.indexOf(s_matchkey_list[index_]) == -1) {
                                         $(this).addClass("active-btn-match");
-
                                         matchCode.push($(this).attr("code"));
                                         matchName.push($(this).val())
                                     }
                                 }
-
                             });
-
                         }
-
                     }
-
-
                 } else if (val == 8) {
                     s_matchkey_str = o_rules[selectIndex[0] - 1]["s_notkeymatch"]
                     if (s_matchkey_str) {
-
                         s_matchkey_list = s_matchkey_str.split(",")
-
                         for (index_ in s_matchkey_list) {
                             //定位button 添加属性
                             $("#btnGroupMatch").find("input").each(function () {
-
-
                                 if ($(this).attr("code") == s_matchkey_list[index_]) {
                                     if (matchCode.indexOf(s_matchkey_list[index_]) == -1) {
                                         $(this).addClass("active-btn-match");
-
                                         matchCode.push($(this).attr("code"));
                                         matchName.push($(this).val())
                                     }
                                 }
-
                             });
                             $("#btnGroupMatch2").find("input").each(function () {
                                 if ($(this).attr("code") == s_matchkey_list[index_]) {
                                     if (matchCode.indexOf(s_matchkey_list[index_]) == -1) {
                                         $(this).addClass("active-btn-match");
-
                                         matchCode.push($(this).attr("code"));
                                         matchName.push($(this).val())
                                     }
                                 }
-
                             });
-
                         }
-
                     }
                 }
                 $('#modal-select-match').modal("show");
@@ -1625,6 +1583,16 @@
                 budget = budget + ",小于" + $('#s_budget_max').val()
             }
         }
+
+        if (budget !== "") {
+            if ($('#budgetExist').prop('checked')) {
+                dataMap["i_budgetfieldexist"] = 1
+            } else {
+                dataMap["i_budgetfieldexist"] = 0
+            }
+        } else {
+            dataMap["i_budgetfieldexist"] = 0
+        }
         dataMap["s_budgetlimit"] = budget;
         var bidamount = "";
         if ($('#s_bidamount_min').val() != "") {

+ 24 - 7
src/web/templates/private/cuser_rule_history_edit.html

@@ -237,21 +237,25 @@
                                     <hr>
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label">预算限制</label>
-                                        <div class="col-sm-3">
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_budget_min" placeholder="单位:元/大于">
                                         </div>
-                                        <label class="col-sm-2" style="text-align: center">___ ___</label>
-                                        <div class="col-sm-3">
+                                        <label class="col-sm-1" style="text-align: center">___ ___</label>
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_budget_max" placeholder="单位:元/小于">
                                         </div>
+                                        <label class="col-sm-2 control-label">预算不存在</label>
+                                        <div class="col-sm-1">
+                                            <input style="margin-top: 10px;" type="checkbox" id="budgetExist">
+                                        </div>
                                     </div>
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label">中标金额限制</label>
-                                        <div class="col-sm-3" id="bidamountDiv">
+                                        <div class="col-sm-2" id="bidamountDiv">
                                             <input class="form-control" type="text" id="s_bidamount_min" placeholder="单位:元/大于">
                                         </div>
-                                        <label class="col-sm-2" style="text-align: center">___ ___</label>
-                                        <div class="col-sm-3">
+                                        <label class="col-sm-1" style="text-align: center">___ ___</label>
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_bidamount_max" placeholder="单位:元/小于">
                                         </div>
                                     </div>
@@ -467,6 +471,10 @@
             $('#existFieldSelect')[0].appendChild(opt)
         }
         $("#existFieldSelect").selectpicker("refresh");
+        if (dataMap.i_budgetfieldexist === 1) {
+            $("#budgetExist").attr("checked", true)
+        }
+
         var btnMatchHtml1 = "";
         var btnMatchHtml2 = "";
         for (var i in matchTypeMap) {
@@ -1377,7 +1385,16 @@
                 budget = budget + ",小于" + $('#s_budget_max').val()
             }
         }
-        dataMap["s_budgetlimit"] = budget
+        dataMap["s_budgetlimit"] = budget;
+        if (budget !== "") {
+            if ($('#budgetExist').prop('checked')) {
+                dataMap["i_budgetfieldexist"] = 1
+            } else {
+                dataMap["i_budgetfieldexist"] = 0
+            }
+        } else {
+            dataMap["i_budgetfieldexist"] = 0
+        }
         var bidamount = "";
         if ($('#s_bidamount_min').val() != "") {
             bidamount = "大于" + $('#s_bidamount_min').val()

+ 13 - 6
src/web/templates/private/euser_rule_edit.html

@@ -123,21 +123,25 @@
                                     <hr>
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label">预算限制</label>
-                                        <div class="col-sm-3">
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_budget_min" placeholder="单位:元/大于" onkeyup="limitNum(this)" disabled />
                                         </div>
-                                        <label class="col-sm-2" style="text-align: center">___ ___</label>
-                                        <div class="col-sm-3">
+                                        <label class="col-sm-1" style="text-align: center">___ ___</label>
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_budget_max" placeholder="单位:元/小于" onkeyup="limitNum(this)"disabled />
                                         </div>
+                                        <label class="col-sm-2 control-label">预算不存在</label>
+                                        <div class="col-sm-1">
+                                            <input style="margin-top: 10px;" type="checkbox" id="budgetExist" onclick="return false;">
+                                        </div>
                                     </div>
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label">中标金额限制</label>
-                                        <div class="col-sm-3" id="bidamountDiv">
+                                        <div class="col-sm-2" id="bidamountDiv">
                                             <input class="form-control" type="text" id="s_bidamount_min" placeholder="单位:元/大于" onkeyup="limitNum(this)" disabled />
                                         </div>
-                                        <label class="col-sm-2" style="text-align: center">___ ___</label>
-                                        <div class="col-sm-3">
+                                        <label class="col-sm-1" style="text-align: center">___ ___</label>
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_bidamount_max" placeholder="单位:元/小于" onkeyup="limitNum(this)" disabled />
                                         </div>
                                     </div>
@@ -455,6 +459,9 @@
         $('#existFieldSelect').attr("value",existField)
         $("#infoType").selectpicker("refresh");
         // $("#existFieldSelect").selectpicker("refresh");
+        if (dataMap.i_budgetfieldexist === 1) {
+            $("#budgetExist").attr("checked", true)
+        }
 
         //匹配方式
         var btnMatchHtml1 = "";

+ 22 - 6
src/web/templates/private/history_rule_edit.html

@@ -246,21 +246,25 @@
                                     <hr>
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label">预算限制</label>
-                                        <div class="col-sm-3">
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_budget_min" placeholder="单位:元/大于" onkeyup="limitNum(this)">
                                         </div>
-                                        <label class="col-sm-2" style="text-align: center">___ ___</label>
-                                        <div class="col-sm-3">
+                                        <label class="col-sm-1" style="text-align: center">___ ___</label>
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_budget_max" placeholder="单位:元/小于" onkeyup="limitNum(this)">
                                         </div>
+                                        <label class="col-sm-2 control-label">预算不存在</label>
+                                        <div class="col-sm-1">
+                                            <input style="margin-top: 10px;" type="checkbox" id="budgetExist">
+                                        </div>
                                     </div>
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label">中标金额限制</label>
-                                        <div class="col-sm-3" id="bidamountDiv">
+                                        <div class="col-sm-2" id="bidamountDiv">
                                             <input class="form-control" type="text" id="s_bidamount_min" placeholder="单位:元/大于" onkeyup="limitNum(this)">
                                         </div>
-                                        <label class="col-sm-2" style="text-align: center">___ ___</label>
-                                        <div class="col-sm-3">
+                                        <label class="col-sm-1" style="text-align: center">___ ___</label>
+                                        <div class="col-sm-2">
                                             <input class="form-control" type="text" id="s_bidamount_max" placeholder="单位:元/小于" onkeyup="limitNum(this)">
                                         </div>
                                     </div>
@@ -550,6 +554,9 @@
         }
         $("#infoType").selectpicker("refresh");
         $("#existFieldSelect").selectpicker("refresh");
+        if (dataMap.i_budgetfieldexist === 1) {
+            $("#budgetExist").attr("checked", true)
+        }
 
         //匹配方式
         var btnMatchHtml1 = "";
@@ -1528,6 +1535,15 @@
             }
         }
         dataMap["s_budgetlimit"] = budget;
+        if (budget !== "") {
+            if ($('#budgetExist').prop('checked')) {
+                dataMap["i_budgetfieldexist"] = 1
+            } else {
+                dataMap["i_budgetfieldexist"] = 0
+            }
+        } else {
+            dataMap["i_budgetfieldexist"] = 0
+        }
         var bidamount = "";
         if ($('#s_bidamount_min').val() != "") {
             bidamount = "大于" + $('#s_bidamount_min').val()