<%@ 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="workContractInfo" action="${url}" method="post" class="form-inline">
					<input type="hidden" name="url" value="${url}"/>
					<input type="hidden" name="fieldLabels" value="${fieldLabels}"/>
					<input type="hidden" name="fieldKeys" value="${fieldKeys}"/>
					<input type="hidden" name="searchLabel" value="${searchLabel}"/>
					<input type="hidden" name="searchKey" value="${searchKey}"/>
					<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 lw7">
						<div class="layui-item query athird">
							<label class="layui-form-label">客户名称：</label>
							<div class="layui-input-block with-icon">
								<form:input path="client.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">
								<form:input path="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>
				</form:form>
			</div>
		</div>

		<div class="full-width fl">
			<div class="contentShadow layui-form contentDetails">

				<table class="oa-table layui-table" id="contentTable">
					<thead>
					<tr>
						<th width="5%"></th>
						<th width="15%">合同编号</th>
						<th width="25%">合同名称</th>
						<th width="15%">客户名称</th>
						<th width="15%">工程分类</th>
						<th width="10%">合同金额(元)</th>
						<th width="15%">签订日期</th>
					</tr>
					</thead>
					<tbody>
					<c:forEach items="${page.list}" var="workContractInfo" varStatus="index">
						<tr id="t${index.index}">
							<td style="text-align:center;"> <input type="checkbox" id="${workContractInfo.id}" class="i-checks"></td>
							<td class="codelabel">${workContractInfo.contractNum}</td>
							<td class="codelabe2">${workContractInfo.name}</td>
							<td class="codelabe3">${workContractInfo.client.name}</td>
							<td class="codelabe4">${fns:getMainDictLabel(workContractInfo.contractType, 'contract_type', '')}</td>
							<td class="codelabe5">${workContractInfo.contractPrice}</td>
							<td class="codelabe6"><fmt:formatDate value="${workContractInfo.contractDate}" pattern="yyyy-MM-dd"/></td>
						</tr>
					</c:forEach>

					</tbody>
				</table>

				<!-- 分页代码 -->
				<table:page page="${page}"></table:page>
				<div style="clear: both;"></div>
			</div>
		</div>
	</div>
</div>
<%--<script>
    layui.use('table', function(){
        layui.table.render({
            limit:${ page.pageSize }
            ,elem: '#contentTable'
            ,page: false
            ,cols: [[
                {field:'id',align:'center',checkbox:true, title: '序号',width:40}
                ,{field:'clientName',align:'center', title: '客户名称',minWidth:200,templet:function(d){
                        var xml = "<a class=\"attention-info\" href=\"javascript:void(0);\" onclick=\"openDialogView('查看客户信息', '${ctx}/workclientinfo/workClientInfo/detail?id=" + d.id + "&wlId=" + d.linkman + "','95%','95%')\">" +
                            "<span title=" + d.clientName + ">" + d.clientName.substr(0,40) + "</span></a>";
                        return xml;
                    }}
                // ,{field:'clientProperty',align:'center', title: '客户性质',width:150}
                // ,{field:'trade',align:'center', title: '所在行业', width:150}
                // ,{field:'area', align:'center',title: '地区',width:200}
                ,{field:'clientType', align:'center',title: '客户类型',minWidth:200,templet:function(d){
                        return "<span title='"+ d.clientType +"'>" + d.clientType + "</span>";
                    }}
                ,{field:'code', align:'center',title: '统一社会信用代码',minWidth:250,templet:function(d){
                        return "<span title='"+ d.code +"'>" + d.code + "</span>";
                    }}
                ,{field:'createDate',align:'center', title: '创建时间', width:85}

            ]]
            ,data: [
                <c:if test="${ not empty page.list}">
                <c:forEach items="${page.list}" var="workClientInfo" varStatus="index">
                <c:if test="${index.index != 0}">,</c:if>
                {
                    "id":"${workClientInfo.id}"
                    ,"linkman":"${workClientInfo.workClientLinkman.id}"
                    ,"clientName":"${workClientInfo.name}"
                    ,"clientProperty":"${fns:getMainDictLabel(workClientInfo.companyType, 'company_type', '')}"
                    ,"trade":"${fns:getDictLabel(workClientInfo.companyIndustry, 'company_industry', '')}"
                    ,"area":"${workClientInfo.area.name}"
                    ,"clientType":"<c:set value="${fn:split(workClientInfo.clientType, ',') }" var="clientTypes" /><c:forEach items="${clientTypes}" var="cType" varStatus="status">${fns:getMainDictLabel(cType, 'client_type', '')}<c:if test="${!status.last}">, </c:if></c:forEach>"
                    ,"code":"${workClientInfo.uscCode}"
                    ,"createDate":"<fmt:formatDate value="${workClientInfo.createDate}" pattern="yyyy-MM-dd"/>"

                }
                </c:forEach>
                </c:if>
            ]
        });
        var table = layui.table;
        var $ = layui.$, active = {
            getCheckData: function(){ //获取选中数据
                var checkStatus = table.checkStatus('id')
                    ,data = checkStatus.data;
                layer.alert(JSON.stringify(data));
            }
        };
    })

    resizeListTable();/*消除由于有竖向滚动条造成table出现横向滚动条*/
</script>--%>
<script>
</script>
<script type="text/javascript">
    $(document).ready(function() {
        //搜索框收放
        $('#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'
            event: 'focus', //响应事件。如果没有传入event，则按照默认的click
            type : 'date'
        });
        laydate.render({
            elem: '#endDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
            event: 'focus', //响应事件。如果没有传入event，则按照默认的click
            type : 'date'
        });
        $('#contentTable thead tr th input.i-checks').on('ifChecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定
            $('#contentTable tbody tr td input.i-checks').iCheck('check');
        });

        $('#contentTable thead tr th input.i-checks').on('ifUnchecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定
            $('#contentTable tbody tr td input.i-checks').iCheck('uncheck');
        });


    });

    function getSelectedItem(){
        var size = $("#contentTable tbody tr td input.i-checks:checked").size();
        if(size == 0 ){
            top.layer.alert('请至少选择一条数据!', {icon: 0, title:'警告'});
            return "-1";
        }
        var arr=new Array();
        $("#contentTable tbody tr td input.i-checks:checked").each(function () {
            var id =  $(this).attr("id");
            var contractNum = $(this).parent().parent().parent().find(".codelabel").html();
            var name = $(this).parent().parent().parent().find(".codelabe2").html();
            var clientName = $(this).parent().parent().parent().find(".codelabe3").html();
            var contractPrice = $(this).parent().parent().parent().find(".codelabe5").html();
            var data = {'id':id,'contractNum':contractNum,'name':name,'clientName':clientName,'contractPrice':contractPrice};
            arr.push(data);
        })
        return arr;
    }
    function page(n,s){
        if(n) $("#pageNo").val(n);
        if(s) $("#pageSize").val(s);
        $("#searchForm").attr("action","${url}");
        $("#searchForm").submit();
        return false;
    }
</script>
</body>
</html>