瀏覽代碼

解决冲突

fuwencai 4 年之前
父節點
當前提交
1c771ea2aa

+ 1006 - 1040
src/web/templates/client/cuser_rule_edit.html

@@ -20,17 +20,18 @@
         border-radius: 4px;
         transform: translateX(-50%);
     }
+
     .position::before {
         position: absolute;
         left: 50%;
         transform: translateX(-50%);
         bottom: -8px;
         content: '';
-        width:0;
-        height:0;
-        border-right:8px solid transparent;
-        border-left:8px solid transparent;
-        border-top:8px solid #303133;
+        width: 0;
+        height: 0;
+        border-right: 8px solid transparent;
+        border-left: 8px solid transparent;
+        border-top: 8px solid #303133;
     }
 
     .position p {
@@ -367,7 +368,8 @@
                                         </div>
                                         <label class="col-sm-2 control-label ">高级字段包</label>
                                         <div class="col-sm-3">
-                                            <select class="form-control" id="extfiledselect" style="border-radius:3px" readonly disabled>
+                                            <select class="form-control" id="extfiledselect" style="border-radius:3px"
+                                                    readonly disabled>
                                                 <option value="1">否</option>
                                                 <option value="2">是</option>
                                             </select>
@@ -878,1179 +880,1143 @@
     }
 
     //关键词/附加词/排除词匹配方式modal
-   function selectKeyMatch(val) {
+    function selectKeyMatch(val) {
         setValue = val;
         if (setValue == 0 || setValue == 1 || setValue == 13) {
             matchCode.length = 0;
             matchName.length = 0;
             $('#modal-select-match').modal("show");
-        }else {
-          matchCode.length=0
-         matchName.length = 0;
+        } else {
+            matchCode.length = 0
+            matchName.length = 0;
 
             if (selectIndex.length > 0 && keyTableChecked) {
                 matchCode.length = 0;
                 matchName.length = 0;
-                
-                
-                           if (val==4){
-                  s_matchkey_str=o_rules[selectIndex[0]-1]["s_keymatch"]
-                
-                }else if(val==6){
-                   s_matchkey_str=o_rules[selectIndex[0]-1]["s_addkeymatch"]
-                
-                }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())
-           }
+
+                if (val == 4) {
+                    s_matchkey_str = o_rules[selectIndex[0] - 1]["s_keymatch"]
+
+                } else if (val == 6) {
+                    s_matchkey_str = o_rules[selectIndex[0] - 1]["s_addkeymatch"]
+
+                } 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");
-            }else {
+            } else {
                 alert("请选中关键词")
             }
         }
     }
+
     //匹配方式按钮点击事件
-     function clickMatchBtn(obj) {
-      
-       var temp_list = ["6","7","8","9"]
-
-      for (i in temp_list){
-        if (matchCode.indexOf( temp_list[i])>-1){
-          matchCode.length=0
-          matchName.length=0
-          break
-        }
-      }
-        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 () {
-            $(this).removeClass("active-btn-match");
-        });
-    }
+    function clickMatchBtn(obj) {
 
+        var temp_list = ["6", "7", "8", "9"]
+
+        for (i in temp_list) {
+            if (matchCode.indexOf(temp_list[i]) > -1) {
+                matchCode.length = 0
+                matchName.length = 0
+                break
+
+            }
+            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())
+            }
 
-    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");
-                }
+                $(this).removeClass("active-btn-match");
             });
         }
 
-        $('#btnGroupMatch .btn-default').each(function () {
-            $(this).removeClass("active-btn-match");
-        });
-    }
 
-    //匹配方式保存
-    function saveMatch() {
-        $('#btnGroupMatch').find("input").each(function () {
-            $(this).removeClass("active-btn-match");
-        });
-        $('#btnGroupMatch2').find("input").each(function () {
-            $(this).removeClass("active-btn-match");
-        });
-        $('#modal-select-match').modal("hide");
-        var matchNameStr = "";
-        var codeStr = "";
-        for (var i in matchName) {
-            if (matchNameStr == "") {
-                matchNameStr = matchName[i];
-            } else {
-                matchNameStr += "," + matchName[i]
-            }
-            if (codeStr == "") {
-                codeStr = matchCode[i]
+        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 {
-                codeStr = codeStr + "," + matchCode[i]
-            }
-        }
-        if (setValue == 0) {
-            $('#s_addkeymatch').val(matchNameStr);
-            dataMap["s_globaladdkeymatch"] = codeStr
-        } else if (setValue == 1) {
-            $('#s_notkeymatch').val(matchNameStr);
-            dataMap["s_globalnotkeymatch"] = codeStr
-        } else if (setValue == 13) {
-            $('#s_globalclearkeymatch').val(matchNameStr);
-            dataMap["s_globalclearkeymatch"] = codeStr
-        } else {
-            for (var i in selectIndex) {
-                var j = selectIndex[i] - 1;
-                if (setValue == 4) {
-                    if ($("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(3)").text() != "") {
-                        $("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(" + setValue + ")").html(matchNameStr);
-                        o_rules[j]["s_keymatch"] = codeStr;
-                    }
-                } else if (setValue == 6) {
-                    if ($("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(5)").text() != "") {
-                        $("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(" + setValue + ")").html(matchNameStr);
-                        o_rules[j]["s_addkeymatch"] = codeStr;
+                $(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");
                     }
-                } else if (setValue == 8) {
-                    if ($("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(7)").text() != "") {
-                        $("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(" + setValue + ")").html(matchNameStr);
-                        o_rules[j]["s_notkeymatch"] = codeStr;
-                    }
-                }
+                });
             }
+
+            $('#btnGroupMatch .btn-default').each(function () {
+                $(this).removeClass("active-btn-match");
+            });
         }
-        $('#modal-select-match').modal("hide");
-        matchName.length = 0;
-        matchCode.length = 0;
-    }
 
-    //采购单位modal
-    function selectBuyer(val) {
-     
-        setValue = val;
-        if (val == 2) {      
-            $('#modal-select-buyer').modal("show");
-            
-        }else {
-            if (keyTableChecked) {
-              
-                  
-
- buyerArr.length=0
-        // 和button的值匹配,对应添加选中属性
-       
-        var d = $("#keywords tbody tr:nth-child("+selectIndex[0]+") td:nth-child(9)").text()
-        // 按逗号分隔
-        var select_value_array = d.split(",")
-        // 和button的值匹配,对应添加选中属性
-         
-        for (index_ in select_value_array){
-        
-              //定位button 添加属性
-
-
-              $("#btnGroupBuyer").find("input").each(function () {
-
-                      
-                if ( $(this).val() ==select_value_array[index_]){
-                  
-                             $(this).addClass("active-btn-match");
-
-                  if (buyerArr.indexOf(select_value_array[index_])==-1){
-                  
-                    buyerArr.push($(this).val())
-           }
+        //匹配方式保存
+        function saveMatch() {
+            $('#btnGroupMatch').find("input").each(function () {
+                $(this).removeClass("active-btn-match");
+            });
+            $('#btnGroupMatch2').find("input").each(function () {
+                $(this).removeClass("active-btn-match");
+            });
+            $('#modal-select-match').modal("hide");
+            var matchNameStr = "";
+            var codeStr = "";
+            for (var i in matchName) {
+                if (matchNameStr == "") {
+                    matchNameStr = matchName[i];
+                } else {
+                    matchNameStr += "," + matchName[i]
+                }
+                if (codeStr == "") {
+                    codeStr = matchCode[i]
+                } else {
+                    codeStr = codeStr + "," + matchCode[i]
+                }
+            }
+            if (setValue == 0) {
+                $('#s_addkeymatch').val(matchNameStr);
+                dataMap["s_globaladdkeymatch"] = codeStr
+            } else if (setValue == 1) {
+                $('#s_notkeymatch').val(matchNameStr);
+                dataMap["s_globalnotkeymatch"] = codeStr
+            } else if (setValue == 13) {
+                $('#s_globalclearkeymatch').val(matchNameStr);
+                dataMap["s_globalclearkeymatch"] = codeStr
+            } else {
+                for (var i in selectIndex) {
+                    var j = selectIndex[i] - 1;
+                    if (setValue == 4) {
+                        if ($("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(3)").text() != "") {
+                            $("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(" + setValue + ")").html(matchNameStr);
+                            o_rules[j]["s_keymatch"] = codeStr;
+                        }
+                    } else if (setValue == 6) {
+                        if ($("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(5)").text() != "") {
+                            $("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(" + setValue + ")").html(matchNameStr);
+                            o_rules[j]["s_addkeymatch"] = codeStr;
+                        }
+                    } else if (setValue == 8) {
+                        if ($("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(7)").text() != "") {
+                            $("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(" + setValue + ")").html(matchNameStr);
+                            o_rules[j]["s_notkeymatch"] = codeStr;
+                        }
+                    }
                 }
-                 
-    });
-              
-          }
-             
-            
-            
-            
-            
-               $('#modal-select-buyer').modal("show");
-            }else {
-                alert("请选中关键词")
             }
+            $('#modal-select-match').modal("hide");
+            matchName.length = 0;
+            matchCode.length = 0;
         }
-    }
 
-    //采购单位点击
-    function clickBuyerBtn(obj) {
-        if ($(obj).hasClass("active-btn-match")) {
-            $(obj).removeClass("active-btn-match")
-            buyerArr.splice($.inArray($(obj).val(), buyerArr), 1)
-        } else {
-            $(obj).addClass("active-btn-match");
-            buyerArr.push($(obj).val())
-        }
-    }
+        //采购单位modal
+        function selectBuyer(val) {
+
+            setValue = val;
+            if (val == 2) {
+                $('#modal-select-buyer').modal("show");
 
-    function saveBuyer() {
-        $('#btnGroupBuyer').find("input").each(function () {
-            $(this).removeClass("active-btn-match");
-        });
-        $('#modal-select-buyer').modal("hide");
-        var buyerStr = "";
-        for (var i in buyerArr) {
-            if ("" === buyerStr) {
-                buyerStr = buyerArr[i];
             } else {
-                buyerStr += "," + buyerArr[i]
+                if (keyTableChecked) {
+                    buyerArr.length = 0
+                    // 和button的值匹配,对应添加选中属性
+
+                    var d = $("#keywords tbody tr:nth-child(" + selectIndex[0] + ") td:nth-child(9)").text()
+                    // 按逗号分隔
+                    var select_value_array = d.split(",")
+                    // 和button的值匹配,对应添加选中属性
+
+                    for (index_ in select_value_array) {
+
+                        //定位button 添加属性
+                        debugger
+
+                        $("#btnGroupBuyer").find("input").each(function () {
+
+
+                            if ($(this).val() == select_value_array[index_]) {
+
+                                $(this).addClass("active-btn-match");
+
+                                if (buyerArr.indexOf(select_value_array[index_]) == -1) {
+
+                                    buyerArr.push($(this).val())
+                                }
+                            }
+
+                        });
+                    }
+                    $('#modal-select-buyer').modal("show");
+                } else {
+                    alert("请选中关键词")
+                }
             }
         }
-        if (setValue == 2) {
-            $('#s_buyerclass').val(buyerStr);
-            $('#s_buyerclass').attr('title', buyerStr);
-            dataMap["s_globalbuyerclass"] = buyerStr;
-        } else {
-            for (var i in selectIndex) {
-                var j = selectIndex[i] - 1;
-                //采购单位
-                $("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(9)").html(buyerStr);
-                o_rules[j]["s_buyerclass"] = buyerStr;
+
+        //采购单位点击
+        function clickBuyerBtn(obj) {
+            if ($(obj).hasClass("active-btn-match")) {
+                $(obj).removeClass("active-btn-match")
+                buyerArr.splice($.inArray($(obj).val(), buyerArr), 1)
+            } else {
+                $(obj).addClass("active-btn-match");
+                buyerArr.push($(obj).val())
             }
         }
-        $('#modal-select-buyer').modal("hide");
-        buyerArr.length = 0;
-    }
 
-    //公告行业modal
-   function selectScope(val) {
-     
-        setValue = val;
-        if (val == 3) {
-            $('#modal-select-scope').modal("show");
-        }else {
-            if (keyTableChecked) {
-               scopeSubArr.length=0
-              
-             //获取当前行的所选规则
-            var s_topscopeclass_str = o_rules[selectIndex[0]-1]["s_topscopeclass"]
-              if (s_topscopeclass_str){
-                
-                s_topscopeclass_list=s_topscopeclass_str.split(",")
-            
-            for (index_ in s_topscopeclass_list){
-    
-              //定位button 添加属性
-              $("#btnGroupTop").find("input").each(function () {
-           
-     
-                      
-                if (this.value ==s_topscopeclass_list[index_]){
-                   $(this).addClass("active-btn-match");
-                  if (scopeTopArr.indexOf(s_topscopeclass_list[index_])==-1){
-                  
-                    scopeTopArr.push($(this).val())
-           }
-                }
-                 
-    });
-              
-          }
-             
-            
-             //选中
-            
-              }
-              else{
-                
-                
-                s_subscopeclass_str=o_rules[selectIndex[0]-1]["s_subscopeclass"]
-                 if (s_subscopeclass_str){
-                               
-                s_subscopeclass_list=s_subscopeclass_str.split(",")
-            
-            for (index_ in s_subscopeclass_list){
-
-              //定位button 添加属性
-              $("#btnGroupSub").find("input").each(function () {
-           
-      
-                      
-                if ( $(this).attr("code") == s_subscopeclass_list[index_]){
-                    $(this).addClass("active-btn-match");
-                  if (scopeSubArr.indexOf(s_subscopeclass_list[index_])==-1){
-                 
-                    scopeSubArr.push($(this).attr("code"))
-           }
-                }
-                 
-    });
-              
-          }
-             
+        function saveBuyer() {
+            $('#btnGroupBuyer').find("input").each(function () {
+                $(this).removeClass("active-btn-match");
+            });
+            $('#modal-select-buyer').modal("hide");
+            var buyerStr = "";
+            for (var i in buyerArr) {
+                if ("" === buyerStr) {
+                    buyerStr = buyerArr[i];
+                } else {
+                    buyerStr += "," + buyerArr[i]
                 }
-            
-            
-            
-            
-            
-            
-            
-            
-            
-            
             }
-                $('#modal-select-scope').modal("show");
-            }else {
-                alert("请选中关键词")
+            if (setValue == 2) {
+                $('#s_buyerclass').val(buyerStr);
+                $('#s_buyerclass').attr('title', buyerStr);
+                dataMap["s_globalbuyerclass"] = buyerStr;
+            } else {
+                for (var i in selectIndex) {
+                    var j = selectIndex[i] - 1;
+                    //采购单位
+                    $("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(9)").html(buyerStr);
+                    o_rules[j]["s_buyerclass"] = buyerStr;
+                }
             }
-        }
-    }
-    //公告行业一级点击
-    function btnTopScopeClick(obj) {
-        if ($(obj).hasClass("active-btn-match")) {
-            $(obj).removeClass("active-btn-match");
-            scopeTopArr.splice($.inArray($(obj).val(), scopeTopArr), 1)
-        } else {
-            $(obj).addClass("active-btn-match");
-            scopeTopArr.push($(obj).val())
+            $('#modal-select-buyer').modal("hide");
+            buyerArr.length = 0;
         }
 
-        //选择一级行业,取消掉所选择的所有二级行业
-        if (scopeSubArr.length > 0) {
-            $('#btnGroupSub .btn-default').each(function () {
-                $(this).removeClass("active-btn-match");
-            });
-            scopeSubArr.length = 0
-        }
-    }
+        //公告行业modal
+        function selectScope(val) {
 
-    //公告行业二级点击
-    function btnSubScopeClick(obj) {
-        if ($(obj).hasClass("active-btn-match")) {
-            $(obj).removeClass("active-btn-match")
-            scopeSubArr.splice($.inArray($(obj).val(), scopeSubArr), 1)
-        } else {
-            $(obj).addClass("active-btn-match");
-            var topid = "#top_" + $(obj).attr("index");
-            $(topid).removeClass("active-btn-match");
-            scopeSubArr.push($(obj).attr("code"))
-        }
+            setValue = val;
+            if (val == 3) {
+                $('#modal-select-scope').modal("show");
+            } else {
+                if (keyTableChecked) {
+                    scopeSubArr.length = 0
 
-        //选择二级行业,取消掉所选择的所有一级行业
-        if (scopeTopArr.length > 0) {
-            $('#btnGroupTop .btn-default').each(function () {
-                $(this).removeClass("active-btn-match");
-            });
-            scopeTopArr.length = 0
+                    //获取当前行的所选规则
+                    var s_topscopeclass_str = o_rules[selectIndex[0] - 1]["s_topscopeclass"]
+                    if (s_topscopeclass_str) {
+
+                        s_topscopeclass_list = s_topscopeclass_str.split(",")
+
+                        for (index_ in s_topscopeclass_list) {
+
+                            //定位button 添加属性
+                            $("#btnGroupTop").find("input").each(function () {
+
+
+                                if (this.value == s_topscopeclass_list[index_]) {
+                                    $(this).addClass("active-btn-match");
+                                    if (scopeTopArr.indexOf(s_topscopeclass_list[index_]) == -1) {
+
+                                        scopeTopArr.push($(this).val())
+                                    }
+                                }
+
+                            });
+
+                        }
+
+
+                        //选中
+
+                    } else {
+
+
+                        s_subscopeclass_str = o_rules[selectIndex[0] - 1]["s_subscopeclass"]
+                        if (s_subscopeclass_str) {
+
+                            s_subscopeclass_list = s_subscopeclass_str.split(",")
+
+                            for (index_ in s_subscopeclass_list) {
+
+                                //定位button 添加属性
+                                $("#btnGroupSub").find("input").each(function () {
+
+
+                                    if ($(this).attr("code") == s_subscopeclass_list[index_]) {
+                                        $(this).addClass("active-btn-match");
+                                        if (scopeSubArr.indexOf(s_subscopeclass_list[index_]) == -1) {
+
+                                            scopeSubArr.push($(this).attr("code"))
+                                        }
+                                    }
+
+                                });
+
+                            }
+
+                        }
+
+
+                    }
+                    $('#modal-select-scope').modal("show");
+                } else {
+                    alert("请选中关键词")
+                }
+            }
         }
-    }
 
-    function saveScope() {
-        $('#btnGroupTop').find("input").each(function () {
-            $(this).removeClass("active-btn-match");
-        });
-        $('#btnGroupSub').find("input").each(function () {
-            $(this).removeClass("active-btn-match");
-        });
-        var scopeStr = "";
-        var topStr = "";
-        var subStr = "";
-        for (var i in scopeTopArr) {
-            if ("" == scopeStr) {
-                scopeStr = scopeTopArr[i];
+        //公告行业一级点击
+        function btnTopScopeClick(obj) {
+            if ($(obj).hasClass("active-btn-match")) {
+                $(obj).removeClass("active-btn-match");
+                scopeTopArr.splice($.inArray($(obj).val(), scopeTopArr), 1)
             } else {
-                scopeStr += "," + scopeTopArr[i]
+                $(obj).addClass("active-btn-match");
+                scopeTopArr.push($(obj).val())
             }
-            if (topStr == "") {
-                topStr = scopeTopArr[i]
-            } else {
-                topStr = topStr + "," + scopeTopArr[i]
+
+            //选择一级行业,取消掉所选择的所有二级行业
+            if (scopeSubArr.length > 0) {
+                $('#btnGroupSub .btn-default').each(function () {
+                    $(this).removeClass("active-btn-match");
+                });
+                scopeSubArr.length = 0
             }
         }
-        for (var i in scopeSubArr) {
-            if ("" == scopeStr) {
-                scopeStr = scopeSubArr[i];
+
+        //公告行业二级点击
+        function btnSubScopeClick(obj) {
+            if ($(obj).hasClass("active-btn-match")) {
+                $(obj).removeClass("active-btn-match")
+                scopeSubArr.splice($.inArray($(obj).val(), scopeSubArr), 1)
             } else {
-                scopeStr += "," + scopeSubArr[i]
+                $(obj).addClass("active-btn-match");
+                var topid = "#top_" + $(obj).attr("index");
+                $(topid).removeClass("active-btn-match");
+                scopeSubArr.push($(obj).attr("code"))
             }
-            if (subStr == "") {
-                subStr = scopeSubArr[i]
-            } else {
-                subStr = subStr + "," + scopeSubArr[i]
+
+            //选择二级行业,取消掉所选择的所有一级行业
+            if (scopeTopArr.length > 0) {
+                $('#btnGroupTop .btn-default').each(function () {
+                    $(this).removeClass("active-btn-match");
+                });
+                scopeTopArr.length = 0
             }
         }
-        if (setValue == 3) {
-            $('#s_scopeclass').val(scopeStr);
-            $('#s_scopeclass').attr('title', scopeStr);
-            dataMap["s_globaltopscopeclass"] = topStr;
-            dataMap["s_globalsubscopeclass"] = subStr;
-        } else {
-            for (var i in selectIndex) {
-                var j = selectIndex[i] - 1;
-                $("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(10)").html(scopeStr);
-                o_rules[j]["s_topscopeclass"] = topStr;
-                o_rules[j]["s_subscopeclass"] = subStr;
+
+        function saveScope() {
+            $('#btnGroupTop').find("input").each(function () {
+                $(this).removeClass("active-btn-match");
+            });
+            $('#btnGroupSub').find("input").each(function () {
+                $(this).removeClass("active-btn-match");
+            });
+            var scopeStr = "";
+            var topStr = "";
+            var subStr = "";
+            for (var i in scopeTopArr) {
+                if ("" == scopeStr) {
+                    scopeStr = scopeTopArr[i];
+                } else {
+                    scopeStr += "," + scopeTopArr[i]
+                }
+                if (topStr == "") {
+                    topStr = scopeTopArr[i]
+                } else {
+                    topStr = topStr + "," + scopeTopArr[i]
+                }
+            }
+            for (var i in scopeSubArr) {
+                if ("" == scopeStr) {
+                    scopeStr = scopeSubArr[i];
+                } else {
+                    scopeStr += "," + scopeSubArr[i]
+                }
+                if (subStr == "") {
+                    subStr = scopeSubArr[i]
+                } else {
+                    subStr = subStr + "," + scopeSubArr[i]
+                }
+            }
+            if (setValue == 3) {
+                $('#s_scopeclass').val(scopeStr);
+                $('#s_scopeclass').attr('title', scopeStr);
+                dataMap["s_globaltopscopeclass"] = topStr;
+                dataMap["s_globalsubscopeclass"] = subStr;
+            } else {
+                for (var i in selectIndex) {
+                    var j = selectIndex[i] - 1;
+                    $("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(10)").html(scopeStr);
+                    o_rules[j]["s_topscopeclass"] = topStr;
+                    o_rules[j]["s_subscopeclass"] = subStr;
+                }
             }
+            $('#modal-select-scope').modal("hide");
+            scopeTopArr.length = 0;
+            scopeSubArr.length = 0;
         }
-        $('#modal-select-scope').modal("hide");
-        scopeTopArr.length = 0;
-        scopeSubArr.length = 0;
-    }
 
-    //页面添加附加词、排除词
-    function addkeyWord(rdata) {
-        o_rules = rdata["o_rules"];
-        $('#g_addkey').attr("value", rdata["s_globaladdkey"]);
-        $('#g_notkey').attr("value", rdata["s_globalnotkey"]);
-        $('#s_globalclearkey').attr("value", rdata["s_globalclearkey"]);
-        dataMap["s_globaladdkey"] = rdata["s_globaladdkey"];
-        dataMap["s_globalnotkey"] = rdata["s_globalnotkey"];
-        dataMap["s_globalclearkey"] = rdata["s_globalclearkey"];
-
-        $('#keywords').dataTable().fnClearTable();
-        $('#keywords').dataTable().fnAddData(rdata["o_rules"]);
-    }
-
-    //表格全选
-    function allSelect(obj) {
-        if ($(obj).is(':checked')) {
-            keyTableChecked = true;
-            keyTableAllChecked = true;
-            $('input[name="ckb-keyid"]').each(function () {
-                this.checked = true;
-                selectIndex.push($(this).parents("tr").index() + 1);
-            })
-        } else {
-            selectIndex.length = 0;
-            keyTableChecked = false;
-            keyTableAllChecked = false;
-            $('input[name="ckb-keyid"]').each(function () {
-                this.checked = false;
-            })
+        //页面添加附加词、排除词
+        function addkeyWord(rdata) {
+            o_rules = rdata["o_rules"];
+            $('#g_addkey').attr("value", rdata["s_globaladdkey"]);
+            $('#g_notkey').attr("value", rdata["s_globalnotkey"]);
+            $('#s_globalclearkey').attr("value", rdata["s_globalclearkey"]);
+            dataMap["s_globaladdkey"] = rdata["s_globaladdkey"];
+            dataMap["s_globalnotkey"] = rdata["s_globalnotkey"];
+            dataMap["s_globalclearkey"] = rdata["s_globalclearkey"];
+
+            $('#keywords').dataTable().fnClearTable();
+            $('#keywords').dataTable().fnAddData(rdata["o_rules"]);
         }
-    }
 
-    //表格单个选中
-    function singleSelect(obj) {
-        var tag = true;
-        selectIndex.length = 0;
-        $('input[name="ckb-keyid"]').each(function () {
-            if (this.checked) {
+        //表格全选
+        function allSelect(obj) {
+            if ($(obj).is(':checked')) {
                 keyTableChecked = true;
-                selectIndex.push($(this).parents("tr").index() + 1);
+                keyTableAllChecked = true;
+                $('input[name="ckb-keyid"]').each(function () {
+                    this.checked = true;
+                    selectIndex.push($(this).parents("tr").index() + 1);
+                })
             } else {
-                tag = false
+                selectIndex.length = 0;
+                keyTableChecked = false;
+                keyTableAllChecked = false;
+                $('input[name="ckb-keyid"]').each(function () {
+                    this.checked = false;
+                })
             }
-        });
-        if (tag) {
-            keyTableAllChecked = true;
-            $('#allCheckbox').prop("checked", true);
-        } else {
-            keyTableAllChecked = false;
-            $('#allCheckbox').prop("checked", false);
         }
-    }
 
-    function saveTag() {
-        let obj = checkArea(dataMap.s_area, dataMap.s_city, dataMap.s_district);
-        if (!obj.flag) {
-            let msg = "选择的" + obj.v1 + "和" + obj.v2 + "生成es语句时会产生错误,请重新选择其中一个";
-            showMsg(msg);
-            return
-        }
-        dataMap["s_customer"] = $('#customer').val();
-        dataMap["s_name"] = $('#tagname').val();
-        dataMap["s_salesperson"] = $('#salename').val();
-        dataMap["s_serverperson"] = $("#serverperson").val();
-        dataMap["s_customername"] = $("#customername").val();
-        dataMap["s_globaladdkey"] = $('#g_addkey').val();
-        dataMap["s_globalnotkey"] = $('#g_notkey').val();
-        dataMap["s_globalclearkey"] = $('#s_globalclearkey').val();
-        //通用规则采购单位行业和关键词中的采购单位行业只能存在一个
-        if (o_rules && o_rules.length > 0) {
-            let tag = false;
-            for (var i in o_rules) {
-                if (o_rules[i].s_buyerclass) {
-                    tag = true
+        //表格单个选中
+        function singleSelect(obj) {
+            var tag = true;
+            selectIndex.length = 0;
+            $('input[name="ckb-keyid"]').each(function () {
+                if (this.checked) {
+                    keyTableChecked = true;
+                    selectIndex.push($(this).parents("tr").index() + 1);
+                } else {
+                    tag = false
                 }
+            });
+            if (tag) {
+                keyTableAllChecked = true;
+                $('#allCheckbox').prop("checked", true);
+            } else {
+                keyTableAllChecked = false;
+                $('#allCheckbox').prop("checked", false);
             }
-            if (tag && dataMap.s_globalbuyerclass) {
-                showMsg("保存失败,采购单位行业在通用规则和关键词规则中不能同时存在!")
-                return;
-            }
-        }
-        //关键词、附加词、排除词存在,则必须有相应的匹配方式
-        if (dataMap.s_globaladdkey && !dataMap.s_globaladdkeymatch || !dataMap.s_globaladdkey && dataMap.s_globaladdkeymatch) {
-            showMsg("保存失败,全局附加词必须有对应的匹配方式!")
-            return;
         }
-        if (dataMap.s_globalnotkey && !dataMap.s_globalnotkeymatch || !dataMap.s_globalnotkey && dataMap.s_globalnotkeymatch) {
-            showMsg("保存失败,全局附加词必须有对应的匹配方式!")
-            return;
-        }
-        if (dataMap.s_globalclearkey && !dataMap.s_globalclearkeymatch || !dataMap.s_globalclearkey && dataMap.s_globalclearkeymatch) {
-            showMsg("保存失败,全局附加词必须有对应的匹配方式!")
-            return;
-        }
-        if (o_rules && o_rules.length > 0) {
-            for (const i in o_rules) {
-                if (o_rules[i].s_matchkey && !o_rules[i].s_keymatch || !o_rules[i].s_matchkey && o_rules[i].s_keymatch) {
-                    showMsg("保存失败,关键词规则中有关键词未对应匹配方式!")
-                    return;
-                }
-                if (o_rules[i].s_addkey && !o_rules[i].s_addkeymatch || !o_rules[i].s_addkey && o_rules[i].s_addkeymatch) {
-                    showMsg("保存失败,关键词规则中有附加词未对应匹配方式!")
-                    return;
+
+        function saveTag() {
+            let obj = checkArea(dataMap.s_area, dataMap.s_city, dataMap.s_district);
+            if (!obj.flag) {
+                let msg = "选择的" + obj.v1 + "和" + obj.v2 + "生成es语句时会产生错误,请重新选择其中一个";
+                showMsg(msg);
+                return
+            }
+            dataMap["s_customer"] = $('#customer').val();
+            dataMap["s_name"] = $('#tagname').val();
+            dataMap["s_salesperson"] = $('#salename').val();
+            dataMap["s_serverperson"] = $("#serverperson").val();
+            dataMap["s_customername"] = $("#customername").val();
+            dataMap["s_globaladdkey"] = $('#g_addkey').val();
+            dataMap["s_globalnotkey"] = $('#g_notkey').val();
+            dataMap["s_globalclearkey"] = $('#s_globalclearkey').val();
+            //通用规则采购单位行业和关键词中的采购单位行业只能存在一个
+            if (o_rules && o_rules.length > 0) {
+                let tag = false;
+                for (var i in o_rules) {
+                    if (o_rules[i].s_buyerclass) {
+                        tag = true
+                    }
                 }
-                if (o_rules[i].s_notkey && !o_rules[i].s_notkeymatch || !o_rules[i].s_notkey && o_rules[i].s_notkeymatch) {
-                    showMsg("保存失败,关键词规则中有排除词未对应匹配方式!")
+                if (tag && dataMap.s_globalbuyerclass) {
+                    showMsg("保存失败,采购单位行业在通用规则和关键词规则中不能同时存在!")
                     return;
                 }
             }
-        }
-        dataMap["s_customer"] = $('#customer').val();
-        dataMap["s_name"] = $('#tagname').val();
-        dataMap["s_salesperson"] = $('#salename').val();
-        dataMap["s_serverperson"] = $("#serverperson").val();
-        dataMap["s_customername"] = $("#customername").val();
-        dataMap["s_globaladdkey"] = $('#g_addkey').val();
-        dataMap["s_globalnotkey"] = $('#g_notkey').val();
-        dataMap["s_globalclearkey"] = $('#s_globalclearkey').val();
-        if (dataMap["s_customer"] == "" || dataMap["s_name"] == "" || dataMap["s_salesperson"] == "" || dataMap["s_serverperson"] == "") {
-            alert("请填写必须字段!")
-            return
-        }
-        if ($('#starttime').find("input").val() != "") {
-            var start = $('#starttime').find("input").val();
-            start = new Date(start).getTime() / 1000;
-            dataMap["i_starttime"] = start;
-        } else {
-            dataMap["i_starttime"] = 0
-        }
-        if ($('#endtime').find("input").val() != "") {
-            var end = $('#endtime').find("input").val();
-            end = new Date(end).getTime() / 1000;
-            dataMap["i_endtime"] = end;
-        } else {
-            dataMap["i_endtime"] = 0
-        }
-        var budget = "";
-        if ($('#s_budget_min').val() != "") {
-            budget = "大于" + $('#s_budget_min').val()
-        }
-        if ($('#s_budget_max').val() != "") {
-            if (budget == "") {
-                budget = "小于" + $('#s_budget_max').val()
+            //关键词、附加词、排除词存在,则必须有相应的匹配方式
+            if (dataMap.s_globaladdkey && !dataMap.s_globaladdkeymatch || !dataMap.s_globaladdkey && dataMap.s_globaladdkeymatch) {
+                showMsg("保存失败,全局附加词必须有对应的匹配方式!")
+                return;
+            }
+            if (dataMap.s_globalnotkey && !dataMap.s_globalnotkeymatch || !dataMap.s_globalnotkey && dataMap.s_globalnotkeymatch) {
+                showMsg("保存失败,全局附加词必须有对应的匹配方式!")
+                return;
+            }
+            if (dataMap.s_globalclearkey && !dataMap.s_globalclearkeymatch || !dataMap.s_globalclearkey && dataMap.s_globalclearkeymatch) {
+                showMsg("保存失败,全局附加词必须有对应的匹配方式!")
+                return;
+            }
+            if (o_rules && o_rules.length > 0) {
+                for (const i in o_rules) {
+                    if (o_rules[i].s_matchkey && !o_rules[i].s_keymatch || !o_rules[i].s_matchkey && o_rules[i].s_keymatch) {
+                        showMsg("保存失败,关键词规则中有关键词未对应匹配方式!")
+                        return;
+                    }
+                    if (o_rules[i].s_addkey && !o_rules[i].s_addkeymatch || !o_rules[i].s_addkey && o_rules[i].s_addkeymatch) {
+                        showMsg("保存失败,关键词规则中有附加词未对应匹配方式!")
+                        return;
+                    }
+                    if (o_rules[i].s_notkey && !o_rules[i].s_notkeymatch || !o_rules[i].s_notkey && o_rules[i].s_notkeymatch) {
+                        showMsg("保存失败,关键词规则中有排除词未对应匹配方式!")
+                        return;
+                    }
+                }
+            }
+            dataMap["s_customer"] = $('#customer').val();
+            dataMap["s_name"] = $('#tagname').val();
+            dataMap["s_salesperson"] = $('#salename').val();
+            dataMap["s_serverperson"] = $("#serverperson").val();
+            dataMap["s_customername"] = $("#customername").val();
+            dataMap["s_globaladdkey"] = $('#g_addkey').val();
+            dataMap["s_globalnotkey"] = $('#g_notkey').val();
+            dataMap["s_globalclearkey"] = $('#s_globalclearkey').val();
+            if (dataMap["s_customer"] == "" || dataMap["s_name"] == "" || dataMap["s_salesperson"] == "" || dataMap["s_serverperson"] == "") {
+                alert("请填写必须字段!")
+                return
+            }
+            if ($('#starttime').find("input").val() != "") {
+                var start = $('#starttime').find("input").val();
+                start = new Date(start).getTime() / 1000;
+                dataMap["i_starttime"] = start;
             } else {
-                budget = budget + ",小于" + $('#s_budget_max').val()
+                dataMap["i_starttime"] = 0
             }
-        }
-        dataMap["s_budgetlimit"] = budget;
-        var bidamount = "";
-        if ($('#s_bidamount_min').val() != "") {
-            bidamount = "大于" + $('#s_bidamount_min').val()
-        }
-        if ($('#s_bidamount_max').val() != "") {
-            if (bidamount == "") {
-                bidamount = "小于" + $('#s_bidamount_max').val()
+            if ($('#endtime').find("input").val() != "") {
+                var end = $('#endtime').find("input").val();
+                end = new Date(end).getTime() / 1000;
+                dataMap["i_endtime"] = end;
             } else {
-                bidamount = bidamount + ",小于" + $('#s_bidamount_max').val()
+                dataMap["i_endtime"] = 0
             }
-        }
-        dataMap["s_bidamountlimit"] = bidamount;
-        if ($('#maxnum').val() !== "") {
-            dataMap["i_maxnum"] = $('#maxnum').val();
-        }
-        if (dataMap.s_globaladdkeymatch.indexOf("1") > -1 || dataMap.s_globaladdkeymatch.indexOf("2") > -1 || dataMap.s_globaladdkeymatch.indexOf("3") > -1 ||
-            dataMap.s_globaladdkeymatch.indexOf("4") > -1 || dataMap.s_globaladdkeymatch.indexOf("5") > -1) {
-            dataMap["i_globaladdkeytype"] = 1
-        } else if (dataMap.s_globaladdkeymatch.indexOf("6") > -1 || dataMap.s_globaladdkeymatch.indexOf("7") > -1 ||
-            dataMap.s_globaladdkeymatch.indexOf("8") > -1 || dataMap.s_globaladdkeymatch.indexOf("9") > -1) {
-            dataMap["i_globaladdkeytype"] = 2
-        } else {
-            dataMap["i_globaladdkeytype"] = 0
-        }
-        if (dataMap.s_globalnotkeymatch.indexOf("1") > -1 || dataMap.s_globalnotkeymatch.indexOf("2") > -1 || dataMap.s_globalnotkeymatch.indexOf("3") > -1 ||
-            dataMap.s_globalnotkeymatch.indexOf("4") > -1 || dataMap.s_globalnotkeymatch.indexOf("5") > -1) {
-            dataMap["i_globalnotkeytype"] = 1
-        } else if (dataMap.s_globalnotkeymatch.indexOf("6") > -1 || dataMap.s_globalnotkeymatch.indexOf("7") > -1 ||
-            dataMap.s_globalnotkeymatch.indexOf("8") > -1 || dataMap.s_globalnotkeymatch.indexOf("9") > -1) {
-            dataMap["i_globalnotkeytype"] = 2
-        } else {
-            dataMap["i_globalnotkeytype"] = 0
-        }
-        dataMap["o_rules"] = JSON.stringify(o_rules);
-        $.ajax({
-            url: "/customerRule/cuser/rule/create",
-            type: 'POST',
-            data: dataMap,
-            success: function (r) {
-                if (r.rep && r.id) {
-                    dataMap.id = r.id
-                    $('#estxt').val(r.s_esquery);
-                    state = 2;
-                    showTip("保存成功", 1000);
+            var budget = "";
+            if ($('#s_budget_min').val() != "") {
+                budget = "大于" + $('#s_budget_min').val()
+            }
+            if ($('#s_budget_max').val() != "") {
+                if (budget == "") {
+                    budget = "小于" + $('#s_budget_max').val()
                 } else {
-                    showTip("保存失败", 1000);
+                    budget = budget + ",小于" + $('#s_budget_max').val()
                 }
             }
-        })
-    }
-
-    //生成数据
-    function produceData() {
-        com.maskShow("正在生成数据...");
-        $.ajax({
-            url: "/customerRule/cuser/produce",
-            type: "post",
-            data: {"id": dataMap.id},
-            success: function (r) {
-                com.maskHide();
-                if (r.rep) {
-                    dataMap.i_estotal = r.count;
-                    showTip("数据生成成功", 1000);
+            dataMap["s_budgetlimit"] = budget;
+            var bidamount = "";
+            if ($('#s_bidamount_min').val() != "") {
+                bidamount = "大于" + $('#s_bidamount_min').val()
+            }
+            if ($('#s_bidamount_max').val() != "") {
+                if (bidamount == "") {
+                    bidamount = "小于" + $('#s_bidamount_max').val()
                 } else {
-                    showTip("数据生成失败", 1000);
+                    bidamount = bidamount + ",小于" + $('#s_bidamount_max').val()
                 }
-            },
-            error: function (r) {
-                com.maskHide();
             }
-        })
-    }
+            dataMap["s_bidamountlimit"] = bidamount;
+            if ($('#maxnum').val() !== "") {
+                dataMap["i_maxnum"] = $('#maxnum').val();
+            }
+            if (dataMap.s_globaladdkeymatch.indexOf("1") > -1 || dataMap.s_globaladdkeymatch.indexOf("2") > -1 || dataMap.s_globaladdkeymatch.indexOf("3") > -1 ||
+                dataMap.s_globaladdkeymatch.indexOf("4") > -1 || dataMap.s_globaladdkeymatch.indexOf("5") > -1) {
+                dataMap["i_globaladdkeytype"] = 1
+            } else if (dataMap.s_globaladdkeymatch.indexOf("6") > -1 || dataMap.s_globaladdkeymatch.indexOf("7") > -1 ||
+                dataMap.s_globaladdkeymatch.indexOf("8") > -1 || dataMap.s_globaladdkeymatch.indexOf("9") > -1) {
+                dataMap["i_globaladdkeytype"] = 2
+            } else {
+                dataMap["i_globaladdkeytype"] = 0
+            }
+            if (dataMap.s_globalnotkeymatch.indexOf("1") > -1 || dataMap.s_globalnotkeymatch.indexOf("2") > -1 || dataMap.s_globalnotkeymatch.indexOf("3") > -1 ||
+                dataMap.s_globalnotkeymatch.indexOf("4") > -1 || dataMap.s_globalnotkeymatch.indexOf("5") > -1) {
+                dataMap["i_globalnotkeytype"] = 1
+            } else if (dataMap.s_globalnotkeymatch.indexOf("6") > -1 || dataMap.s_globalnotkeymatch.indexOf("7") > -1 ||
+                dataMap.s_globalnotkeymatch.indexOf("8") > -1 || dataMap.s_globalnotkeymatch.indexOf("9") > -1) {
+                dataMap["i_globalnotkeytype"] = 2
+            } else {
+                dataMap["i_globalnotkeytype"] = 0
+            }
+            dataMap["o_rules"] = JSON.stringify(o_rules);
+            $.ajax({
+                url: "/customerRule/cuser/rule/create",
+                type: 'POST',
+                data: dataMap,
+                success: function (r) {
+                    if (r.rep && r.id) {
+                        dataMap.id = r.id
+                        $('#estxt').val(r.s_esquery);
+                        state = 2;
+                        showTip("保存成功", 1000);
+                    } else {
+                        showTip("保存失败", 1000);
+                    }
+                }
+            })
+        }
 
-    //预览数据
-    function previewData() {
-        myDataTable = $('#previewData').DataTable({
-            "destroy": true,
-            "paging": true,
-            "lengthChange": false,
-            "searching": false,
-            "ordering": false,
-            "info": true,
-            "autoWidth": true,
-            "serverSide": true,
-            "ajax": {
-                url: "/customerRule/rule/preview",
+        //生成数据
+        function produceData() {
+            com.maskShow("正在生成数据...");
+            $.ajax({
+                url: "/customerRule/cuser/produce",
                 type: "post",
-                data: {"s_dataid": dataMap.s_dataid},
-            },
-            "language": {
-                "url": "/dist/js/dataTables.chinese.lang"
-            },
-            "fnDrawCallback": function () {
-                $("ul.pagination").prepend("&nbsp;&nbsp;&nbsp;转到第 <input type='text' id='changePage'   style='width:20px;'> 页    <a type='text' href='javascript:void(0);' id='dataTable-btn' style='text-align:center'>GO</a>");
-                $('#dataTable-btn').click(function (e) {
-                    var redirectpage = 0
-                    if ($("#changePage").val() && $("#changePage").val() > 0) {
-                        var redirectpage = $("#changePage").val() - 1;
+                data: {"id": dataMap.id},
+                success: function (r) {
+                    com.maskHide();
+                    if (r.rep) {
+                        dataMap.i_estotal = r.count;
+                        showTip("数据生成成功", 1000);
+                    } else {
+                        showTip("数据生成失败", 1000);
                     }
-                    myDataTable.page(redirectpage).draw(false);
-                });
-                this.api().column(0).nodes().each(function (cell, i) {
-                    cell.innerHTML = i + 1;
-                });
-            },
-            "columns": [
-                {"data": null, width: "2%"},
-                {
-                    "data": function (row) {
-                        if (row.s_matchkey) {
-                            return row.s_matchkey
-                        } else {
-                            return ""
-                        }
-                    }, width: "8%"
                 },
-                {
-                    "data": function (row) {
-                        if (row.area) {
-                            return row.area
-                        } else {
-                            return ""
-                        }
-                    }, width: "4%"
+                error: function (r) {
+                    com.maskHide();
+                }
+            })
+        }
+
+        //预览数据
+        function previewData() {
+            myDataTable = $('#previewData').DataTable({
+                "destroy": true,
+                "paging": true,
+                "lengthChange": false,
+                "searching": false,
+                "ordering": false,
+                "info": true,
+                "autoWidth": true,
+                "serverSide": true,
+                "ajax": {
+                    url: "/customerRule/rule/preview",
+                    type: "post",
+                    data: {"s_dataid": dataMap.s_dataid},
                 },
-                {
-                    "data": function (row) {
-                        if (row.city) {
-                            return row.city
-                        } else {
-                            return ""
+                "language": {
+                    "url": "/dist/js/dataTables.chinese.lang"
+                },
+                "fnDrawCallback": function () {
+                    $("ul.pagination").prepend("&nbsp;&nbsp;&nbsp;转到第 <input type='text' id='changePage'   style='width:20px;'> 页    <a type='text' href='javascript:void(0);' id='dataTable-btn' style='text-align:center'>GO</a>");
+                    $('#dataTable-btn').click(function (e) {
+                        var redirectpage = 0
+                        if ($("#changePage").val() && $("#changePage").val() > 0) {
+                            var redirectpage = $("#changePage").val() - 1;
                         }
-                    }, width: "4%"
+                        myDataTable.page(redirectpage).draw(false);
+                    });
+                    this.api().column(0).nodes().each(function (cell, i) {
+                        cell.innerHTML = i + 1;
+                    });
                 },
-                {
-                    "data": function (row) {
-                        if (row.s_jyhref) {
-                            if (row.title.length > 36) {
-                                var str = row.title.substring(0, 36) + "..."
+                "columns": [
+                    {"data": null, width: "2%"},
+                    {
+                        "data": function (row) {
+                            if (row.s_matchkey) {
+                                return row.s_matchkey
                             } else {
-                                var str = row.title
+                                return ""
                             }
-                            tmp = '<a class="" target="_blank" href=' + row.s_jyhref + '>' + str + '</a>';
-                            return tmp
-                        } else {
-                            return row.title
-                        }
-                    }, width: "5%"
-                },
-                {
-                    "data": function (row) {
-                        if (row.subtype) {
-                            return row.subtype
-                        } else {
-                            return ""
-                        }
-                    }, width: "4%"
-                },
-                {
-                    "data": function (row) {
-                        var str = com.trimStr(row.detail);
-                        if (str.length > 14) {
-                            return str.substring(0, 14) + "..."
-                        } else {
-                            return str
-                        }
-                    }, width: "5%"
-                },
-                {
-                    "data": function (row) {
-                        var dt = new Date();
-                        dt.setTime(parseInt(row.publishtime) * 1000);
-                        return dt.format("yyyy-MM-dd")
-                    }, width: "4%"
-                },
-                {
-                    "data": function (row) {
-                        if (row.href) {
-                            var shref = row.href;
-                            tmp = '<a class="" target="_blank" href=' + shref + '>公告地址</a>';
-                            return tmp
-                        } else {
-                            return ""
-                        }
-                    }, width: "5%"
-                },
-                {
-                    "data": function (row) {
-                        if (row.projectcode) {
-                            return row.projectcode
-                        } else {
-                            return ""
-                        }
-                    }, width: "5%"
-                },
-                {
-                    "data": "projectname", width: "5%", render: function (val) {
-                        if (val === undefined) {
-                            return ""
-                        } else {
-                            return val
-                        }
-                    }
-                },
-                {
-                    "data": function (row) {
-                        if (row.projectscope) {
-                            if (row.projectscope.length > 14) {
-                                return row.projectscope.substring(0, 14) + "..."
+                        }, width: "8%"
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.area) {
+                                return row.area
                             } else {
-                                return row.projectscope
+                                return ""
                             }
-                        }
-                        return ""
-                    }, width: "3%"
-                },
-                {
-                    "data": function (row) {
-                        if (row.budget == undefined) {
-                            return ""
-                        } else {
-                            return row.budget
-                        }
-                    }, width: "3%"
-                },
-                {
-                    "data": function (row) {
-                        if (row.bidamount == undefined) {
-                            return ""
-                        } else {
-                            return row.bidamount
-                        }
-                    }, width: "3%"
-                },
-                {
-                    "data": "bidopentime", width: "3%", render: function (val) {
-                        if (val) {
+                        }, width: "4%"
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.city) {
+                                return row.city
+                            } else {
+                                return ""
+                            }
+                        }, width: "4%"
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.s_jyhref) {
+                                if (row.title.length > 36) {
+                                    var str = row.title.substring(0, 36) + "..."
+                                } else {
+                                    var str = row.title
+                                }
+                                tmp = '<a class="" target="_blank" href=' + row.s_jyhref + '>' + str + '</a>';
+                                return tmp
+                            } else {
+                                return row.title
+                            }
+                        }, width: "5%"
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.subtype) {
+                                return row.subtype
+                            } else {
+                                return ""
+                            }
+                        }, width: "4%"
+                    },
+                    {
+                        "data": function (row) {
+                            var str = com.trimStr(row.detail);
+                            if (str.length > 14) {
+                                return str.substring(0, 14) + "..."
+                            } else {
+                                return str
+                            }
+                        }, width: "5%"
+                    },
+                    {
+                        "data": function (row) {
                             var dt = new Date();
-                            dt.setTime(parseInt(val) * 1000);
+                            dt.setTime(parseInt(row.publishtime) * 1000);
                             return dt.format("yyyy-MM-dd")
-                        } else {
-                            return ""
-                        }
-                    }
-                },
-                {
-                    "data": "buyer", width: "3%", render: function (val) {
-                        if (val == undefined) {
-                            val = ""
-                        }
-                        return val
-                    }
-                },
-                {
-                    "data": function (row) {
-                        if (row.buyerperson) {
-                            return row.buyerperson
-                        } else {
-                            return ""
-                        }
-                    }, width: "4%"
-                },
-                {
-                    "data": function (row) {
-                        if (row.buyertel) {
-                            return row.buyertel
-                        } else {
-                            return ""
-                        }
-                    }, width: "4%"
-                },
-                {
-                    "data": "agency", width: "5%", render: function (val) {
-                        if (val == undefined) {
-                            val = ""
-                        }
-                        return val
-                    }
-                },
-                {
-                    "data": "s_winner", width: "3%", render: function (val) {
-                        if (val == undefined) {
-                            val = ""
-                        }
-                        return val
-                    }
-                },
-                {
-                    "data": function (row) {
-                        if (row.winnerperson) {
-                            return row.winnerperson
-                        } else {
-                            return ""
+                        }, width: "4%"
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.href) {
+                                var shref = row.href;
+                                tmp = '<a class="" target="_blank" href=' + shref + '>公告地址</a>';
+                                return tmp
+                            } else {
+                                return ""
+                            }
+                        }, width: "5%"
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.projectcode) {
+                                return row.projectcode
+                            } else {
+                                return ""
+                            }
+                        }, width: "5%"
+                    },
+                    {
+                        "data": "projectname", width: "5%", render: function (val) {
+                            if (val === undefined) {
+                                return ""
+                            } else {
+                                return val
+                            }
                         }
-                    }, width: "4%"
-                },
-                {
-                    "data": function (row) {
-                        if (row.winnertel) {
-                            return row.winnertel
-                        } else {
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.projectscope) {
+                                if (row.projectscope.length > 14) {
+                                    return row.projectscope.substring(0, 14) + "..."
+                                } else {
+                                    return row.projectscope
+                                }
+                            }
                             return ""
+                        }, width: "3%"
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.budget == undefined) {
+                                return ""
+                            } else {
+                                return row.budget
+                            }
+                        }, width: "3%"
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.bidamount == undefined) {
+                                return ""
+                            } else {
+                                return row.bidamount
+                            }
+                        }, width: "3%"
+                    },
+                    {
+                        "data": "bidopentime", width: "3%", render: function (val) {
+                            if (val) {
+                                var dt = new Date();
+                                dt.setTime(parseInt(val) * 1000);
+                                return dt.format("yyyy-MM-dd")
+                            } else {
+                                return ""
+                            }
                         }
-                    }, width: "4%"
-                },
-                {
-                    "data": function (row) {
-                        if (row.legal_person) {
-                            return row.legal_person
-                        } else {
-                            return ""
+                    },
+                    {
+                        "data": "buyer", width: "3%", render: function (val) {
+                            if (val == undefined) {
+                                val = ""
+                            }
+                            return val
                         }
-                    }, width: "4%"
-                },
-                {
-                    "data": function (row) {
-                        if (row.company_phone) {
-                            return row.company_phone
-                        } else {
-                            return ""
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.buyerperson) {
+                                return row.buyerperson
+                            } else {
+                                return ""
+                            }
+                        }, width: "4%"
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.buyertel) {
+                                return row.buyertel
+                            } else {
+                                return ""
+                            }
+                        }, width: "4%"
+                    },
+                    {
+                        "data": "agency", width: "5%", render: function (val) {
+                            if (val == undefined) {
+                                val = ""
+                            }
+                            return val
                         }
-                    }, width: "4%"
-                },
-                {
-                    "data": function (row) {
-                        if (row.company_email) {
-                            return row.company_email
-                        } else {
-                            return ""
+                    },
+                    {
+                        "data": "s_winner", width: "3%", render: function (val) {
+                            if (val == undefined) {
+                                val = ""
+                            }
+                            return val
                         }
-                    }, width: "4%"
-                },
-            ]
-        });
-        $('#modal-preview').modal("show");
-        if (dataMap.i_extfieldstype == 1) {
-            var str = "标准字段包 " + dataMap.i_maxnum + "/" + dataMap.i_estotal;
-            $('#dataCount').html(str)
-        } else {
-            var str = "高级字段包 " + dataMap.i_maxnum + "/" + dataMap.i_estotal;
-            $('#dataCount').html(str)
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.winnerperson) {
+                                return row.winnerperson
+                            } else {
+                                return ""
+                            }
+                        }, width: "4%"
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.winnertel) {
+                                return row.winnertel
+                            } else {
+                                return ""
+                            }
+                        }, width: "4%"
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.legal_person) {
+                                return row.legal_person
+                            } else {
+                                return ""
+                            }
+                        }, width: "4%"
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.company_phone) {
+                                return row.company_phone
+                            } else {
+                                return ""
+                            }
+                        }, width: "4%"
+                    },
+                    {
+                        "data": function (row) {
+                            if (row.company_email) {
+                                return row.company_email
+                            } else {
+                                return ""
+                            }
+                        }, width: "4%"
+                    },
+                ]
+            });
+            $('#modal-preview').modal("show");
+            if (dataMap.i_extfieldstype == 1) {
+                var str = "标准字段包 " + dataMap.i_maxnum + "/" + dataMap.i_estotal;
+                $('#dataCount').html(str)
+            } else {
+                var str = "高级字段包 " + dataMap.i_maxnum + "/" + dataMap.i_estotal;
+                $('#dataCount').html(str)
+            }
         }
-    }
 
-    //导入标签
-    function importRule() {
+        //导入标签
+        function importRule() {
 
-        $("#file").click();
-    }
+            $("#file").click();
+        }
 
-    $(function () {
-        $("#uploadform").find("input").change(function () {
+        $(function () {
+            $("#uploadform").find("input").change(function () {
 
-            var val = $(this).val() ? $(this).val() : "";
-            if (val.indexOf(".xlsx") < 0) {
-                showMsg("文件格式非法", function () {
-                });
-            } else {
-                var myform = new FormData();
-                myform.append('xlsx', $("#file")[0].files[0]);
-                $.ajax({
-                    url: "/customerRule/rule/import",
-                    type: 'POST',
-                    data: myform,
-                    async: false,
-                    contentType: false,//不要设置Content-Type请求头
-                    processData: false,// 使数据不做处理
-                    success: function (r) {
-                        if (r.rep) {
-                            // dataMap["id"] = r.id;
-
-                            addkeyWord(r.rdata);
-                            alert("导入成功")
-                        } else {
-                            alert("导入失败")
+                var val = $(this).val() ? $(this).val() : "";
+                if (val.indexOf(".xlsx") < 0) {
+                    showMsg("文件格式非法", function () {
+                    });
+                } else {
+                    var myform = new FormData();
+                    myform.append('xlsx', $("#file")[0].files[0]);
+                    $.ajax({
+                        url: "/customerRule/rule/import",
+                        type: 'POST',
+                        data: myform,
+                        async: false,
+                        contentType: false,//不要设置Content-Type请求头
+                        processData: false,// 使数据不做处理
+                        success: function (r) {
+                            if (r.rep) {
+                                // dataMap["id"] = r.id;
+
+                                addkeyWord(r.rdata);
+                                alert("导入成功")
+                            } else {
+                                alert("导入失败")
+                            }
+                            $("#uploadform").find("input").val('')
                         }
-                        $("#uploadform").find("input").val('')
-                    }
-                })
-            }
+                    })
+                }
+            })
         })
-    })
-
-    var key_flag = -1;      // 0:新增,1:修改
-    //关键词表格新增
-    function add_Rule() {
-        key_flag = 0;
-        $('#keyword_txt').val("");
-        $('#addword_txt').val("");
-        $('#notword_txt').val("");
-                $('#modal-add-keyword > div > div > div > div.modal-header > div > div > span:nth-child(2)').html("新增关键词")
-
-        $('#modal-add-keyword').modal("show");
-    }
 
-    //关键词修改
-    function modify_Rule() {
-        if (selectIndex.length == 1) {
-            key_flag = 1;
-            var index = selectIndex[0] - 1;
-            $('#modal-add-keyword').modal("show");
-            $('#keyword_txt').val(o_rules[index].s_matchkey);
-            $('#addword_txt').val(o_rules[index].s_addkey);
-            $('#notword_txt').val(o_rules[index].s_notkey);
-                            $('#modal-add-keyword > div > div > div > div.modal-header > div > div > span:nth-child(2)').html("修改关键词")
+        var key_flag = -1;      // 0:新增,1:修改
+        //关键词表格新增
+        function add_Rule() {
+            key_flag = 0;
+            $('#keyword_txt').val("");
+            $('#addword_txt').val("");
+            $('#notword_txt').val("");
+            $('#modal-add-keyword > div > div > div > div.modal-header > div > div > span:nth-child(2)').html("新增关键词")
 
-        } else {
-            showTip("请选中需要修改的关键词,且只能选中一条", 1000)
+            $('#modal-add-keyword').modal("show");
         }
 
-    }
-
-    function saveKeyword() {
-        var key = $('#keyword_txt').val();
-        var addkey = $('#addword_txt').val();
-        var notkey = $('#notword_txt').val();
-        if (key != "") {
-            var rule = {};
-            rule["s_matchkey"] = key.replace(",", ",");
-            if (addkey != "") rule["s_addkey"] = addkey.replace(",", ",");
-            if (notkey != "") rule["s_notkey"] = notkey.replace(",", ",");
-            $('#modal-add-keyword').modal('hide');
-            if (key_flag == 1) {
-            
-              
-            
-     
-              var index = selectIndex[0] - 1;
-              o_rules[index]
-                
-         
-              //保存原有关键词匹配方式 附加词匹配方式 排除词匹配方式对应的code
-              var s_keymatch_code=o_rules[index]["s_keymatch"]
-              var s_addkeymatch_code=o_rules[index]["s_addkeymatch"]
-              var s_notkeymatch_code=o_rules[index]["s_notkeymatch"]
-              
-              //采购单位和公告行业赋值
-               rule["s_buyerclass"]=o_rules[index]["s_buyerclass"]
-              rule["s_subscopeclass"]=o_rules[index]["s_subscopeclass"]
-              rule["s_topscopeclass"]=o_rules[index]["s_topscopeclass"]
-              
-              /* if (rule["s_matchkey"]&&rule["s_matchkey"]!=""){
-                          $("#keywords tbody tr:nth-child("+selectIndex[0]+") td:nth-child(4)").html(a);
-
-                        o_rules[index]["s_keymatch"]=s_keymatch_code
-
-            }
-            if (rule["s_addkey"]&&rule["s_addkey"]!="")
-            {
-                          $("#keywords tbody tr:nth-child("+selectIndex[0]+") td:nth-child(6)").html(b);
-            o_rules[index]["s_addkeymatch"]=s_addkeymatch_code
+        //关键词修改
+        function modify_Rule() {
+            if (selectIndex.length == 1) {
+                key_flag = 1;
+                var index = selectIndex[0] - 1;
+                $('#modal-add-keyword').modal("show");
+                $('#keyword_txt').val(o_rules[index].s_matchkey);
+                $('#addword_txt').val(o_rules[index].s_addkey);
+                $('#notword_txt').val(o_rules[index].s_notkey);
+                $('#modal-add-keyword > div > div > div > div.modal-header > div > div > span:nth-child(2)').html("修改关键词")
 
+            } else {
+                showTip("请选中需要修改的关键词,且只能选中一条", 1000)
             }
-            if (rule["s_notkey"]&&rule["s_notkey"] !="")
-            {
-                          $("#keywords tbody tr:nth-child("+selectIndex[0]+") td:nth-child(8)").html(c);
-            o_rules[index]["s_notkeymatch"]=s_notkeymatch_code
 
-            }*/
-            
-             if (rule["s_matchkey"]&&rule["s_matchkey"]!=""){
+        }
 
-                        rule["s_keymatch"]=s_keymatch_code
+        function saveKeyword() {
+            var key = $('#keyword_txt').val();
+            var addkey = $('#addword_txt').val();
+            var notkey = $('#notword_txt').val();
+            if (key != "") {
+                var rule = {};
+                rule["s_matchkey"] = key.replace(",", ",");
+                if (addkey != "") rule["s_addkey"] = addkey.replace(",", ",");
+                if (notkey != "") rule["s_notkey"] = notkey.replace(",", ",");
+                $('#modal-add-keyword').modal('hide');
+                if (key_flag == 1) {
+                    var index = selectIndex[0] - 1;
+                    o_rules[index]
+
+                    //保存原有关键词匹配方式 附加词匹配方式 排除词匹配方式对应的code
+                    var s_keymatch_code = o_rules[index]["s_keymatch"]
+                    var s_addkeymatch_code = o_rules[index]["s_addkeymatch"]
+                    var s_notkeymatch_code = o_rules[index]["s_notkeymatch"]
+
+                    //采购单位和公告行业赋值
+                    rule["s_buyerclass"] = o_rules[index]["s_buyerclass"]
+                    rule["s_subscopeclass"] = o_rules[index]["s_subscopeclass"]
+                    rule["s_topscopeclass"] = o_rules[index]["s_topscopeclass"]
+
+                    /* if (rule["s_matchkey"]&&rule["s_matchkey"]!=""){
+                                $("#keywords tbody tr:nth-child("+selectIndex[0]+") td:nth-child(4)").html(a);
+
+                              o_rules[index]["s_keymatch"]=s_keymatch_code
+
+                  }
+                  if (rule["s_addkey"]&&rule["s_addkey"]!="")
+                  {
+                                $("#keywords tbody tr:nth-child("+selectIndex[0]+") td:nth-child(6)").html(b);
+                  o_rules[index]["s_addkeymatch"]=s_addkeymatch_code
+
+                  }
+                  if (rule["s_notkey"]&&rule["s_notkey"] !="")
+                  {
+                                $("#keywords tbody tr:nth-child("+selectIndex[0]+") td:nth-child(8)").html(c);
+                  o_rules[index]["s_notkeymatch"]=s_notkeymatch_code
+
+                  }*/
+
+                    if (rule["s_matchkey"] && rule["s_matchkey"] != "") {
+
+                        rule["s_keymatch"] = s_keymatch_code
 
-            }
-            if (rule["s_addkey"]&&rule["s_addkey"]!="")
-            {
-            rule["s_addkeymatch"]=s_addkeymatch_code
+                    }
+                    if (rule["s_addkey"] && rule["s_addkey"] != "") {
+                        rule["s_addkeymatch"] = s_addkeymatch_code
 
-            }
-            if (rule["s_notkey"]&&rule["s_notkey"] !="")
-            {
-            rule["s_notkeymatch"]=s_notkeymatch_code
-
-            } 
-                o_rules.splice(index, 1, rule)
-                $('#keywords').dataTable().fnClearTable();
-            $('#keywords').dataTable().fnAddData(o_rules);
-            
-          
-          
-         
-          
-          
-            }else {
-                o_rules.push(rule)
-                 $('#keywords').dataTable().fnClearTable();
-            $('#keywords').dataTable().fnAddData(o_rules);
-                
-            }
-          
-            
-     
-           
-           
-      
-        }else {
-            showTip("关键词不能为空", 500)
-        }
-    }
+                    }
+                    if (rule["s_notkey"] && rule["s_notkey"] != "") {
+                        rule["s_notkeymatch"] = s_notkeymatch_code
 
-    //关键词删除
-    function del_Rule() {
-        if (keyTableChecked && selectIndex.length > 0) {
-            showConfirm("确定删除?", function () {
-                var tmp = []
-                for (var i in selectIndex) {
-                    var j = selectIndex[i] - 1;
-                    tmp.push(j)
-                }
-                o_rules = deleteArrayVal(o_rules, tmp)
-                $('#keywords').dataTable().fnClearTable();
-                $('#keywords').dataTable().fnAddData(o_rules);
+                    }
+                    o_rules.splice(index, 1, rule)
+                    $('#keywords').dataTable().fnClearTable();
+                    $('#keywords').dataTable().fnAddData(o_rules);
 
-                keyTableChecked = false;
-                if (o_rules.length == 0) {
-                    $('#allCheckbox').prop("checked", false);
+                } else {
+                    o_rules.push(rule)
                     $('#keywords').dataTable().fnClearTable();
+                    $('#keywords').dataTable().fnAddData(o_rules);
+
                 }
-            })
-        } else {
-            showTip("请选中需要删除的关键词", 500)
+            } else {
+                showTip("关键词不能为空", 500)
+            }
         }
-    }
 
-    function checkArea(area, city, district) {
-        let flag = true;
-        let v1 = "";
-        let v2 = ""
-        if (area == "" && city == "" && district == "") {
-            flag = true
+        //关键词删除
+        function del_Rule() {
+            if (keyTableChecked && selectIndex.length > 0) {
+                showConfirm("确定删除?", function () {
+                    var tmp = []
+                    for (var i in selectIndex) {
+                        var j = selectIndex[i] - 1;
+                        tmp.push(j)
+                    }
+                    o_rules = deleteArrayVal(o_rules, tmp)
+                    $('#keywords').dataTable().fnClearTable();
+                    $('#keywords').dataTable().fnAddData(o_rules);
+
+                    keyTableChecked = false;
+                    if (o_rules.length == 0) {
+                        $('#allCheckbox').prop("checked", false);
+                        $('#keywords').dataTable().fnClearTable();
+                    }
+                })
+            } else {
+                showTip("请选中需要删除的关键词", 500)
+            }
         }
-        if (city != "" && area != "") {
-            var areaArr = area.split(",");
-            var cityArr = city.split(",");
-            for (var i in areaArr) {
-                if (cityMap[areaArr[i]] != undefined) {
-                    for (var j in cityArr) {
-                        if ($.inArray(cityArr[j], cityMap[areaArr[i]]) > -1) {
-                            flag = false;
-                            v1 = areaArr[i];
-                            v2 = cityArr[j]
+
+        function checkArea(area, city, district) {
+            let flag = true;
+            let v1 = "";
+            let v2 = ""
+            if (area == "" && city == "" && district == "") {
+                flag = true
+            }
+            if (city != "" && area != "") {
+                var areaArr = area.split(",");
+                var cityArr = city.split(",");
+                for (var i in areaArr) {
+                    if (cityMap[areaArr[i]] != undefined) {
+                        for (var j in cityArr) {
+                            if ($.inArray(cityArr[j], cityMap[areaArr[i]]) > -1) {
+                                flag = false;
+                                v1 = areaArr[i];
+                                v2 = cityArr[j]
+                            }
                         }
                     }
                 }
+                return {flag: flag, v1: v1, v2: v2}
             }
-            return {flag: flag, v1: v1, v2: v2}
-        }
-        if (city != "" && district != "") {
-            var cityArr = city.split(",");
-            var districtArr = district.split(",");
-            for (var i in cityArr) {
-                if (districtMap[cityArr[i]] != undefined) {
-                    for (var j in districtArr) {
-                        let dis = districtArr[j].split("-")[1];
-                        if ($.inArray(dis, districtMap[cityArr[i]]) > -1) {
-                            flag = false;
-                            v1 = cityArr[i];
-                            v2 = districtArr[j]
+            if (city != "" && district != "") {
+                var cityArr = city.split(",");
+                var districtArr = district.split(",");
+                for (var i in cityArr) {
+                    if (districtMap[cityArr[i]] != undefined) {
+                        for (var j in districtArr) {
+                            let dis = districtArr[j].split("-")[1];
+                            if ($.inArray(dis, districtMap[cityArr[i]]) > -1) {
+                                flag = false;
+                                v1 = cityArr[i];
+                                v2 = districtArr[j]
+                            }
                         }
                     }
                 }
+                return {flag: flag, v1: v1, v2: v2}
             }
             return {flag: flag, v1: v1, v2: v2}
         }
-        return {flag: flag, v1: v1, v2: v2}
-    }
 
-    // 获取页面跳转传过来的参数
-    function GetQueryString(name) {
-        var LocString = String(window.document.location.href);
-        var rs = new RegExp("(^|)" + name + "=([^&]*)(&|$)", "gi").exec(LocString);
-        var tmp;
-        if (tmp = rs) {
-            return decodeURI(tmp[2])
+        // 获取页面跳转传过来的参数
+        function GetQueryString(name) {
+            var LocString = String(window.document.location.href);
+            var rs = new RegExp("(^|)" + name + "=([^&]*)(&|$)", "gi").exec(LocString);
+            var tmp;
+            if (tmp = rs) {
+                return decodeURI(tmp[2])
+            }
+            return "";
         }
-        return "";
-    }
 </script>

+ 249 - 330
src/web/templates/client/keywordRule.html

@@ -43,167 +43,147 @@
             matchCode.length = 0;
             matchName.length = 0;
             $('#modal-select-match').modal("show");
-        }else {
-          matchCode.length=0
-         matchName.length = 0;
+        } else {
+            matchCode.length = 0
+            matchName.length = 0;
 
             if (selectIndex.length > 0 && keyTableChecked) {
                 matchCode.length = 0;
                 matchName.length = 0;
-                
-                
-                if (val==4){
-                  s_matchkey_str=o_rules[selectIndex[0]-1]["s_keymatch"]
-                 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())
-           }
-                }
-                 
-    });
-                  
-          }
-             
-                }
+                if (val == 4) {
+                    s_matchkey_str = o_rules[selectIndex[0] - 1]["s_keymatch"]
+                    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");
-            }else {
+            } else {
                 alert("请选中关键词")
             }
         }
     }
+
     //匹配方式按钮点击事件
     function clickMatchBtn(obj) {
-      
-       var temp_list = ["6","7","8","9"]
-      
-      for (i in temp_list){
-        if (matchCode.indexOf( temp_list[i])>-1){
-          matchCode.length=0
-          matchName.length=0
-          break
+
+        var temp_list = ["6", "7", "8", "9"]
+
+        for (i in temp_list) {
+            if (matchCode.indexOf(temp_list[i]) > -1) {
+                matchCode.length = 0
+                matchName.length = 0
+                break
+            }
         }
-      }
         if ($(obj).hasClass("active-btn-match")) {
             $(obj).removeClass("active-btn-match")
             matchCode.splice($.inArray($(obj).attr("code"), matchCode), 1);
@@ -221,139 +201,88 @@
 
     //采购单位modal
     function selectBuyer(val) {
-     
+
         setValue = val;
-        if (val == 2) {      
+        if (val == 2) {
             $('#modal-select-buyer').modal("show");
-            
-        }else {
+        } else {
             if (keyTableChecked) {
-              
-                  
-       
- buyerArr.length=0
-        // 和button的值匹配,对应添加选中属性
-       
-        var d = $("#keywords tbody tr:nth-child("+selectIndex[0]+") td:nth-child(9)").text()
-        // 按逗号分隔
-        var select_value_array = d.split(",")
-        // 和button的值匹配,对应添加选中属性
-         
-        for (index_ in select_value_array){
-
-              //定位button 添加属性
-                         
-
-              $("#btnGroupBuyer").find("input").each(function () {
-                      
-                if ( $(this).val() ==select_value_array[index_]){
- 
-                             $(this).addClass("active-btn-match");
-
-                  if (buyerArr.indexOf(select_value_array[index_])==-1){
-                  
-                    buyerArr.push($(this).val())
-           }
+                buyerArr.length = 0
+                // 和button的值匹配,对应添加选中属性
+                var d = $("#keywords tbody tr:nth-child(" + selectIndex[0] + ") td:nth-child(9)").text()
+                // 按逗号分隔
+                var select_value_array = d.split(",")
+                // 和button的值匹配,对应添加选中属性
+                for (index_ in select_value_array) {
+                    //定位button 添加属性
+                    $("#btnGroupBuyer").find("input").each(function () {
+                        if ($(this).val() == select_value_array[index_]) {
+                            $(this).addClass("active-btn-match");
+                            if (buyerArr.indexOf(select_value_array[index_]) == -1) {
+                                buyerArr.push($(this).val())
+                            }
+                        }
+                    });
                 }
-                 
-    });
-              
-          }
-             
-            
-            
-            
-            
-               $('#modal-select-buyer').modal("show");
-            }else {
+                $('#modal-select-buyer').modal("show");
+            } else {
                 alert("请选中关键词")
             }
         }
     }
+
     //公告行业modal
     function selectScope(val) {
-     
+
         setValue = val;
         if (val == 3) {
             $('#modal-select-scope').modal("show");
-        }else {
+        } else {
             if (keyTableChecked) {
-               scopeSubArr.length=0
-              
-             //获取当前行的所选规则
-            var s_topscopeclass_str = o_rules[selectIndex[0]-1]["s_topscopeclass"]
-              if (s_topscopeclass_str){
-                
-                s_topscopeclass_list=s_topscopeclass_str.split(",")
-            
-            for (index_ in s_topscopeclass_list){
-
-              //定位button 添加属性
-              $("#btnGroupTop").find("input").each(function () {
-           
-
-                      
-                if (this.value ==s_topscopeclass_list[index_]){
-                   $(this).addClass("active-btn-match");
-                  if (scopeTopArr.indexOf(s_topscopeclass_list[index_])==-1){
-                  
-                    scopeTopArr.push($(this).val())
-           }
-                }
-                 
-    });
-              
-          }
-             
-            
-             //选中
-            
-              }
-              else{
-                
-                
-                s_subscopeclass_str=o_rules[selectIndex[0]-1]["s_subscopeclass"]
-                 if (s_subscopeclass_str){
-                               
-                s_subscopeclass_list=s_subscopeclass_str.split(",")
-            
-            for (index_ in s_subscopeclass_list){
-
-              //定位button 添加属性
-              $("#btnGroupSub").find("input").each(function () {
-           
-             
-                      
-                if ( $(this).attr("code") == s_subscopeclass_list[index_]){
-                    $(this).addClass("active-btn-match");
-                  if (scopeSubArr.indexOf(s_subscopeclass_list[index_])==-1){
-                 
-                    scopeSubArr.push($(this).attr("code"))
-           }
-                }
-                 
-    });
-              
-          }
-             
+                scopeSubArr.length = 0
+                //获取当前行的所选规则
+                var s_topscopeclass_str = o_rules[selectIndex[0] - 1]["s_topscopeclass"]
+                if (s_topscopeclass_str) {
+                    s_topscopeclass_list = s_topscopeclass_str.split(",")
+                    for (index_ in s_topscopeclass_list) {
+                        //定位button 添加属性
+                        $("#btnGroupTop").find("input").each(function () {
+                            if (this.value == s_topscopeclass_list[index_]) {
+                                $(this).addClass("active-btn-match");
+                                if (scopeTopArr.indexOf(s_topscopeclass_list[index_]) == -1) {
+                                    scopeTopArr.push($(this).val())
+                                }
+                            }
+                        });
+                    }
+                    //选中
+
+                } else {
+                    s_subscopeclass_str = o_rules[selectIndex[0] - 1]["s_subscopeclass"]
+                    if (s_subscopeclass_str) {
+                        s_subscopeclass_list = s_subscopeclass_str.split(",")
+                        for (index_ in s_subscopeclass_list) {
+                            //定位button 添加属性
+                            $("#btnGroupSub").find("input").each(function () {
+                                if ($(this).attr("code") == s_subscopeclass_list[index_]) {
+                                    $(this).addClass("active-btn-match");
+                                    if (scopeSubArr.indexOf(s_subscopeclass_list[index_]) == -1) {
+
+                                        scopeSubArr.push($(this).attr("code"))
+                                    }
+                                }
+
+                            });
+                        }
+                    }
                 }
-            
-            
-            
-            
-            
-            
-            
-            
-            
-            
-            }
                 $('#modal-select-scope').modal("show");
-            }else {
+            } else {
                 alert("请选中关键词")
             }
         }
     }
+
     var key_flag = -1;      // 0:新增,1:修改
     //关键词表格新增
     function add_Rule() {
@@ -365,10 +294,11 @@
 
         $('#modal-add-keyword').modal("show");
     }
+
     //关键词修改
-    function modify_Rule(){
+    function modify_Rule() {
         if (selectIndex.length == 1) {
-            
+
             key_flag = 1;
             var index = selectIndex[0] - 1;
             $('#modal-add-keyword > div > div > div > div.modal-header > div > div > span:nth-child(2)').html("修改关键词")
@@ -376,15 +306,16 @@
             $('#keyword_txt').val(o_rules[index].s_matchkey);
             $('#addword_txt').val(o_rules[index].s_addkey);
             $('#notword_txt').val(o_rules[index].s_notkey);
-        }else {
+        } else {
             showTip("请选中需要修改的关键词,且只能选中一条", 1000)
         }
 
     }
+
     //关键词删除
     function del_Rule() {
         if (keyTableChecked && selectIndex.length > 0) {
-            showConfirm("确定删除?", function() {
+            showConfirm("确定删除?", function () {
                 var tmp = []
                 for (var i in selectIndex) {
                     var j = selectIndex[i] - 1;
@@ -400,10 +331,11 @@
                     $('#keywords').dataTable().fnClearTable();
                 }
             })
-        }else {
+        } else {
             showTip("请选中需要删除的关键词", 500)
         }
     }
+
     //表格全选
     function allSelect(obj) {
         if ($(obj).is(':checked')) {
@@ -413,7 +345,7 @@
                 this.checked = true;
                 selectIndex.push($(this).parents("tr").index() + 1);
             })
-        }else {
+        } else {
             selectIndex.length = 0;
             keyTableChecked = false;
             keyTableAllChecked = false;
@@ -422,7 +354,8 @@
             })
         }
     }
-     function saveKeyword() {
+
+    function saveKeyword() {
         var key = $('#keyword_txt').val();
         var addkey = $('#addword_txt').val();
         var notkey = $('#notword_txt').val();
@@ -433,79 +366,65 @@
             if (notkey != "") rule["s_notkey"] = notkey.replace(",", ",");
             $('#modal-add-keyword').modal('hide');
             if (key_flag == 1) {
-            
-              
-            
-     
-              var index = selectIndex[0] - 1;
-              o_rules[index]
-                
-              //保存原有关键词匹配方式 附加词匹配方式 排除词匹配方式对应的code
-              var s_keymatch_code=o_rules[index]["s_keymatch"]
-              var s_addkeymatch_code=o_rules[index]["s_addkeymatch"]
-              var s_notkeymatch_code=o_rules[index]["s_notkeymatch"]
-              
-              //采购单位和公告行业赋值
-               rule["s_buyerclass"]=o_rules[index]["s_buyerclass"]
-              rule["s_subscopeclass"]=o_rules[index]["s_subscopeclass"]
-              rule["s_topscopeclass"]=o_rules[index]["s_topscopeclass"]
-              
-              /* if (rule["s_matchkey"]&&rule["s_matchkey"]!=""){
-                          $("#keywords tbody tr:nth-child("+selectIndex[0]+") td:nth-child(4)").html(a);
-
-                        o_rules[index]["s_keymatch"]=s_keymatch_code
+                var index = selectIndex[0] - 1;
+                o_rules[index]
 
-            }
-            if (rule["s_addkey"]&&rule["s_addkey"]!="")
-            {
-                          $("#keywords tbody tr:nth-child("+selectIndex[0]+") td:nth-child(6)").html(b);
-            o_rules[index]["s_addkeymatch"]=s_addkeymatch_code
+                //保存原有关键词匹配方式 附加词匹配方式 排除词匹配方式对应的code
+                var s_keymatch_code = o_rules[index]["s_keymatch"]
+                var s_addkeymatch_code = o_rules[index]["s_addkeymatch"]
+                var s_notkeymatch_code = o_rules[index]["s_notkeymatch"]
 
-            }
-            if (rule["s_notkey"]&&rule["s_notkey"] !="")
-            {
-                          $("#keywords tbody tr:nth-child("+selectIndex[0]+") td:nth-child(8)").html(c);
-            o_rules[index]["s_notkeymatch"]=s_notkeymatch_code
+                //采购单位和公告行业赋值
+                rule["s_buyerclass"] = o_rules[index]["s_buyerclass"]
+                rule["s_subscopeclass"] = o_rules[index]["s_subscopeclass"]
+                rule["s_topscopeclass"] = o_rules[index]["s_topscopeclass"]
 
-            }*/
-            
-             if (rule["s_matchkey"]&&rule["s_matchkey"]!=""){
+                /* if (rule["s_matchkey"]&&rule["s_matchkey"]!=""){
+                            $("#keywords tbody tr:nth-child("+selectIndex[0]+") td:nth-child(4)").html(a);
 
-                        rule["s_keymatch"]=s_keymatch_code
+                          o_rules[index]["s_keymatch"]=s_keymatch_code
 
-            }
-            if (rule["s_addkey"]&&rule["s_addkey"]!="")
-            {
-            rule["s_addkeymatch"]=s_addkeymatch_code
+              }
+              if (rule["s_addkey"]&&rule["s_addkey"]!="")
+              {
+                            $("#keywords tbody tr:nth-child("+selectIndex[0]+") td:nth-child(6)").html(b);
+              o_rules[index]["s_addkeymatch"]=s_addkeymatch_code
 
-            }
-            if (rule["s_notkey"]&&rule["s_notkey"] !="")
-            {
-            rule["s_notkeymatch"]=s_notkeymatch_code
+              }
+              if (rule["s_notkey"]&&rule["s_notkey"] !="")
+              {
+                            $("#keywords tbody tr:nth-child("+selectIndex[0]+") td:nth-child(8)").html(c);
+              o_rules[index]["s_notkeymatch"]=s_notkeymatch_code
 
-            } 
+              }*/
+
+                if (rule["s_matchkey"] && rule["s_matchkey"] != "") {
+
+                    rule["s_keymatch"] = s_keymatch_code
+
+                }
+                if (rule["s_addkey"] && rule["s_addkey"] != "") {
+                    rule["s_addkeymatch"] = s_addkeymatch_code
+
+                }
+                if (rule["s_notkey"] && rule["s_notkey"] != "") {
+                    rule["s_notkeymatch"] = s_notkeymatch_code
+
+                }
                 o_rules.splice(index, 1, rule)
                 $('#keywords').dataTable().fnClearTable();
-            $('#keywords').dataTable().fnAddData(o_rules);
-            
-          
-          
-         
-          
-          
-            }else {
+                $('#keywords').dataTable().fnAddData(o_rules);
+
+
+            } else {
                 o_rules.push(rule)
-                 $('#keywords').dataTable().fnClearTable();
-            $('#keywords').dataTable().fnAddData(o_rules);
-                
+                $('#keywords').dataTable().fnClearTable();
+                $('#keywords').dataTable().fnAddData(o_rules);
+
             }
-          
-            
-     
-           
-           
-      
-        }else {
+
+
+        } else {
             showTip("关键词不能为空", 500)
         }
     }

文件差異過大導致無法顯示
+ 385 - 132
src/web/templates/private/cuser_rule_create.html


+ 198 - 0
src/web/templates/private/cuser_rule_edit.html

@@ -821,6 +821,121 @@
             if (selectIndex.length > 0 && keyTableChecked) {
                 matchCode.length = 0;
                 matchName.length = 0;
+                if (val == 4) {
+                    s_matchkey_str = o_rules[selectIndex[0] - 1]["s_keymatch"]
+                    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");
             }else {
                 alert("请选中关键词")
@@ -829,6 +944,14 @@
     }
     //匹配方式按钮点击事件
     function clickMatchBtn(obj) {
+        var temp_list = ["6", "7", "8", "9"]
+        for (i in temp_list) {
+            if (matchCode.indexOf(temp_list[i]) > -1) {
+                matchCode.length = 0
+                matchName.length = 0
+                break
+            }
+        }
         if ($(obj).hasClass("active-btn-match")) {
             $(obj).removeClass("active-btn-match")
             matchCode.splice($.inArray($(obj).attr("code"), matchCode), 1);
@@ -929,6 +1052,23 @@
             $('#modal-select-buyer').modal("show");
         }else {
             if (keyTableChecked) {
+                buyerArr.length = 0
+                // 和button的值匹配,对应添加选中属性
+                var d = $("#keywords tbody tr:nth-child(" + selectIndex[0] + ") td:nth-child(9)").text()
+                // 按逗号分隔
+                var select_value_array = d.split(",")
+                // 和button的值匹配,对应添加选中属性
+                for (index_ in select_value_array) {
+                    //定位button 添加属性
+                    $("#btnGroupBuyer").find("input").each(function () {
+                        if ($(this).val() == select_value_array[index_]) {
+                            $(this).addClass("active-btn-match");
+                            if (buyerArr.indexOf(select_value_array[index_]) == -1) {
+                                buyerArr.push($(this).val())
+                            }
+                        }
+                    });
+                }
                 $('#modal-select-buyer').modal("show");
             }else {
                 alert("请选中关键词")
@@ -980,6 +1120,43 @@
             $('#modal-select-scope').modal("show");
         }else {
             if (keyTableChecked) {
+                scopeSubArr.length = 0
+                //获取当前行的所选规则
+                var s_topscopeclass_str = o_rules[selectIndex[0] - 1]["s_topscopeclass"]
+                if (s_topscopeclass_str) {
+                    s_topscopeclass_list = s_topscopeclass_str.split(",")
+                    for (index_ in s_topscopeclass_list) {
+                        //定位button 添加属性
+                        $("#btnGroupTop").find("input").each(function () {
+                            if (this.value == s_topscopeclass_list[index_]) {
+                                $(this).addClass("active-btn-match");
+                                if (scopeTopArr.indexOf(s_topscopeclass_list[index_]) == -1) {
+                                    scopeTopArr.push($(this).val())
+                                }
+                            }
+                        });
+                    }
+                    //选中
+
+                } else {
+                    s_subscopeclass_str = o_rules[selectIndex[0] - 1]["s_subscopeclass"]
+                    if (s_subscopeclass_str) {
+                        s_subscopeclass_list = s_subscopeclass_str.split(",")
+                        for (index_ in s_subscopeclass_list) {
+                            //定位button 添加属性
+                            $("#btnGroupSub").find("input").each(function () {
+                                if ($(this).attr("code") == s_subscopeclass_list[index_]) {
+                                    $(this).addClass("active-btn-match");
+                                    if (scopeSubArr.indexOf(s_subscopeclass_list[index_]) == -1) {
+
+                                        scopeSubArr.push($(this).attr("code"))
+                                    }
+                                }
+
+                            });
+                        }
+                    }
+                }
                 $('#modal-select-scope').modal("show");
             }else {
                 alert("请选中关键词")
@@ -1637,6 +1814,27 @@
             $('#modal-add-keyword').modal('hide');
             if (key_flag == 1) {
                 var index = selectIndex[0] - 1;
+
+                o_rules[index]
+
+                //保存原有关键词匹配方式 附加词匹配方式 排除词匹配方式对应的code
+                var s_keymatch_code = o_rules[index]["s_keymatch"]
+                var s_addkeymatch_code = o_rules[index]["s_addkeymatch"]
+                var s_notkeymatch_code = o_rules[index]["s_notkeymatch"]
+
+                //采购单位和公告行业赋值
+                rule["s_buyerclass"] = o_rules[index]["s_buyerclass"]
+                rule["s_subscopeclass"] = o_rules[index]["s_subscopeclass"]
+                rule["s_topscopeclass"] = o_rules[index]["s_topscopeclass"]
+                if (rule["s_matchkey"] && rule["s_matchkey"] != "") {
+                    rule["s_keymatch"] = s_keymatch_code
+                }
+                if (rule["s_addkey"] && rule["s_addkey"] != "") {
+                    rule["s_addkeymatch"] = s_addkeymatch_code
+                }
+                if (rule["s_notkey"] && rule["s_notkey"] != "") {
+                    rule["s_notkeymatch"] = s_notkeymatch_code
+                }
                 o_rules.splice(index, 1, rule)
             }else {
                 o_rules.push(rule)

+ 181 - 105
src/web/templates/private/euser_tag_rule.html

@@ -7,7 +7,9 @@
     <section class="content-header">
         <h1>私有标签
             <small>
-                <button class="btn btn-primary btn-sm" onclick="importRule()"><i class="fa fa-fw fa-cloud-upload fa-lg"></i>导入关键词</button>
+                <button class="btn btn-primary btn-sm" onclick="importRule()"><i
+                            class="fa fa-fw fa-cloud-upload fa-lg"></i>导入关键词
+                </button>
                 <form style="display:none" id='uploadform' method='post'>
                     <input type='file' name='xlsx' id='file'/>
                 </form>
@@ -23,67 +25,68 @@
     <!-- Main content -->
     <div class="content">
         <form class="form-horizontal">
-                <div class="box box-primary">
-                    <div class="box-header with-border">
-                        <i class="fa fa-tag"></i>
-                        <h3 class="box-title">标签信息</h3>
-                        <a class="btn btn-primary btn-sm" style="float: right;margin-top: 7px;margin-right: 10px" onclick="saveTag1()"><i class="fa fa-fw fa-file-text fa-lg"></i>保存</a>
-                    </div>
-                    <div class="box-body">
-                        <div class="form-group">
-                            <label class="col-sm-2 control-label"><span style="color:red;">* </span>标签名称</label>
-                            <div class="col-sm-3">
-                                <input type="text" class="form-control" id="tagname" placeholder="标签规则名称" required>
-                            </div>
-                        </div>
-                        <div class="form-group">
-                            <label class="col-sm-2 control-label"><span style="color:red;">* </span>是否启用</label>
-                            <div class="col-sm-3">
-                                <input id="useSelect" type="checkbox" checked/>
-                            </div>
-                            <script>
-                                $('#useSelect').on('switchChange.bootstrapSwitch', function (event, state) {
-                                    if (state) {
-                                        dataMap["i_isuse"] = 1
-                                    }else {
-                                        dataMap["i_isuse"] = 0
-                                    }
-                                })
-                            </script>
+            <div class="box box-primary">
+                <div class="box-header with-border">
+                    <i class="fa fa-tag"></i>
+                    <h3 class="box-title">标签信息</h3>
+                    <a class="btn btn-primary btn-sm" style="float: right;margin-top: 7px;margin-right: 10px"
+                       onclick="saveTag1()"><i class="fa fa-fw fa-file-text fa-lg"></i>保存</a>
+                </div>
+                <div class="box-body">
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label"><span style="color:red;">* </span>标签名称</label>
+                        <div class="col-sm-3">
+                            <input type="text" class="form-control" id="tagname" placeholder="标签规则名称" required>
                         </div>
                     </div>
-                    <div class="box-header with-border">
-                        <i class="fa fa-bookmark"></i>
-                        <h3 class="box-title">关键词规则</h3>
-                        <div style="float: right">
-                            <a class="btn btn-default btn-sm" onclick="selectKeyMatch(4)">关键词匹配方式</a>
-                            <a class="btn btn-default btn-sm" onclick="selectKeyMatch(6)">附加词匹配方式</a>
-                            <a class="btn btn-default btn-sm" onclick="selectKeyMatch(8)">排除词匹配方式</a>
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label"><span style="color:red;">* </span>是否启用</label>
+                        <div class="col-sm-3">
+                            <input id="useSelect" type="checkbox" checked/>
                         </div>
+                        <script>
+                            $('#useSelect').on('switchChange.bootstrapSwitch', function (event, state) {
+                                if (state) {
+                                    dataMap["i_isuse"] = 1
+                                } else {
+                                    dataMap["i_isuse"] = 0
+                                }
+                            })
+                        </script>
                     </div>
-                    <div class="box-body">
-                        <table id="keywords" class="table table-bordered">
-                            <thead>
-                            <div style="margin: 10px 10px 0px;">
-                                <a class="btn btn-twitter" onclick="add_Rule()">新增</a>
-                                <a class="btn btn-twitter" onclick="modify_Rule()">修改</a>
-                                <a class="btn btn-twitter" onclick="del_Rule()">删除</a>
-                            </div>
-                            <tr>
-                                <th>编号</th>
-                                <th><input type="checkbox" onclick="allSelect(this)" id="allCheckbox"></th>
-                                <th>关键词</th>
-                                <th>匹配方式</th>
-                                <th>附加词</th>
-                                <th>匹配方式</th>
-                                <th>排除词</th>
-                                <th>匹配方式</th>
-                                <th>标签名称</th>
-                            </tr>
-                            </thead>
-                        </table>
+                </div>
+                <div class="box-header with-border">
+                    <i class="fa fa-bookmark"></i>
+                    <h3 class="box-title">关键词规则</h3>
+                    <div style="float: right">
+                        <a class="btn btn-default btn-sm" onclick="selectKeyMatch(4)">关键词匹配方式</a>
+                        <a class="btn btn-default btn-sm" onclick="selectKeyMatch(6)">附加词匹配方式</a>
+                        <a class="btn btn-default btn-sm" onclick="selectKeyMatch(8)">排除词匹配方式</a>
                     </div>
                 </div>
+                <div class="box-body">
+                    <table id="keywords" class="table table-bordered">
+                        <thead>
+                        <div style="margin: 10px 10px 0px;">
+                            <a class="btn btn-twitter" onclick="add_Rule()">新增</a>
+                            <a class="btn btn-twitter" onclick="modify_Rule()">修改</a>
+                            <a class="btn btn-twitter" onclick="del_Rule()">删除</a>
+                        </div>
+                        <tr>
+                            <th>编号</th>
+                            <th><input type="checkbox" onclick="allSelect(this)" id="allCheckbox"></th>
+                            <th>关键词</th>
+                            <th>匹配方式</th>
+                            <th>附加词</th>
+                            <th>匹配方式</th>
+                            <th>排除词</th>
+                            <th>匹配方式</th>
+                            <th>标签名称</th>
+                        </tr>
+                        </thead>
+                    </table>
+                </div>
+            </div>
         </form>
     </div>
 </div>
@@ -192,10 +195,10 @@
         })
         if ({{.T.tagrule}}) {
             dataMap = {{.T.tagrule}}
-            $('#tagname').val(dataMap.s_name)
+                $('#tagname').val(dataMap.s_name)
             if (dataMap.i_isuse == 1) {
                 $('#useSelect').bootstrapSwitch('state', true);
-            }else {
+            } else {
                 $('#useSelect').bootstrapSwitch('state', false);
             }
             o_list = dataMap.o_list
@@ -217,10 +220,10 @@
         //匹配方式
         for (var i in matchTypeMap) {
             if (i < 5) {
-                btnMatchHtml1 += `<input type="button" class="btn btn-default col-md-pull-2" style="margin-left: 10px;margin-top: 10px" onclick="clickMatchBtn(this)"
+                btnMatchHtml1 += `<input type="button" class="btn btn-default col-md-pull-2 matchWay" style="margin-left: 10px;margin-top: 10px" onclick="clickMatchBtn(this)"
                             code="${matchTypeMap[i]["code"]}" value="${matchTypeMap[i]["name"]}">`;
-            }else {
-                btnMatchHtml2 += `<input type="button" class="btn btn-default col-md-pull-2" style="margin-left: 10px;margin-top: 10px" onclick="clickMatchBtn2(this)"
+            } else {
+                btnMatchHtml2 += `<input type="button" class="btn btn-default col-md-pull-2 matchWay" style="margin-left: 10px;margin-top: 10px" onclick="clickMatchBtn2(this)"
                             code="${matchTypeMap[i]["code"]}" value="${matchTypeMap[i]["name"]}">`;
             }
         }
@@ -244,11 +247,14 @@
             "data": o_list,
             "columns": [
                 {"data": null, width: "1%"},
-                {"data": "", width: "1%", render: function() {
+                {
+                    "data": "", width: "1%", render: function () {
                         return `<input type="checkbox" name="ckb-keyid" onclick="singleSelect(this)" style="text-align: center">`
-                    }},
+                    }
+                },
                 {"data": "s_matchkey", width: "10%"},
-                {"data": function (row) {
+                {
+                    "data": function (row) {
                         var str = row.s_keymatch;
                         if (str && str != "") {
                             var s = "";
@@ -264,9 +270,11 @@
                             return s
                         }
                         return ""
-                    }, width: "5%"},
+                    }, width: "5%"
+                },
                 {"data": "s_addkey", width: "10%"},
-                {"data": function (row) {
+                {
+                    "data": function (row) {
                         var str = row.s_addkeymatch;
                         if (str && str != "") {
                             var s = "";
@@ -282,9 +290,11 @@
                             return s
                         }
                         return ""
-                    }, width: "5%"},
+                    }, width: "5%"
+                },
                 {"data": "s_notkey", width: "10%"},
-                {"data": function (row) {
+                {
+                    "data": function (row) {
                         var str = row.s_notkeymatch;
                         if (str && str != "") {
                             var s = "";
@@ -300,7 +310,8 @@
                             return s
                         }
                         return ""
-                    }, width: "5%"},
+                    }, width: "5%"
+                },
                 {"data": "s_name", width: "10%"},
             ],
             "columnDefs": [{
@@ -308,9 +319,9 @@
                 "render": function (data, type, full, meta) {
                     if (data && data.length > 44) {
                         return "<a title='" + data + "' href='#' style='text-decoration: none;'>" + data.trim().substr(0, 44) + "..." + "</a>";
-                    }else if (data == undefined) {
+                    } else if (data == undefined) {
                         return ""
-                    }else {
+                    } else {
                         return data
                     }
                 }
@@ -319,9 +330,9 @@
                 "render": function (data, type, full, meta) {
                     if (data && data.length > 44) {
                         return "<a title='" + data + "' href='#' style='text-decoration: none;'>" + data.trim().substr(0, 44) + "..." + "</a>";
-                    }else if (data == undefined) {
+                    } else if (data == undefined) {
                         return ""
-                    }else {
+                    } else {
                         return data
                     }
                 }
@@ -330,15 +341,16 @@
                 "render": function (data, type, full, meta) {
                     if (data && data.length > 44) {
                         return "<a title='" + data + "' href='#' style='text-decoration: none;'>" + data.trim().substr(0, 44) + "..." + "</a>";
-                    }else if (data == undefined) {
+                    } else if (data == undefined) {
                         return ""
-                    }else {
+                    } else {
                         return data
                     }
                 }
             }]
         });
     })
+
     function cancelModel() {
         $('#modal-add-keyword').modal("hide");
         $('#modal-select-match').modal("hide");
@@ -349,10 +361,12 @@
             $(this).removeClass("active-btn-match");
         });
     }
+
     function importRule() {
         $("#file").click();
     }
-    $(function() {
+
+    $(function () {
         $("#uploadform").find("input").change(function () {
             var val = $(this).val() ? $(this).val() : "";
             if (val.indexOf(".xlsx") < 0) {
@@ -373,15 +387,16 @@
                             o_list = r.rdata["o_rules"]
                             $('#keywords').dataTable().fnClearTable();
                             $('#keywords').dataTable().fnAddData(o_list);
-                            showTip("导入成功",1000);
+                            showTip("导入成功", 1000);
                         } else {
-                            showTip("导入失败",1000);
+                            showTip("导入失败", 1000);
                         }
                     }
                 })
             }
         })
     });
+
     function allSelect(obj) {
         if ($(obj).is(':checked')) {
             keyTableChecked = true;
@@ -390,7 +405,7 @@
                 this.checked = true;
                 selectIndex.push($(this).parents("tr").index() + 1);
             })
-        }else {
+        } else {
             selectIndex.length = 0;
             keyTableChecked = false;
             keyTableAllChecked = false;
@@ -399,6 +414,7 @@
             })
         }
     }
+
     function singleSelect(obj) {
         var tag = true;
         selectIndex.length = 0;
@@ -406,18 +422,19 @@
             if (this.checked) {
                 keyTableChecked = true;
                 selectIndex.push($(this).parents("tr").index() + 1);
-            }else {
+            } else {
                 tag = false
             }
         });
         if (tag) {
             keyTableAllChecked = true;
             $('#allCheckbox').prop("checked", true);
-        }else {
+        } else {
             keyTableAllChecked = false;
             $('#allCheckbox').prop("checked", false);
         }
     }
+
     function saveTag1() {
         dataMap.s_name = $('#tagname').val()
         if (dataMap.s_name == "") {
@@ -442,7 +459,7 @@
         }
         dataMap["o_list"] = JSON.stringify(o_list);
         dataMap["hid"] = history_id;
-        if(history_id !== ""){
+        if (history_id !== "") {
             dataMap["i_isuse"] = 1;
         }
         $.ajax({
@@ -452,8 +469,8 @@
             success: function (r) {
                 if (r.rep && r.id) {
                     // showTip("保存成功", 1000);
-                    if(history_id !== ""){
-                        window.location.href = "/service/customer/history?id="+ r.id +"&hid="+ history_id; 
+                    if (history_id !== "") {
+                        window.location.href = "/service/customer/history?id=" + r.id + "&hid=" + history_id;
                         return
                     }
                     window.location.href = "/service/customer/edit?id=" + r.id
@@ -463,24 +480,69 @@
             }
         })
     }
+
+    var keyWords = []
+    var addWords = []
+    var filterWords = []
+
     function selectKeyMatch(val) {
+        keyWords = []
+        addWords = []
+        filterWords = []
+        $('input[name="ckb-keyid"]').each(function () {
+            if (this.checked) {
+                var key = $(this).parents("tr").find("td:eq(3)").html()
+                var add = $(this).parents("tr").find("td:eq(5)").html()
+                var filter = $(this).parents("tr").find("td:eq(7)").html()
+                keyWords = key.split(",")
+                addWords = add.split(",")
+                filterWords = filter.split(",")
+            }
+        });
+
         setValue = val;
         if (setValue == 0 || setValue == 1) {
             matchCode.length = 0;
             matchName.length = 0;
             $('#modal-select-match').modal("show");
-        }else {
+        } else {
             if (selectIndex.length > 0 && keyTableChecked) {
                 matchCode.length = 0;
                 matchName.length = 0;
                 $('#modal-select-match').modal("show");
-            }else {
+
+                if (setValue === 4) {
+                    $(".matchWay").each(function () {
+                        console.log(keyWords.indexOf(this.value) !== -1)
+                        if (keyWords.indexOf(this.value) !== -1) {
+                            $(this).addClass("active-btn-match");
+                        }
+                    })
+                } else if (setValue === 6) {
+                    $(".matchWay").each(function () {
+                        if (addWords.indexOf(this.value) !== -1) {
+                            $(this).addClass("active-btn-match");
+                        }
+                    })
+                } else if (setValue === 8) {
+                    $(".matchWay").each(function () {
+                        if (filterWords.indexOf(this.value) !== -1) {
+                            $(this).addClass("active-btn-match");
+                        }
+                    })
+                }
+            } else {
                 alert("请选中关键词")
             }
         }
     }
+
     //匹配方式按钮点击事件
     function clickMatchBtn(obj) {
+        if (matchCode.indexOf("6") !== -1 || matchCode.indexOf("7") !== -1) {
+            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);
@@ -495,6 +557,7 @@
             $(this).removeClass("active-btn-match");
         });
     }
+
     function clickMatchBtn2(obj) {
         matchCode.length = 0;
         matchName.length = 0;
@@ -517,6 +580,7 @@
             $(this).removeClass("active-btn-match");
         });
     }
+
     //匹配方式保存
     function saveMatch() {
         $('#btnGroupMatch').find("input").each(function () {
@@ -530,38 +594,37 @@
         for (var i in matchName) {
             if (matchNameStr == "") {
                 matchNameStr = matchName[i];
-            }else {
+            } else {
                 matchNameStr += "," + matchName[i]
             }
             if (codeStr == "") {
                 codeStr = matchCode[i]
-            }else {
+            } else {
                 codeStr = codeStr + "," + matchCode[i]
             }
         }
         if (setValue == 0) {
             $('#s_addkeymatch').val(matchNameStr);
             dataMap["s_globaladdkeymatch"] = codeStr
-        }else if (setValue == 1) {
+        } else if (setValue == 1) {
             $('#s_notkeymatch').val(matchNameStr);
             dataMap["s_globalnotkeymatch"] = codeStr
-        }else {
+        } else {
             for (var i in selectIndex) {
                 var j = selectIndex[i] - 1;
                 if (setValue == 4) {
-                    if ($("#keywords tbody tr:nth-child("+selectIndex[i]+") td:nth-child(3)").text() != "") {
-                        $("#keywords tbody tr:nth-child("+selectIndex[i]+") td:nth-child("+setValue+")").html(matchNameStr);
+                    if ($("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(3)").text() != "") {
+                        $("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(" + setValue + ")").html(matchNameStr);
                         o_list[j]["s_keymatch"] = codeStr;
                     }
-                }else if (setValue == 6) {
-                    if ($("#keywords tbody tr:nth-child("+selectIndex[i]+") td:nth-child(5)").text() != "") {
-                        $("#keywords tbody tr:nth-child("+selectIndex[i]+") td:nth-child("+setValue+")").html(matchNameStr);
+                } else if (setValue == 6) {
+                    if ($("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(5)").text() != "") {
+                        $("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(" + setValue + ")").html(matchNameStr);
                         o_list[j]["s_addkeymatch"] = codeStr;
                     }
-                }
-                else if (setValue == 8) {
-                    if ($("#keywords tbody tr:nth-child("+selectIndex[i]+") td:nth-child(7)").text() != "") {
-                        $("#keywords tbody tr:nth-child("+selectIndex[i]+") td:nth-child("+setValue+")").html(matchNameStr);
+                } else if (setValue == 8) {
+                    if ($("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(7)").text() != "") {
+                        $("#keywords tbody tr:nth-child(" + selectIndex[i] + ") td:nth-child(" + setValue + ")").html(matchNameStr);
                         o_list[j]["s_notkeymatch"] = codeStr;
                     }
                 }
@@ -571,6 +634,7 @@
         matchName.length = 0;
         matchCode.length = 0;
     }
+
     var key_flag = -1;      // 0:新增,1:修改
     //关键词表格新增
     function add_Rule() {
@@ -580,8 +644,9 @@
         $('#notword_txt').val("");
         $('#modal-add-keyword').modal("show");
     }
+
     //关键词修改
-    function modify_Rule(){
+    function modify_Rule() {
         if (selectIndex.length == 1) {
             key_flag = 1;
             var index = selectIndex[0] - 1;
@@ -590,11 +655,12 @@
             $('#keyword_txt').val(o_list[index].s_matchkey)
             $('#addword_txt').val(o_list[index].s_addkey);
             $('#notword_txt').val(o_list[index].s_notkey);
-        }else {
+        } else {
             showTip("请选中需要修改的关键词,且只能选中一条", 1000)
         }
 
     }
+
     function saveKeyword() {
         var tagname = $('#rulename').val()
         var key = $('#keyword_txt').val()
@@ -609,20 +675,30 @@
             $('#modal-add-keyword').modal('hide');
             if (key_flag == 1) {
                 var index = selectIndex[0] - 1;
+
+                //保存原有关键词匹配方式 附加词匹配方式 排除词匹配方式对应的code
+                var s_keymatch_code = o_list[index]["s_keymatch"]
+                var s_addkeymatch_code = o_list[index]["s_addkeymatch"]
+                var s_notkeymatch_code = o_list[index]["s_notkeymatch"]
+
+                rule["s_keymatch"] = s_keymatch_code
+                rule["s_addkeymatch"] = s_addkeymatch_code
+                rule["s_notkeymatch"] = s_notkeymatch_code
                 o_list.splice(index, 1, rule)
-            }else {
+            } else {
                 o_list.push(rule)
             }
             $('#keywords').dataTable().fnClearTable();
             $('#keywords').dataTable().fnAddData(o_list);
-        }else {
+        } else {
             showTip("必填项不能为空", 1000)
         }
     }
+
     //关键词删除
     function del_Rule() {
         if (keyTableChecked && selectIndex.length > 0) {
-            showConfirm("确定删除?", function() {
+            showConfirm("确定删除?", function () {
                 var tmp = []
                 for (var i in selectIndex) {
                     var j = selectIndex[i] - 1;
@@ -638,7 +714,7 @@
                     $('#keywords').dataTable().fnClearTable();
                 }
             })
-        }else {
+        } else {
             showTip("请选中需要删除的关键词", 500)
         }
     }

部分文件因文件數量過多而無法顯示