HWarningRuleForm0306.jsp 11.2 KB
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>全网监控智能分析平台</title>
<script language="javascript">
	$(document).ready(function() {
		<c:if test="${allProvince == true}">
			changeAllProvince(true);
		</c:if>
		
		<c:if test="${allProvince != true}">
			<c:forEach items="${hWarningRule.provinceList}" var="province">
				$("input:checkbox[value='${province.provinceId}']").attr('checked','true');
			</c:forEach>
		</c:if>
		
		<c:if test="${allChannel == true}">
			changeAllChannel(true);
		</c:if>
		
		<c:if test="${allDataSource == true}">
			changeAllDataSource(true);
		</c:if>
		
		<c:if test="${allBusiness == true}">
			changeAllBusiness(true);
		</c:if>

		parent.document.all('hWarningRuleFrame').style.height= document.body.scrollHeight + "px";
	});

	function submitForm() {
		if (validate()) {
			$('#detailForm').submit();
		}
	}

	function validate() {
		if (!$('#name').val()) {
			alert("请填写规则名称");
			return false;
		}
		if (!$('#code').val()) {
			alert("请填写规则代码");
			return false;
		}
		return true;
	}
	
	function changeAllProvince(checked) {
		if(checked) {
			$(".province").attr("checked","checked");
	        $(".province").attr("disabled",true);
		} else {
			$(".province").attr("checked",false);
	        $(".province").attr("disabled",false);
		}
	}
	
	function changeAllChannel(checked) {
		if(checked) {
			$(".channel").attr("checked","checked");
	        $(".channel").attr("disabled",true);
		} else {
			$(".channel").attr("checked",false);
	        $(".channel").attr("disabled",false);
		}
	}
	
	function channelChange() {
		var selectedChannel = new Array();
		$("input:checkbox[name='channels'][checked]").each(function () {
			selectedChannel.push($(this).attr('value'));
		});
		if(selectedChannel.length == 0) {
			$('#channelDetail').html("");
		} else {
			$.ajax({
	            type : 'GET',
	            contentType : 'application/json',
	            url: '${ctx}/BaseManage/HWarningRuleManage/getChangeChannlResult?channels=' + selectedChannel.join(","),
	            success: function(data) {
	            	//alert($('#dataSourceDiv').html());
	            	alert(JSON.stringify(data));
	            	
	            	$('#channelDetail').html(channelDetailHtml);
	            	parent.document.all('hWarningRuleFrame').style.height= document.body.scrollHeight + "px";
	         	}
	     	});
		}
	}
	
	function changeAllDataSource(checked, channelId) {
		if(channelId) {
			if(checked) {
				$("input:checkbox[name='dataSources_" + channelId + "']").attr("checked","checked");
		        $("input:checkbox[name='dataSources_" + channelId + "']").attr("disabled",true);
			} else {
				$("input:checkbox[name='dataSources_" + channelId + "']").attr("checked",false);
		        $("input:checkbox[name='dataSources_" + channelId + "']").attr("disabled",false);
			}
		} else {
			if(checked) {
				$(".dataSource").attr("checked","checked");
		        $(".dataSource").attr("disabled",true);
			} else {
				$(".dataSource").attr("checked",false);
		        $(".dataSource").attr("disabled",false);
			}
		}
		
	}
	
	function changeAllBusiness(checked, channelId) {
		if(channelId) {
			if(checked) {
				$("input:checkbox[name='businesses_" + channelId + "']").attr("checked","checked");
		        $("input:checkbox[name='businesses_" + channelId + "']").attr("disabled",true);
			} else {
				$("input:checkbox[name='businesses_" + channelId + "']").attr("checked",false);
		        $("input:checkbox[name='businesses_" + channelId + "']").attr("disabled",false);
			}
		} else {
			if(checked) {
				$(".business").attr("checked","checked");
		        $(".business").attr("disabled",true);
			} else {
				$(".business").attr("checked",false);
		        $(".business").attr("disabled",false);
			}
		}
	}
	
</script>
</head>
<body>
	<div class="col-xs-12" style="padding-top: 20px;">
		<form id="detailForm" class="form-horizontal" role="form"
			action="${ctx}/BaseManage/HWarningRuleManage/submitHWarningRuleFrame" method="post">
			<input type="hidden" name="hwarningruleId" value="${hWarningRule.hwarningruleId}">
			<div class="form-group">
				<label class="col-sm-1 control-label">规则名称</label>
				<div class="col-xs-4">
					<input type="input" class="form-control" id="name" name="name" value="${hWarningRule.name}">
				</div>
				<label class="col-sm-1 control-label">规则代码</label>
				<div class="col-xs-4">
					<input type="input" class="form-control" id="code" name="code" value="${hWarningRule.code}">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-1 control-label">隐患发生场景</label>
				<div class="col-xs-4">
					<select class="form-control" name="hWarningSence.hwarningsenceId" id="hwarningsenceId">
						<c:forEach items="${hWarningSenceList}" var="hWarningSence">
							<option value="${hWarningSence.hwarningsenceId}"
								<c:if test="${hWarningSence.hwarningsenceId == hWarningRule.hWarningSence.hwarningsenceId}">selected</c:if>>${hWarningSence.name}</option>
						</c:forEach>
					</select>
				</div>
				<label class="col-sm-1 control-label">准确率</label>
				<div class="col-xs-4">
					<input type="input" class="form-control" id="correctRate" name="correctRate" value="${hWarningRule.correctRate}">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-1 control-label">生效时间</label>
				<div class="col-xs-4">
					<input type="input" class="form-control Wdate" id="validbeginTime" name="validbeginTimeStr"
						value="${hWarningRule.validbeginTime}"
						onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:false,maxDate:'#F{$dp.$D(\'validendTime\');}'})">
				</div>
				<label class="col-sm-1 control-label">失效时间</label>
				<div class="col-xs-4">
					<input type="input" class="form-control Wdate" id="validendTime" name="validendTimeStr"
						value="${hWarningRule.validendTime}"
						onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:false,minDate:'#F{$dp.$D(\'validbeginTime\');}'})">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-1 control-label">阀值一</label>
				<div class="col-xs-4">
					<input type="input" class="form-control" id="threshold1Value" name="threshold1Value"
						value="${hWarningRule.threshold1Value}">
				</div>
				<label class="col-sm-1 control-label">阀值二</label>
				<div class="col-xs-4">
					<input type="input" class="form-control" id="threshold2Value" name="threshold2Value"
						value="${hWarningRule.threshold2Value}">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-1 control-label">阀值三</label>
				<div class="col-xs-4">
					<input type="input" class="form-control" id="threshold3Value" name="threshold3Value"
						value="${hWarningRule.threshold3Value}">
				</div>
				<label class="col-sm-1 control-label">阀值四</label>
				<div class="col-xs-4">
					<input type="input" class="form-control" id="threshold4Value" name="threshold4Value"
						value="${hWarningRule.threshold4Value}">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-1 control-label">阀值五</label>
				<div class="col-xs-4">
					<input type="input" class="form-control" id="threshold5Value" name="threshold5Value"
						value="${hWarningRule.threshold5Value}">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-1 control-label">隐患描述</label>
				<div class="col-xs-7">
					<textarea id="calculateStr" name="hwarningDesc" class="form-control input-large" rows="4">${hWarningRule.hwarningDesc}</textarea>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-1 control-label">省份</label>
				<div class="col-xs-7">
					<div class="checkbox-inline">
						<label><input type="checkbox" name="allProvince" value="true" id="allProvince" title="全选"
							onchange="changeAllProvince(this.checked)" <c:if test="${allProvince == true}">checked</c:if> />全选</label>
					</div>
					<br>
					<c:forEach items="${provinceList}" var="province">
						<div class="checkbox-inline">
							<label><input type="checkbox" name="provinces" class="province" value="${province.provinceId}"
								title="${province.provinceName}" />${province.provinceName}</label>
						</div>
					</c:forEach>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-1 control-label">渠道</label>
				<div class="col-xs-7">
					<div class="checkbox-inline">
						<label><input type="checkbox" name="allChannel" value="true" id="allChannel" title="全选"
							onchange="changeAllChannel(this.checked)" <c:if test="${allChannel == true}">checked</c:if> />全选</label>
					</div>
					<br>
					<c:forEach items="${channelList}" var="channel">
						<div class="checkbox-inline">
							<label><input type="checkbox" name="channels" class="channel" value="${channel.channelId}"
								title="${channel.channelName}" onchange="channelChange()" />${channel.channelName}</label>
						</div>
					</c:forEach>
				</div>
			</div>
			<div id="channelDetail">
				<div class="form-group">
					<label class="col-sm-1 control-label">数据来源</label>
					<div class="col-xs-7">
						<div class="checkbox-inline">
							<label><input type="checkbox" name="allDataSource" value="true" id="allDataSource" title="全选"
								onchange="changeAllDataSource(this.checked)" <c:if test="${allDataSource == true}">checked</c:if> />全选</label>
						</div>
						<br>
						<div id="dataSourceDiv">
							<c:forEach items="${dataSourceList}" var="dataSource">
								<div class="checkbox-inline">
									<label><input type="checkbox" name="dataSources" class="dataSource" value="${dataSource.dataSourceId}"
										title="${dataSource.dataSourceName}" />${dataSource.dataSourceName}</label>
								</div>
							</c:forEach>
						</div>
					</div>
				</div>
	
				<div class="form-group">
					<label class="col-sm-1 control-label">业务</label>
					<div class="col-xs-7">
						<div class="checkbox-inline">
							<label><input type="checkbox" name="allBusiness" value="true" id="allBusiness" title="全选"
								onchange="changeAllBusiness(this.checked)" <c:if test="${allBusiness == true}">checked</c:if> />全选</label>
						</div>
						<br>
						<c:forEach items="${businessList}" var="business">
							<div class="checkbox-inline">
								<label><input type="checkbox" name="businesses" class="business" value="${business.businessId}"
									title="${business.businessName}" />${business.businessName}</label>
							</div>
						</c:forEach>
					</div>
				</div>
			</div>

			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-5">
					<br> <input type="button" class="btn btn-default" value="保存" onclick="submitForm();">
					<button type="reset" class="btn btn-default">重置</button>
					<input type="button" class="btn btn-default" value="返回"
						onclick="window.location.href='${ctx}/BaseManage/HWarningRuleManage/hWarningRuleListFrame'">
				</div>
			</div>
		</form>
	</div>
</body>
</html>