<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>版本信息管理</title>
	<meta name="decorator" content="default"/>


	<style>
		.widthClass{
			display: inline-block;
		}
		.shows .input-group{
			width: 48%!important;
		}
	</style>
	<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="appversions" action="${ctx}/appversion/appversions/" 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">
								<input id="versions" name="versions" type="text"  maxlength="64" class=" form-control  layui-input laydate-icon" value="${appversions.versions}" />
								</input>
							</div>
						</div>
						<div class="layui-item query athird">
							<label class="layui-form-label">类型：</label>
							<div class="layui-input-block">
								<form:select path="remarks" class=" form-control  simple-select">
									<form:option items="" value="" label=""/>
									<form:option items="IOS" value="IOS" label="IOS" itemLabel="label"/>
									<form:option items="Android" value="Android" label="Android" itemLabel="label"/>
								</form:select>
							</div>
						</div>
						<div class="layui-item athird">
							<div class="input-group">
								<a href="#" id="moresee"><i class="glyphicon glyphicon-menu-down"></i></a>
								<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>
                <br/>
            </div>
        </div>
	<!-- 工具栏 -->
		<div class="full-width fl">
			<div class="contentShadow layui-form contentDetails">
				<div class="nav-btns">
			<shiro:hasPermission name="appversion:appversions:add">
				<!-- 增加按钮 -->
				<a href="javascript:void(0)" onclick="openDialogre('新增版本信息', '${ctx}/appversion/appversions/form','95%','95%')" class="nav-btn nav-btn-add" ><i class="fa fa-plus"></i>&nbsp;添加</a>
			</shiro:hasPermission>
<%--
			<shiro:hasPermission name="appversion:appversions:edit">
			    <table:editRow url="${ctx}/appversion/appversions/form" title="版本信息" id="contentTable"></table:editRow><!-- 编辑按钮 -->
			</shiro:hasPermission>
			<shiro:hasPermission name="appversion:appversions:del">
				<table:delRow url="${ctx}/appversion/appversions/deleteAll" id="contentTable"></table:delRow><!-- 删除按钮 -->
			</shiro:hasPermission>
	--%>
			<shiro:hasPermission name="appversion:appversions:import">
				<table:importExcel url="${ctx}/appversion/appversions/import"></table:importExcel><!-- 导入按钮 -->
			</shiro:hasPermission>
			<shiro:hasPermission name="appversion:appversions:export">
	       		<table:exportExcel url="${ctx}/appversion/appversions/export"></table:exportExcel><!-- 导出按钮 -->
	       	</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 style="text-align: center;width:15%"  class="sort-column updateDate">更新时间</th>
				<th style="text-align: center;width:10%"  class="sort-column remarks">备注信息</th>
				<th style="text-align: center;width:10%"  class="sort-column versions">版本信息</th>
				<th style="text-align: center;width:15%"  class="sort-column content">版本更新</th>
				<th style="text-align: center;width:40%"  class="sort-column url">下载地址</th>
				<th style="text-align: center;width:10%">操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="appversions">
			<tr>
				<td>
					<fmt:formatDate value="${appversions.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${appversions.remarks}
				</td>
				<td>
					${appversions.versions}
				</td>
				<td>
					${appversions.content}
				</td>
				<td>
					<a href="${appversions.url}">${appversions.url}</a>
				</td>
				<td>
					<div style="text-align: center">
					<shiro:hasPermission name="appversion:appversions:view">
						<a href="javascript:void(0)" onclick="openDialogView('查看版本信息', '${ctx}/appversion/appversions/form?id=${appversions.id}&readAttr=disabled','80%','80%')" class="btn btn-info btn-xs" ><i class="fa fa-search-plus"></i> 查看</a>
					</shiro:hasPermission>
    				<shiro:hasPermission name="appversion:appVersions:del">
						<a href="${ctx}/appversion/appversions/delete?id=${appversions.id}" onclick="return confirmx('确认要删除该版本信息吗？', this.href)"   class="btn btn-danger btn-xs"><i class="fa fa-trash"></i> 删除</a>
					</shiro:hasPermission>
					</div>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>--%>
				<table class="oa-table layui-table" id="contentTable"></table>

				<!-- 分页代码 -->
				<table:page page="${page}"></table:page>
				<div style="clear: both;"></div>
			</div>
		</div>
	</div>
	<div id="changewidth"></div>
</div>
<script src="${ctxStatic}/layer-v2.3/layui/layui.all.js" charset="utf-8"></script>
<script>
    layui.use('table', function(){
        layui.table.render({
            limit:${ page.pageSize }
            ,elem: '#contentTable'
            ,page: false
            ,cols: [[
                {field:'updateDate',align:'center',sort: true, width:150,title: '更新时间', templet:function(d){
                        return "<span title='"+ d.updateDate +"'>" + d.updateDate + "</span>";
                    }},
                {field:'remarks',align:'center', minWidth:150, title: '备注信息',templet:function(d){
                        return "<span title='"+ d.remarks +"'>" + d.remarks + "</span>";
                    }}
                ,{field:'versions',align:'center', minWidth:150, title: '版本信息',templet:function(d){
                        return "<span title='"+ d.versions +"'>" + d.versions + "</span>";
                    }}
                ,{field:'content',align:'center', minWidth:150, title: '版本更新',templet:function(d){
                        return "<span title='"+ d.content +"'>" + d.content + "</span>";
                    }}
                ,{field:'url',align:'center',minWidth:200, title: '下载地址',templet:function(d){
                        var xml = "<a class=\"attention-info\" href=\""+d.url+"\" >" +
                            "<span title=" + d.url + ">" + d.url + "</span></a>";
                        return xml;
                    }}
                ,{align:'caozuo',align:'center',title:"操作",width:80,templet:function(d){
                        ////对操作进行初始化
                        var xml = "";
                            xml +="<a href=\"javascript:void(0)\" onclick=\"openDialogView('查看版本信息', '${ctx}/appversion/appversions/form?id="+ d.id + "&readAttr=disabled','95%','95%')\" class=\"op-btn op-btn-view\" ><i class=\"fa fa-view\"></i> 查看</a>";
                        return xml;
                    }}
            ]]
            ,data: [
                <c:if test="${ not empty page.list}">
                <c:forEach items="${page.list}" var="appversions" varStatus="index">
                <c:if test="${index.index != 0}">,</c:if>
                {
                "id":"${appversions.id}"
                    ,"updateDate":"<fmt:formatDate value="${appversions.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
                    ,"remarks":"${appversions.remarks}"
                    ,"versions":"${appversions.versions}"
                    ,"content":"${appversions.content}"
                    ,"url":"${appversions.url}"
                }
                </c:forEach>
                </c:if>
            ]
        });

    })

    resizeListTable();
</script>
<script>
    resizeListWindow1();
    $(window).resize(function(){
        resizeListWindow1();
    });
</script>
<script type="text/javascript">
    $(document).ready(function() {
        $("#cus_name").show();
        $("#cus_name").siblings().hide();
        //搜索框收放
        $('#moresee').click(function(){
            if($('#moresees').is(':visible'))
            {
                $('#moresees').slideUp(0,resizeListWindow1);
                $('#moresee i').removeClass("glyphicon glyphicon-menu-up").addClass("glyphicon glyphicon-menu-down");
            }else{
                $('#moresees').slideDown(0,resizeListWindow1);
                $('#moresee i').removeClass("glyphicon glyphicon-menu-down").addClass("glyphicon glyphicon-menu-up");
            }
        });

    });
    function switchInput(obj){
        $("#"+obj).show();
        $("#"+obj).siblings().hide();
    }
    function openDialogre(title,url,width,height,target){

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

        }
        top.layer.open({
            type: 2,
            area: [width, height],
            title: title,
            skin: 'two-btns',
            maxmin: true, //开启最大化最小化按钮
            content: url ,
            btn: ['提交','关闭'],
            yes: 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() ){
                    top.layer.close(index);//关闭对话框。
                    //setTimeout(function(){top.layer.close(index)}, 100);//延时0.1秒，对应360 7.1版本bug
                }

            }

        });
    }

    function openDialogre(title,url,width,height,target){

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

        }
        top.layer.open({
            type: 2,
            area: [width, height],
            title: title,
            skin: 'two-btns',
            maxmin: true, //开启最大化最小化按钮
            content: url ,
            btn: ['提交','关闭'],
            yes: 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() ){
                    top.layer.close(index);//关闭对话框。
                    //setTimeout(function(){top.layer.close(index)}, 100);//延时0.1秒，对应360 7.1版本bug
                }

            }

        });
    }
</script>
</body>
</html>