<%@ 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"/>
	<script type="text/javascript">
		$(document).ready(function() {
            laydate.render({
                elem: '#startDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                event: 'focus' //响应事件。如果没有传入event，则按照默认的click
            });
            //搜索框收放
            $('#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");
                }
            });
		});

	</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="caseInfo" action="${ctx}/caseinfo/caseInfo/companyList" 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 with-icon">
									<sys:treeselect id="caseCategory" name="caseCategory.id" value="${caseInfo.caseCategory.id}" labelName="caseCategory.name" labelValue="${caseInfo.caseCategory.name}"
													title="区域" url="/casecategory/caseCategory/treeData" cssClass="form-control input-sm" allowClear="true"/>
								</div>
							</div>
							<div class="layui-item query athird">
								<label class="layui-form-label">创建人：</label>
								<div class="layui-input-block">
									<form:input path="createBy.name" htmlEscape="false" maxlength="255"  class=" form-control layui-input"/>
								</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">
								<label class="layui-form-label">分享部门：</label>
								<div class="layui-input-block with-icon">
									<sys:treeselect id="office" name="officeId" value="${caseInfo.officeId}" labelName="officeName" labelValue="${caseInfo.officeName}"
													title="部门" url="/sys/office/treeData?type=2" cssClass=" form-control input-sm" allowClear="true" notAllowSelectParent="true"/>
								</div>
							</div>
							<div class="layui-item query athird">
								<label class="layui-form-label">施工时间：</label>
								<div class="layui-input-block">
									<input id="startDate" name="startDate" type="text" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon"
										   value="<fmt:formatDate value="${caseInfo.startDate}" pattern="yyyy-MM-dd"/>"/>
								</div>
							</div>
							<div class="layui-item query athird">
								<label class="layui-form-label">案例类型：</label>
								<div class="layui-input-block">
									<form:select path="shareStatus" class="form-control required simple-select">
										<form:option value="" label=""/>
										<form:options items="${fns:getDictList('share_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
									</form:select>
								</div>
							</div>
							<div class="layui-item query athird">
								<label class="layui-form-label">案例名称：</label>
								<div class="layui-input-block">
									<form:input path="name" htmlEscape="false" maxlength="255"  class=" form-control layui-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="area" name="area.id" value="${caseInfo.area.id}" labelName="area.name" labelValue="${caseInfo.area.name}"
													title="区域" url="/sys/area/treeData" cssClass="form-control input-sm" 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>
						<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: [[
                    // {checkbox: true, fixed: true},
                    {field:'index',align:'center', title: '序号',width:40}
                    ,{field:'project',align:'center', title: '所属项目',width:150,templet:function(d){
                            return "<span title='"+ d.project +"'>" + d.project + "</span>";
                        }}
                    ,{field:'caseName',align:'center', title: '案例名称(分部分项)',minWidth:200,templet:function(d){
                            return "<a class=\"attention-info\" title=\"" + d.caseName + "\" href=\"javascript:void(0);\" onclick=\"openDialogView('查看案例详情', '${ctx}/caseinfo/caseInfo/form?id=" + d.id +"&tabId=0','95%', '95%')\">" + d.caseName + "</a>";
                        }}
                    ,{field:'caseCate', align:'center',title: '案例类别',width:100,templet:function(d){
                            return "<span title='"+ d.caseCate +"'>" + d.caseCate + "</span>";
                        }}
                    ,{field:'startDate', align:'center',title: '施工时间', width:80}
                    ,{field:'area',align:'center', title: '工程所在地',  width:100,templet:function(d){
                            return "<span title=\"" + d.area + "\">" + d.area + "</span>";
                        }}
                    ,{field:'company',align:'center', title: '案例分享公司',  width:90,templet:function(d){
                            return "<span title=\"" + d.company + "\">" + d.company + "</span>";
                        }}
                    ,{field:'office',align:'center', title: '案例分享部门',  width:90,templet:function(d){
                            return "<span title=\"" + d.office + "\">" + d.office + "</span>";
                        }}
                    ,{field:'createBy',align:'center', title: '创建人',  width:80}
                    ,{field:'auditBy',align:'center', title: '审核人',  width:80}
                    ,{field:'caseType',align:'center', title: '案例类型',  width:80}
                ]]
                ,data: [
                    <c:if test="${ not empty page.list}">
                    <c:forEach items="${page.list}" var="caseInfo"  varStatus="index">
                    <c:set var="Sid" scope="session" value="<%= UserUtils.getUser().getId()%>"/>
                    <c:set var="rname" scope="session" value="<%= UserUtils.getSelectRole().get(0).getName()%>"/>
                    <c:if test="${index.index != 0}">,</c:if>
                    {
                        "index":"${index.index+1}"
                        ,"id":"${caseInfo.id}"
                        ,"project":<c:choose><c:when test="${caseInfo.ext == 1}">"${caseInfo.contractName}"</c:when><c:otherwise>"${caseInfo.project.projectName}"</c:otherwise></c:choose>
                        ,"caseName":"${caseInfo.name}"
                        ,"caseCate":"${caseInfo.caseCategory.name}"
                        ,"startDate":"<fmt:formatDate value="${caseInfo.startDate}" pattern="yyyy-MM-dd"/>"
                        ,"area":"${caseInfo.area.name}"
                        ,"company":"${caseInfo.companyName}"
						,"office":"${caseInfo.officeName}"
                        ,"createBy":"${caseInfo.createBy.name}"
                        ,"auditBy":<c:choose><c:when test="${caseInfo.status == 1 or caseInfo.status == 2}">"未审核"</c:when><c:otherwise>"${caseInfo.updateBy.name}"</c:otherwise></c:choose>
                        ,"caseType":"${fns:getDictLabel(caseInfo.shareStatus, 'share_status', '')}"
                    }
                    </c:forEach>
                    </c:if>
                ]
                // ,even: true
                // ,height: 315
            });
        })

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