|
@@ -67,6 +67,8 @@
|
|
|
</li>
|
|
|
<li data-mode="guide" class="exactRuleShow" style="display: none"><a href="#tab_3" data-toggle="tab" aria-expanded="false">精准筛选规则</a>
|
|
|
</li>
|
|
|
+ <li data-mode="guide" class="exactRuleShow" style="display: none"><a href="#tab_4" data-toggle="tab" aria-expanded="false">精准筛选规则</a>
|
|
|
+ </li>
|
|
|
<button class="btn btn-primary btn-sm" style="float: right;margin-top: 4px;margin-right: 10px"
|
|
|
onclick="saveTag()"><i class="fa fa-fw fa-file-text fa-lg"></i>保存
|
|
|
</button>
|
|
@@ -461,6 +463,31 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="tab-pane" id="tab_3">
|
|
|
+ <div class="box box-primary">
|
|
|
+ <div class="box-header with-border">
|
|
|
+ <div class="col-sm-10">
|
|
|
+ <h5>说明:可根据公告匹配的“关键词分组”个数,确定是否推送该简公告;符合以下其中1条规则即推送</h5>
|
|
|
+ </div>
|
|
|
+ <div class="col-sm-2">
|
|
|
+ <button class="btn btn-twitter btn-sm" style="float: right;margin-top: 4px;margin-right: 10px"
|
|
|
+ onclick="addExactRuleShow()"><i class="fa fa-fw fa-file-text fa-lg"></i>新增
|
|
|
+ </button> </div>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <table id="exactRuleTable" class="table table-bordered">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>编号</th>
|
|
|
+ <th>关键词分组匹配条件</th>
|
|
|
+
|
|
|
+ <th>操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="tab-pane" id="tab_4">
|
|
|
<div class="box box-primary">
|
|
|
<div class="box-header with-border">
|
|
|
<div class="form-group">
|
|
@@ -519,6 +546,7 @@
|
|
|
var selectIndex = []; //选中的编号
|
|
|
var setValue = 0; // 4: 关键词匹配方式,6:附加词匹配方式,8:排除词匹配方式,9:采购单位,10:公告行业, 2:全局采购单位类型, 3:全局公告行业
|
|
|
var state = 1;
|
|
|
+ var exactRuleArr =[];// 临时数组 用于存放规则字符串转换后的数据
|
|
|
$(document).ready(function () {
|
|
|
var name1 = {{(session "user").name}};
|
|
|
if (name1 != dataMap.s_updateuser) {
|
|
@@ -2706,4 +2734,146 @@
|
|
|
})
|
|
|
}
|
|
|
//分组管理
|
|
|
+ // 精准筛选规则-新增按钮点击方法
|
|
|
+ function addExactRuleShow(){
|
|
|
+ // 判断是否设置关键词
|
|
|
+
|
|
|
+ // 判断是否设置关键词匹配方式
|
|
|
+
|
|
|
+ // 新增精准筛选规则弹框
|
|
|
+ // 请求分组列表接口获取数据
|
|
|
+ $.ajax({
|
|
|
+ url: "/service/cuser/groupList",
|
|
|
+ type: "post",
|
|
|
+ data: {"id": dataMap.id},
|
|
|
+ async: false,
|
|
|
+ success: function (r) {
|
|
|
+ if (r.data) {
|
|
|
+ for (var i in r.data) {
|
|
|
+ var groupOption = document.createElement('option');
|
|
|
+ groupOption.innerText =r.data[i].name
|
|
|
+ groupOption.value = r.data[i].name
|
|
|
+ $("select[name='groupSelect']").append(groupOption)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ $("#modal-add-exactRule").modal("show");
|
|
|
+ }
|
|
|
+ // 精准筛选规则-新增按钮
|
|
|
+ function addExactRule(){
|
|
|
+ // groupList()
|
|
|
+ // $(".addGroup").hide()
|
|
|
+
|
|
|
+ $("#insertexactRule .exact-rule-2").show()
|
|
|
+ $("#addExactRuleButton").hide()
|
|
|
+ // $(".insertexactRule-form").selectpicker("refresh");
|
|
|
+ }
|
|
|
+ // 精准筛选规则-新增精准匹配规则保存按钮点击事件
|
|
|
+ function add_exactRule_save(){
|
|
|
+
|
|
|
+ // 获取值
|
|
|
+ document.querySelector("#insertexactRule > div.insertexactRule-form.exact-rule-1 > div:nth-child(1) > div > select")
|
|
|
+ // 更新exactRuleArr 临时数组
|
|
|
+
|
|
|
+ // 转化成 规则保存到dataMap["s_exactRule"]
|
|
|
+ exactRuleArrToStr()
|
|
|
+ //
|
|
|
+ }
|
|
|
+ // 精准筛选规则-临时数组转换成规则字符串
|
|
|
+ // [[{"group":"A","match_way":"content","count":5},{},{}],[]]
|
|
|
+ // (title_A>0 and content_B>8) or title_B>4 or (content_A>7 and content_B>1)
|
|
|
+ function exactRuleArrToStr(){
|
|
|
+ let ruleStrArr = []
|
|
|
+ for (let i = 0; i < exactRuleArr.length; i++) {
|
|
|
+ let rulesArr = [];
|
|
|
+ for (let j = 0; j < exactRuleArr[i].length; j++) {
|
|
|
+ let count =exactRuleArr[i][j].count-1
|
|
|
+ let group = exactRuleArr[i][j].group
|
|
|
+ let match_way = exactRuleArr[i][j].match_way
|
|
|
+ let rule = match_way+"_"+group+">"+count
|
|
|
+ rulesArr.push(rule)
|
|
|
+ }
|
|
|
+ if (rulesArr.length>1){ // 拼接小括号
|
|
|
+ ruleStrArr.push("("+rulesArr.join(" and ")+")")
|
|
|
+ }else {
|
|
|
+ if (rulesArr.length>0){
|
|
|
+ ruleStrArr.push(rulesArr[0])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dataMap["s_exactRule"] = ruleStrArr.join(" or ")
|
|
|
+ }
|
|
|
+ // (title_A>0 and content_B>8) or title_B>4 or (content_A>7 and content_B>1)
|
|
|
+ // 精准筛选规则-规则字符串转换成临时数组 仅支持这种格式 (title_A>0 and content_B>8) or title_B>4 or (content_A>7 and content_B>1)
|
|
|
+ // 返回值 status true 成功 false 转换失败
|
|
|
+ // 分组名称不要包含公式中的符号 : 下划线、>、()、or、and
|
|
|
+ function exactRuleArrToStr() {
|
|
|
+ // let exactRuleStr = dataMap["s_exactRule"]
|
|
|
+ let exactRuleStr = "(title_A>0 and content_B>8) or title_B>4 or (content_A>7 and content_B>1)"
|
|
|
+ debugger
|
|
|
+ let exactRuleList = exactRuleStr.split(" or ") // 分割成单条规则
|
|
|
+ for (let i=0; i< exactRuleList.length; i++) {
|
|
|
+ let exactRuleTmp = exactRuleList[i]
|
|
|
+ let rulesArr = [];
|
|
|
+ if (exactRuleTmp.startsWith("(")) {
|
|
|
+ exactRuleTmp = exactRuleTmp.slice(1, -1) //去掉首尾的括号
|
|
|
+ }
|
|
|
+ let singleRuleArr = exactRuleTmp.split(" and ") // 分割单条规则中的数据
|
|
|
+ for (let j=0;j<singleRuleArr.length;j++) {
|
|
|
+ let singleRule =singleRuleArr[j]
|
|
|
+ // 匹配方式
|
|
|
+ let singleRuleSplit = singleRule.split("_")
|
|
|
+ if (singleRuleSplit.length<2){
|
|
|
+ console.log("singleRuleSplit 长度不够",singleRuleSplit)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let matchWay = singleRuleSplit[0] // 第一位是匹配方式
|
|
|
+ // 然后接着分割出分组名称和次数 使用 _
|
|
|
+ let singleRuleSplit2 = singleRuleSplit[1].split(">")
|
|
|
+ if (singleRuleSplit2.length<2){
|
|
|
+ console.log("singleRuleSplit2 长度不够",singleRuleSplit2)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let groupName = singleRuleSplit2[0]
|
|
|
+ let count = singleRuleSplit2[1]
|
|
|
+ // 次数 次数这里要+1 因为展示框里用的是>= 公式里面用的是>
|
|
|
+ let rule = {
|
|
|
+ "group":groupName,"match_way":matchWay,"count":parseInt(count)+1
|
|
|
+ }
|
|
|
+ rulesArr.push(rule)
|
|
|
+ }
|
|
|
+ exactRuleArr.push(rulesArr)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 精准筛选规则-铺列表页面
|
|
|
+ function exactRuleTableShow(){
|
|
|
+ let ruleStrArr = []
|
|
|
+ for (let i = 0; i < exactRuleArr.length; i++) {
|
|
|
+ let rulesArr = [];
|
|
|
+ for (let j = 0; j < exactRuleArr[i].length; j++) {
|
|
|
+ let count =exactRuleArr[i][j].count-1
|
|
|
+ let group = exactRuleArr[i][j].group
|
|
|
+ let match_way = exactRuleArr[i][j].match_way
|
|
|
+ let rule = match_way+"_"+group+">"+count
|
|
|
+ rulesArr.push(rule)
|
|
|
+ }
|
|
|
+ if (rulesArr.length>1){ // 拼接小括号
|
|
|
+ ruleStrArr.push("("+rulesArr.join(" and ")+")")
|
|
|
+ }else {
|
|
|
+ if (rulesArr.length>0){
|
|
|
+ ruleStrArr.push(rulesArr[0])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 精准筛选规则-编辑规则页面
|
|
|
+ function exactRuleEdit(){
|
|
|
+
|
|
|
+ }
|
|
|
+ // 精准筛选规则-编辑规则页面
|
|
|
+ function exactRuleDelete(){
|
|
|
+
|
|
|
+ }
|
|
|
</script>
|