<%@ 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="workItem" action="${ctx}/workitem/workItem/" 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="name" name="itemName" type="text"  maxlength="60" class=" form-control layui-input " value="${workItem.itemName}"/>
								</input>
							</div>
						</div>
						<div class="layui-item query athird lw9">
							<label class="layui-form-label double-line ">是否固定资产：</label>
							<div class="layui-input-block">
								<form:select path="isAssets" class="form-control simple-select">
									<form:option value="" label=""/>
									<form:option value="1" label="是"/>
									<form:option value="0" 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>
					<div id="moresees" style="clear:both;display:none;">

						<div class="layui-item query athird lw9">
							<label class="layui-form-label">固定资产编号：</label>
							<div class="layui-input-block">
								<input id="number" name="number" type="text"  maxlength="64" class=" form-control  layui-input laydate-icon" value="${workItem.number}" />
								</input>
							</div>
						</div>

						<div class="layui-item query athird lw9">
							<label class="layui-form-label">固定资产状态：</label>
							<div class="layui-input-block">
								<form:select path="state" class=" form-control  simple-select">
									<form:option value="" label=""/>
									<form:option value="1" label="正常"/>
									<form:option value="2" label="借用"/>
									<form:option value="3" label="领用"/>
									<form:option value="4" label="报废"/>
								</form:select>
							</div>
						</div>
						<div class="layui-item query athird">
							<label class="layui-form-label">使用人：</label>
							<div class="layui-input-block">
								<input id="endUserName" name="endUserName" type="text"  maxlength="64" class=" form-control  layui-input laydate-icon" value="${workItem.endUserName}" />
								</input>
							</div>
						</div>
						<div class="layui-item query athird">
							<label class="layui-form-label">使用日期：</label>
							<div class="layui-input-block">
								<input id="beginDate" placeholder="开始时间" name="beginDate" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
									   value="<fmt:formatDate value="${workItem.beginDate}" pattern="yyyy-MM-dd"/>"/>
								</input>
								<span class="group-sep">-</span>
								<input id="endDate" placeholder="结束时间" name="endDate" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
									   value="<fmt:formatDate value="${workItem.endDate}" pattern="yyyy-MM-dd"/>"/>
								</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="userOfficeId" name="userOfficeId" value="${workItem.userOfficeId}" labelName="userOfficeName" labelValue="${workItem.userOfficeName}"
												title="部门" url="/sys/office/treeDataAll?type=2" cssClass="form-control layui-input" allowClear="true" notAllowSelectParent="true"/>
							</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>
					<button class="nav-btn" data-toggle="tooltip" data-placement="left" onclick="print()" title="打印"><i class="glyphicon "></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>
<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: [[
                {checkbox: true, fixed: true},
                {field:'itemName',align:'center',minWidth:150, title: '物品名称'},
                {field:'itemNumber',align:'center',  title: '物品编号',width:150, templet:function(d){
                        return "<span title='"+ d.itemNumber +"'>" + d.itemNumber + "</span>";
                    }}
                ,{field:'itemType',align:'center', title: '物品分类', width:150, templet:function(d){
                        return "<span title='"+ d.itemType +"'>" + d.itemType + "</span>";
                    }}
                ,{field:'itemModel',align:'center', title: '规格型号', width:150, templet:function(d){
                        return "<span title='"+ d.itemModel +"'>" + d.itemModel + "</span>";
                    }}
                ,{field:'itemPrimaryUnit', align:'center',width:150,title: '计量单位', templet:function(d){
                        return "<span title='"+ d.itemPrimaryUnit +"'>" + d.itemPrimaryUnit + "</span>";
                    }}
                ,{field:'itemCount', align:'center',title: '数量', width:80}
                ,{field:'isAssets', align:'center',title: '是否固定资产',width:150}
                ,{field:'number', align:'center',title: '固定资产编号',width:150}
                ,{field:'state', align:'center',title: '固定资产状态',width:150}
                ,{field:'endUserName', align:'center',title: '使用人',width:150}
                ,{field:'userDate', align:'center',title: '使用日期',width:150}
                ,{field:'userOfficeName', align:'center',title: '所属部门',width:150}
            ]]
            ,data: [
                <c:if test="${ not empty page.list}">
                <c:forEach items="${page.list}" var="workItem" varStatus="index">
                <c:if test="${index.index != 0}">,</c:if>
                {

                    "itemName":"${workItem.itemName}"
                    ,"itemNumber":"${workItem.workCatalogueItem.number}"
                    ,"itemType":"${fns:getMainDictLabel(workItem.workCatalogueItem.type, 'item_type', '')}"
                    ,"itemModel":"${workItem.workCatalogueItem.model}"
                    ,"itemPrimaryUnit":"${fns:getMainDictLabel(workItem.workCatalogueItem.primaryUnit, 'full_count_unit', '')}"
                    ,"itemCount":"${workItem.itemCount}"
                    ,"isAssets":<c:if test="${workItem.isAssets eq '1'}">"是"</c:if><c:if test="${workItem.isAssets eq '0'}">"否"</c:if>
                    ,"number":"${workItem.number}"
                    ,"state":<c:if test="${workItem.state eq '1'}">"正常"</c:if> <c:if test="${workItem.state eq '2'}">"借用"</c:if><c:if test="${workItem.state eq '3'}">"领用"</c:if> <c:if test="${workItem.state eq '4'}">"报废"</c:if>
                    ,"endUserName":"${workItem.endUserName}"
                    ,"userDate":"<fmt:formatDate value="${workItem.userDate}" pattern="yyyy-MM-dd"/>"
                    ,"userOfficeName":"${workItem.userOfficeName}"
                }
                </c:forEach>
                </c:if>
            ]

        });

    })
</script>
<script>
    resizeListWindow1();
    $(window).resize(function(){
        resizeListWindow1();
    });
</script>
<script type="text/javascript">
    $(document).ready(function() {
        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'
        });
        //搜索框收放
        $('#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 print(){
    top.layer.msg('打印功能尚未开发！',{icon: 2,time: 2500,area: ['200px', '100px'], });
}
</script>
</body>
</html>