<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>项目明细一览表</title>
	<meta name="decorator" content="default"/>
	<%--<script src="${ctxStatic}/layer-v2.3/laydate/laydate.js"></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'
            });
        });

        function reset() {
            $("#searchForm").resetForm();
        }

        function openDialog(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,
                maxmin: true, //开启最大化最小化按钮
                content: url,
                skin: 'three-btns',
                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
                    }

                },*/
                btn1: 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(1) ){
                        // top.layer.close(index);//关闭对话框。
                        setTimeout(function(){top.layer.close(index)}, 100);//延时0.1秒，对应360 7.1版本bug
                    }
                },
                btn2: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(2) ){
                        // top.layer.close(index);//关闭对话框。
                        // setTimeout(function(){top.layer.close(index)}, 100);//延时0.1秒，对应360 7.1版本bug
                    }
                    return false;
                },
                btn3: function (index) {
                }
            });
        }

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

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

            }
            var split = buttons.split(",");
            top.layer.open({
                type: 2,
                area: [width, height],
                title: title,
                maxmin: true, //开启最大化最小化按钮
                skin: 'three-btns',
                content: url,
                btn: split,
                btn1: 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(1) ){
                        // top.layer.close(index);//关闭对话框。
                        setTimeout(function(){top.layer.close(index)}, 100);//延时0.1秒，对应360 7.1版本bug
                    }
                },
                btn2:function(index,layero){
                    if(split.length==2){return}
                    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(2) ){
                        // top.layer.close(index);//关闭对话框。
                        // setTimeout(function(){top.layer.close(index)}, 100);//延时0.1秒，对应360 7.1版本bug
                    }
                    return false;
                },
                btn3: function (index) {
                }
            });
        }
	</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="projectRecords" action="${ctx}/ruralProject/ruralProjectRecords/detailList" 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 lw6">
                        <div class="layui-item query athird">
                            <label class="layui-form-label">创建日期：</label>
                            <div class="layui-input-block">
                                <input id="beginDate" name="beginDate" placeholder="开始时间" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
                                       value="<fmt:formatDate value="${projectRecords.beginDate}" pattern="yyyy-MM-dd"/>"/>
                                </input>
                                <span class="group-sep">-</span>
                                <input id="endDate" name="endDate" placeholder="结束时间" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
                                       value="<fmt:formatDate value="${projectRecords.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">
                                <form:input path="projectName" htmlEscape="false" maxlength="64"  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="reset()">重置</button>
								<button id="searchQuery" class="fixed-btn searchQuery fr" onclick="search()">查询</button>
							</div>
						</div>
						<div style="    clear:both;"></div>
					</div>
					<div id="moresees" class="lw6" style="clear:both;display:none;">
						<div class="layui-item query athird">
							<label class="layui-form-label">项目负责人：</label>
							<div class="layui-input-block">
								<form:input path="leaderNameStr" 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">
								<form:input path="workContractInfo.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">
								<form:input path="workContractInfo.contractNum" htmlEscape="false" maxlength="255"  class=" form-control layui-input"/>
							</div>
						</div>
						<div class="layui-item query athird">
							<label class="layui-form-label double-line">合同金额(元)：</label>
							<div class="layui-input-block">
								<form:input path="workContractInfo.contractPrice" 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">
								<form:input path="workContractInfo.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">
                                <form:select path="workContractInfo.contractType" cssClass="form-control required simple-select">
                                    <form:option value="" label=""/>
                                    <form:options items="${fns:getMainDictList('contract_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
                                </form:select>
                                <style>
                                    #contractType{
                                        height:40px;
                                        line-height: 40px;
                                        -moz-box-sizing: border-box;
                                        -webkit-box-sizing: border-box;
                                        box-sizing: border-box;
                                    }
                                </style>
                            </div>
                        </div>
                        <div class="layui-item query athird">
                            <label class="layui-form-label">规模类型：</label>
                            <div class="layui-input-block">
                                <form:select path="scaleType" class="form-control editable-select layui-input" id="scaleType" value="${scaleType}">
                                    <form:option value=""/>
                                    <form:options items="${fns:getMainDictList('scale_type')}" itemLabel="label" itemValue="label" htmlEscape="false"/>
                                </form:select>
                            </div>
                        </div>
                        <div class="layui-item query athird">
                            <label class="layui-form-label">规模单位：</label>
                            <div class="layui-input-block">
                                <form:select path="scaleUnit" class="form-control editable-select layui-input" id="scaleUnit" value="${scaleUnit}">
                                    <form:option value=""/>
                                    <form:options items="${fns:getMainDictList('scale_unit')}" itemLabel="label" itemValue="label" 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="scaleQuantity" htmlEscape="false"  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="${projectRecords.area.id}" labelName="area.name" labelValue="${projectRecords.area.name}"
                                                title="区域" url="/sys/area/treeData" cssClass="form-control layui-input" allowClear="true" notAllowSelectParent="true"/>
                            </div>
                        </div>
                        <div class="layui-item query athird">
                            <label class="layui-form-label">建设地点：</label>
                            <div class="layui-input-block">
                                <form:input path="projectSite" htmlEscape="false"  class="form-control layui-input"/>
                            </div>
                        </div>
                        <div class="layui-item query athird">
                            <label class="layui-form-label">特殊要求：</label>
                            <div class="layui-input-block">
                                <form:input path="remarks" htmlEscape="false"  class="form-control layui-input"/>
                            </div>
                        </div>
                        <div class="layui-item query athird">
                            <label class="layui-form-label">工程概况：</label>
                            <div class="layui-input-block">
                                <form:input path="projectDesc" htmlEscape="false"  class="form-control layui-input"/>
                            </div>
                        </div>
						<div class="layui-item query athird">
							<label class="layui-form-label">状态：</label>
							<div class="layui-input-block">
								<form:select path="projectStatus" class=" form-control  simple-select">
									<form:option value="" label=""/>
									<form:options items="${fns:getDictList('audit_state')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
								</form:select>
							</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">
					<shiro:hasPermission name="project:projectRecordsDetail:export">
						<table:exportExcel url="${ctx}/ruralProject/ruralProjectRecords/exportDetail"></table:exportExcel><!-- 导出按钮 -->
					</shiro:hasPermission>
					<div style="clear: both;"></div>
				</div>
				<table class="oa-table layui-table" id="contentTable1"></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: '#contentTable1'
            ,page: false
            ,cols: [[
                // {checkbox: true, fixed: true},
                {field:'index',align:'center',fixed: 'left', title: '序号',width:60}
                ,{field:'projId',align:'center',fixed: true, title: '项目编号',width:200,templet:function(d){
                        return "<a class=\"attention-info\" href=\"#\" onclick=\"openDialogView('查看项目', '${ctx}/ruralProject/ruralProjectRecords/view?id=" + d.id + "','95%', '95%')\">" + d.projId + "</a>";
                    }}
                ,{field:'projName',align:'center', title: '项目名称',width:200,templet:function(d){
                        return "<a class=\"attention-info\" href=\"#\" onclick=\"openDialogView('查看项目', '${ctx}/ruralProject/ruralProjectRecords/view?id=" + d.id +"','95%', '95%')\">" + d.projName + "</a>";
                    }}
                ,{field:'contractNumber', align:'center',title: '合同编号',width:200}
                ,{field:'contractName', align:'center',title: '合同名称',width:200}
                ,{field:'contractAmt', align:'center',title: '合同金额(元)',width:100}
                ,{field:'clientName',align:'center', title: '主委托方',width:200}
                ,{field:'contractType',align:'center', title: '工程分类',width:100}
                ,{field:'scaleType',align:'center', title: '规模类型',width:100}
                ,{field:'scaleUnit',align:'center', title: '规模单位',width:100}
                ,{field:'scaleQuantity',align:'center', title: '规模数量',width:100}
                ,{field:'area',align:'center', title: '项目所在地',width:100}
                ,{field:'projectSite',align:'center', title: '建设地点',width:200}
                ,{field:'remark',align:'center', title: '特殊要求',width:200}
                ,{field:'projectDesc',align:'center', title: '工程概况',width:200}
                ,{field:'projMaster', align:'center',title: '项目负责人',width:200}
                ,{field:'projectStatus',align:'center', title: '项目状态',width:100}
                ,{field:'createDate',align:'center', title: '创建日期',width:150}
            ]]
            ,data: [
                <c:if test="${ not empty page.list}">
                <c:forEach items="${page.list}" var="projectRecords" varStatus="index">
                <c:if test="${index.index != 0}">,</c:if>
                {
                    "index":"${index.index+1}"
                    ,"id":"${projectRecords.id}"
                    ,"projId":"${projectRecords.projectId}"
                    ,"projName":"${projectRecords.projectName}"
                    ,"projMaster":"<c:forEach items="${projectRecords.projectLeaders}" var="leader" varStatus="status"><c:choose><c:when test="${status.last}">${leader.name}</c:when><c:otherwise>${leader.name},</c:otherwise></c:choose></c:forEach>"
                    ,"contractName":"${projectRecords.workContractInfo.name}"
                    ,"contractNumber":"${projectRecords.workContractInfo.contractNum}"
                    ,"contractAmt":"<fmt:formatNumber value="${projectRecords.workContractInfo.contractPrice}" pattern="#,##0.00#"/>"
                    ,"contractType":"${projectRecords.workContractInfo.constructionProjectTypeStr}"
                    ,"clientName":"${projectRecords.workContractInfo.client.name}"
                    ,"scaleType":"${projectRecords.scaleType}"
                    ,"scaleUnit":"${projectRecords.scaleUnit}"
                    ,"scaleQuantity":"${projectRecords.scaleQuantity}"
                    ,"area":"${projectRecords.area.name}"
                    ,"projectSite":"${projectRecords.projectSite}"
                    ,"remark":"${projectRecords.remarks}"
                    ,"projectDesc":"${projectRecords.projectDesc}"
                    ,"projectStatus":"${fns:getDictLabel(projectRecords.projectStatus, 'audit_state', '')}"
                    ,"createDate":"<fmt:formatDate value="${projectRecords.createDate}" pattern="yyyy-MM-dd"/>"
                }
                </c:forEach>
                </c:if>
            ]
            // ,even: true
            // ,height: 315
        });

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