<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/include/header2.jsp"%>
<link rel="stylesheet" type="text/css" href="${ctx}/css/newCss/dialog.css">
<title>codeLibrary修改</title>
<style>
	#tbwrap th, #tbwrap td{
		width: 100px;
	}
</style>
</head>
<body class="bg1">
	<div class="headCon">
		<%@ include file="/WEB-INF/jsp/top2.jsp"%>
	</div>

	<div class="clear"></div>

	<div class="container_fluid">
		<div class="searchCon left_menu managerLeft" style="position:relative;">
			<jsp:include page="/include/manageLeft.jsp">
				<jsp:param name="index" value="codeLibrary" />
			</jsp:include>
		</div>
		<!-- <div id="resultCon1" class="resultCon" style="margin-left: 255px;"> -->
		<div class="resultCon" style="margin-left: 255px;position:relative;">
			<div class="reSearch">
				<div class="p_bar" style="border-bottom: 1px dashed #afb4bb;">您当前的位置：codeLibrary修改</div>
				<div class="row">
					<div class="search-group btnCon">
						<span>
							<button class="btn btn-primary" id="add"><span class="glyphicon glyphicon-plus" aria-hidden="ture"></span>添加</button>
						</span>
						<!--  <span>
							<button class="btn btn-primary" id="update"><span class="glyphicon glyphicon-plus" aria-hidden="ture"></span>更新标注流程</button>
						</span>
						<span>
							<button class="btn btn-primary" id="update2"><span class="glyphicon glyphicon-plus" aria-hidden="ture"></span>更新s标注流程2个案件</button>
						</span>  -->
					</div>
				</div>
				
			</div>	
			<div class="clear"></div><!-- 清除浮动 -->
			<div class="resultTable" style="width: 99%;padding: 10px;border-radius: 5px;">
				<div class="tbCon" style="position:relative;">
					<table id="tbwrap" class="table table-bordered" style="table-layout:fixed;"></table>
				</div>
				
				<div class="page eui-pager-custom" id="j_pager"></div>
			</div>
		</div>
	</div>
			

	<!--表格模板引擎-->
	<script type="text/html" id="tb_template">
		<thead>
			<tr>
				<th>CodeNo</th><th>ItemNo</th><th>ItemName</th><th>Itemaval</th><th>SortNo</th><th>IsInUse</th><th>ItemDescribe</th><th>ItemAttribute</th>
				<th>Attribute1</th><th>Attribute2</th><th>Attribute3</th><th>Attribute4</th><th>Attribute5</th><th>Attribute6</th><th>Attribute7</th>
				<th>Attribute8</th><th>InputUser</th><th>InputTime</th><th>InputOrg</th><th>UpdateTime</th><th>UpdateUser</th><th>Remark</th>
				<th>HelpText</th>
				<th style="width:120px">操作</th>		
			</tr>
		</thead>
		<tbody data-type="body">
			<!if(list.length>0) {!>
				<!for(var i=0,len=list.length;i<len;i++){
					var item = list[i],classItem = (i%2!=0)?"odd td_odd":"even";
				!>
				
				<tr class="gradeA <!=classItem!>" data-rowdata="<!=itemArr!>" data-markmess="<!=markMess!>">
					<td title="<!=item.CodeNo!>"><!=item.CodeNo!></td>						
					<td title="<!=item.ItemNo!>"><!=item.ItemNo!></td>
					<td title="<!=item.ItemName!>"><!=item.ItemName!></td>
					<td title="<!=item.Itemaval!>"><!=item.Itemaval!></td>
					<td title="<!=item.SortNo!>"><!=item.SortNo!></td>
					<td title="<!=item.IsInUse!>"><!=item.IsInUse!></td>
					<td title="<!=item.ItemDescribe!>"><!=item.ItemDescribe!></td>
					<td title="<!=item.ItemAttribute!>"><!=item.ItemAttribute!></td>
					<td title="<!=item.Attribute1!>"><!=item.Attribute1!></td>
					<td title="<!=item.Attribute2!>"><!=item.Attribute2!></td>
					<td title="<!=item.Attribute3!>"><!=item.Attribute3!></td>
					<td title="<!=item.Attribute4!>"><!=item.Attribute4!></td>
					<td title="<!=item.Attribute5!>"><!=item.Attribute5!></td>
					<td title="<!=item.Attribute6!>"><!=item.Attribute6!></td>
					<td title="<!=item.Attribute7!>"><!=item.Attribute7!></td>
					<td title="<!=item.Attribute8!>"><!=item.Attribute8!></td>
					<td title="<!=item.InputUser!>"><!=item.InputUser!></td>
					<td title="<!=item.InputTime!>"><!=item.InputTime!></td>
					<td title="<!=item.InputOrg!>"><!=item.InputOrg!></td>
					<td title="<!=item.UpdateTime!>"><!=item.UpdateTime!></td>
					<td title="<!=item.UpdateUser!>"><!=item.UpdateUser!></td>
					<td title="<!=item.Remark!>"><!=item.Remark!></td>
					<td title="<!=item.HelpText!>"><!=item.HelpText!></td>
					<td>
						<a title="修改"  data-value="<!=item["CodeNo"]!>" data-name="<!=item["ItemNo"]!>" class="edit btn btn-primary btn-xs"><span class="glyphicon glyphicon-edit" aria-hidden="ture"></span>修改</a>
						<a title="删除"  data-value="<!=item["CodeNo"]!>" data-name="<!=item["ItemNo"]!>" class="delete btn btn-danger btn-xs"><span class="glyphicon glyphicon-edit" aria-hidden="ture"></span>删除</a>
					</td>
				</tr>
			<!}!>
			<!}else{!>
				<tr>
					<td colspan="23"> 暂无数据</td>
				</tr>
			<!}!>
		</tbody>
	</script>

	<script src="${ctx}/js/lib/core.js"></script>
	<script src="${ctx}/component/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
	<script src="${ctx}/js/lib/perfect-scrollbar.jquery.js"></script>
	<script type="text/javascript">
		var sysRoleDialog;
		var markMess='',checked_arr=[];
		$(function() {

			//查询
			$("#searchBtn").click(function() {
				search();
				resize();				
			});
			search();
			resize();

			$(".btnCon").delegate("#add","click",function() {

				// 3.2 弹窗窗口，显示详细信息
				seajs.use("component/dialog", function(dialog) {
					sysUserDialog = new dialog({
						"width" : 800,
						"height" : 600,
						"contentType" : "iframe",
						"html" : "${ctx}/outService/addCodeLibrary.do",
						// 内容
						"title" : "编辑详细信息" //标题
					});
				});
			});
			$(".btnCon").delegate("#update","click",function() {
				$.ajax({
					type:"post",
					url:"${ctx}/outService/repair.do",
					success:function(result){
						alert(result);
					}
					})
			});
			$(".btnCon").delegate("#update2","click",function() {
				$.ajax({
					type:"post",
					url:"${ctx}/outService/repairTwo.do",
					success:function(result){
						alert(result);
					}
					})
			});
			$("#tbwrap").delegate(".delete","click",function(){
				if (confirm('确定删除？')){
					$.ajax({
					type:"post",
					data:{CodeNo:$(this).data("value"),ItemNo:$(this).data("name")},
					url:"${ctx}/outService/deleteCode.do",
					success:function(result){
						if(result=="删除成功！"){
							alert(result);
							parent.location.replace("${ctx}/sysPara/codeLibrary.do");
						}else{
							alert("删除失败");
							parent.location.replace("${ctx}/sysPara/codeLibrary.do");
						}
					}
					})
				}
			})
			$("#tbwrap").delegate(".edit","click",function() {
				// 3.1 获取主键
				var CodeNo=$(this).data("value");
				var ItemNo=$(this).data("name")+"";

				// 3.2 弹窗窗口，显示详细信息
				seajs.use("component/dialog", function(dialog) {
					sysUserDialog = new dialog({
						"width" : 800,
						"height" : 600,
						"contentType" : "iframe",
						"html" : "${ctx}/outService/editCodeLibrary.do?CodeNo="+CodeNo+"&ItemNo="+ItemNo,
						// 内容
						"title" : "编辑详细信息" //标题
					});
				});
			});

		})
			//点击选择需要发起调查的数据
			/*$("#tbwrap").delegate("tr.gradeA .check_box","click",function(){
				alert("aaaaa");
			});*/

		//函数
		function search() {
			// 这里放包含查询条件的DIV
			var paramData = {
				page:1
			};

			seajs.use([ "component/table" ], function(uiTable) {
				$.post("${ctx}/outService/showList.do",paramData,function(data){
					var table = new uiTable({
						 "con": "#tbwrap",//放table的容器,"rowCount":22,"currentPage":1}
						 "data": {
							 "list": data.dataList//渲染需要的数据
						 },
						 "template": "tb_template",//渲染的模板
						 "pager": {//翻页
							 "con": "#j_pager",//翻页容器
							 "data": {
								 "currentPage": data.currentPage,//当前页
								 "pageCount": data.totalPage,
								 "rowCount": data.total
							 },
							 //翻页样式
							 template: '<ul class="pagination" style="margin: 0;"><li><a title="首页" class="page_first" data-role="first" href="#">首页</a></li><li><a title="上一页" class="page_prev" href="#" data-role="prev">上一页</a></li><li class="pageNum" data-value="pageNum"><a></a></li><li><a title="下一页" class="page_next" href="#" data-role="next">下一页</a></li><li><a title="尾页" class="page_last" href="#" data-role="last">尾页</a></li></ul><div class="pageGo">共<span data-role="rowCount"></span>条 跳转到 <input  type="text" data-target="input" class="input_txt" style="width:80px;"/><a href="#" data-role="go" class="go">GO</a></div>'
						 }
					 });
					 table.getPager().bind("changePage", function (event, page, hander) {//点击翻页时
					 	//获取当前页选择数据
						 var paramData = {
									currentPage:page
								};
						 $.post("${ctx}/outService/showList.do",paramData,function(change){
							 table.render({//重新渲染
									list: change.dataList//传入新的渲染数据
							});
							hander({
								"currentPage": change.currentPage,
								"pageCount": change.totalPage,
								"rowCount": change.total
							});
						 });
					 });
				});
			});
		}
	
	     $(function () {
			$(".resultCon").perfectScrollbar();
			$(".searchCon").perfectScrollbar();
			$(".tbCon").perfectScrollbar();
			resize();
            $(window).resize(function(){
				resize();
			});
			
	    });
	    function resize(){
			//获取窗口高度
			var windowheight=$(window).height();
			var width=$("resultCon").width();
			var leftList = windowheight-40;
			$(".searchCon").css({"height":leftList+"px"});
			$(".resultCon").css({"height":leftList-12+"px"});
			$("#tbwrap").css({"width":2500+"px"});
			/*$(".resultTable").css({"height":360+"px"});*/
			//$(".tableMain").css({"height":windowheight-40-42-131+"px"});
			//$(".table_list").css({"height":windowheight-40-42-100-85+"px"});
			$(".resultCon").perfectScrollbar("update");
			$(".searchCon").perfectScrollbar("update");
			$(".tbCon").perfectScrollbar("update");
		}
	</script>
	<%@ include file="/include/footer.jsp"%>
</body>
</html>
