QualityRuleConfiguration.jsp 30.4 KB
Newer Older
liuna's avatar
liuna committed
1 2 3 4 5 6 7 8
<%@ 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> 
9
    <title>数据质量规则维护</title>
liuna's avatar
liuna committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
<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>
41
			<li class="active">数据质量规则维护</li>
liuna's avatar
liuna committed
42 43 44 45 46 47 48 49 50 51
		</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">
52 53 54
								<div class="table-header">数据质量规则更新</div>
								<form action="#" class="form-horizontal" id="ruleUpdateForm" method="post">
									<table id="ruleMaintainTable" class="table-null">
55
										<tr><td>数据质量规则ID:</td><td id="qualityRuleId"></td></tr>
56 57 58
										<tr><td>省份(<font color="red">必填</font>):</td>
											<td>
												<c:forEach var="province" items="${provinceList}">
59
													<input type="checkbox" name="province"  value="${province.provinceId}" >${province.provinceName}
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
												</c:forEach>
											</td>
										</tr>
										<tr><td>数据来源(<font color="red">必填</font>):</td>
											<td>
												<select class="form-control" name="dataSource" id="dataSource" >
													<c:forEach var="dataSource" items="${dataSourceList}">
														<c:if test="${dataSource.dataSourceId == '5'}">
															<option value="${dataSource.dataSourceId}" selected>${dataSource.dataSourceName}</option>
														</c:if >
														<c:if test="${dataSource.dataSourceId != '5'}">
															<option value="${dataSource.dataSourceId}" >${dataSource.dataSourceName}</option>
														</c:if >
													</c:forEach>
												</select></td>
										</tr>
										<tr><td>渠道(<font color="red">必填</font>):</td>
											<td><select class="form-control" name="channel" id="channel" >
												<c:forEach var="channel" items="${channelList}">
													<c:if test="${channel.channelId == '7'}">
														<option value="${channel.channelId}" selected>${channel.channelName}</option>
													</c:if>
													<c:if test="${channel.channelId != '7'}">
														<option value="${channel.channelId}">${channel.channelName}</option>
													</c:if>
												</c:forEach>
											</select></td>
										</tr>
										<tr><td>业务(<font color="red">必填</font>):</td>
											<td >
												<div id="businesstd"></div>

											</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>
												<div id="kpitd"></div>

											</td>
										</tr>
										<tr><td>指标监控时间(<font color="red">必填</font>):</td>
											<td>
110 111
												<input type="text" style="width:200px" name="frequencyValue" id="frequencyValue" />
												<select style="width:200px" name="frequencyType" id="frequencyType">
112 113 114 115 116 117 118 119
													<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">
120
												<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 ]}})'/>
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
											</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"></tbody>
											</table></td></tr>
										<tr><td>准确性规则类型:</td>
											<td><select class="form-control" name="ruleType" id="ruleType" >
												<option value=""></option>
												<option value="1">范围类</option>
												<option  value="2">重复类</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>
liuna's avatar
liuna committed
163
										</td></tr>
164
									</table>
liuna's avatar
liuna committed
165
								</form>
166 167
								<input type="hidden" id="kpi" name="kpi" value='${kpiList}' />
								<input type="hidden" id="business" name="business" value='${businessList}' />
liuna's avatar
liuna committed
168 169 170 171 172 173 174
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
175

176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
	<script type="text/javascript">
        $(".range").hide();
        $(".repeate").hide();
        $("#addParam").hide();
        $("#ruleType").change(function (){
            var selectValue = $("#ruleType").val();
            if (selectValue == ""){
                $(".range").hide();
                $(".repeate").hide();
                $("#addParam").hide();
            }
            if (selectValue == 1){
                $(".repeate").hide();
                $(".range").show();
                $("#addParam").show();
            }
            if (selectValue == 2){
                $(".range").hide();
                $(".repeate").show();
                $("#addParam").show();
            }
        });

        //删除所有准确性规则
        function deleteAllTr(){
            $("#addTr").empty();
        }

        //删除一条准确性规则
        function deleteRow(elementTag){
            $(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 == "1" || ruleType == "2"){
                if(ruleType == "1"){
                    if(scopeMaxValue==""){$.alert("范围最大值不能为空");}
                    if(scopeMinValue==""){$.alert("范围最小值不能为空");}
                    repeatedCheckGranularity ="无";
                    repeatedCheckStartTime ="无";
                    repeatedCheckEndTime ="无";
                    ifRepeatedCheckSeries ="无";
                    repeatedCheckMaxTime ="无";
                    ifRepeatedCheckSummation ="无";
                } else if(ruleType == "2"){
                    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(){
272
            if($.trim($("#frequencyValue").val())==""){
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443
                $.alert("指标监控时间不能为空");
            }else if($("#businessTime").val()==""){
                $.alert("指标业务时间不能为空");
            }else if($("#ruleCrtTime").val()==""){
                $.alert("规则创建时间不能为空");
            }else if($("#ruleUpdateTime").val()==""){
                $.alert("规则更新时间不能为空");
            }else{
                if($.trim($("#ruleType").val())=="1" || $.trim($("#ruleType").val())=="2"){
                    $.dialog({
                        title: "提醒",
                        content: "有准确性规则参数尚未添加,确定提交",
                        ok: function(){

                            $("#ruleSubmit").attr("disabled",true);
                            var i = $("#addTr").find("tr").size();

                            if(i==0){
                                var createForm=$("#ruleMaintainForm");
                                createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
                                createForm.submit();
                                createForm.attr("action","#");
                            }else{
                                $("#addTr").find("tr").each(function(){
                                    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(scopeMaxValue =="无"){scopeMaxValue ="";}
                                    if(scopeMinValue =="无"){scopeMinValue ="";}
                                    if(repeatedCheckGranularity =="无"){repeatedCheckGranularity ="";}
                                    if(repeatedCheckStartTime =="无"){repeatedCheckStartTime ="";}
                                    if(repeatedCheckEndTime ="无"){repeatedCheckEndTime ="";}
                                    if(ifRepeatedCheckSeries =="无"){ifRepeatedCheckSeries ="";}
                                    if(repeatedCheckMaxTime =="无"){repeatedCheckMaxTime ="";}
                                    if(ifRepeatedCheckSummation =="无"){ifRepeatedCheckSummation ="";}
                                    $.ajax({
                                        type : "GET",
                                        contentType : "application/json",
                                        url: "${ctx}/AnalysisSupport/QualityRuleMaintain/createAccuracyRule?ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+repeatedCheckGranularity+"&repeatedCheckStartTime="+repeatedCheckStartTime+"&repeatedCheckEndTime="+repeatedCheckEndTime+"&scopeMinValue="+ifRepeatedCheckSeries+"&ifRepeatedCheckSeries="+repeatedCheckMaxTime+"&repeatedCheckMaxTime="+ifRepeatedCheckSummation+"&ifRepeatedCheckSummation=",
                                        dataType : "text",
                                        async: false,
                                        beforeSend: function(data) {},
                                        success: function(){
                                            i--;
                                            if(i==0){
                                                var createForm=$("#ruleMaintainForm");
                                                createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
                                                createForm.submit();
                                                createForm.attr("action","#");
                                            }
                                        }
                                    });
                                });
                            }
                        },
                        okValue: "确定",
                        cancel: function(){},
                        cancelValue: "取消",
                    });
                }else{
                    $("#ruleSubmit").attr("disabled",true);
                    var i = $("#addTr").find("tr").size();

                    if(i==0){
                        var createForm=$("#ruleMaintainForm");
                        createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
                        createForm.submit();
                        createForm.attr("action","#");
                    }else{
                        $("#addTr").find("tr").each(function(){
                            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(scopeMaxValue =="无"){scopeMaxValue ="";}
                            if(scopeMinValue =="无"){scopeMinValue ="";}
                            if(repeatedCheckGranularity =="无"){repeatedCheckGranularity ="";}
                            if(repeatedCheckStartTime =="无"){repeatedCheckStartTime ="";}
                            if(repeatedCheckEndTime ="无"){repeatedCheckEndTime ="";}
                            if(ifRepeatedCheckSeries =="无"){ifRepeatedCheckSeries ="";}
                            if(repeatedCheckMaxTime =="无"){repeatedCheckMaxTime ="";}
                            if(ifRepeatedCheckSummation =="无"){ifRepeatedCheckSummation ="";}
                            $.ajax({
                                type : "GET",
                                contentType : "application/json",
                                url: "${ctx}/AnalysisSupport/QualityRuleMaintain/createAccuracyRule?ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+encodeURIComponent(repeatedCheckGranularity)+"&repeatedCheckStartTime="+encodeURIComponent(repeatedCheckStartTime)+"&repeatedCheckEndTime="+encodeURIComponent(repeatedCheckEndTime)+"&ifRepeatedCheckSeries="+ifRepeatedCheckSeries+"&repeatedCheckMaxTime="+repeatedCheckMaxTime+"&ifRepeatedCheckSummation="+ifRepeatedCheckSummation,
                                dataType : "text",
                                async: false,
                                beforeSend: function(data) {},
                                success: function(){
                                    i--;
                                    if(i==0){
                                        var createForm=$("#ruleMaintainForm");
                                        createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
                                        createForm.submit();
                                        createForm.attr("action","#");
                                    }
                                }
                            });
                        });
                    }
                }

            }
        });

        $("#ruleBack").click(function(){
            location.href="${ctx}/AnalysisSupport/QualityRuleResult";
        });

        function getProvinceCheckedValues() {
            var provinceArray = new Array();
            var i=0;
            $("#province:checked").each(function(){
                provinceArray[i]=$(this).val();
                i++;
            });
            return provinceArray;
        }

        function getProvinceCheckedValuesString(){
            var provinceStr="";
            var provinceArray=getProvinceCheckedValues();
            for(var i=0;i<provinceArray.length;i++){
                if(i==provinceArray.length-1){
                    provinceStr+=provinceArray[i];
                }else{
                    provinceStr+=provinceArray[i]+",";
                }
            }
            return provinceStr;
        }

        var dataSourceValue =$("#dataSource").val();
        var channelValue = $("#channel").val();
        var businessIds = getBusinessCheckedValues();
        var calCycleValue =$("#calCycle").val();
        $("#dataSource").change(function(){
            dataSourceValue = $("#dataSource").val();
            updateBusiness(dataSourceValue,channelValue);
        });
        $("#channel").change(function(){
            channelValue = $("#channel").val();
            updateBusiness(dataSourceValue,channelValue);

        });

        function updateKpi(businessIds,calCycleValue){

            $.ajax({
                type : "GET",
                contentType : "application/json",
                url: "${ctx}/AnalysisSupport/QualityRuleMaintain/findKpiId?businessIds="+businessIds+"&calCycleValue="+calCycleValue,
                async: false,
                beforeSend: function(data) {},
                success: function(data){
                    var td = $("#kpitd");
                    td.empty();
                    data = JSON.parse(data)
                    data.forEach(function(t){
444
                        td.append("<input type='checkbox' title='"+t[2]+"' name='kpiinput' class='kpiItem' value='"+t[0]+"' >"+t[1]+"</input>")
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
                    });
                }
            });
        }

        function updateBusiness(dataSource,channel){
            $.ajax({
                type : "GET",
                contentType : "application/json",
                url: "${ctx}/AnalysisSupport/QualityRuleMaintain/findBusinessId?dataSource="+dataSource+"&channel="+channel,
                async: false,
                beforeSend: function(data) {},
                success: function(data){
                    var td = $("#businesstd");
                    var businessIds = new Array();
                    td.empty();
                    data = JSON.parse(data)
                    data.forEach(function(t){
463
                        td.append("<input type='checkbox' name='businessinput' class='businessItem' value='"+t[0]+"' >"+t[1]+"</input>")
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494
                        businessIds+=t[0]+",";
                    });
                    updateKpi(businessIds,calCycleValue);
                }
            });

            $(".businessItem").click(function(){
                businessIds="";
                $("[name='businessinput']:checked").each(function (){
                    businessIds += $(this).val()+",";
                });
                updateKpi(businessIds,calCycleValue);
            });

        }
        $("#calCycle").change(function () {
            calCycleValue=$("#calCycle").val();
            $("[name='businessinput']:checked").each(function (){
                businessIds += $(this).val()+",";
            });
            updateKpi(businessIds,calCycleValue)
            updateBusinessTime(calCycleValue)
        });

        updateBusiness($("#dataSource").val(),$("#channel").val());



        function updateBusinessTime(calCycleValue) {
            $("#businessTimetd").empty()
            if(calCycleValue == "30MI"){
495
                $("#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 ]}})'/>");
496
            }else if(calCycleValue == "01HR"){
497
                $("#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 ]}})'/>");
498
            }else if(calCycleValue == "01DY"){
499
                $("#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 ]}})'/>");
500
            }else if(calCycleValue == "01MO"){
501
                $("#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 ]}})' />");
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556
            }
        }

        function getBusinessCheckedValues(){
            var businessArray = new Array();
            var i=0;
            $("[name='businessinput']:checked").each(function(){
                businessArray[i]=$(this).val();
                i++;
            });
            return businessArray;
        }

        function getBusinessCheckedValuesString(){
            var businessStr="";
            var businessArray=getBusinessCheckedValues();
            for(var i=0;i<businessArray.length;i++){
                if(i==businessArray.length-1){
                    businessStr+=businessArray[i];
                }else{
                    businessStr+=businessArray[i]+",";
                }
            }
            return businessStr;
        }

        function getKpiCheckedValues(){
            var kpiArray = new Array();
            var i=0;
            $("[name='kpiinput']:checked").each(function(){
                kpiArray[i]=$(this).val();
                i++;
            });
            return kpiArray;
        }

        function getKpiCheckedValuesString(){
            var kpiStr="";
            var kpiArray=getKpiCheckedValues();
            for(var i=0;i<kpiArray.length;i++){
                if(i==kpiArray.length-1){
                    kpiStr+=kpiArray[i];
                }else{
                    kpiStr+=kpiArray[i]+",";
                }
            }
            return kpiStr;
        }

        var provinceValue = getProvinceCheckedValuesString();
        var businessValue = getBusinessCheckedValuesString();
        var kpiValue = getKpiCheckedValuesString();
        console.log("provinceValue:"+provinceValue+"businessValue:"+businessValue+"kpiValue:"+kpiValue)

	</script>
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592
	<script type="text/javascript">
        //加载页面时显示
        var getQualityRuleId = "${qualityRule.qualityRuleId}";
        var getProvince = "${qualityRule.provinceId}";
        var getDataSource = "${qualityRule.dataSourceId}";
        var getChannel = "${qualityRule.channelId}";
        var getBusinessinput = "${qualityRule.businessId}";
        var getKpiinput = "${qualityRule.kpiId}";
        var getFrequencyValue = "${qualityRule.frequencyValue}";
        var getFrequencyType = "${qualityRule.frequencyType}";
        var getBusinessTime = "${qualityRule.businessTime}";
        $("#qualityRuleId").text(getQualityRuleId);
        $("input[name='province']").each(function(){
            if($(this).val()==getProvince){
                console.log( $(this))
                $(this).attr("checked",true);
            }
        });
        $("#dataSource").val(getDataSource);
        $("#channel").val(getChannel);
        $("input[name='businessinput']").each(function(){
            if($(this).val()==getBusinessinput){
                console.log( $(this))
                $(this).attr("checked",true);
            }
        });
        $("input[name='kpiinput']").each(function(){
            if($(this).val()==getKpiinput){
                console.log( $(this))
                $(this).attr("checked",true);
            }
        });
        $("#frequencyValue").val(getFrequencyValue);
        $("#frequencyType").val(getFrequencyType);
        $("#businessTime").val(getBusinessTime);
	</script>
liuna's avatar
liuna committed
593 594
</body>
</html>