<%@ page language="java" pageEncoding="UTF-8" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%> <c:set var="ctx" value="${pageContext.request.contextPath}"/> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>数据质量规则维护</title> <style> .table-null .table{ margin-bottom: 0px; } .table-null .table > tbody > tr > td, .table-null .table > thead > tr > th{ text-align: center; width: 25%; } .table-null td:first-child{ text-align: right; width: 36%; } .table-null tr td:last-child .form-control,.table-null tr td:last-child table{ width: 400px; } .file-box{ position:relative;} .file{ position:absolute; top:0; height:30px; filter:alpha(opacity:0);opacity:0;width:470px;cursor: pointer; } /* .file-box{ position:relative;width:340px} .txt{ height:22px; border:1px solid #cdcdcd; width:180px;} .btn{ background-color:#FFF; border:1px solid #CDCDCD;height:24px; width:70px;} .file{ position:absolute; top:0; right:80px; height:24px; filter:alpha(opacity:0);opacity: 0;width:260px } */ </style> </head> <body> <div class="container"> <ol class="breadcrumb"> <li><a href="${ctx}/index">首页</a></li> <li>数据质量核查</li> <li class="active">数据质量规则维护</li> </ol> </div> <div id="main-container main-tab-container"> <div id="content" class="container"> <div class="section"> <div class="tab-content"> <div class="tab-pane fade in active" id="home"> <div class="row"> <div class="col-xs-12"> <div class="table-header">数据质量规则更新</div> <form action="#" class="form-horizontal" id="ruleUpdateForm" method="post"> <table id="ruleMaintainTable" class="table-null"> <tr><td><input type="hidden" name="qualityRuleId"id="qualityRuleId" value="${qualityRule.qualityRuleId}"/></td></tr> <tr><td>省份(<font color="red">必填</font>):</td> <td> <c:forEach var="province" items="${provinceList}"> <c:if test="${qualityRule.provinceId == province.provinceId}"> <span>${province.provinceName}</span> </c:if> </c:forEach> </td> </tr> <tr><td>数据来源(<font color="red">必填</font>):</td> <td> <c:forEach var="dataSource" items="${dataSourceList}"> <c:if test="${dataSource.dataSourceId == DataSource.dataSourceId}"> <span>${dataSource.dataSourceName}</span> </c:if > </c:forEach> </select></td> </tr> <tr><td>渠道(<font color="red">必填</font>):</td> <td> <c:forEach var="channel" items="${channelList}"> <c:if test="${channel.channelId == Channel.channelId}"> <span>${channel.channelName}</span> </c:if > </c:forEach> </select></td> </tr> <tr><td>业务(<font color="red">必填</font>):</td> <td > <c:forEach var="business" items="${businessList}"> <c:if test="${business.businessId == Business.businessId}"> <span>${Business.businessName}</span> </c:if > </c:forEach> </td> </tr> <%--<tr><td>数据采集频率(<font color="red">必填</font>):</td>--%> <%--<td><select class="form-control" name="calCycle" id="calCycle" style="display: inline;">--%> <%--<option value="30MI">30分钟</option>--%> <%--<option value="01HR">1小时</option>--%> <%--<option value="01DY">1天</option>--%> <%--<option value="01MO">1月</option>--%> <%--</select>--%> <%--</td></tr>--%> <tr><td>指标(<font color="red">必填</font>):</td> <td> <c:forEach var="kpi" items="${kpiList}"> <c:if test="${kpi.kpiId == qualityRule.kpiId}"> <span>${kpi.kpiName}</span> </c:if > </c:forEach> </td> </tr> <tr><td>监控延迟时间(<font color="red">必填</font>):</td> <td> <input type="text" style="width:200px" name="frequencyValue" id="frequencyValue"/> <select style="width:200px" name="frequencyType" id="frequencyType"> <option value="0">分钟</option> <option value="1">小时</option> <option value="2">天</option> <option value="3">月</option> </select></td> </tr> <tr><td>核查时间(<font color="red">必填</font>):</td> <td id="businessTimetd"> <input type='text' class='form-control' id='businessTime' name='businessTime' onfocus='WdatePicker({dateFmt:"yyyy-MM-dd HH:mm:00",startDate:"%y-%M-%d 00:00:00",alwaysUseStartDate:true,readOnly:false,hmsMenuCfg : {H : [ 1, 6 ], m : [ 30, 2 ], s : [ 60, 0 ]}})'/> </td> </tr> <tr><td>添加准确性规则:</td> <td><table class="table table-hover table-striped" id="displayParam"> <thead> <tr><th>规则类型</th><th>范围最大值</th><th>范围最小值</th><th>重复考核粒度</th><th>重复考核开始时间</th><th>重复考核结束时间</th><th>重复是否连续</th><th>重复最大次数</th><th>数据是否累计</th><th><a href="javascript:deleteAllTr()">删除所有规则</a></th></tr> </thead> <tbody id="addTr" class='col-md-15'> <c:forEach var="accuracyRuleList" items="${accuracyRuleList}"> <tr> <td>${accuracyRuleList.ruleType}</td> <td>${accuracyRuleList.scopeMaxValue}</td> <td>${accuracyRuleList.scopeMinValue}</td> <td>${accuracyRuleList.repeatedCheckGranularity}</td> <td>${accuracyRuleList.repeatedCheckStartTime}</td> <td>${accuracyRuleList.repeatedCheckEndTime}</td> <td>${accuracyRuleList.ifRepeatedCheckSeries}</td> <td>${accuracyRuleList.repeatedCheckMaxTime}</td> <td>${accuracyRuleList.ifRepeatedCheckSummation}</td> <td> <a href="javascript:;" title="${accuracyRuleList.accuracyRuleId}" onclick="deleteRow(this,'${accuracyRuleList.accuracyRuleId}')">删除</a><%--<a href="javascript:;" onclick="updateRow(this)">修改</a>--%> </td> </tr> </c:forEach> </tbody> </table></td></tr> <tr><td>准确性规则类型:</td> <td><select class="form-control" name="ruleType" id="ruleType" > <option value="">无</option> <option value="范围">范围类</option> <option value="重复">重复类</option> </select></td></tr> <tr class="range"><td>范围最大值:</td><td><input type="text" class="form-control" name="scopeMaxValue" id="scopeMaxValue" /></td></tr> <tr class="range"><td>范围最小值:</td><td><input type="text" class="form-control" name="scopeMinValue" id="scopeMinValue" /></td></tr> <tr class="repeate"><td>重复考核粒度:</td> <td><select class="form-control" name='repeatedCheckGranularity' id='repeatedCheckGranularity'> <option value="day" selected>日</option> <option value="mon">月</option> </select> </td></tr> <tr class="repeate"><td>重复考核开始时间:</td><td><input type="text" class="form-control" id="repeatedCheckStartTime" name="repeatedCheckStartTime" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'repeatedCheckStartTime\')}'})" /></td></tr> <tr class="repeate"><td>重复考核结束时间:</td><td><input id="repeatedCheckEndTime" name="repeatedCheckEndTime" class="form-control" type="text" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'repeatedCheckEndTime\')}'})"></td></tr> <tr class="repeate"><td>重复是否连续:</td> <td><select name='ifRepeatedCheckSeries' id='ifRepeatedCheckSeries' class="form-control"> <option value="1" selected>是</option> <option value="0">否</option> </select> </td></tr> <tr class="repeate"><td>重复最大次数:</td><td><input type='text' name='repeatedCheckMaxTime' id='repeatedCheckMaxTime' class="form-control" style="display: inline;"/></td></tr> <tr class="repeate"><td>数据是否累计:</td> <td><select name='ifRepeatedCheckSummation' id='ifRepeatedCheckSummation' class="form-control"> <option value="1" selected>是</option> <option value="0">否</option> </select> </td></tr> <tr><td></td> <td><button type="button" id="addParam" class="btn btn-primary">添加规则</button></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> </td></tr> </table> </form> <input type="hidden" id="kpi" name="kpi" value='${kpiList}' /> <input type="hidden" id="business" name="business" value='${businessList}' /> </div> </div> </div> </div> </div> </div> </div> <script type="text/javascript"> //加载页面时显示 var getQualityRuleId = "${qualityRule.qualityRuleId}"; var getFrequencyValue = "${qualityRule.frequencyValue}"; var getFrequencyType = "${qualityRule.frequencyType}"; var getBusinessTime = "${qualityRule.businessTime}"; getBusinessTime = getBusinessTime.replace(".0",""); $("#frequencyValue").val(getFrequencyValue); $("#frequencyType").val(getFrequencyType); $("#businessTime").val(getBusinessTime); </script> <script type="text/javascript"> $(document).ready(function(){ if($("#frequencyType").val() == "0"){ $("#calCycle").val("30MI"); }else if($("#frequencyType").val() == "1"){ $("#calCycle").val("01HR"); }else if($("#frequencyType").val() == "2"){ $("#calCycle").val("01DY"); }else if($("#frequencyType").val() == "3"){ $("#calCycle").val("01MO"); } }); $(".range").hide(); $(".repeate").hide(); $("#addParam").hide(); $("#ruleType").change(function (){ var selectValue = $("#ruleType").val(); if (selectValue == ""){ $(".range").hide(); $(".repeate").hide(); $("#addParam").hide(); } if (selectValue == "范围"){ $(".repeate").hide(); $(".range").show(); $("#addParam").show(); } if (selectValue == "重复"){ $(".range").hide(); $(".repeate").show(); $("#addParam").show(); } }); //删除所有参数 function deleteAllTr(){ $.ajax({ type : "GET", contentType : "application/json", url:"${ctx}/AnalysisSupport/QualityRuleConfiguration/deleteAccuracyRule?qualityRuleId="+getQualityRuleId, dataType : "text", beforeSend: function(data){}, success:function(){ $("#addTr").empty(); } }); }; //删除一条参数 function deleteRow(elementTag, accuracyRuleId){ if(accuracyRuleId==""){ $(elementTag).parent().parent().remove(); }else{ $.ajax({ type : "GET", contentType : "application/json", url:"${ctx}/AnalysisSupport/QualityRuleConfiguration/deleteAccuracyRule?accuracyRuleId="+accuracyRuleId, dataType : "text", beforeSend: function(data){}, success:function(){ $(elementTag).parent().parent().remove(); } }); } } //添加准确性规则 $("#addParam").click(function(){ var ruleType= $("#ruleType").val(); var scopeMaxValue = $.trim($("#scopeMaxValue").val()); var scopeMinValue = $.trim($("#scopeMinValue").val()); var repeatedCheckGranularity = $.trim($("#repeatedCheckGranularity").val()); var repeatedCheckStartTime = $.trim($("#repeatedCheckStartTime").val()); var repeatedCheckEndTime = $.trim($("#repeatedCheckEndTime").val()); var ifRepeatedCheckSeries = $.trim($("#ifRepeatedCheckSeries").val()); var repeatedCheckMaxTime = $.trim($("#repeatedCheckMaxTime").val()); var ifRepeatedCheckSummation = $.trim($("#ifRepeatedCheckSummation").val()); if(ruleType == "范围" || ruleType == "重复"){ if(ruleType == "范围"){ if(scopeMaxValue==""){$.alert("范围最大值不能为空");} if(scopeMinValue==""){$.alert("范围最小值不能为空");} repeatedCheckGranularity =""; repeatedCheckStartTime =""; repeatedCheckEndTime =""; ifRepeatedCheckSeries =""; repeatedCheckMaxTime =""; ifRepeatedCheckSummation =""; } else if(ruleType == "重复"){ if(repeatedCheckGranularity==""){$.alert("重复考核粒度不能为空");} if(repeatedCheckStartTime==""){$.alert("重复考核开始时间不能为空");} if(repeatedCheckEndTime==""){$.alert("重复考核结束时间不能为空");} if(ifRepeatedCheckSeries==""){$.alert("重复是否连续不能为空");} if(repeatedCheckMaxTime==""){$.alert("重复最大次数不能为空");} if(ifRepeatedCheckSummation==""){$.alert("数据是否累计不能为空");} scopeMaxValue =""; scopeMinValue =""; } if($("#addTr").find("tr.orange-tr").html()==null){ var addRow = $("<tr><td>"+ruleType+"</td><td>"+scopeMaxValue+"</td><td>"+scopeMinValue+"</td><td>"+repeatedCheckGranularity+"</td><td>"+repeatedCheckStartTime+"</td><td>"+repeatedCheckEndTime+"</td><td>"+ifRepeatedCheckSeries+"</td><td>"+repeatedCheckMaxTime+"</td><td>"+ifRepeatedCheckSummation+"</td><td><a href='javascript:;' title='' onclick='deleteRow(this)'>删除</a></td></tr>"); $("#addTr").append(addRow); $("#ruleType").attr("value",""); $("#scopeMaxValue").attr("value",""); $("#scopeMinValue").attr("value",""); $("#repeatedCheckGranularity").attr("value",""); $("#repeatedCheckStartTime").attr("value",""); $("#repeatedCheckEndTime").attr("value",""); $("#ifRepeatedCheckSeries").attr("value",""); $("#repeatedCheckMaxTime").attr("value",""); $("#ifRepeatedCheckSummation").attr("value",""); }else{ var findTr = $("#addTr").find("tr.orange-tr"); $(findTr).find("td").eq(0).html(ruleType); $(findTr).find("td").eq(1).html(scopeMaxValue); $(findTr).find("td").eq(2).html(scopeMinValue); $(findTr).find("td").eq(3).html(repeatedCheckGranularity); $(findTr).find("td").eq(4).html(repeatedCheckStartTime); $(findTr).find("td").eq(5).html(repeatedCheckEndTime); $(findTr).find("td").eq(6).html(ifRepeatedCheckSeries); $(findTr).find("td").eq(7).html(repeatedCheckMaxTime); $(findTr).find("td").eq(8).html(ifRepeatedCheckSummation); $("#addTr").find("tr").removeClass(); $("#addParam").text("添加规则"); } } }); //form表单提交 $("#ruleSubmit").click(function() { $.dialog({ title: "提醒", content:"确定修改该规则吗?", ok: function(){ if($.trim($("#frequencyValue").val())==""){ $.alert("监控延迟时间的值不能为空"); }else if($("#businessTime").val()==""){ $.alert("核查时间不能为空"); }else{ if($.trim($("#ruleType").val())!=""){ $.dialog({ title: "提醒", content: "有准确性规则添加,确定提交", ok: function(){ var i = $("#addTr").find("tr").size(); if(0==i){ var form = $("#ruleUpdateForm"); form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm"); form.submit(); form.attr("action","#"); }else{ $("#addTr").find("tr").each(function(){ var accuracyRuleId = $(this).find("td").find("a").attr("title"); var ruleType = $(this).find("td").eq(0).html(); var scopeMaxValue= $(this).find("td").eq(1).html(); var scopeMinValue = $(this).find("td").eq(2).html(); var repeatedCheckGranularity = $(this).find("td").eq(3).html(); var repeatedCheckStartTime = $(this).find("td").eq(4).html(); var repeatedCheckEndTime = $(this).find("td").eq(5).html(); var ifRepeatedCheckSeries = $(this).find("td").eq(6).html(); var repeatedCheckMaxTime = $(this).find("td").eq(7).html(); var ifRepeatedCheckSummation = $(this).find("td").eq(8).html(); if(accuracyRuleId!=""){//不是新增参数 $.ajax({ type : "GET", contentType : "application/json", url:"${ctx}/AnalysisSupport/QualityRuleConfiguration/updateAccuracyRule?qualityRuleId="+getQualityRuleId+"&ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+repeatedCheckGranularity+"&repeatedCheckStartTime="+repeatedCheckStartTime+"&repeatedCheckEndTime="+repeatedCheckEndTime+"&ifRepeatedCheckSeries="+ifRepeatedCheckSeries+"&repeatedCheckMaxTime="+repeatedCheckMaxTime+"&ifRepeatedCheckSummation="+ifRepeatedCheckSummation+"&accuracyRuleId="+accuracyRuleId, dataType : "text", async: false, beforeSend: function(data){}, success:function(){ i--; if(i==0){ var form = $("#ruleUpdateForm"); form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm"); form.submit(); form.attr("action","#"); } } }); } else{//是新增参数 $.ajax({ type : "GET", contentType : "application/json", url:"${ctx}/AnalysisSupport/QualityRuleConfiguration/updateAccuracyRule?qualityRuleId="+getQualityRuleId+"&ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+repeatedCheckGranularity+"&repeatedCheckStartTime="+repeatedCheckStartTime+"&repeatedCheckEndTime="+repeatedCheckEndTime+"&ifRepeatedCheckSeries="+ifRepeatedCheckSeries+"&repeatedCheckMaxTime="+repeatedCheckMaxTime+"&ifRepeatedCheckSummation="+ifRepeatedCheckSummation+"&accuracyRuleId="+accuracyRuleId, dataType : "text", beforeSend: function(data){ }, success:function(){ i--; if(i==0){ var form = $("#ruleUpdateForm"); form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm"); form.submit(); form.attr("action","#"); } } }); } }); } }, okValue: "确定", cancel:function(){}, cancelValue: "取消" }); }else{//如果 参数填写框 不存在未填写的 数据 var i = $("#addTr").find("tr").size(); if(0==i){ var form = $("#ruleUpdateForm"); form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm"); form.submit(); form.attr("action","#"); }else{ $("#addTr").find("tr").each(function(){ var accuracyRuleId = $(this).find("td").find("a").attr("title"); var ruleType = $(this).find("td").eq(0).html(); var scopeMaxValue= $(this).find("td").eq(1).html(); var scopeMinValue = $(this).find("td").eq(2).html(); var repeatedCheckGranularity = $(this).find("td").eq(3).html(); var repeatedCheckStartTime = $(this).find("td").eq(4).html(); var repeatedCheckEndTime = $(this).find("td").eq(5).html(); var ifRepeatedCheckSeries = $(this).find("td").eq(6).html(); var repeatedCheckMaxTime = $(this).find("td").eq(7).html(); var ifRepeatedCheckSummation = $(this).find("td").eq(8).html(); if(accuracyRuleId!=""){//不是新增参数 $.ajax({ type : "GET", contentType : "application/json", url:"${ctx}/AnalysisSupport/QualityRuleConfiguration/updateAccuracyRule?qualityRuleId="+getQualityRuleId+"&ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+repeatedCheckGranularity+"&repeatedCheckStartTime="+repeatedCheckStartTime+"&repeatedCheckEndTime="+repeatedCheckEndTime+"&ifRepeatedCheckSeries="+ifRepeatedCheckSeries+"&repeatedCheckMaxTime="+repeatedCheckMaxTime+"&ifRepeatedCheckSummation="+ifRepeatedCheckSummation+"&accuracyRuleId="+accuracyRuleId, dataType : "text", async: false, beforeSend: function(data){}, success:function(){ i--; if(i==0){ var form = $("#ruleUpdateForm"); form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm"); form.submit(); form.attr("action","#"); } } }); }else{//是新增参数 $.ajax({ type : "GET", contentType : "application/json", url:"${ctx}/AnalysisSupport/QualityRuleConfiguration/updateAccuracyRule?qualityRuleId="+getQualityRuleId+"&ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+repeatedCheckGranularity+"&repeatedCheckStartTime="+repeatedCheckStartTime+"&repeatedCheckEndTime="+repeatedCheckEndTime+"&ifRepeatedCheckSeries="+ifRepeatedCheckSeries+"&repeatedCheckMaxTime="+repeatedCheckMaxTime+"&ifRepeatedCheckSummation="+ifRepeatedCheckSummation+"&accuracyRuleId="+accuracyRuleId, dataType : "text", beforeSend: function(data){ }, success:function(){ i--; if(i==0){ var form = $("#ruleUpdateForm"); form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm"); form.submit(); form.attr("action","#"); } } }); } }); } } } }, okValue:"确定", cancel: function(){}, cancelValue:"返回", lock:true }); }) $("#ruleBack").click(function(){ location.href="${ctx}/AnalysisSupport/QualityRuleResult"; }); var calCycleValue =$("#calCycle").val(); $("#calCycle").change(function () { calCycleValue=$("#calCycle").val(); updateBusinessTime(calCycleValue) updateMonitorTimeTime(calCycleValue) }); function updateBusinessTime(calCycleValue) { $("#businessTimetd").empty() if(calCycleValue == "30MI"){ $("#businessTimetd").append("<input type='text' class='form-control' id='businessTime' name='businessTime' onfocus='WdatePicker({dateFmt:\"yyyy-MM-dd HH:00:00\",startDate:\"%y-%M-%d 00:00:00\",alwaysUseStartDate:true,readOnly:false,hmsMenuCfg : {H : [ 1, 6 ], m : [ 30, 2 ], s : [ 60, 0 ]}})'/>"); }else if(calCycleValue == "01HR"){ $("#businessTimetd").append("<input type='text' class='form-control' id='businessTime' name='businessTime' onfocus='WdatePicker({dateFmt:\"yyyy-MM-dd HH:00:00\",startDate:\"%y-%M-%d 00:00:00\",alwaysUseStartDate:true,readOnly:false,hmsMenuCfg : {H : [ 1, 6 ], m : [ 60, 0 ], s : [ 60, 0 ]}})'/>"); }else if(calCycleValue == "01DY"){ $("#businessTimetd").append("<input type='text' class='form-control' id='businessTime' name='businessTime' onfocus='WdatePicker({dateFmt:\"yyyy-MM-dd 00:00:00\",startDate:\"%y-%M-%d 00:00:00\",alwaysUseStartDate:true,startDate:\"yyyy-MM-dd 00:00:00\",readOnly:false,hmsMenuCfg : {H : [ 24, 0 ], m : [ 60, 0 ], s : [ 60, 0 ]}})'/>"); }else if(calCycleValue == "01MO"){ $("#businessTimetd").append("<input type='text' class='form-control' id='businessTime' name='businessTime' onfocus='WdatePicker({dateFmt:\"yyyy-MM-01 00:00:00\",startDate:\"%y-%M-%d 00:00:00\",alwaysUseStartDate:true,readOnly:false,hmsMenuCfg : {H : [ 24, 0 ], m : [ 60, 0 ], s : [ 60, 0 ]}})' />"); } } function updateMonitorTimeTime(calCycleValue) { if (calCycleValue == "30MI") { $("#frequencyValue").val("30"); $("#frequencyType").val(0); } else if (calCycleValue == "01HR") { $("#frequencyValue").val("1"); $("#frequencyType").val(1); } else if (calCycleValue == "01DY") { $("#frequencyValue").val("1"); $("#frequencyType").val(2); } else if (calCycleValue == "01MO") { $("#frequencyValue").val("1"); $("#frequencyType").val(3); } } </script> </body> </html>