Jianghan преди 5 години
родител
ревизия
5ec5a27116

+ 22 - 10
src/models/rules_es.go

@@ -20,8 +20,8 @@ type AreaCityDistrictMust struct {
 
 //省市县
 type AreaCityDistrict struct {
-	Area []string `json:"area,omitempty"`
-	City []string `json:"city,omitempty"`
+	Area     []string `json:"area,omitempty"`
+	City     []string `json:"city,omitempty"`
 	District []string `json:"district,omitempty"`
 }
 
@@ -43,12 +43,17 @@ type ToptypeSubtype struct {
 	Subtype []string `json:"subtype,omitempty"`
 }
 
+//一级公告类型
+//type ScopeclassMust1 struct {
+//	*Scopeclass `json:"prefix,omitempty"`
+//}
+
 //公告类型
 type ScopeclassMust struct {
 	*Scopeclass `json:"terms,omitempty"`
 }
 type Scopeclass struct {
-	Globaltopscopeclass []string `json:"s_topscopeclass,omitempty"`
+	Globaltopscopeclass []string `json:"topscopeclass,omitempty"`
 	Globalsubscopeclass []string `json:"s_subscopeclass,omitempty"`
 }
 
@@ -77,7 +82,7 @@ type PublishtimeMust struct {
 //时间范围
 type PublishtimeObject struct {
 	//查询时间
-	Publishtime *Publishtime `json:"publishtime,omitempty"`
+	Publishtime  *Publishtime  `json:"publishtime,omitempty"`
 	Publishtime1 *Publishtime1 `json:"publishtime1,omitempty"`
 	Publishtime2 *Publishtime2 `json:"publishtime2,omitempty"`
 }
@@ -91,8 +96,9 @@ type Publishtime1 struct {
 	Gte int `json:"gte"`
 }
 type Publishtime2 struct {
-	Lt  int `json:"lt"`
+	Lt int `json:"lt"`
 }
+
 //字段是或否存在
 type ExistfieldsObjectMust struct {
 	ExistfieldsObject *ExistfieldsObject `json:"constant_score,omitempty"`
@@ -128,15 +134,15 @@ type MultiMatch struct {
 }
 
 //匹配方式 采购单位、中标单位 正则匹配
-type Regular struct{
-	Regexp1 *Regular_Buyer	`json:"regexp1,omitempty"`
-	Regexp2 *Regular_winner	`json:"regexp2,omitempty"`
+type Regular struct {
+	Regexp1 *Regular_Buyer  `json:"regexp1,omitempty"`
+	Regexp2 *Regular_winner `json:"regexp2,omitempty"`
 }
 type Regular_Buyer struct {
-	Buyer		string	`json:"buyer,omitempty"`
+	Buyer string `json:"buyer,omitempty"`
 }
 type Regular_winner struct {
-	Winner		string	`json:"s_winner,omitempty"`
+	Winner string `json:"s_winner,omitempty"`
 }
 
 //排除词 must_not
@@ -152,6 +158,12 @@ type BuyerclassObject struct {
 	} `json:"terms,omitempty"`
 }
 
+type TopscopeclassObject struct {
+	Terms struct {
+		Topscopeclass []string `json:"topscopeclass,omitempty"`
+	} `json:"terms,omitempty"`
+}
+
 //公告行业二级 should
 type SubscopeclassObject struct {
 	Terms struct {

+ 38 - 7
src/service/common_rule.go

@@ -20,12 +20,12 @@ import (
 type CommonRule struct {
 	*xweb.Action
 	//rule
-	ruleList   xweb.Mapper `xweb:"/service/common_rule/list"`   //标签列表
-	ruleCreate xweb.Mapper `xweb:"/service/common_rule/create"` //新建标签
-	ruleDel    xweb.Mapper `xweb:"/service/common_rule/del"`    //删除标签
-	ruleEdit   xweb.Mapper `xweb:"/service/common_rule/edit"`   //编辑标签
-	ruleSave   xweb.Mapper `xweb:"/service/common_rule/save"`   //保存标签
-
+	ruleList     xweb.Mapper `xweb:"/service/common_rule/list"`         //标签列表
+	ruleCreate   xweb.Mapper `xweb:"/service/common_rule/create"`       //新建标签
+	ruleDel      xweb.Mapper `xweb:"/service/common_rule/del"`          //删除标签
+	ruleEdit     xweb.Mapper `xweb:"/service/common_rule/edit"`         //编辑标签
+	ruleSave     xweb.Mapper `xweb:"/service/common_rule/save"`         //保存标签
+	archive      xweb.Mapper `xweb:"/service/common_rule/archive"`             //存档
 	productData  xweb.Mapper `xweb:"/service/common_rule/produce"`      //生成预览数据
 	downloadData xweb.Mapper `xweb:"/service/common_rule/downloadata"`  //下载数据
 	downloadRule xweb.Mapper `xweb:"/service/common_rule/downloadrule"` //下载标签
@@ -271,6 +271,37 @@ func (r *CommonRule) ProductData() {
 		})
 	}
 }
+
+func (r *CommonRule) Archive() {
+	defer qu.Catch()
+	if r.Method() == "POST" {
+		rep := false
+		_id := r.GetString("_id")
+		query := bson.M{
+			"_id": qu.StringTOBsonId(_id),
+		}
+		tag, _ := Mgo.FindOne("tags_common", query)
+		if len(*tag) > 0 {
+			user := r.GetSession("user").(map[string]interface{})
+			histoty, _ := Mgo.FindOne("tags_history", `{"s_tagid":"`+_id+`"}`)
+			s_state := "创建"
+			if len(*histoty) > 0 { //该id已有记录
+				s_state = "变更"
+			}
+			(*tag)["s_tagid"] = _id                    //tags表id
+			(*tag)["s_state"] = s_state                //状态
+			(*tag)["l_changetime"] = time.Now().Unix() //变更时间
+			(*tag)["s_changeperson"] = user["name"]
+			id := Mgo.Save("tags_history", tag)
+			if id != "" {
+				rep = true
+			}
+		}
+		r.ServeJson(map[string]interface{}{
+			"rep": rep,
+		})
+	}
+}
 func (r *CommonRule) DownloadData() {
 	defer qu.Catch()
 	dataId := r.GetString("s_dataid")
@@ -288,7 +319,7 @@ func (r *CommonRule) DownloadData() {
 func (r *CommonRule) DownloadRule() {
 	defer qu.Catch()
 	id := r.GetString("id")
-	path := ResponseXlsx_Rule(id)
+	path := ResponseXlsx_Rule(id, "common")
 	if path == "" {
 		r.ServeJson("没有数据")
 	} else {

+ 1 - 1
src/service/private_rule.go

@@ -379,7 +379,7 @@ func (r *Rule) DownloadData() {
 func (r *Rule) DownloadRule() {
 	defer qu.Catch()
 	id := r.GetString("id")
-	path := ResponseXlsx_Rule(id)
+	path := ResponseXlsx_Rule(id, "private")
 	if path == "" {
 		r.ServeJson("没有数据")
 	} else {

+ 8 - 1
src/service/private_service.go

@@ -37,12 +37,19 @@ func (f *Private) Keydatademo(world string) {
 	log.Println(world) //RVpIW1JNBAEHAwwXCF8dDEoC
 	tmp := make(map[string]interface{})
 	destr := qu.SE.DecodeString(world)
+	typeStr := f.GetString("type")
+
 	log.Println(destr)
 	if len(destr) > 10 {
 		ctime := destr[:10]
 		ctimeint := qu.Int64All(ctime)
 		if time.Now().Sub(time.Unix(ctimeint, 0)).Hours()/24 < Subday {
-			tagfield, _ := Mgo.FindOneByField("tags", bson.M{"s_dataid": world}, bson.M{"i_extfieldstype": 1, "i_estotal": 1, "s_customer": 1})
+			var tagfield *map[string]interface{}
+			if typeStr == "private" {
+				tagfield, _ = Mgo.FindOneByField("tags", bson.M{"s_dataid": world}, bson.M{"i_extfieldstype": 1, "i_estotal": 1, "s_customer": 1})
+			}else {
+				tagfield, _ = Mgo.FindOneByField("tags_common", bson.M{"s_dataid": world}, bson.M{"i_extfieldstype": 1, "i_estotal": 1, "s_customer": 1})
+			}
 			if (*tagfield) != nil && len(*tagfield) > 0 {
 				if qu.Int64All((*tagfield)["i_extfieldstype"]) == Standard {
 					tmp["fieldtype"] = Standardstr

+ 8 - 3
src/util/parsxlsx.go

@@ -23,7 +23,7 @@ const (
 )
 
 //通用标签相关字段
-var export_fields = []string{"s_customer", "", "s_area", "s_city", "s_district", "s_toptype", "s_subtype", "i_starttime", "i_endtime", "s_budgetlimit", "s_bidamountlimit", "s_globaltopscopeclass", "s_globalsubscopeclass", "s_globalbuyerclass", "s_globaladdkey", "s_globaladdkeymatch", "s_globalnotkey", "s_globalnotkeymatch", "s_existfields", "i_extfieldstype"}
+var export_fields = []string{"s_customer", "s_tagname", "", "s_area", "s_city", "s_district", "s_toptype", "s_subtype", "i_starttime", "i_endtime", "s_budgetlimit", "s_bidamountlimit", "s_globaltopscopeclass", "s_globalsubscopeclass", "s_globalbuyerclass", "s_globaladdkey", "s_globaladdkeymatch", "s_globalnotkey", "s_globalnotkeymatch", "s_existfields", "i_extfieldstype"}
 
 //关键词标签相关字段
 var export_o_rules = []string{"s_matchkey", "s_keymatch", "s_addkey", "s_addkeymatch", "s_notkey", "s_notkeymatch", "s_buyerclass"}
@@ -275,9 +275,14 @@ func ResponseXlsx_Data(id string) string {
 	return ""
 }
 
-func ResponseXlsx_Rule(id string) string {
+func ResponseXlsx_Rule(id, s string) string {
 	defer util.Catch()
-	data, _ := Mgo.FindById("tags", id, `{}`)
+	var data *map[string]interface{}
+	if s == "private" {
+		data, _ = Mgo.FindById("tags", id, `{}`)
+	}else {
+		data, _ = Mgo.FindById("tags_common", id, `{}`)
+	}
 	if len(*data) == 0 {
 		return ""
 	}

+ 28 - 5
src/util/utiltag.go

@@ -196,7 +196,9 @@ func Utiltags(tag map[string]interface{}) string {
 		}
 		adsBoolObect.Bool.Should = append(adsBoolObect.Bool.Should, models.AreaCityDistrictMust{AreaCityDistrict: &models.AreaCityDistrict{District: ds}})
 	}
-	ffBoolObject.Must = append(ffBoolObject.Must, adsBoolObect)
+	if len(adsBoolObect.Bool.Should) > 0 {
+		ffBoolObject.Must = append(ffBoolObject.Must, adsBoolObect)
+	}
 	if tab.Stoptype != "" || tab.Ssubtype != "" {
 		if len(tab.Stoptype) > 0 {
 			toptypeSubtype := models.ToptypeSubtype{}
@@ -278,10 +280,9 @@ func Utiltags(tag map[string]interface{}) string {
 	if tab.Sglobaltopscopeclass != "" || tab.Sglobalsubscopeclass != "" {
 		if len(tab.Sglobaltopscopeclass) > 0 {
 			topScopeclass := models.Scopeclass{}
-			topScopeclass.Globaltopscopeclass = strings.Split(tab.Sglobaltopscopeclass, ",")
+			topScopeclass.Globaltopscopeclass = method3(strings.Split(tab.Sglobaltopscopeclass, ","))
 			ffBoolObject.Must = append(ffBoolObject.Must, models.ScopeclassMust{&topScopeclass})
-		}
-		if len(tab.Sglobalsubscopeclass) > 0 {
+		}else if len(tab.Sglobalsubscopeclass) > 0 {
 			subScopeclass := models.Scopeclass{}
 			subScopeclass.Globalsubscopeclass = strings.Split(tab.Sglobalsubscopeclass, ",")
 			ffBoolObject.Must = append(ffBoolObject.Must, models.ScopeclassMust{&subScopeclass})
@@ -345,7 +346,16 @@ func Utiltags(tag map[string]interface{}) string {
 		if snotkeymatchs := strsToArr(v.Snotkeymatch, "str"); snotkeymatchs != nil {
 			tmpses = method2(tmpses, v.Snotkey, v.Snotkeymatch, snotkeymatchs)
 		}
-		if len(v.Ssubscopeclass) > 0 {
+		if len(v.Stopscopeclass) > 0 {
+			sArr := method3(strings.Split(v.Stopscopeclass, ","))
+			tmpses.Bool.Must = append(tmpses.Bool.Must, models.TopscopeclassObject{
+				Terms: struct {
+					Topscopeclass []string `json:"topscopeclass,omitempty"`
+				}{
+					Topscopeclass: sArr,
+				},
+			})
+		}else if len(v.Ssubscopeclass) > 0 {
 			tmpses.Bool.Must = append(tmpses.Bool.Must, models.SubscopeclassObject{
 				Terms: struct {
 					Subscopeclass []string `json:"s_subscopeclass,omitempty"`
@@ -565,4 +575,17 @@ func method2(newEsObject models.NewEsObject, keyword, keymatch string, tmps []st
 		}
 	}
 	return newEsObject
+}
+
+/**
+ * 一级公告行业处理 d、t、p
+ */
+func method3(arr []string) []string {
+	var sArr []string
+	for _, v := range arr{
+		sArr = append(sArr, v + "d")
+		sArr = append(sArr, v + "t")
+		sArr = append(sArr, v + "p")
+	}
+	return sArr
 }

BIN
src/web/res/export_rule.xlsx


+ 310 - 238
src/web/templates/com/modal.html

@@ -185,7 +185,7 @@
                                               id="keyword_txt"></textarea></div>
                             </div>
                             <div class="form-group">
-                                <label class="col-sm-2 control-label">附词</label>
+                                <label class="col-sm-2 control-label">附词</label>
                                 <div class="col-sm-10">
                                     <textarea class="form-control" style="max-width: 100%" placeholder="输入附件词"
                                               id="addword_txt"></textarea></div>
@@ -260,133 +260,205 @@
 
 <!-- 通用标签modal -->
 <div class="modal fade" id="modal-comrule" tabindex="-1" role="dialog" aria-hidden="true">
-	<div class="modal-dialog" style="width: 80%">
-		<div class="modal-content">
-    <div class="modal-header">
-				<div class="modal-header">
-					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
-					<div class="edit-form">
-						<div class="edit-info">
-							<span class="info"><i class="fa fa-fw fa-tags fa-lg"></i>通用标签</span>
-              <button class="btn btn-sm btn-success" style="margin-left:12px;margin-top: -3px;" onclick="addcomrule()"><i class="fa fa-fw fa-check-square fa-lg"></i>新增标签
-                </button>
-						</div>
-						<div class="content">
-							<table id="comrule" class="table table-bordered" style="white-space: nowrap;width:100%">
-								<thead>
-								<tr>
-                  <th>编号</th>
-                  <th><input type="checkbox" id="selrow" onclick="selectrow(this)"/></th>
-									<th>标签名称</th>
-                  <th>附加词类型</th>
-                  <th>排除词类型</th>
-									<th>创建时间</th>
-                  <th>创建人</th>
-								</tr>
-								</thead>
-							</table>
-						</div>
-					</div>
-			</div>
-		</div>
-    </div>
-	</div><!-- /.modal -->
+    <div class="modal-dialog" style="width: 80%">
+        <div class="modal-content">
+            <div class="modal-header">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                    <div class="edit-form">
+                        <div class="edit-info">
+                            <span class="info"><i class="fa fa-fw fa-tags fa-lg"></i>通用标签</span>
+                            <button class="btn btn-sm btn-success" style="margin-left:12px;margin-top: -3px;"
+                                    onclick="addcomrule()"><i class="fa fa-fw fa-check-square fa-lg"></i>新增标签
+                            </button>
+                        </div>
+                        <div class="content">
+                            <table id="comrule" class="table table-bordered">
+                                <thead>
+                                <tr>
+                                    <th>编号</th>
+                                    <th><input type="checkbox" id="selrow" onclick="selectrow(this)"/></th>
+                                    <th>标签名称</th>
+                                    <th>附加词类型</th>
+                                    <th>排除词类型</th>
+                                    <th>采购单位行业</th>
+                                    <th>公告行业</th>
+                                    <th>创建时间</th>
+                                    <th>创建人</th>
+                                </tr>
+                                </thead>
+                            </table>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div><!-- /.modal -->
 </div>
 
 <script>
-  //通用标签列表
-  function importcomrule(){
-    comruletable=$('#comrule').DataTable({
-      "destroy": true,
-      "paging": true,
-      "lengthChange": false,
-      "searching": true,
-      "ordering": false,
-      "info": true,
-      "autoWidth": false,
-      "serverSide": true,
-      "ajax": {
-          url: "/service/common_rule/list",
-          type: "post",
-          data: {},
-      },
-      "language": {
-          "url": "/dist/js/dataTables.chinese.lang"
-      },
-      "fnDrawCallback": function () {
-          $("ul.pagination").prepend("&nbsp;&nbsp;&nbsp;转到第 <input type='text' id='changePage_comrule'   style='width:20px;'> 页    <a type='text' href='javascript:void(0);' id='dataTable-comrule' style='text-align:center'>GO</a>");
-          $('#dataTable-comrule').click(function (e) {
-              var redirectpage = 0
-              if ($("#changePage_comrule").val() && $("#changePage_comrule").val() > 0) {
-                  var redirectpage = $("#changePage_comrule").val() - 1;
-              }
-              comruletable.page(redirectpage).draw(false);
-          });
-          this.api().column(0).nodes().each(function (cell, i) {
-              cell.innerHTML = i + 1;
-          });
-      },
-      "columns": [
-          {"data": null, width: "1%"},
-          {"data": "_id", width: "1%", render: function(val,a,row) {
-                  return "<input type='checkbox' value='"+val+"' addkeytype='"+row.i_globaladdkeytype+"' notkeytype='"+row.i_globalnotkeytype+"' style='text-align: center'/>"
-              }},
-         {"data": "s_tagname"},
-         {"data": "i_globaladdkeytype"},
-         {"data": "i_globalnotkeytype"},
-         {"data": "i_createtime", render: function (val) {
-            var dt = new Date()
-            dt.setTime(parseInt(val) * 1000)
-            return dt.format("yyyy-MM-dd hh:mm:ss")
-          }},
-         {"data": "s_createuser"}
-      ]
-    })
-    $("#modal-comrule").modal("show");
-  }
-
-  //新增通用标签
-  function addcomrule(){
-		var ids=[];
-    var type1map={};
-    var type2map={};
-    //在编辑追加的时候考虑在编标签和通用标签匹配方式类型的一致性
-    //if(dataMap.i_globaladdkeytype != undefined){
-    //  type1map[dataMap.i_globaladdkeytype+""] =true;
-    //}else if(dataMap.i_globalnotkeytype != undefined){
-    //   type2map[dataMap.i_globalnotkeytype+""] =true;
-    //}
-		$("#comrule_wrapper td input[type=checkbox]").each(function(){
-			if($(this).prop("checked")){
-				ids.push($(this).val());
-        var type1 = $(this).attr("addkeytype");
-        type1map[type1] =true;
-        var type2 = $(this).attr("notkeytype");
-        type2map[type2] =true;
-			}
-		});
-    if(Object.keys(type1map).length ==2){
-      alert("附加词类型不完全一致")
-      return
-    }else if(Object.keys(type2map).length == 2){
-      alert("排除词类型不完全一致")
-      return
+    //通用标签列表
+    function importcomrule() {
+        comruletable = $('#comrule').DataTable({
+            "destroy": true,
+            "paging": true,
+            "lengthChange": false,
+            "searching": true,
+            "ordering": false,
+            "info": true,
+            "autoWidth": false,
+            "serverSide": true,
+            "ajax": {
+                url: "/service/common_rule/list",
+                type: "post",
+                data: {},
+            },
+            "language": {
+                "url": "/dist/js/dataTables.chinese.lang"
+            },
+            "fnDrawCallback": function () {
+                $("ul.pagination").prepend("&nbsp;&nbsp;&nbsp;转到第 <input type='text' id='changePage_comrule'   style='width:20px;'> 页    <a type='text' href='javascript:void(0);' id='dataTable-comrule' style='text-align:center'>GO</a>");
+                $('#dataTable-comrule').click(function (e) {
+                    var redirectpage = 0
+                    if ($("#changePage_comrule").val() && $("#changePage_comrule").val() > 0) {
+                        var redirectpage = $("#changePage_comrule").val() - 1;
+                    }
+                    comruletable.page(redirectpage).draw(false);
+                });
+                this.api().column(0).nodes().each(function (cell, i) {
+                    cell.innerHTML = i + 1;
+                });
+            },
+            "columns": [
+                {"data": null},
+                {"data": "_id", width: "1%", render: function (val, a, row) {
+                        return "<input type='checkbox' value='" + val + "' addkeytype='" + row.i_globaladdkeytype + "' notkeytype='" + row.i_globalnotkeytype + "' style='text-align: center'/>"
+                    }
+                },
+                {"data": "s_tagname"},
+                {"data": "i_globaladdkeytype"},
+                {"data": "i_globalnotkeytype"},
+                {"data": "s_globalbuyerclass", render: function (val) {
+                        if (val && val != "") {
+                            return val
+                        } else {
+                            return ""
+                        }
+                    }, width: "18%"},
+                {"data": function (row) {
+                        if (row.s_globaltopscopeclass && row.s_globaltopscopeclass != "") {
+                            return row.s_globaltopscopeclass
+                        } else if (row.s_globalsubscopeclass && row.s_globalsubscopeclass != "") {
+                            return row.s_globalsubscopeclass
+                        } else {
+                            return ""
+                        }
+                    }, width: "18%"},
+                {"data": "i_createtime", render: function (val) {
+                        var dt = new Date();
+                        dt.setTime(parseInt(val) * 1000);
+                        return dt.format("yyyy-MM-dd")
+                    }
+                },
+                {"data": "s_createuser"}
+            ],
+            "columnDefs": [{
+                "targets": [5],
+                "render": function (data, type, full, meta) {
+                    if (data && data.length > 24) {
+                        return "<a title='" + data + "' href='#' style='text-decoration: none;'>" + data.trim().substr(0, 24) + "..." + "</a>";
+                    } else if (data == undefined) {
+                        return ""
+                    } else {
+                        return data
+                    }
+                }
+            }, {
+                "targets": [6],
+                "render": function (data, type, full, meta) {
+                    if (data && data.length > 24) {
+                        return "<a title='" + data + "' href='#' style='text-decoration: none;'>" + data.trim().substr(0, 24) + "..." + "</a>";
+                    } else if (data == undefined) {
+                        return ""
+                    } else {
+                        return data
+                    }
+                }
+            }
+            ]
+        });
+        $("#modal-comrule").modal("show");
     }
-    if(ids.length > 0){
-      showConfirm("确定新增标签?", function() {
-				$.post("/service/rule/importcomrule",{"ids":ids.join(","),"tagid":dataMap._id},function(d){
-          if(d&&d.rep){
-            $("#modal-comrule").modal("hide");
-            addcomdata(d);
-          }else{
-            showTip("新增失败",1000);
-          }
-				})
-			})
-    }else{
-      alert("请选中标签!");
+
+    //新增通用标签
+    function addcomrule() {
+        var ids = [];
+        var type1map = {};
+        var type2map = {};
+        var buyerArr = [];
+        var topScopeArr = [];
+        var subScopeArr = [];
+        var table = $('#comrule').dataTable();
+        var nTrs = table.fnGetNodes();
+        for (var i = 0; i < nTrs.length; i++) {
+            if ($(nTrs[i].childNodes[1]).find("input").prop("checked")) {
+                ids.push(table.fnGetData(nTrs[i])._id);
+                var type1 = table.fnGetData(nTrs[i]).i_globaladdkeytype;
+                type1map[type1] = true;
+                var type2 = table.fnGetData(nTrs[i]).i_globalnotkeytype;
+                type2map[type2] = true;
+
+                buyerArr.push(table.fnGetData(nTrs[i]).s_globalbuyerclass);
+                topScopeArr.push(table.fnGetData(nTrs[i]).s_globaltopscopeclass);
+                subScopeArr.push(table.fnGetData(nTrs[i]).s_globalsubscopeclass);
+            }
+        }
+        if (buyerArr.length > 0) {
+            if (buyerArr.some(function (value, index) {
+                return value !== buyerArr[0];
+            })) {
+                alert("采购单位行业不一致");
+                return
+            }
+        }
+        if (topScopeArr.length > 0) {
+            if (topScopeArr.some(function (value, index) {
+                return value !== topScopeArr[0];
+            })) {
+                alert("公告行业不一致");
+                return
+            }
+        }else if (subScopeArr.length > 0) {
+            if (subScopeArr.some(function (value, index) {
+                return value !== subScopeArr[0];
+            })) {
+                alert("公告行业不一致");
+                return
+            }
+        }
+        if (Object.keys(type1map).length == 2) {
+            alert("附加词类型不完全一致");
+            return
+        } else if (Object.keys(type2map).length == 2) {
+            alert("排除词类型不完全一致");
+            return
+        }
+        if (ids.length > 0) {
+            showConfirm("确定新增标签?", function () {
+                $.post("/service/rule/importcomrule", {"ids": ids.join(","), "tagid": dataMap._id}, function (d) {
+                    if (d && d.rep) {
+                        $("#modal-comrule").modal("hide");
+                        addcomdata(d);
+                    } else {
+                        showTip("新增失败", 1000);
+                    }
+                })
+            })
+        } else {
+            alert("请选中标签!");
+        }
     }
-  }
+
     //选择器
     function selectrow(me) {
         var sel = $(me);
@@ -413,123 +485,123 @@
     function cancelModel1() {
         $('#modal-add-keyword').modal('hide')
     }
-    
+
     //追加通用标签数据
-    function addcomdata(d){
-      /*
-      //province赋值
-      if(d.data.s_area != undefined){
-        $("#province").find("option").each(function(){
-          if(d.data.s_area.indexOf($(this).val()) != -1){
-            $(this).attr("selected",true);
-          }
-        })
-        $("#province").selectpicker("refresh");//刷新select框
-        dataMap.s_area = d.data.s_area;
-      }
-      //city赋值
-      if(d.data.s_city != undefined){
-        $("#city").find("option").each(function(){
-          if(d.data.s_city.indexOf($(this).val()) != -1){
-            $(this).attr("selected",true);
-          }
-        })
-        $("#city").selectpicker("refresh");//刷新select框
-         dataMap.s_city = d.data.s_city;
-      }
-      //district赋值
-      if(d.data.s_district != undefined){
-        $("#district").find("option").each(function(){
-          if(d.data.s_district.indexOf($(this).val()) != -1){
-            $(this).attr("selected",true);
-          }
-        })
-        $("#district").selectpicker("refresh");//刷新select框
-        dataMap.s_district = d.data.s_district;
-      }
-      //一级公告类别赋值
-      if(d.data.s_toptype != undefined){
-        $("#topTypeSelect").find("option").each(function(){
-          if(d.data.s_toptype.indexOf($(this).val()) != -1){
-            $(this).attr("selected",true);
-          }
-        })
-        $("#topTypeSelect").selectpicker("refresh");//刷新select框
-         dataMap.s_toptype = d.data.s_toptype;
-      }
-      //二级公告类别赋值
-      if(d.data.s_subtype != undefined){
-        $("#subTypeSelect").find("option").each(function(){
-          if(d.data.s_subtype.indexOf($(this).val()) != -1){
-            $(this).attr("selected",true);
-          }
-        })
-        $("#subTypeSelect").selectpicker("refresh");//刷新select框
-         dataMap.s_subtype = d.data.s_subtype;
-      }
-      //选择字段
-      if(d.data.s_existfields != undefined){
-        $("#existFieldSelect").find("option").each(function(){
-          if(d.data.s_existfields.indexOf($(this).val()) != -1){
-            $(this).attr("selected",true);
-          }
-        })
-        $("#existFieldSelect").selectpicker("refresh");//刷新select框
-         dataMap.s_existfields = d.data.s_existfields;
-      }
-      */
-      //全局附加词
-      if(d.data.s_globaladdkey != undefined){
-        $("#g_addkey").val(d.data.s_globaladdkey);
-        dataMap.s_globaladdkey = d.data.s_globaladdkey;
-      }
-      //全局附加词匹配方式
-      if(d.data.s_globaladdkeymatch != undefined){
-        var v ="";
-        var s_globaladdkeymatchArr = d.data.s_globaladdkeymatch.split(",")
-        for(var i in s_globaladdkeymatchArr){
-          var code = s_globaladdkeymatchArr[i];
-          if(i == 0){
-            v = matchTypeMap2[code];
-          }else{
-            v = v+","+matchTypeMap2[code];
-          }
+    function addcomdata(d) {
+        /*
+        //province赋值
+        if(d.data.s_area != undefined){
+          $("#province").find("option").each(function(){
+            if(d.data.s_area.indexOf($(this).val()) != -1){
+              $(this).attr("selected",true);
+            }
+          })
+          $("#province").selectpicker("refresh");//刷新select框
+          dataMap.s_area = d.data.s_area;
+        }
+        //city赋值
+        if(d.data.s_city != undefined){
+          $("#city").find("option").each(function(){
+            if(d.data.s_city.indexOf($(this).val()) != -1){
+              $(this).attr("selected",true);
+            }
+          })
+          $("#city").selectpicker("refresh");//刷新select框
+           dataMap.s_city = d.data.s_city;
+        }
+        //district赋值
+        if(d.data.s_district != undefined){
+          $("#district").find("option").each(function(){
+            if(d.data.s_district.indexOf($(this).val()) != -1){
+              $(this).attr("selected",true);
+            }
+          })
+          $("#district").selectpicker("refresh");//刷新select框
+          dataMap.s_district = d.data.s_district;
+        }
+        //一级公告类别赋值
+        if(d.data.s_toptype != undefined){
+          $("#topTypeSelect").find("option").each(function(){
+            if(d.data.s_toptype.indexOf($(this).val()) != -1){
+              $(this).attr("selected",true);
+            }
+          })
+          $("#topTypeSelect").selectpicker("refresh");//刷新select框
+           dataMap.s_toptype = d.data.s_toptype;
+        }
+        //二级公告类别赋值
+        if(d.data.s_subtype != undefined){
+          $("#subTypeSelect").find("option").each(function(){
+            if(d.data.s_subtype.indexOf($(this).val()) != -1){
+              $(this).attr("selected",true);
+            }
+          })
+          $("#subTypeSelect").selectpicker("refresh");//刷新select框
+           dataMap.s_subtype = d.data.s_subtype;
+        }
+        //选择字段
+        if(d.data.s_existfields != undefined){
+          $("#existFieldSelect").find("option").each(function(){
+            if(d.data.s_existfields.indexOf($(this).val()) != -1){
+              $(this).attr("selected",true);
+            }
+          })
+          $("#existFieldSelect").selectpicker("refresh");//刷新select框
+           dataMap.s_existfields = d.data.s_existfields;
+        }
+        */
+        //全局附加词
+        if (d.data.s_globaladdkey != undefined) {
+            $("#g_addkey").val(d.data.s_globaladdkey);
+            dataMap.s_globaladdkey = d.data.s_globaladdkey;
+        }
+        //全局附加词匹配方式
+        if (d.data.s_globaladdkeymatch != undefined) {
+            var v = "";
+            var s_globaladdkeymatchArr = d.data.s_globaladdkeymatch.split(",")
+            for (var i in s_globaladdkeymatchArr) {
+                var code = s_globaladdkeymatchArr[i];
+                if (i == 0) {
+                    v = matchTypeMap2[code];
+                } else {
+                    v = v + "," + matchTypeMap2[code];
+                }
+            }
+            $("#s_addkeymatch").val(v);
+        }
+        //全局排除词
+        if (d.data.s_globalnotkey != undefined) {
+            $("#g_notkey").val(d.data.s_globalnotkey);
+            dataMap.s_globalnotkey = d.data.s_globalnotkey;
+        }
+        //全局排除词匹配方式
+        if (d.data.s_globalnotkeymatch != undefined) {
+            var v = "";
+            var s_globalnotkeymatchArr = d.data.s_globalnotkeymatch.split(",")
+            for (var i in s_globalnotkeymatchArr) {
+                var code = s_globalnotkeymatchArr[i];
+                if (i == 0) {
+                    v = matchTypeMap2[code];
+                } else {
+                    v = v + "," + matchTypeMap2[code];
+                }
+            }
+            $("#s_notkeymatch").val(v);
+            dataMap.s_globalnotkeymatch = d.data.s_globalnotkeymatch;
+        }
+        //采购单位行业
+        if (d.data.s_globalbuyerclass != undefined) {
+            $("#s_buyerclass").val(d.data.s_globalbuyerclass);
+            dataMap.s_globalbuyerclass = d.data.s_globalbuyerclass;
         }
-        $("#s_addkeymatch").val(v);
-      }
-      //全局排除词
-      if(d.data.s_globalnotkey != undefined){
-        $("#g_notkey").val(d.data.s_globalnotkey);
-        dataMap.s_globalnotkey = d.data.s_globalnotkey;
-      }
-      //全局排除词匹配方式
-      if(d.data.s_globalnotkeymatch != undefined){
-        var v ="";
-        var s_globalnotkeymatchArr = d.data.s_globalnotkeymatch.split(",")
-        for(var i in s_globalnotkeymatchArr){
-          var code = s_globalnotkeymatchArr[i];
-          if(i == 0){
-            v = matchTypeMap2[code];
-          }else{
-            v = v+","+matchTypeMap2[code];
-          }
+        //公告行业
+        if (d.data.s_globalsubscopeclass != undefined) {
+            $("#s_scopeclass").val(d.data.s_globalsubscopeclass);
+            dataMap.s_globalsubscopeclass = d.data.s_globalsubscopeclass;
         }
-        $("#s_notkeymatch").val(v);
-         dataMap.s_globalnotkeymatch = d.data.s_globalnotkeymatch;
-      }
-      //采购单位行业
-      if(d.data.s_globalbuyerclass != undefined){
-         $("#s_buyerclass").val(d.data.s_globalbuyerclass);
-         dataMap.s_globalbuyerclass = d.data.s_globalbuyerclass;
-      }
-      //公告行业
-      if(d.data.s_globalsubscopeclass != undefined){
-         $("#s_scopeclass").val(d.data.s_globalsubscopeclass);
-         dataMap.s_globalsubscopeclass = d.data.s_globalsubscopeclass;
-      }
-      //关键词规则
-      $('#keywords').dataTable().fnClearTable();
-      $('#keywords').dataTable().fnAddData(d.data.o_rules);
-      o_rules = d.data.o_rules;
+        //关键词规则
+        $('#keywords').dataTable().fnClearTable();
+        $('#keywords').dataTable().fnAddData(d.data.o_rules);
+        o_rules = d.data.o_rules;
     }
 </script>

+ 16 - 5
src/web/templates/private/common_rule_create.html

@@ -648,6 +648,8 @@
         });
     }
     function clickMatchBtn2(obj) {
+        matchCode.length = 0;
+        matchName.length = 0;
         if ($(obj).hasClass("active-btn-match")) {
             $(obj).removeClass("active-btn-match")
             matchCode.splice($.inArray($(obj).attr("code"), matchCode), 1);
@@ -874,13 +876,14 @@
     }
     //表格单个选中
     function singleSelect(obj) {
-        var tag = false;
+        var tag = true;
         selectIndex.length = 0;
         $('input[name="ckb-keyid"]').each(function () {
             if (this.checked) {
                 keyTableChecked = true;
-                tag = true;
                 selectIndex.push($(this).parents("tr").index() + 1);
+            }else {
+                tag = false
             }
         });
         if (tag) {
@@ -901,9 +904,10 @@
         }
         dataMap["s_tagname"] = $('#tagname').val();
         dataMap["s_tagfield"] = $('#tagfield').val();
+        dataMap["s_serverperson"] = $('#serverperson').val();
         dataMap["s_globaladdkey"] = $('#g_addkey').val();
         dataMap["s_globalnotkey"] = $('#g_notkey').val();
-        if (dataMap["s_tagname"] == "" || dataMap["s_tagfield"] == "") {
+        if (dataMap["s_tagname"] == "" || dataMap.s_tagfield == "" || dataMap.s_serverperson == "") {
             alert("请填写必须字段!");
             return
         }
@@ -1290,6 +1294,9 @@
     //关键词表格新增
     function add_Rule() {
         key_flag = 0;
+        $('#keyword_txt').val("");
+        $('#addword_txt').val("");
+        $('#notword_txt').val("");
         $('#modal-add-keyword').modal("show");
     }
     //关键词修改
@@ -1332,10 +1339,13 @@
     function del_Rule() {
         if (keyTableChecked) {
             showConfirm("确定删除?", function() {
-                for (var i in selectIndex) {
+                for (var i in o_rules) {
                     var j = selectIndex[i] - 1;
-                    o_rules.splice(o_rules[j], 1)
+                    if (i != j) {
+                        tmp.push(o_rules[i])
+                    }
                 }
+                o_rules = tmp;
                 $('#keywords').dataTable().fnClearTable();
                 $('#keywords').dataTable().fnAddData(o_rules);
 
@@ -1389,5 +1399,6 @@
             }
             return {flag: flag, v1: v1, v2: v2}
         }
+        return {flag: flag, v1: v1, v2: v2}
     }
 </script>

+ 27 - 31
src/web/templates/private/common_rule_edit.html

@@ -400,7 +400,7 @@
     $(document).ready(function () {
         var name1 = {{(session "user").name}};
         if (name1 != dataMap.s_updateuser) {
-            showTip("上次修改人员是" + name1, 1000)
+            showTip("上次修改人员是" + dataMap.s_updateuser, 1000)
         }
         $('#extfiledselect').val(dataMap.i_extfieldstype);
         $('#estxt').val(dataMap.s_esquery);
@@ -1035,13 +1035,14 @@
     }
     //表格单个选中
     function singleSelect(obj) {
-        var tag = false;
+        var tag = true;
         selectIndex.length = 0;
         $('input[name="ckb-keyid"]').each(function () {
             if (this.checked) {
                 keyTableChecked = true;
-                tag = true;
                 selectIndex.push($(this).parents("tr").index() + 1);
+            }else {
+                tag = false
             }
         });
         if (tag) {
@@ -1061,15 +1062,13 @@
             showMsg(msg);
             return
         }
-        dataMap["s_customer"] = $('#customer').val();
         dataMap["s_tagname"] = $('#tagname').val();
-        dataMap["s_salesperson"] = $('#salename').val();
-        dataMap["s_serverperson"] = $("#serverperson").val();
-        dataMap["s_customername"] = $("#customername").val();
+        dataMap["s_tagfield"] = $('#tagfield').val();
+        dataMap["s_serverperson"] = $('#serverperson').val();
         dataMap["s_globaladdkey"] = $('#g_addkey').val();
         dataMap["s_globalnotkey"] = $('#g_notkey').val();
-        if (dataMap["s_customer"] == "" || dataMap["s_tagname"] == "" || dataMap["s_salesperson"] == "" || dataMap["s_serverperson"] == "") {
-            alert("请填写必须字段!")
+        if (dataMap["s_tagname"] == "" || dataMap["s_tagfield"] == "" || dataMap["s_serverperson"] == "") {
+            alert("请填写必须字段!");
             return
         }
         if ($('#starttime').find("input").val() != "") {
@@ -1127,7 +1126,6 @@
         }else {
             dataMap["i_globalnotkeytype"] = 0
         }
-        console.log(dataMap)
         dataMap["o_rules"] = JSON.stringify(o_rules);
         $.ajax({
             url: "/service/common_rule/save",
@@ -1308,8 +1306,7 @@
                         }
                         return val
                     }},
-                {
-                    "data": function (row) {
+                {"data": function (row) {
                         if (row.buyerperson) {
                             return row.buyerperson
                         } else {
@@ -1317,8 +1314,7 @@
                         }
                     }, width: "4%"
                 },
-                {
-                    "data": function (row) {
+                {"data": function (row) {
                         if (row.buyertel) {
                             return row.buyertel
                         } else {
@@ -1326,24 +1322,21 @@
                         }
                     }, width: "4%"
                 },
-                {
-                    "data": "agency", width: "5%", render: function (val) {
+                {"data": "agency", width: "5%", render: function (val) {
                         if (val == undefined) {
                             val = ""
                         }
                         return val
                     }
                 },
-                {
-                    "data": "winner", width: "3%", render: function (val) {
+                {"data": "winner", width: "3%", render: function (val) {
                         if (val == undefined) {
                             val = ""
                         }
                         return val
                     }
                 },
-                {
-                    "data": function (row) {
+                {"data": function (row) {
                         if (row.winnerperson) {
                             return row.winnerperson
                         } else {
@@ -1351,8 +1344,7 @@
                         }
                     }, width: "4%"
                 },
-                {
-                    "data": function (row) {
+                {"data": function (row) {
                         if (row.winnertel) {
                             return row.winnertel
                         } else {
@@ -1360,8 +1352,7 @@
                         }
                     }, width: "4%"
                 },
-                {
-                    "data": function (row) {
+                {"data": function (row) {
                         if (row.legal_person) {
                             return row.legal_person
                         } else {
@@ -1369,8 +1360,7 @@
                         }
                     }, width: "4%"
                 },
-                {
-                    "data": function (row) {
+                {"data": function (row) {
                         if (row.company_phone) {
                             return row.company_phone
                         } else {
@@ -1378,8 +1368,7 @@
                         }
                     }, width: "4%"
                 },
-                {
-                    "data": function (row) {
+                {"data": function (row) {
                         if (row.company_email) {
                             return row.company_email
                         } else {
@@ -1414,7 +1403,7 @@
                 var myform = new FormData();
                 myform.append('xlsx', $("#file")[0].files[0]);
                 $.ajax({
-                    url: "/service/common_rule/import",
+                    url: "/service/rule/import",
                     type: 'POST',
                     data: myform,
                     async: false,
@@ -1465,6 +1454,9 @@
     //关键词表格新增
     function add_Rule() {
         key_flag = 0;
+        $('#keyword_txt').val("");
+        $('#addword_txt').val("");
+        $('#notword_txt').val("");
         $('#modal-add-keyword').modal("show");
     }
     //关键词修改
@@ -1507,10 +1499,13 @@
     function del_Rule() {
         if (keyTableChecked) {
             showConfirm("确定删除?", function() {
-                for (var i in selectIndex) {
+                for (var i in o_rules) {
                     var j = selectIndex[i] - 1;
-                    o_rules.splice(o_rules[j], 1)
+                    if (i != j) {
+                        tmp.push(o_rules[i])
+                    }
                 }
+                o_rules = tmp;
                 $('#keywords').dataTable().fnClearTable();
                 $('#keywords').dataTable().fnAddData(o_rules);
 
@@ -1564,5 +1559,6 @@
             }
             return {flag: flag, v1: v1, v2: v2}
         }
+        return {flag: flag, v1: v1, v2: v2}
     }
 </script>

+ 3 - 4
src/web/templates/private/common_rule_list.html

@@ -136,7 +136,7 @@
     function del(s){
         showConfirm("确定删除?", function() {
             $.ajax({
-                url:"/service/rule/del",
+                url:"/service/common_rule/del",
                 type:"post",
                 data:{"_id": s.split(",")[0], "s_dataid": s.split(",")[1]},
                 success:function(r){
@@ -152,13 +152,12 @@
     function archive(_id){
         showConfirm("是否存档?", function() {
             $.ajax({
-                url:"/service/rule/archive",
+                url:"/service/common_rule/archive",
                 type:"post",
                 data:{"_id":_id},
                 success:function(r){
                   if(r.rep){
                     showTip("存档成功",1000);
-                    //ttable.ajax.reload();
                   }else{
                     showTip("存档失败",1000);
                   }
@@ -167,7 +166,7 @@
         });
     }
     function preview(s_dataid) {
-        var href = {{.T.preview_href}} + "?key=" + s_dataid;
+        var href = {{.T.preview_href}} + "?type=common"+"&key=" + s_dataid;
         $('#preview-href').html(href);
         $('#preview-href').attr("href", href);
         $('#modal-preview-href').modal("show")

+ 78 - 15
src/web/templates/private/rule_create.html

@@ -527,27 +527,57 @@
                     }},
                 {"data": "s_matchkey", width: "10%"},
                 {"data": function (row) {
-                        if (row.s_keymatch) {
-                            return row.s_keymatch
-                        }else {
-                            return ""
+                        var str = row.s_keymatch;
+                        if (str && str != "") {
+                            var s = "";
+                            for (var i in matchTypeMap) {
+                                if (str.indexOf(matchTypeMap[i]["code"]) != -1) {
+                                    if (s == "") {
+                                        s = matchTypeMap[i]["name"]
+                                    } else {
+                                        s = s + "," + matchTypeMap[i]["name"]
+                                    }
+                                }
+                            }
+                            return s
                         }
+                        return ""
                     }, width: "5%"},
                 {"data": "s_addkey", width: "10%"},
                 {"data": function (row) {
-                        if (row.s_addkeymatch) {
-                            return row.s_addkeymatch
-                        }else {
-                            return ""
+                        var str = row.s_addkeymatch;
+                        if (str && str != "") {
+                            var s = "";
+                            for (var i in matchTypeMap) {
+                                if (str.indexOf(matchTypeMap[i]["code"]) != -1) {
+                                    if (s == "") {
+                                        s = matchTypeMap[i]["name"]
+                                    } else {
+                                        s = s + "," + matchTypeMap[i]["name"]
+                                    }
+                                }
+                            }
+                            return s
                         }
+                        return ""
                     }, width: "5%"},
                 {"data": "s_notkey", width: "10%"},
                 {"data": function (row) {
-                        if (row.s_notkeymatch) {
-                            return row.s_notkeymatch
-                        }else {
-                            return ""
+                        var str = row.s_notkeymatch;
+                        if (str && str != "") {
+                            var s = "";
+                            for (var i in matchTypeMap) {
+                                if (str.indexOf(matchTypeMap[i]["code"]) != -1) {
+                                    if (s == "") {
+                                        s = matchTypeMap[i]["name"]
+                                    } else {
+                                        s = s + "," + matchTypeMap[i]["name"]
+                                    }
+                                }
+                            }
+                            return s
                         }
+                        return ""
                     }, width: "5%"},
                 {"data": "s_buyerclass", width: "7%", render: function (val) {
                         if (val == undefined) {
@@ -666,7 +696,7 @@
     //匹配方式按钮点击事件
     function clickMatchBtn(obj) {
         if ($(obj).hasClass("active-btn-match")) {
-            $(obj).removeClass("active-btn-match");
+            $(obj).removeClass("active-btn-match")
             matchCode.splice($.inArray($(obj).attr("code"), matchCode), 1);
             matchName.splice($.inArray($(obj).val(), matchName), 1)
         } else {
@@ -674,6 +704,32 @@
             matchCode.push($(obj).attr("code"));
             matchName.push($(obj).val())
         }
+
+        $('#btnGroupMatch2 .btn-default').each(function () {
+            $(this).removeClass("active-btn-match");
+        });
+    }
+    function clickMatchBtn2(obj) {
+        matchCode.length = 0;
+        matchName.length = 0;
+        if ($(obj).hasClass("active-btn-match")) {
+            $(obj).removeClass("active-btn-match")
+            matchCode.splice($.inArray($(obj).attr("code"), matchCode), 1);
+            matchName.splice($.inArray($(obj).val(), matchName), 1)
+        } else {
+            $(obj).addClass("active-btn-match");
+            matchCode.push($(obj).attr("code"));
+            matchName.push($(obj).val())
+            $('#btnGroupMatch2 .btn-default').each(function () {
+                if (this != obj) {
+                    $(this).removeClass("active-btn-match");
+                }
+            });
+        }
+
+        $('#btnGroupMatch .btn-default').each(function () {
+            $(this).removeClass("active-btn-match");
+        });
     }
     //匹配方式保存
     function saveMatch() {
@@ -1329,6 +1385,9 @@
     //关键词表格新增
     function add_Rule() {
         key_flag = 0;
+        $('#keyword_txt').val("");
+        $('#addword_txt').val("");
+        $('#notword_txt').val("");
         $('#modal-add-keyword').modal("show");
     }
     //关键词修改
@@ -1371,10 +1430,13 @@
     function del_Rule() {
         if (keyTableChecked) {
             showConfirm("确定删除?", function() {
-                for (var i in selectIndex) {
+                for (var i in o_rules) {
                     var j = selectIndex[i] - 1;
-                    o_rules.splice(o_rules[j], 1)
+                    if (i != j) {
+                        tmp.push(o_rules[i])
+                    }
                 }
+                o_rules = tmp;
                 $('#keywords').dataTable().fnClearTable();
                 $('#keywords').dataTable().fnAddData(o_rules);
 
@@ -1429,5 +1491,6 @@
             }
             return {flag: flag, v1: v1, v2: v2}
         }
+        return {flag: flag, v1: v1, v2: v2}
     }
 </script>

+ 18 - 8
src/web/templates/private/rule_edit.html

@@ -423,7 +423,7 @@
     $(document).ready(function () {
         var name1 = {{(session "user").name}};
         if (name1 != dataMap.s_updateuser) {
-            showTip("上次修改人员是" + name1, 1000)
+            showTip("上次修改人员是" + dataMap.s_updateuser, 1000)
         }
         $('#extfiledselect').val(dataMap.i_extfieldstype);
         //es
@@ -860,6 +860,8 @@
         });
     }
     function clickMatchBtn2(obj) {
+        matchCode.length = 0;
+        matchName.length = 0;
         if ($(obj).hasClass("active-btn-match")) {
             $(obj).removeClass("active-btn-match")
             matchCode.splice($.inArray($(obj).attr("code"), matchCode), 1);
@@ -1114,15 +1116,14 @@
     }
     //表格单个选中
     function singleSelect(obj) {
-        var tag = false;
+        var tag = true;
         selectIndex.length = 0;
         $('input[name="ckb-keyid"]').each(function () {
             if (this.checked) {
                 keyTableChecked = true;
-                tag = true;
                 selectIndex.push($(this).parents("tr").index() + 1);
-            } else {
-                tag = false;
+            }else {
+                tag = false
             }
         });
         if (tag) {
@@ -1233,7 +1234,7 @@
             success: function (r) {
                 com.maskHide();
                 if (r.rep) {
-                    dataMap.i_estotal = r.count
+                    dataMap.i_estotal = r.count;
                     showTip("数据生成成功", 1000);
                 } else {
                     showTip("数据生成失败", 1000);
@@ -1544,6 +1545,9 @@
     //关键词表格新增
     function add_Rule() {
         key_flag = 0;
+        $('#keyword_txt').val("");
+        $('#addword_txt').val("");
+        $('#notword_txt').val("");
         $('#modal-add-keyword').modal("show");
     }
     //关键词修改
@@ -1584,12 +1588,17 @@
     }
     //关键词删除
     function del_Rule() {
+        console.log(selectIndex);
         if (keyTableChecked) {
+            var tmp = [];
             showConfirm("确定删除?", function() {
-                for (var i in selectIndex) {
+                for (var i in o_rules) {
                     var j = selectIndex[i] - 1;
-                    o_rules.splice(o_rules[j], 1)
+                    if (i != j) {
+                        tmp.push(o_rules[i])
+                    }
                 }
+                o_rules = tmp;
                 $('#keywords').dataTable().fnClearTable();
                 $('#keywords').dataTable().fnAddData(o_rules);
 
@@ -1644,5 +1653,6 @@
             }
             return {flag: flag, v1: v1, v2: v2}
         }
+        return {flag: flag, v1: v1, v2: v2}
     }
 </script>

+ 1 - 1
src/web/templates/private/rule_list.html

@@ -169,7 +169,7 @@
         });
     }
     function preview(s_dataid) {
-        var href = {{.T.preview_href}} + "?key=" + s_dataid;
+        var href = {{.T.preview_href}} + "?type=private"+"&key=" + s_dataid;
         $('#preview-href').html(href);
         $('#preview-href').attr("href", href);
         $('#modal-preview-href').modal("show")