HWarningRuleForm0306.jsp 11.5 KB
Newer Older
liuna's avatar
1  
liuna committed
1 2 3 4 5 6 7 8 9 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 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 110 111 112 113 114 115 116 117 118 119 120 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 163 164 165 166 167 168 169 170 171 172 173 174 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 272 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
<%@ 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>
afe's avatar
afe committed
311
</html>