TaskDetailForm.jsp 6.95 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
<%@ 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>
<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;
}

</style>
<script type="text/javascript" src="${ctx}/static/js/validation.js"></script>
<script language="javascript">
var sandboxOptions = new Array();
var recoverOptions = new Array();
	$(document).ready(function(){
		<c:forEach items="${tableList}" var="dimTable">
			<c:if test="${dimTable.tableCategory == 1}">
				var option = new Option('${dimTable.tabName}','${dimTable.tabId}');
				sandboxOptions.push(option);
				recoverOptions.push(option);
			</c:if>
			
			<c:if test="${dimTable.tableCategory == 2}">
				var option = new Option('${dimTable.tabName}','${dimTable.tabId}');
				sandboxOptions.push(option);
			</c:if>
		</c:forEach>
		
		<c:forEach items="${taskDetail.tables}" var="table">
			var option = new Option('${table.tabName}','${table.tabId}');
			$("#selectedTables").append(option);
		</c:forEach>

		<c:if test="${taskDetail.taskType == '2'}">
			$("#tables").append(recoverOptions);
		</c:if>
		
		<c:if test="${taskDetail.taskType == '3'}">
			$("#tables").append(sandboxOptions);
		</c:if>
		
		<c:if test="${empty taskDetail.taskType}">
			$("#tables").append(recoverOptions);
		</c:if> 
	});

function changeOption() {
	$("#tables").empty();
	$('#selectedTables').empty();
	if($('#taskType').val() == '2') {
		$("#tables").append(recoverOptions);
	} else {
		$("#tables").append(sandboxOptions);
	}
}

function addOption() {
	var selectedOptions = $("#tables").find("option:selected");
	for(var i=0;i<selectedOptions.length;i++) {
		if($("#selectedTables").find("option[value="+selectedOptions[i].value+"]").length == 0) {
			$('#selectedTables').append(new Option(selectedOptions[i].text, selectedOptions[i].value));	
		}
	}
}

function removeOption() {
	$("#selectedTables option:selected").remove();
}

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

function validate() {
	if(!checkNameAndCode()) {
		return false;
	}
	if($('#selectedTables option').length == 0) {
		alert("请选择数据表");
		return false;
	} else {
		$('#selectedTables option').attr('selected', true);
	}
	if(!$('#starttime').val()) {
		alert("请填写数据开始时间");
		return false;
	}
	if(!$('#endtime').val()) {
		alert("请填写数据结束时间");
		return false;
	}
	return true;
}
</script>
</head>
<body>
	<div id="main-tab-container">
		<div id="content" class="container">
				<div class="section">
					<div class="tab-content">

										<!-- this is for emulating position fixed of the nav -->
											<!-- /scroller-inner -->
											<!-- Top Navigation -->
											<div class="tab-pane fade in active" id="home">
												<div class="row">
													<div class="col-xs-12">
														<div class="table-header">数据恢复任务维护</div>
														<form id="detailForm" class="form-horizontal" role="form" action="${ctx}/BaseManage/TaskDetailManage/submitTaskDetailFrame" method="post">
														<input type="hidden" id="taskInfoId" name="taskInfoId" value="${taskDetail.taskInfoId}">
														
														<table class="table-null">
															<tr>
																<td>任务信息名称(<font color="red">必填</font>):</td>
																<td><input type="input" class="form-control" id="name" name="name" value="${taskDetail.name}"></td>
															</tr>
															
															<tr>
																<td>任务信息代码(<font color="red">必填</font>):</td>
																<td><input type="input" class="form-control" id="code" name="code" value="${taskDetail.code}"></td>
															</tr>
															
															<tr>
																<td>任务信息类型:</td>
																<td><select class="form-control" name="taskType" id="taskType" onchange="changeOption();">
																	<c:if test="${taskDetail.taskType == '2'}">
																	  <option value="2">数据恢复任务</option>
																	</c:if>
																	<c:if test="${taskDetail.taskType == '3'}">
																	  <option value="3">沙盒任务</option>
																	</c:if>
																	</select>
																</td>
															</tr>
															
															<tr>
																<td>数据表</td>
																<td nowrap>
																	<select class="form-control" size="5" multiple id="tables"> </select>
																      	<input type="button" value=">>" class="btn btn-default" onclick="addOption();" >
																      	<input type="button" value="<<" class="btn btn-default" onclick="removeOption();">
																	<select class="form-control" size="5" multiple id="selectedTables" name="selectedTables"></select>
																</td>
															</tr>
															
															<tr>
																<td>数据开始时间:</td>
																<td>
																<input type="text" class="form-control Wdate" id="starttime" name="startTimeStr" value="${taskDetail.starttime}"
														      	onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:false,maxDate:'#F{$dp.$D(\'endtime\');}'})">
																</td>
															</tr>
															
															<tr>
																<td>数据结束时间:</td>
																<td>
																	<input type="input" class="form-control Wdate" id="endtime" name="endTimeStr"  value="${taskDetail.endtime}"
														      	onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:false,minDate:'#F{$dp.$D(\'starttime\');}'})">
																</td>
															</tr>
															
															<tr>
																<td></td>
																<td>
																	<button type="button" id="modelSubmit" class="btn btn-primary" onclick="saveForm('taskInfoId');">确定</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/TaskDetailManage/taskDetailListFrame?taskType=${taskDetail.taskType}'">返回</button>
																</td>
															</tr>
														 </table> 
														</form>
													</div>
												</div>
											</div>
					</div>
				</div>
		</div>
	</div>
</body>
</html>