<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>编号模板管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {

		});
        function openDialogre(title,url,width,height,target,button) {
            if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) {//如果是移动端，就使用自适应大小弹窗
                width = 'auto';
                height = 'auto';
            } else {//如果是PC端，根据用户设置的width和height显示。

            }
            var split = button.split(",");
            top.layer.open({
                type: 2,
                area: [width, height],
                title: title,
                maxmin: true, //开启最大化最小化按钮
                content: url,
				skin:"three-btns",
                btn: split,
                btn1: function (index, layero) {
                    // var iframeWin = window[layero.find('iframe')[0]['name']];
                    var iframeWin = layero.find('iframe')[0].contentWindow;
                    iframeWin.genTpl(null);
                },
                btn2: function(index, layero){
                    var body = top.layer.getChildFrame('body', index);
                    var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                    var inputForm = body.find('#inputForm');
                    var top_iframe;
                    if(target){
                        top_iframe = target;//如果指定了iframe，则在改frame中跳转
                    }else{
                        top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
                    }
                    inputForm.attr("target",top_iframe);//表单提交成功后，从服务器返回的url在当前tab中展示

                    if(iframeWin.contentWindow.doSubmit(index) ){
                        // top.layer.close(index);//关闭对话框。
                        // setTimeout(function(){top.layer.close(index)}, 100);//延时0.1秒，对应360 7.1版本bug
                    }
                    return false;
                },
                btn3: function (index) {

                }
            });
        }
	</script>
	<style>
		body{
			background-color:transparent;
			filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFFFFF, endColorstr=#26FFFFFF);
			color:#ffffff;
			background-color:rgba(255,255,255,0);
			height:100%;
		}
	</style>
</head>
<body>
<div class="wrapper wrapper-content">
	<sys:message content="${message}"/>
	<div class="layui-row">
		<div class="full-width fl">
			<div class="contentShadow layui-row" id="queryDiv">
			<form:form id="searchForm" modelAttribute="serialNumTpl" action="${ctx}/serialnum/serialNumTpl/" method="post" class="form-inline">
				<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
				<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
				<table:sortColumn id="orderBy" name="orderBy" value="${page.orderBy}" callback="sortOrRefresh();"/><!-- 支持排序 -->

				<div class="commonQuery">
					<%--<div class="layui-item query athird">
						<label class="layui-form-label">公司名称：</label>
						<div class="layui-input-block">
							<form:input path="company.name" htmlEscape="false" maxlength="64"  class=" form-control layui-input"/>
						</div>
					</div>--%>
					<div class="layui-item query athird">
						<label class="layui-form-label">模板名称：</label>
						<div class="layui-input-block">
							<form:input path="tplName" htmlEscape="false" maxlength="20"  class=" form-control layui-input"/>
						</div>
					</div>
					<div class="layui-item athird fr">
						<div class="input-group">
							<button id="searchReset" class="fixed-btn searchReset fr" onclick="resetSearch()">重置</button>
							<button id="searchQuery" class="fixed-btn searchQuery fr" onclick="search()">查询</button>
						</div>
					</div>
					<div style="    clear:both;"></div>
				</div>

			</form:form>
		</div>
	</div>
		<div class="full-width fl">
			<div class="contentShadow layui-form contentDetails">
				<div class="nav-btns">
					<shiro:hasPermission name="serialnum:serialNumTpl:add">
						<%--<table:addRow url="${ctx}/serialnum/serialNumTpl/form" title="编号模板"></table:addRow><!-- 增加按钮 -->--%>
						<button class="nav-btn nav-btn-add" data-toggle="tooltip" data-placement="left" onclick="openDialogre('修改编号模板', '${ctx}/serialnum/serialNumTpl/form?id=${serialNumTpl.id}','95%', '95%','','生成模板,提交,关闭')" title="添加"><i class="fa fa-plus"></i> 添加</button>
					</shiro:hasPermission>
					<button class="nav-btn nav-btn-refresh" data-toggle="tooltip" data-placement="left" onclick="sortOrRefresh()" title="刷新"><i class="glyphicon glyphicon-repeat"></i>&nbsp;刷新</button>
					<div style="clear: both;"></div>
				</div>

	
				<!-- 表格 -->
				<table id="contentTable" class="table table-striped table-bordered table-hover table-condensed dataTables-example dataTable">
					<thead>
						<tr>
							<th width="40"> <input type="checkbox" class="i-checks"></th>
							<th  class="sort-column tplName">模板名称</th>
							<th  class="sort-column s.name">公司名称</th>
							<th  class="sort-column bizCode">业务标识</th>
							<th  class="sort-column serialNum">序列号长度</th>
							<th  class="sort-column serialTpl">编号模板示例</th>
							<th width="130">操作</th>
						</tr>
					</thead>
					<tbody>
					<c:forEach items="${page.list}" var="serialNumTpl">
						<tr>
							<td> <input type="checkbox" id="${serialNumTpl.id}" class="i-checks"></td>
							<td><a  href="#" onclick="openDialogView('查看编号模板', '${ctx}/serialnum/serialNumTpl/view?id=${serialNumTpl.id}','95%', '95%')">
								${serialNumTpl.tplName}
							</a></td>
							<td>
									${serialNumTpl.company.name}
							</td>
							<td>
								${fns:getDictLabel(serialNumTpl.bizCode,'serial_biztype' ,'' )}
							</td>
							<td>
								${serialNumTpl.serialNumLen}
							</td>
							<td>
									${serialNumTpl.serialTplEx}
							</td>
							<td class="op-td text-center">
								<div class="op-btn-box">
                                    <shiro:hasPermission name="serialnum:serialNumTpl:edit">
                                        <a href="javascript:void(0);" onclick="openDialogre('修改编号模板', '${ctx}/serialnum/serialNumTpl/form?id=${serialNumTpl.id}','95%', '95%','','生成模板,提交,关闭')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 修改</a>
                                    </shiro:hasPermission>
                                    <shiro:hasPermission name="serialnum:serialNumTpl:del">
                                        <a href="${ctx}/serialnum/serialNumTpl/delete?id=${serialNumTpl.id}" onclick="return confirmx('确认要删除该编号模板吗？', this.href)"   class="op-btn op-btn-delete"><i class="fa fa-trash"></i> 删除</a>
                                    </shiro:hasPermission>
								</div>
							</td>
						</tr>
					</c:forEach>
					</tbody>
				</table>

					<!-- 分页代码 -->
				<table:page page="${page}"></table:page>
				<div style="clear: both;"></div>
			</div>
		</div>
	</div>
</div>
<script>
    resizeListWindow1();
    $(window).resize(function(){
        resizeListWindow1();
    });
    $("a").on("click",addLinkVisied);
</script>
</body>
</html>