Commit 9fe6b58d authored by 胡斌's avatar 胡斌

过滤规则维护页面编写

parent c8358d99
This diff is collapsed.
package com.hp.cmsz.entity;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.*;
/**
* warning_filtering_rule_info_t表对应的实体类
......@@ -14,24 +13,26 @@ import javax.persistence.SequenceGenerator;
* @author Liu Na
*
*/
@Entity
@Table(name = "WARNING_FILTERING_RULE_INFO_T",schema = "ccolap")
public class FilterRule implements Serializable{
private Long warningFilteringRuleId;//过滤规则ID
private Long kpiId;//指标ID
private Long provinceId;//省份ID
private Long channelId;//渠道ID
private Long businessId;//业务ID
private Date filterStartTime;//过滤开始时间
private Date filterEndTime;//过滤结束时间
private String filterReason;//过滤原因
private String filterType;//过滤类型
private Date ruleCrtTime;//规则创建时间
private Date ruleUpdateTime;//规则更新时间
private Timestamp filteringStartTime;//过滤开始时间
private Timestamp filteringEndTime;//过滤结束时间
private String filteringReason;//过滤原因
private String filteringType;//过滤类型
private Timestamp ruleCrtTime;//规则创建时间
private Timestamp ruleUpdateTime;//规则更新时间
private String validFlag;//规则是否有效
private String frequency;//频率
private String ifRepeat;//是否重复
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="FilterRuleSequence")
@SequenceGenerator(name = "FilterRuleSequence", sequenceName = "warning_filtering_rule_info_t_seq", allocationSize=1)
@SequenceGenerator(name = "FilterRuleSequence", sequenceName = "WARNING_FILTERING_RULE_SEQ", allocationSize=1)
public Long getWarningFilteringRuleId() {
return warningFilteringRuleId;
......@@ -51,59 +52,76 @@ public class FilterRule implements Serializable{
public void setProvinceId(Long provinceId) {
this.provinceId = provinceId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getBusinessId() {
return businessId;
}
public void setBusinessId(Long businessId) {
this.businessId = businessId;
}
public Date getFilterStartTime() {
return filterStartTime;
public Timestamp getFilteringStartTime() {
return filteringStartTime;
}
public void setFilterStartTime(Date filterStartTime) {
this.filterStartTime = filterStartTime;
public void setFilteringStartTime(Timestamp filteringStartTime) {
this.filteringStartTime = filteringStartTime;
}
public Date getFilterEndTime() {
return filterEndTime;
public Timestamp getFilteringEndTime() {
return filteringEndTime;
}
public void setFilterEndTime(Date filterEndTime) {
this.filterEndTime = filterEndTime;
public void setFilteringEndTime(Timestamp filteringEndTime) {
this.filteringEndTime = filteringEndTime;
}
public String getFilterReason() {
return filterReason;
public String getFilteringReason() {
return filteringReason;
}
public void setFilterReason(String filterReason) {
this.filterReason = filterReason;
public void setFilteringReason(String filteringReason) {
this.filteringReason = filteringReason;
}
public String getFilterType() {
return filterType;
public String getFilteringType() {
return filteringType;
}
public void setFilterType(String filterType) {
this.filterType = filterType;
public void setFilteringType(String filteringType) {
this.filteringType = filteringType;
}
public Date getRuleCrtTime() {
public Timestamp getRuleCrtTime() {
return ruleCrtTime;
}
public void setRuleCrtTime(Date ruleCrtTime) {
public void setRuleCrtTime(Timestamp ruleCrtTime) {
this.ruleCrtTime = ruleCrtTime;
}
public Date getRuleUpdateTime() {
public Timestamp getRuleUpdateTime() {
return ruleUpdateTime;
}
public void setRuleUpdateTime(Date ruleUpdateTime) {
public void setRuleUpdateTime(Timestamp ruleUpdateTime) {
this.ruleUpdateTime = ruleUpdateTime;
}
public String getValidFlag() {
return validFlag;
}
public void setValidFlag(String validFlag) {
this.validFlag = validFlag;
}
public String getFrequency() {
return frequency;
}
public void setFrequency(String frequency) {
this.frequency = frequency;
}
public String getIfRepeat() {
return ifRepeat;
}
public void setIfRepeat(String ifRepeat) {
this.ifRepeat = ifRepeat;
}
}
......@@ -25,6 +25,10 @@ public interface BusinessDao extends JpaSpecificationExecutor<Business>,
@Query("select business.businessId, business.businessName from Business business where business.isActive = 'Y' and business.businessId >= 0 order by business.businessId")
List<Object[]> findAllBusinessIdAndBusinessName();
@Query("from Business business where business.isActive = 'Y' and business.businessId >= 0 order by business.businessId")
List<Business> findAllBusiness();
//加入isActive=N || add by August 2014-3-27
//由数据来源和渠道得到业务
@Query("select business.businessId, business.businessName from Business business,ChannelDataSourceMap channelDataSourceMap where business.channelDataSourceMapId=channelDataSourceMap.channelDataSourceMapId and channelDataSourceMap.channelId IN (:channelIdList) and channelDataSourceMap.dataSourceId IN (:datasourceIdList) and business.isActive = 'Y' and business.businessId >= 0 order by business.businessId ")
......
......@@ -29,6 +29,7 @@ public interface KpiDao extends JpaSpecificationExecutor<Kpi>,PagingAndSortingRe
@Query("select kpi.kpiName, kpi.kpiCode from Kpi kpi where kpi.kpiId = :kpiId")
List<Kpi> findKpiCodeAndKpiNameByKpiId(@Param("kpiId") Long kpiId);
List<Kpi> findAllByIsActive(String active);
@Query("select kpi.kpiId, kpi.kpiName from Kpi kpi where kpi.kpiId >=0")
List<Object[]> findAllKpiIdAndKpiName();
......
package com.hp.cmsz.service.analysissupport;
import com.hp.cmsz.entity.FilterRule;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.*;
import java.util.List;
/**
*
* @author Liu Na
......@@ -12,4 +16,22 @@ import org.springframework.transaction.annotation.Transactional;
@Transactional
public class FilterRuleService {
@PersistenceContext
protected EntityManager em;
@Transactional
public void insertIntoRule(List<FilterRule> filterRules){
long begin = System.currentTimeMillis();
for (int i = 0; i < filterRules.size(); i++) {
em.persist(filterRules.get(i));
if (i % 100 == 0) {
em.flush();
em.clear();
}
}
long end = System.currentTimeMillis();
System.out.println((end-begin)/1000.0);
}
}
package com.hp.cmsz.web.analysissupport;
import java.util.List;
import java.util.Map;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import com.google.gson.Gson;
import com.hp.cmsz.entity.*;
import com.hp.cmsz.repository.*;
import com.hp.cmsz.service.BusinessService;
import com.hp.cmsz.service.analysissupport.FilterRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
import com.hp.cmsz.web.PageURLController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 质量规则维护的新增过滤规则控制类
*
......@@ -48,6 +53,15 @@ public class FilterRuleMaintainController {
@Autowired
private DataSourceDao dataSourceDao;
@Autowired
private FilterRuleDao filterRuleDao;
@Autowired
private FilterRuleService filterRuleService;
@RequestMapping(value = "")
public String filterMaintainHome(Map model){
//查询出所有的省份
......@@ -55,13 +69,17 @@ public class FilterRuleMaintainController {
//查询出所有的渠道信息
List<Channel> channelList=(List<Channel>)channelDao.findChannel();
//查询出所有的指标
List<Kpi> kpiList=(List<Kpi>)kpiDao.findAll();
List<Kpi> kpiList=(List<Kpi>)kpiDao.findAllByIsActive("Y");
//查询出所有的业务
List<Object[]> businessList=(List<Object[]>)businessDao.findAllBusinessIdAndBusinessName();
//查询出所有的数据类型
List<DataType> dataTypeList= (List<DataType>)dataTypeDao.findAll();
//查询出所有的数据来源
List<DataSource> dataSourceList=(List<DataSource>)dataSourceDao.findAll();
Gson gson = new Gson();
model.put("provinceList", provinceList);
model.put("channelList", channelList);
......@@ -69,6 +87,71 @@ public class FilterRuleMaintainController {
model.put("businessList", gson.toJson(businessList));
model.put("dataTypeList", dataTypeList);
model.put("dataSourceList", dataSourceList);
return PageURLController.FilterMaintain;
}
@RequestMapping(value = "/createRule",method = RequestMethod.POST)
public void createRule(
@RequestParam(value="province") String province,
@RequestParam(value="dataSource") String dataSource,
@RequestParam(value="channel") String channel,
@RequestParam(value="businessinput") String businessinput,
@RequestParam(value="kpiinput") String kpiinput,
@RequestParam(value="filterStartTime") String filterStartTime,
@RequestParam(value="filterEndTime") String filterEndTime,
@RequestParam(value="ifRepeate") String ifRepeate,
@RequestParam(value="cycle", required=false) String cycle,
@RequestParam(value="cycleUnit", required=false) String cycleUnit,
@RequestParam(value="filterReason") String filterReason,
HttpServletRequest request, HttpServletResponse response){
//查询出所有的数据来源
List<DataSource> dataSourceList=(List<DataSource>)dataSourceDao.findAll();
ifRepeate = ifRepeate.equals("0")?"1":"0";
String [] kpiArr = kpiinput.split(",");
String [] provinceArr = province.split(",");
List<FilterRule> filterRules = new ArrayList<FilterRule>();
for (String p : provinceArr) {
for (String s : kpiArr) {
FilterRule filterRule = new FilterRule();
filterRule.setKpiId(Long.parseLong(s));
filterRule.setFilteringEndTime(Timestamp.valueOf(filterEndTime));
filterRule.setFilteringStartTime(Timestamp.valueOf(filterStartTime));
filterRule.setProvinceId(Long.parseLong(p));
filterRule.setIfRepeat(ifRepeate);
filterRule.setFilteringType("1");
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
filterRule.setRuleCrtTime(Timestamp.valueOf(df.format(new Date())));
filterRule.setRuleUpdateTime(Timestamp.valueOf(df.format(new Date())));
filterRule.setValidFlag("1");
filterRule.setFilteringReason(filterReason);
if("1".equals(ifRepeate)){
if ("0".equals(cycleUnit)) {
filterRule.setFrequency(cycle+"/1440");
}else if ("1".equals(cycleUnit)) {
filterRule.setFrequency(cycle+"/24");
}else if ("2".equals(cycleUnit)) {
filterRule.setFrequency(cycle);
}else if ("3".equals(cycleUnit)) {
filterRule.setFrequency("ADD_MONTH("+cycle+")");
}
}
filterRules.add(filterRule);
}
}
// filterRuleService.insertIntoRule(filterRules);
}
}
package com.hp.cmsz.web.analysissupport;
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
import com.hp.cmsz.entity.*;
import com.hp.cmsz.repository.*;
import com.hp.cmsz.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -19,11 +25,67 @@ import com.hp.cmsz.web.PageURLController;
@RequestMapping(value="AnalysisSupport/FilterRuleResult")
public class FilterRuleResultController {
@Autowired
private FilterRuleDao filterRuleDao;
@Autowired
private ProvinceDao provinceDao;
@Autowired
private ChannelDao channelDao;
@Autowired
private ChannelDataSourceMapDao channelDataSourceMapDao;
@Autowired
private BusinessService businessService;
@Autowired
private BusinessDao businessDao;
@Autowired
private KpiDao kpiDao;
@Autowired
private DataTypeDao dataTypeDao;
@Autowired
private DataSourceDao dataSourceDao;
@RequestMapping(value = "")
public String ruleResultHome(
@RequestParam(value = "rulePageNum", defaultValue="1") String rulePageNum,
Map model){
List<FilterRule> FilterRuleList = (List<FilterRule>) filterRuleDao.findAll();
Gson gson = new Gson();
//查询出所有的省份
List<Province> provinceList=(List<Province>)provinceDao.findProvince();
//查询出所有的渠道信息
List<Channel> channelList=(List<Channel>)channelDao.findChannel();
//查询出所有的指标
List<Kpi> kpiList=(List<Kpi>)kpiDao.findAllByIsActive("Y");
//查询出所有的业务
List<Business> businessList=(List<Business>)businessDao.findAllBusiness();
//查询出所有的数据类型
List<DataType> dataTypeList= (List<DataType>)dataTypeDao.findAll();
//查询出所有的数据来源
List<DataSource> dataSourceList=(List<DataSource>)dataSourceDao.findAll();
List<ChannelDataSourceMap> channelDataSourceMapList = (List<ChannelDataSourceMap>) channelDataSourceMapDao.findAll();
model.put("channelDataSourceMapList", channelDataSourceMapList);
model.put("provinceList", provinceList);
model.put("channelList", channelList);
model.put("kpiList", kpiList);
model.put("businessList", businessList);
model.put("dataTypeList", dataTypeList);
model.put("dataSourceList", dataSourceList);
model.put("filterRuleViewList", gson.toJson(FilterRuleList));
return PageURLController.FilterResult;
}
......
......@@ -16,38 +16,6 @@
</label>
</div>
</c:forEach>
<!--
<div class="checkbox-inline">
<label>
<input type="checkbox" name="channel" class="channel" value="实体厅" checked disabled> 实体厅
</label>
</div>
<div class="checkbox-inline">
<label>
<input type="checkbox" name="channel" class="channel" value="网厅" checked disabled> 网厅
</label>
</div>
<div class="checkbox-inline">
<label>
<input type="checkbox" name="channel" class="channel" value="短厅" checked disabled> 短厅
</label>
</div>
<div class="checkbox-inline">
<label>
<input type="checkbox" name="channel" class="channel" value="IVR" checked disabled> IVR
</label>
</div>
<div class="checkbox-inline">
<label>
<input type="checkbox" name="channel" class="channel" value="WAP" checked disabled> WAP
</label>
</div>
<div class="checkbox-inline">
<label>
<input type="checkbox" name="channel" class="channel" value="平台" checked disabled> 平台
</label>
</div>
-->
</div>
<script type="text/javascript">
var channelCheckedValues=$(".channel:checked");
......
......@@ -10,7 +10,6 @@
</c:forEach>
</div>
<script type="text/javascript">
console.log("${provinceList}");
//全选和不全选所有的省
$("#allProvince").click(function(){
if($("#allProvince").attr("checked") == "checked"){//全选
......@@ -32,7 +31,7 @@ $(".province").click(function(){
//返回结果为一个数组,数组中包含选中的省份,以逗号隔开的ID
function getProvinceCheckedValues(){
var provinceArray=new Array();
var provinceArray=[];
var i=0;
$(".province:checked").each(function(){
provinceArray[i]=$(this).val();
......
......@@ -53,11 +53,12 @@
<form action="#" class="form-horizontal" id="filterMaintainForm" method="post" enctype="multipart/form-data">
<table id="filterMaintainTable" class="table-null">
<tr><td>省份(<font color="red">必填</font>):</td>
<td>
<td><div style="width: 50%">
<c:forEach var="province" items="${provinceList}">
<input type="checkbox" name="province" id="province" value="${province.provinceId}" checked>${province.provinceName}
<input type="checkbox" name="province" value="${province.provinceId}" checked>${province.provinceName}
</c:forEach>
</td>
</div></td>
</tr>
<tr><td>数据来源(<font color="red">必填</font>):</td>
<td>
......@@ -86,23 +87,27 @@
</tr>
<tr><td>业务(<font color="red">必填</font>):</td>
<td >
<div id="businesstd"></div>
<div id="businesstd" style="width: 50%"></div>
</td>
</tr>
<tr><td>指标(<font color="red">必填</font>):</td>
<td>
<div id="kpitd"></div>
<div id="kpitd" style="width: 50%"></div>
</td>
</tr>
<!--<tr><td>影响开始时间(<font color="red">必填</font>):</td><td><input type="text" class="form-control" id="ruleCrtTime" name="ruleCrtTime" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'ruleCrtTime\')}'})" /></td></tr>
<tr><td>影响结束时间(<font color="red">必填</font>):</td><td><input id="ruleUpdateTime" name="ruleUpdateTime" class="form-control" type="text" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'ruleUpdateTime\')}'})"> </td></tr> -->
<tr><td>生效开始时间(<font color="red">必填</font>):</td><td><input type="text" class="form-control" id="filterStartTime" name="filterStartTime" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'filterStartTime\')}'})" /></td></tr>
<tr><td>生效结束时间(<font color="red">必填</font>):</td><td><input id="filterEndTime" name="filterEndTime" class="form-control" type="text" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'filterEndTime\')}'})"> </td></tr>
<tr><td>是否重复(<font color="red">必填</font>):</td><td><input type="radio" class="ifRepeate" name="ifRepeate" value="1" />
<input type="radio" class="ifRepeate" name="ifRepeate" value="0" /></td></tr>
<tr class="period"><td>过滤周期(<font color="red">必填</font>):</td><td><input type="text" class="form-control" name="scopeMaxValue" id="scopeMaxValue" /></td></tr>
<tr><td>生效开始时间(<font color="red">必填</font>):</td><td><input type="text" class="form-control timeSelect" id="filterStartTime" name="filterStartTime" onfocus="WdatePicker({onpicked:changeDate})" /></td></tr>
<tr><td>生效结束时间(<font color="red">必填</font>):</td><td><input id="filterEndTime" name="filterEndTime" class="form-control timeSelect" type="text" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'filterStartTime\')}',onpicked:changeDate})"> </td></tr>
<tr><td>是否重复(<font color="red">必填</font>):</td><td><input type="radio" class="ifRepeate" name="ifRepeate" value="0" />
<input type="radio" class="ifRepeate" name="ifRepeate" value="1" checked/></td></tr>
<tr class="period"><td>过滤周期(<font color="red">必填</font>):</td>
<td>
<input type="text" style="width: 20%;float: left" class="form-control" name="cycle" id="cycle" />
<select style="width: 12%;float: left" class="form-control" name="cycleUnit" id="unit" >
</select>
</td>
</tr>
<tr><td>过滤原因(<font color="red">必填</font>):</td><td><input type='text' name='filterReason' id='filterReason' class="form-control" style="display: inline;"/></td></tr>
<tr><td></td><td><button type="button" id="ruleSubmit" class="btn btn-primary">确定</button>
<button type="reset" class="btn btn-warning" id="ruleBack">返回</button>
......@@ -120,16 +125,62 @@
$(".period").hide();
$(".ifRepeate").change(function (){
var selectValue = $("input:radio[name='ifRepeate']:checked").val();
console.log(selectValue);
if (selectValue == 0){
$(".period").hide();
var alertMsg=[];
var filterStartTime = $("#filterStartTime").val();
if(filterStartTime ===""){
alertMsg.push("您没有选择生效开始时间,请先选择生效开始时间和结束时间")
}
var filterEndTime = $("#filterEndTime").val();
if(filterEndTime ===""){
alertMsg.push("您没有选择生效结束时间,请先选择生效开始时间和结束时间")
}
if(alertMsg.length ===0){
var timeDifference = new Date(filterEndTime).getTime() - new Date(filterStartTime).getTime();
var $unit = $("#unit");
$unit.empty();
if(timeDifference<(1000*60*60*24)){
$unit.append(new Option("分钟",0));
$unit.append(new Option("小时",1))
}
$unit.append(new Option("天",2));
$unit.append(new Option("月",3))
}else{
alertMsg.forEach(function (t,i) {
msg+="<span style='color: red'>"+(i+1)+"."+t+"</span><br />"
});
$.dialog({
title: "提醒",
content:msg,
ok: function(){
},
okValue:"确定",
lock:true
});
}
if (selectValue == 1){
$(".period").show();
}
})
if (selectValue == 1){
$(".period").hide();
}
});
function changeDate() {
$("input[name='ifRepeate']:eq(1)").attr("checked",'checked');
$(".period").hide();
}
function getProvinceCheckedValues() {
var provinceArray = new Array();
var provinceArray = [];
var i=0;
$("#province:checked").each(function(){
provinceArray[i]=$(this).val();
......@@ -217,7 +268,7 @@ function updateBusiness(dataSource,channel){
updateBusiness($("#dataSource").val(),$("#channel").val());
function getBusinessCheckedValues(){
var businessArray = new Array();
var businessArray = [];
var i=0;
$("[name='businessinput']:checked").each(function(){
businessArray[i]=$(this).val();
......@@ -263,4 +314,106 @@ function getKpiCheckedValuesString(){
}
$('#ruleSubmit').click(function () {
var alertMsg = [];
var provinceArr = $("input:checkbox[name='province']:checked");
if(provinceArr.length ===0){
alertMsg.push("您没有选择省份,请选择省份")
}
var businessArr = $("input:checkbox[name='businessinput']");
var businessChecked=false;
businessArr.each(function () {
if($(this).attr("checked"))businessChecked=true
});
if(businessArr.length !==0 && !businessChecked){
alertMsg.push("您没有选择业务,请选择业务")
}
var kpiArr = $("input:checkbox[name='kpiinput']");
var kpiChecked = false;
kpiArr.each(function () {
if($(this).attr("checked"))kpiChecked=true
});
if(kpiArr.length !==0 && !kpiChecked){
alertMsg.push("您没有选择指标,请选择指标")
}
var filterStartTime = $("#filterStartTime").val();
if(filterStartTime ===""){
alertMsg.push("您没有选择生效开始时间,请选择生效开始时间")
}
var filterEndTime = $("#filterEndTime").val();
if(filterEndTime ===""){
alertMsg.push("您没有选择生效结束时间,请选择生效结束时间")
}
var filterReason = $("#filterReason").val();
if(filterReason ===""){
alertMsg.push("您没有填写过滤原因,请填写过滤原因")
}
var ifRepeate = $("input:radio[name='ifRepeate']:checked").val();
var cycle = $("#cycle").val();
if(ifRepeate ===0 && cycle===""){
alertMsg.push("您选择了重复,请填写重复周期")
}
if(alertMsg.length ===0){
$.dialog({
title: "提醒",
content:"确定上传该规则吗?",
ok: function(){
$.ajax({
cache: true,
type : "POST",
async: false,
dataType : "json",
url: "${ctx}/AnalysisSupport/FilterRuleMaintain/createRule",
data:$("#filterMaintainForm").serialize(),
success: function(data){
window.location.href="${ctx}/AnalysisSupport/FilterRuleResult";
}
})
},
okValue:"确定",
cancel: function(){},
cancelValue:"返回修改",
lock:true
});
}
else{
var msg="";
alertMsg.forEach(function (t,i) {
msg+="<span style='color: red'>"+(i+1)+"."+t+"</span><br />"
});
$.dialog({
title: "提醒",
content:msg,
ok: function(){
},
okValue:"确定",
lock:true
});
}
})
</script>
\ No newline at end of file
......@@ -41,11 +41,40 @@
<div class="slideMenu" id="cbp-spmenu-s2" style="">
<div class="form">
<tags:ProvinceTag />
<tags:ChannelTag />
<tags:BusinessTag />
<div class="slide-menu-option">
<label for="">数据来源</label>
<c:forEach var="list" items="${dataSourceList}">
<div class="checkbox-inline"><label><input type="checkbox" name="dataSource" class="dataSource" title="${list.dataSourceName}" value="${list.dataSourceId }" onchange="showBusiness()" checked >${list.dataSourceName}</label></div>
</c:forEach>
</div>
<div class="slide-menu-option">
<label for="">渠道</label>
<c:forEach var="list" items="${channelList}">
<div class="checkbox-inline"><label><input type="checkbox" name="channel" class="channel" title="${list.channelName}" value="${list.channelId }" onchange="showBusiness()" checked >${list.channelName}</label></div>
</c:forEach>
</div>
<div class="slide-menu-option">
<label for="">业务</label>
<div class="checkbox-inline"><label><input type="checkbox" id="allBusiness" name="allBusiness" checked >全选</label></div>
<div id="businessCheckboxs">
<%--<c:forEach var="list" items="${businessList}">--%>
<%--<div class="checkbox-inline"><label><input type="checkbox" name="business" class="business" title="${list.businessName}" value="${list.businessId }" checked >${list.businessName}</label></div>--%>
<%--</c:forEach>--%>
</div>
</div>
<div class="slide-menu-option">
<label for="">指标</label>
<div class="checkbox-inline"><label><input type="checkbox" id="allKpi" name="allKpi" checked >全选</label></div>
<div id="kpiCheckboxs">
<%--<c:forEach var="list" items="${kpiList}">--%>
<%--<div class="checkbox-inline" id="" style="display: none"><label><input type="checkbox" name="kpi" class="kpi" title="${list.kpiName}" value="${list.kpiId }" checked >${list.kpiName}</label></div>--%>
<%--</c:forEach>--%>
</div>
</div>
<button id="submit" class="btn btn-primary" onclick="modelResultSubmit()">提交</button>
<button id="disable" class="btn btn-warning" onclick="modelResultReset()">重置</button>
<button id="submit" class="btn btn-primary" >提交</button>
<button id="disable" class="btn btn-warning">重置</button>
</div>
</div>
......@@ -87,14 +116,154 @@
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="${ctx}/static/js/filterResultDetailTable.js"></script>
<script type="text/javascript">
filterResultDetailTable();
var provinceArr = [];
<c:forEach var="list" items="${provinceList}">
provinceArr.push({provinceName:'${list.provinceName}',provinceId:'${list.provinceId}'});
</c:forEach>
var channelList = [];
<c:forEach var="list" items="${channelList}">
channelList.push({channelName:'${list.channelName}',channelId:'${list.channelId}'});
</c:forEach>
var businessList = [];
<c:forEach var="list" items="${businessList}">
businessList.push({businessName:'${list.businessName}',businessId:'${list.businessId}',channelDataSourceMapId:'${list.channelDataSourceMapId}'});
</c:forEach>
var channelDataSourceMapList = [];
<c:forEach var="list" items="${channelDataSourceMapList}">
channelDataSourceMapList.push({channelDataSourceMapId:'${list.channelDataSourceMapId}',
channelId:'${list.channelId}',dataSourceId:'${list.dataSourceId}'});
</c:forEach>
var kpiList = [];
<c:forEach var="list" items="${kpiList}">
kpiList.push({kpiId:'${list.kpiId}',
kpiName:'${list.kpiName}',businessId:'${list.businessId}'});
</c:forEach>
var dataSourceList = [];
<c:forEach var="list" items="${dataSourceList}">
dataSourceList.push({dataSourceName:'${list.dataSourceName}', dataSourceId:'${list.dataSourceId}'});
</c:forEach>
filterResultDetailTable();
$('#allBusiness').change(function () {
if($(this).context.checked){
showBusiness();
showKpi();
}else{
$("[name='business']:checked").each(function () {
$(this).removeAttr('checked')
});
showKpi();
}
});
function showBusiness() {
$('#businessCheckboxs').empty();
var selectedDatasource = [];
$("[name='dataSource']:checked").each(function () {
selectedDatasource.push($(this).val())
});
var selectedChannel = [];
$("[name='channel']:checked").each(function () {
selectedChannel.push($(this).val())
});
var channelDataSource = [];
for(var i=0;i<selectedDatasource.length;i++){
for(var j=0;j<selectedChannel.length;j++){
for(var k=0;k<channelDataSourceMapList.length;k++){
if(channelDataSourceMapList[k].channelId ===selectedChannel[j] && channelDataSourceMapList[k].dataSourceId===selectedDatasource[i]){
channelDataSource.push(channelDataSourceMapList[k].channelDataSourceMapId)
}
}
}
}
channelDataSource.forEach(function (t) {
for(var k=0;k<businessList.length;k++){
if(businessList[k].channelDataSourceMapId === t){
var context = '<div class="checkbox-inline"><label><input type="checkbox" name="business" class="business" title="'+businessList[k].businessName+'" value="'+businessList[k].businessId+'" onchange="showKpi()" checked >'+businessList[k].businessName+'</label></div>'
$('#businessCheckboxs').append(context)
}
}
});
showKpi();
}
function showKpi(){
$('#kpiCheckboxs').empty();
var selectedBusiness = [];
$("[name='business']:checked").each(function () {
selectedBusiness.push($(this).val())
});
selectedBusiness.forEach(function (t) {
for(var k=0;k<kpiList.length;k++){
if(kpiList[k].businessId === t){
var context = '<div class="checkbox-inline"><label><input type="checkbox" name="kpi" class="kpi" title="'+kpiList[k].kpiName+'" value="'+kpiList[k].kpiId+'" onchange="test()" checked >'+kpiList[k].kpiName+'</label></div>'
$('#kpiCheckboxs').append(context)
}
}
})
}
$('#submit').click(function(){
var provinceArr ="";
$("[name='province']:checked").each(function () {
provinceArr+=$(this).val()+","
});
provinceArr = provinceArr.substring(0,provinceArr.length-1);
var selectedDatasource=[];
$("[name='dataSource']:checked").each(function () {
selectedDatasource.push($(this).val())
});
var selectedChannel = [];
$("[name='channel']:checked").each(function () {
selectedChannel.push($(this).val())
});
var channelDataSource = [];
for(var i=0;i<selectedDatasource.length;i++){
for(var j=0;j<selectedChannel.length;j++){
for(var k=0;k<channelDataSourceMapList.length;k++){
if(channelDataSourceMapList[k].channelId ===selectedChannel[j] && channelDataSourceMapList[k].dataSourceId===selectedDatasource[i]){
channelDataSource.push(channelDataSourceMapList[k].channelDataSourceMapId)
}
}
}
}
if($('#allBusiness').checked){
var business="";
channelDataSource.forEach(function (t) {
for(var k=0;k<businessList.length;k++){
if(businessList[k].channelDataSourceMapId === t){
business+=businessList[k].businessName+","
}
}
});
}else{
business="";
$("[name='business']:checked").each(function () {
business+=$(this).val()+","
});
}
});
$("#createFilter").click(function(){
$("#createFilter").click(function(){
$.dialog({
title: "提醒",
content:"确定新建过滤规则?",
......
......@@ -127,19 +127,18 @@ function filterResultDetailTable(){
var header = new Array();
header[0] = ["","<input type='radio' name='update'id='update' onclick='javascript:radioChoose(this);'/>","1%",""];
header[1] = ["过滤规则ID","filterRuleId","7%","15"];
header[2] = ["省份","provinceName","7%","15"];
header[3] = ["渠道","qualityRuleId","7%","15"];
header[4] = ["业务","qualityRuleId","7%","15"];
header[5] = ["数据来源","qualityRuleId","7%","15"];
header[6] = ["影响开始时间","qualityRuleId","7%","15"];
header[7] = ["影响结束时间","qualityRuleId","7%","15"];
header[8] = ["是否重复","qualityRuleId","7%","15"];
header[9] = ["过滤周期","qualityRuleId","7%","15"];
header[10] = ["过滤原因","qualityRuleId","7%","15"];
header[1] = ["过滤规则ID","warningFilteringRuleId","7%","15"];
header[2] = ["省份","provinceId","7%","15"];
header[3] = ["渠道","channel","7%","15"];
header[4] = ["业务","business","7%","15"];
header[5] = ["数据来源","datasource","7%","15"];
header[6] = ["影响开始时间","filteringStartTime","7%","15"];
header[7] = ["影响结束时间","filteringEndTime","7%","15"];
header[8] = ["是否重复","ifRepeat","7%","15"];
header[9] = ["过滤周期","frequency","7%","15"];
header[10] = ["过滤原因","filteringReason","7%","15"];
window.pagging = new table_pagging({limit:12,tableId:'filterResultTable',header:header});
//pagging.pagging(jsonData);
pagging.pagging(jsonData,provinceArr);
}
var table_pagging = function() {
this.init.apply(this, arguments);
......@@ -206,6 +205,7 @@ table_pagging.prototype = {
pagging : function(objectJson) {
this.objectlist = eval('(' + objectJson + ')');
if (this.start + this.limit >= this.objectlist.length) {
this.end = this.objectlist.length;
} else {
......@@ -296,45 +296,48 @@ table_pagging.prototype = {
if(tdContext==null){
tdContext = "&nbsp;";
}
/*if(K==3){
if(tdContext!="&nbsp;"){
var strLength = tdContext.lastIndexOf(".");
var strBody = tdContext.substring(0,strLen-14);
var strExt = tdContext.substring(strLen);
tdContext=strBody+strExt;
if(k===2){
tdContext = this.getProvinceName(tdContext)
}
if(k===3){
tdContext = this.getChannel(this.getData(this.objectlist[i],"kpiId"))
}
}*/
// if(k==12){ //显示协查单的详细列表
// tdContext= "<a target='_blank' href='/CmszMonitorAnalysis/MonitorOperation/WorkingOrderReasult?xcdId="+this.getData(this.objectlist[i],this.header[k][1])+"'>"+ tdContext+"</a>"
if(k==9){
if(tdContext!="&nbsp;"){
tdContext = df.format(new Date(tdContext));
if(k===4){
tdContext = this.getBusiness(this.getData(this.objectlist[i],"kpiId"))
}
if(k===5){
tdContext = this.getDataSource(this.getData(this.objectlist[i],"kpiId"))
}
if(k==10){
if(tdContext!="&nbsp;"){
tdContext = df.format(new Date(tdContext));
if(k===6){
tdContext = df.format(new Date(tdContext))
}
if(k===7){
tdContext = df.format(new Date(tdContext))
}
if(k==11){
tdContext = "<a href='javascript:;' onclick='lookParm(\""+this.getData(this.objectlist[i],"dataModelId")+"\",\""+this.getData(this.objectlist[i],"dataModelName")+"\")'>查看参数</a>";
//tdContext = "<a href='javascript:;' onclick=\"openDialog('"+this.getData(this.objectlist[i],"dataModelId")+"','"+ this.getData(this.objectlist[i],"dataModelName")"')\">查看参数</a>";
if(k===8){
tdContext = (tdContext==1)?"是":"否";
}
if(k==4){
if (this.header[k][4] && !(tdContext == "&nbsp;")) {
td.title = tdTitle;
tdContext = tdContext + "";
if (tdContext.length > parseInt(this.header[k][4])) {
tdContext = tdContext.substring(0,
this.header[k][4])
+ "..";
if(k===9){
if(tdContext.indexOf("/")!==-1){
var unit = tdContext.split("/")[1];
var value = tdContext.split("/")[0];
if(unit==="1440")unit="分钟";
if(unit==="24")unit="小时";
}else{
if(tdContext.indexOf("ADD")!==-1){
unit="个月"
value = tdContext.substring(tdContext.indexOf("(")+1,tdContext.length-1)
}else{
value=tdContext;
unit="天"
}
}
tdContext = value+unit;
}
}
} else {
tdContext=this.header[k][1]+"<span style='display:none'>"+i+"</span>";
......@@ -362,14 +365,6 @@ table_pagging.prototype = {
}
}
console.log(tdContext);
td.innerHTML = tdContext;
// alert(tdContext+"----i:"+i+",j:"+j+",k:"+k);
}
......@@ -386,6 +381,81 @@ table_pagging.prototype = {
this.createPageTr();
},
getProvinceName : function (provinceId) {
var provinceName ="&nbsp";
provinceArr.forEach(function (t) {
if(t.provinceId === provinceId+""){
provinceName = t.provinceName
}
});
return provinceName
},
getBusiness : function (kpiId) {
var businessName ="&nbsp";
kpiList.forEach(function (t) {
if(t.kpiId === kpiId+""){
businessName = t.businessId
}
});
businessList.forEach(function (t) {
if(t.businessId === businessName){
businessName = t.businessName
}
});
return businessName
},
getChannel : function (kpiId) {
var tmp ="&nbsp";
kpiList.forEach(function (t) {
if(t.kpiId === kpiId+""){
tmp = t.businessId
}
});
businessList.forEach(function (t) {
if(t.businessId === tmp){
tmp = t.channelDataSourceMapId
}
});
channelDataSourceMapList.forEach(function (t) {
if(t.channelDataSourceMapId === tmp){
tmp = t.channelId
}
});
channelList.forEach(function (t) {
if(t.channelId === tmp){
tmp = t.channelName
}
});
return tmp
},
getDataSource : function (kpiId) {
var tmp ="&nbsp";
kpiList.forEach(function (t) {
if(t.kpiId === kpiId+""){
tmp = t.businessId
}
});
businessList.forEach(function (t) {
if(t.businessId === tmp){
tmp = t.channelDataSourceMapId
}
});
channelDataSourceMapList.forEach(function (t) {
if(t.channelDataSourceMapId === tmp){
tmp = t.dataSourceId
}
});
dataSourceList.forEach(function (t) {
if(t.dataSourceId === tmp){
tmp = t.dataSourceName
}
});
return tmp
},
// 从json获取数据,其中key如果带有.这个符号,说明需要获取的数据是多维数组(也可以看成对象)
getData : function(arrayObj, key) {
if (key.indexOf(".") > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment