HWarningRuleForm.jsp 8.09 KB
Newer Older
afe's avatar
afe 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
<%@ 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 type="text/javascript" src="${ctx}/static/js/validation.js"></script>
<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[name='provinces'][value='${province.provinceId}']").attr('checked','true');
			</c:forEach>
		</c:if> 

		
		/* <c:if test="${allDataSource == true}">
			changeAllDataSource(true);
		</c:if>
		
		<c:if test="${allBusiness == true}">
			changeAllBusiness(true);
		</c:if>
		
		<c:if test="${allKpi == true}">
			changeAllKpi(true);
		</c:if> */
		parent.document.all('hWarningRuleFrame').style.height= document.body.scrollHeight + "px";
		getModelByType();
	});

	function submitForm() {
		var url = '${ctx}/BaseManage/HWarningRuleManage/checkNameAndCode';
		var data = 'name=' + $('#name').val() + "&code=" + $('#code').val() + "&id=" + $('#hwarningruleId').val();
		checkAndSubmit(url, data);
	}

	function validate() {
		if(!checkNameAndCode()) {
			return false;
		}
		if(!isNumber($('#correctRate'))) {
			return false;
		}
		if(!isFloat($('#threshold1Value'), 37)) {
			return false;
		}
		if(!isFloat($('#threshold2Value'), 37)) {
			return false;
		}
		if(!isFloat($('#threshold3Value'), 37)) {
			return false;
		}
		if(!isFloat($('#threshold4Value'), 37)) {
			return false;
		}
		if(!isFloat($('#threshold5Value'), 37)) {
			return false;
		}
		if(!checkKpi()) {
			return false;
		}
		return true;
	}
	
	function changeHeight() {
		parent.document.all('hWarningRuleFrame').style.height= document.body.scrollHeight + "px";
	}
	
	function getModelByType() {
		//alert($("#dataModelType option:selected").val());
		//return false;
		$.ajax({
            type : 'POST',
            url: "${ctx}/BaseManage/EWarningRuleManage/getModelByType",
            data: "dataModelTypeId=" + $("#dataModelType option:selected").val(),
            success: function(data) {
            	//alert(data.length);
            	$('#dataModel').empty();
            	for(var i=0;i<data.length;i++) {
            		var option = new Option(data[i].dataModelName,data[i].dataModelId);
            		$('#dataModel').append(option);            		
            	}
            	<c:if test="${not empty hWarningRule.dataModel}">
	    			$("#dataModel").val('${hWarningRule.dataModel.dataModelId}');
	    		</c:if>
         	}
     	});
	}
</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" id="hwarningruleId" name="hwarningruleId" value="${hWarningRule.hwarningruleId}">
			<div class="form-group">
				<label class="col-sm-2 control-label">规则名称(<font color="red">必填</font>):</label>
				<div class="col-xs-2">
					<input type="input" class="form-control" id="name" name="name" value="${hWarningRule.name}">
				</div>
				<label class="col-sm-2 control-label">规则代码(<font color="red">必填</font>):</label>
				<div class="col-xs-2">
					<input type="input" class="form-control" id="code" name="code" value="${hWarningRule.code}">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label">隐患发生场景</label>
				<div class="col-xs-2">
					<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-2 control-label">准确率</label>
				<div class="col-xs-2">
					<input type="input" class="form-control" id="correctRate" name="correctRate" value="${hWarningRule.correctRate}" maxlength="10">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label">生效时间</label>
				<div class="col-xs-2">
					<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-2 control-label">失效时间</label>
				<div class="col-xs-2">
					<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-2 control-label">模型类型:</label>
				<div class="col-xs-2">
					<select class="form-control" name="dataModelType.dataModelTypeId" id="dataModelType" onchange="getModelByType()">
						<c:forEach items="${dataModelTypeList}" var="dataModelType">
							<option value="${dataModelType.dataModelTypeId}"
								<c:if test="${dataModelType.dataModelTypeId == eWarningRule.dataModelType.dataModelTypeId}">selected</c:if> >${dataModelType.dataModelTypeName}</option>
						</c:forEach> 
					</select>
				</div>
					<label class="col-sm-2 control-label">关联模型:</label>
				<div class="col-xs-2">
					<select class="form-control" name="dataModel.dataModelId" id="dataModel">
						
					</select>
				</div>
			</div>

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

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

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

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

			<tags:WARN_PROVINCE />

			<tags:WARN_KPI_NEW />

			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-5">
					<button type="button" id="modelSubmit" class="btn btn-primary" onclick="saveForm('hwarningruleId');">确定</button>
					<!-- <button type="reset" class="btn btn-default" id="modelReset">清空</button> -->
					<button type="reset" class="btn btn-warning" id="modelBack" onclick="window.location.href='${ctx}/BaseManage/HWarningRuleManage/hWarningRuleListFrame'">返回</button>
				</div>
			</div>
		</form>
	</div>
</body>
</html>