<%@ page import="com.jeeplus.modules.sys.utils.UserUtils" %>
<%@ 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="page" action="${ctx}/leaveapply/leaveManage" 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  name="basicInfo.name" type="text"  maxlength="64" class=" form-control  layui-input laydate-icon"  />
								</input>
							</div>
						</div>
						<div class="layui-item query athird">
							<label class="layui-form-label">部门：</label>
							<div class="layui-input-block with-icon">
								<sys:treeselect id="id" name="basicInfo.office.id" value="${leaveApply.basicInfo.office.id}" labelName="basicInfo.office.name" labelValue="${leaveApply.basicInfo.office.name}"
												title="部门" url="/sys/office/treeData?type=2" cssClass="form-control layui-input" allowClear="true" notAllowSelectParent="true"/>
							</div>
						</div>
						<div class="layui-item athird">
							<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">
					<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 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:'name',align:'center',sort: true, minWidth:120,title: '姓名', templet:function(d){
                        var xml = "<a class=\"attention-info\" href=\"javascript:void(0)\" onclick=\"openDialogView('查看请假', '${ctx}/leaveapply/leaveManage/view?basicInfoId=" + d.basicInfoId + "&sumDays="+d.sumDays+"','95%','95%')\">" +
                            "<span title=" + d.name + ">" + d.name + "</span></a>";
                        return xml;
                    }},
                {field:'number',align:'center',width:150, title: '工号',templet:function(d){
                        return "<span title='"+ d.number +"'>" + d.number + "</span>";
                    }}
                ,{field:'office',align:'center',width:150, title: '部门',templet:function(d){
                        return "<span title='"+ d.office +"'>" + d.office + "</span>";
                    }}
                ,{field:'job',align:'center',width:150, title: '职级',templet:function(d){
                        return "<span title='"+ d.job +"'>" + d.job + "</span>";
                    }}
                ,{field:'sumDays',align:'center',width:150, title: '累计天数',templet:function(d){
                        return "<span title='"+ d.sumDays +"'>" + d.sumDays + "</span>";
                    }}
                ,{field:'state',align:'center',width:100, title: '重置状态',templet:function(d){
                        return "<span title='"+ d.state +"'>" + d.state + "</span>";
                    }}
                ,{align:'caozuo',align:'center',title:"操作",width:160,templet:function(d){
                        var xml = "";
                        if(d.canedit != undefined && d.canedit == "1"){
                        xml +="<a href=\"${ctx}/leaveapply/leaveManage/reset?basicInfoId=" + d.basicInfoId+"\" onclick=\"return confirmx('确认要重置该人员请假吗？', this.href)\"   class=\"op-btn op-btn-delete\"><i class=\"fa fa-trash\"></i> 重置</a>";
                        }
                        return xml;
                    }}
            ]]
            ,data: [
                <c:if test="${ not empty page.list}">
                <c:forEach items="${page.list}" var="leaveApply" varStatus="index">
                <c:if test="${index.index != 0}">,</c:if>
                {
                    "id":"${leaveApply.id}"
                    ,"basicInfoId":"${leaveApply.basicInfo.id}"
                    ,"name":"${leaveApply.basicInfo.name}"
                    ,"number":"${leaveApply.basicInfo.no}"
                    ,"office":"${leaveApply.basicInfo.office.name}"
                    ,"job":"${leaveApply.basicInfo.jobGrade.name}"
                    ,"sumDays":"${leaveApply.sumDays}"
                    <shiro:hasPermission name="leaveapply:leaveMange:reset">
                    ,"canedit":<c:if test="${leaveApply.state eq '0'}">"1"</c:if> <c:if test="${leaveApply.state eq '1'}">"0"</c:if>
                    </shiro:hasPermission>
                    ,"state":<c:if test="${leaveApply.state eq '0'}">"未重置"</c:if> <c:if test="${leaveApply.state eq '1'}">"已重置"</c:if>
                }
                </c:forEach>
                </c:if>
            ]
        });

    })
    resizeListTable();
</script>
<script>
    resizeListWindow1();
    $(window).resize(function(){
        resizeListWindow1();
    });

    function reset(id){

	}
</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");
            }
        });

        laydate.render({
            elem: '#beginDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
            format: 'yyyy-MM-dd',
            type : 'date'
        });

        laydate.render({
            elem: '#endDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
            format: 'yyyy-MM-dd',
            type : 'date'
        });

    });
    function switchInput(obj){
        $("#"+obj).show();
        $("#"+obj).siblings().hide();
    }

</script>
</body>
</html>
