ModelResult.jsp 11.9 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
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>全网监控智能分析平台</title>
</head>
<body>
	<div id="sticky-wrap"></div>

	<div>
		<div class="container">
			<ol class="breadcrumb">
			<li><a href="${ctx}/index">首页</a></li>
			<li>预分析与建模</li>
			<li class="active">数据模型管理</li>
		</ol>
		</div>
	</div>

	<div id="main-container main-tab-container">
		<div id="content" class="container">
			<div class="tab-bar-bt">
				<ul class="nav nav-tabs">
					<li class="active"><a href="#home" data-toggle="tab">模型维护</a></li>
					<li><a href="${ctx}/BaseManage/TaskManage/modelMonitorHome">模型监控</a></li>
				</ul>
			</div>
			<div class="section">
				<div class="tab-content">

					<div class="tab-pane fade in active" id="home">
						<div class="row me-row">

							<div id="slidePushMenus2" class="cbp-spmenu-push">

								<div class="slideMenu" id="cbp-spmenu-s2" style="">
									<div class="form">
										<tags:ModelResultPeriodTag/>
										<tags:FXJM_modelResult_DataModelTypeTag/>
										<tags:FXJM_Status/>
afe's avatar
afe committed
46
										<tags:ModelDataType/>
liuna's avatar
liuna committed
47 48
										<tags:FXJM_TitleSearch/>
										
afe's avatar
afe committed
49

afe's avatar
afe committed
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
										<!-- <tags:FXJM_modelResult_DeployedServerTag/> -->
										<button id="submit" class="btn btn-primary" onclick="modelResultSubmit()">提交</button>
										<button id="disable" class="btn btn-warning"	onclick="modelResultReset()">重置</button>
									</div>
								</div>

								<div class="main col-xs-12">
									<div id="mainm2" class="mainm" ></div>

									<div class="content clearfix">
										<div class="block clearfix">
											<button id="showLeftPush2" class="menu-trigger btn btn-default" onclick="toggleMenu('slidePushMenus2')"> 
												<span class="glyphicon glyphicon-list"></span>
											</button>
											<div class="slide-menu-tags">
												<span id="PeriodTag" class="label label-info" data-placement="bottom" >最近一个月</span> 
												<span id="DataModelTag" class="label label-info" data-placement="bottom" ></span>
												<span id="DataModelTitleTag" class="label label-info" data-placement="bottom" ></span>
												<span id="DataModelStatusTag" class="label label-info" data-placement="bottom" ></span>
											</div>
											<div class="bt-list-import">
												<a href="#" id="uploadExcel" class=""> <span
													class="glyphicon glyphicon-import"></span> <span
													class="glyphicon-class">导出Excel</span> </a>
											</div>
										</div>

										<div class="row">
											<div class="col-xs-12">
												<div class="table-header">
												模型查询结果
											     <shiro:hasAnyRoles name="admin,dataAnalysis,businessAnalysis">
													<div id="time_div" style="top: -6px;float: right;height: 0px;position: relative;">
														<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" id="updateModel" disabled>修改模型</button>
														<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" id="createModel">新建模型</button>
													</div>
												 </shiro:hasAnyRoles>	
												</div>
											     <table id="modelResultTable" class="table table-hover table-striped">
	                                            </table>
90
	                                      		<input type="hidden" id="dataModelView" name="dataModelView" value='${dataModelViewList}' />
afe's avatar
afe committed
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
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<form action="#" method="get" id="listForm"></form>
				</div>
			</div>
		</div>
	</div>
<script type="text/javascript" src="${ctx}/static/js/modelResultDetailTable.js"></script>
<script type="text/javascript">
	initDate();
	
	
	var receiveModelPageNum = "${modelPageNum}";
	modelResultDetailTable();
	if(receiveModelPageNum!=1){
		$("#goPageNo").attr("value",receiveModelPageNum);
		//document.getElementById("jumpButton").click();
		$("#jumpButton").click();
	}
	
	var receiveModelType = "${labelModelType}";
	var receiveGlobalModelType = "${globalModelType}";
	var receiveModelPeriod = "${labelModelPeriod}";
	var receiveModelTitle = "${labelModelTitle}";
	var receiveModelStatusId = "${labelModelStatusId}";
liuna's avatar
liuna committed
121
	var receiveKpiTypeId = "${labelKpiTypeId}";
afe's avatar
afe committed
122 123 124 125 126 127 128
	var judge = true;
	
	if(receiveModelPeriod!="" && receiveModelPeriod!=null){
		$("#PeriodTag").text("时间范围").attr('data-original-title',receiveModelPeriod).tooltip();
		$("#DataModelTag").text("数据模型类别").append($("<span class='badge'></span>").text(receiveModelType.split(" ").length)).attr('data-original-title',receiveModelType).tooltip();
		var modelStatusText = $("#modelStatus option[value="+receiveModelStatusId+"]").text();
		$("#DataModelStatusTag").text("模型状态").attr('data-original-title',modelStatusText).tooltip();
liuna's avatar
liuna committed
129 130
		var kpiTypeIdText = $("#kpiTypeId option[value="+receiveKpiTypeId+"]").text();
		$("#KpiTypeIdTag").text("数据类型").attr('data-original-title',kpiTypeIdText).tooltip();
afe's avatar
afe committed
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
	}
	if(receiveModelTitle!="" && receiveModelTitle!=null){
		$("#DataModelTitleTag").text("模型名称").attr('data-original-title', receiveModelTitle).tooltip();
	}
	
</script>

<script type="text/javascript">
	$("#createModel").click(function(){
			$.dialog({
				title: "提醒",
				content:"确定新建模型?",
				ok: function(){location.href="${ctx}/ModelManage/ModelMaintain";},
				okValue:"确定",
				cancel: function(){},
				cancelValue:"取消",
				lock:true
				}); 
	});

	function modelResultReset(){
		initDate();
		dataModelTypeReset();
		/* deployedServerReset(); */
		titleReset();
		judge=true;
	}
	
	function modelResultSubmit(){
		var modelPeriod = getPeriodStr();
		var modelType = getDateModelTypeStr();
		var modelStatusId = getModelStatusCheckedValue();
		//var deployedServer = getDeployedServerIdStr();
		var modelTitle = $.trim(getTitle());
liuna's avatar
liuna committed
165
		var kpiTypeId = getKpiTypeIdCheckedValue();
afe's avatar
afe committed
166 167 168 169
		receiveGlobalModelType = modelType;
		receiveModelPeriod = modelPeriod;
		receiveModelTitle = modelTitle;
		receiveModelStatusId = modelStatusId;
liuna's avatar
liuna committed
170
		receiveKpiTypeId = kpiTypeId;
afe's avatar
afe committed
171 172 173 174
		if(modelTitle!=""){
			$.ajax({
				    type : 'GET',
					contentType : 'application/json',
liuna's avatar
liuna committed
175
					url: "${ctx}/ModelManage/ModelResult/modelTableChange?modelTitle="+encodeURIComponent(modelTitle)+"&modelPeriod="+modelPeriod+"&modelType="+modelType+"&kpiTypeId="+kpiTypeId,/* +"&deployedServer="+deployedServer */
afe's avatar
afe committed
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
					dataType : 'text',
					async: false,
					beforeSend: function(data) { 
					},
					success: function(data) {
	                   $("#dataModelView").val(data);
	                   modelResultDetailTable();
	                   modelId="";
	                   $("#updateModel").attr("disabled", true);
					   toggleMenu('slidePushMenus2');//隐藏筛选项
				       updateTag(true);
					}
				});
		}else{
			if(modelPeriod==""){
			$.alert("时间选择不能为空");
		}else if(modelType==""){
			$.alert("模型类别选择不能为空");
		}/* else if(deployedServer==""){
			$.alert("部署服务器选择不能为空");
		} */else{
			$.ajax({
				    type : 'GET',
					contentType : 'application/json',
liuna's avatar
liuna committed
200
					url: "${ctx}/ModelManage/ModelResult/modelTableChange?modelPeriod="+modelPeriod+"&modelType="+modelType+"&modelTitle="+encodeURIComponent(modelTitle)+"&modelStatusId="+modelStatusId+"&kpiTypeId="+kpiTypeId,/* +"&deployedServer="+deployedServer */
afe's avatar
afe committed
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
					dataType : 'text',
					async: false,
					beforeSend: function(data) { 
					},
					success: function(data) {
	                   $("#dataModelView").val(data);
	                   modelResultDetailTable();
	                   modelId="";
	                   $("#updateModel").attr("disabled", true);
					   toggleMenu('slidePushMenus2');//隐藏筛选项
				       updateTag(true);
					}
				});
		}
		}
		
	}
	
	function updateTag(ifUpdate){
		if(ifUpdate){
			$("#PeriodTag").empty();
			$("#DataModelTag").empty();
			$("#DataModelTitleTag").empty();
			$("#DataModelStatusTag").empty();
liuna's avatar
liuna committed
225
			$("#KpiTypeIdTag").empty();
afe's avatar
afe committed
226 227 228 229 230 231 232
			if(judge == true){
                 $("#PeriodTag").text("最近一个月");
            }else{
				if(""==$.trim(getTitle())){
					$("#PeriodTag").text("时间范围").attr('data-original-title',getPeriodStr()).tooltip();
					$("#DataModelTag").text("数据模型类别").append($("<span class='badge'></span>").text(getDateModelTypeValues().length)).attr('data-original-title',getDataModelTypeTitleStr()).tooltip();
					$("#DataModelStatusTag").text("模型状态").attr('data-original-title',getModelStatusCheckedText()).tooltip();
liuna's avatar
liuna committed
233
					$("#KpiTypeIdTag").text("数据类型").attr('data-original-title',kpiTypeIdText()).tooltip();
afe's avatar
afe committed
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 311 312 313 314
				}else{
					$("#DataModelTitleTag").text("模型名称").attr('data-original-title', $.trim(getTitle())).tooltip();
				}
			//$("#DeployedServerTag").text("部署服务器").append($("<span class='badge'></span>").text(getDeployedServerValues().length)).attr('data-original-title',getDeployedServerTitleStr()).tooltip();
		  }	
		}
	}
	
	//更新按钮点击
	$("#updateModel").click(function(){
			var pageNum = $("#goPageNo").val();
			$.dialog({
				title: "提醒",
				content:"确定修改模型?",
				ok: function(){location.href="${ctx}/ModelManage/ModelParameterConfiguration?dataModelId="+modelId+"&modelPeriod="+receiveModelPeriod+"&modelType="+receiveGlobalModelType+"&modelStatusId="+receiveModelStatusId+"&modelTitle="+encodeURIComponent(receiveModelTitle)+"&modelPageNum="+pageNum;},
				okValue:"确定",
				cancel: function(){},
				cancelValue:"取消",
				lock:true
				}); 
		
		
	
		/* $.confirm("确定修改模型?",
		function(){location.href="${ctx}/ModelManage/ModelParameterConfiguration?dataModelId="+modelId;},
		function(){}); */
	});
	
	//查看参数
	function lookParm(dataModelId,dataModelTitle){
			$.dialog({
				title:"数据模型标题:"+dataModelTitle,
				content:"<div id='paramList'>"+
				"<div class='col-xs-12'><div class='panel panel-default'><div class='panel-heading'>参数列表</div><div class='panel-body'> <table class='table table-hover table-striped'> <thead> <tr> <th width='20%'>参数ID号</th> <th width='35%'>参数名</th> <th width='20%'>参数值</th> <th width='25%'>参数类型</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div>"+
				"</div>",
				lock:true,
				width:800,
				initialize:function(){
					$.ajax({
						type : 'GET',
						contentType : 'application/json',
						url: "${ctx}/ModelManage/ModelResult/findParam?dataModelId="+dataModelId,
						dataType : 'text',
						beforeSend: function(data) { 
						},
						success: function(data){
							for(var i=0;i<data.length;i++){
			                      if(data[i]=='\"'){
			                         data=data.replace('\"','\'');
			                      }             
			                  }
							  data=eval("("+data+")");
							if(data!=null && data!=""){
								var paramTbody = $('#paramList tbody');
								for(var i=0;i<data.length;i++){
									if(data[i].parameterValue=="undefined" || data[i].parameterValue==null || data[i].parameterValue==""){
										data[i].parameterValue="";
									}
									paramTbody.append($("<tr></tr>").append("<td>"+data[i].parameterId+"</td>")
											 					  .append("<td>"+data[i].parameterName+"</td>")
											 					  .append("<td>"+data[i].parameterValue+"</td>")
											 					  .append("<td>"+data[i].parameterDataType+"</td>"));
								}
							}
						}
						});
					}

			});
		}
		
		$("#uploadExcel").click(function(){
			var listForm=$("#listForm");
           	listForm.attr("method","post");
		   	listForm.attr("action","${ctx}/ModelManage/ModelResult/uploadModel");
		   	listForm.submit();
		   	listForm.attr("action","#");
		});
</script>
</body>
</html>