<%@ 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">
		var validateForm;
		function doSubmit(){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $("#inputForm").submit();
			  return true;
		  }
	
		  return false;
		}
		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
            laydate.render({
                elem: '#workStartDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                event: 'focus' //响应事件。如果没有传入event，则按照默认的click
            });
            laydate.render({
                elem: '#workEndDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                event: 'focus' //响应事件。如果没有传入event，则按照默认的click
            });
		});

        function setValue(obj){
            $.ajax({
                type:'post',
                url:'${ctx}/workreimbursement/workReimbursement/getProjectInfo',
                data:{
                    "obj":obj
                },
                success:function(data){
                    var d = JSON.parse(data);
                    $("#projectNumber").val(d.projectNumber);
                }
            })
        }

        function setContractValue(obj){
            $.ajax({
                type:'post',
                url:'${ctx}/workengineeringproject/workEngineeringProject/getContractInfo',
                data:{
                    "obj":obj
                },
                success:function(data){
                    var d = JSON.parse(data);
                    $("#contractNum").val(d.contractNum);
                    $("#contractName").val(d.clientName);
                    $("#linkmanName").val(d.linkmanName);
                    $("#linkmanPhone").val(d.linkmanPhone);
                    $("#linkmanEmail").val(d.linkmanEmail);
                    $("#linkmanPosition").val(d.linkmanPosition);

                }
            })
        }

        function display1(){
            var id =$("#bidCompanyId")[0].defaultValue;
            $.get("${ctx}/workclientinfo/workClientInfo/selectLinkman", { clientId: id},
                function(data,textStatus){
                    data = data.body.list;
                    if(data !=null){
                        for (var i=0; i<data.length; i++){
                            addRow('#workClientLinkmanList', workClientLinkmanRowIdx, workClientLinkmanTpl, data[i]);
                            workClientLinkmanRowIdx = workClientLinkmanRowIdx + 1;
                        }
                    }
                });
        }
	</script>
    <script type="text/javascript">
        $(function () {

            if(${requestScope.linkmanList !=null}){
                var defaultLinkmanName = "";
                $.each(JSON.parse('${requestScope.linkmanList}'),function(n,value){
                    var optionTag = '<option id="linkman_attr_'+n+'" type="text" value='+n+'>'+value.linkmanName+'</option>';
                    $("#linkman_list").append(optionTag);
                    if(n==0){
                        defaultLinkmanName=value.linkmanName;
                    }
                });
                $("#linkman_list option:first").prop("selected","selected").text(defaultLinkmanName);
            }
        });

        /**
         * 查看联系人（需要用到linkManList）
         */
        function selectLinkman(index,target) {
            if(target=='linkman'){
                var manList = JSON.parse('${requestScope.linkmanList}');

                var linkman = manList[index];
                $("#linkmanPosition").val(linkman.linkmanPosition);
                $("#linkmanPhone").val(linkman.linkmanPhone);
                $("#linkmanEmail").val(linkman.linkmanEmail);
            }
        }

    </script>
</head>
<body class="hideScroll">
<div class="tabs-container">
    <div class="nav nav-tabs">
            <ul class="nav nav-tabs">
                <li class="active"><a href="javascript:void(0)">项目基本信息</a></li>
                <li>
                    <c:if test="${workEngineeringProject.isExt ne 1}">
                        <a href="${ctx}/workengineeringproject/workEngineeringProject/getClientContractionInfo?id=${workEngineeringProject.id}">客户合同信息</a>
                    </c:if>
                </li>
            </ul>
    </div>
    <div class="tab-content">
        <div id="tab-1" class="tab-pane active">
                <table class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
                       <tbody>
                           <tr>
                               <td class="width-20 active" rowspan="2"><label class="pull-right">合同信息:</label></td>
                           </tr>
                           <tr>
                               <td class="width-15 active"><label class="pull-right">合同名称：</label></td>
                               <c:choose>
                                   <c:when test="${workEngineeringProject.isExt eq 1}">
                                       <td class="width-25" colspan="3">
                                        ${workEngineeringProject.contractInfoName}
                                       </td>
                                   </c:when>
                                   <c:otherwise>
                                       <td class="width-25">
                                               ${workEngineeringProject.contractId.name}
                                       </td>
                                       <td class="width-15 active"><label class="pull-right">合同编号：</label></td>
                                       <td class="width-25">
                                               ${workEngineeringProject.contractId.contractNum}
                                       </td>
                                   </c:otherwise>
                               </c:choose>

                           </tr>
                           <tr>
                               <td class="width-20 active" rowspan="8"><label class="pull-right">项目信息:</label></td>
                           </tr>
                           <tr>
                               <td class="width-15 active"><label class="pull-right">总项目名称：</label></td>
                               <td class="width-25">
                                   ${workEngineeringProject.totalProjectName}
                               </td>
                               <td class="width-15 active"><label class="pull-right">总项目编号：</label></td>
                               <td class="width-25">
                                   ${workEngineeringProject.totalProjectId}
                               </td>
                           </tr>
                           <tr>
                               <td class="width-15 active"><label class="pull-right">项目名称：</label></td>
                               <td class="width-25">
                                       ${workEngineeringProject.projectId.name}
                               </td>
                               <td class="width-15 active"><label class="pull-right">项目编号：</label></td>
                               <td class="width-25">
                                   ${workEngineeringProject.projectId.number}
                               </td>
                           </tr>
                           <tr>
                               <td class="width-15 active"><label class="pull-right">行业分类：</label></td>
                               <td class="width-35">
                                   ${fns:getDictLabel(workEngineeringProject.psort, 'psort', '')}
                               </td>
                               <td class="width-15 active"><label class="pull-right">详细分类：</label></td>
                               <td class="width-35">
                                   <c:choose>
                                       <c:when test="${workEngineeringProject.psort eq 1}">
                                           ${fns:getDictLabel(workEngineeringProject.ssort, 'ssort1', '')}
                                       </c:when>
                                       <c:when test="${workEngineeringProject.psort eq 2}">
                                           ${fns:getDictLabel(workEngineeringProject.ssort, 'ssort2', '')}
                                       </c:when>
                                       <c:when test="${workEngineeringProject.psort eq 3}">
                                           ${fns:getDictLabel(workEngineeringProject.ssort, 'ssort3', '')}
                                       </c:when>
                                       <c:when test="${workEngineeringProject.psort eq 4}">
                                           ${fns:getDictLabel(workEngineeringProject.ssort, 'ssort4', '')}
                                       </c:when>
                                       <c:when test="${workEngineeringProject.psort eq 5}">
                                           ${fns:getDictLabel(workEngineeringProject.ssort, 'ssort5', '')}
                                       </c:when>
                                       <c:when test="${workEngineeringProject.psort eq 10}">
                                           ${fns:getDictLabel(workEngineeringProject.ssort, 'ssort10', '')}
                                       </c:when>
                                       <c:otherwise>
                                           无
                                       </c:otherwise>
                                   </c:choose>
                               </td>
                           </tr>
                           <tr>

                               <td class="width-15 active"><label class="pull-right">业务类型：</label></td>
                               <td class="width-25">
                                   ${fns:getMainDictLabel(workEngineeringProject.businessType, 'business_type', '')}
                               </td>
                               <td class="width-15 active"><label class="pull-right">预送审金额(元)：</label></td>
                               <td class="width-25">
                                       ${workEngineeringProject.preTrialAmount}
                               </td>
                           </tr>
                           <tr>
                               <td class="width-15 active"><label class="pull-right">工作开始时间：</label></td>
                               <td class="width-25" colspan="3">
                                   <fmt:formatDate value="${workEngineeringProject.workStartDate}" pattern="yyyy-MM-dd"/>
                                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;至&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                   <fmt:formatDate value="${workEngineeringProject.workEndDate}" pattern="yyyy-MM-dd"/>
                               </td>
                           </tr>
                           <tr>
                               <td class="width-15 active"><label class="pull-right">业主要求：</label></td>
                               <td class="width-25" colspan="3">
                                       ${workEngineeringProject.emploperRequire}
                               </td>
                           </tr>
                           <tr>
                               <td class="width-15 active"><label class="pull-right">所属公司/部门：</label></td>
                               <td class="width-25">
                                       ${workEngineeringProject.office.name}
                               </td>
                               <td class="width-15 active"><label class="pull-right">工程所在地：</label></td>
                               <td class="width-25">
                                       ${workEngineeringProject.area.name}
                               </td>
                           </tr>
                           <tr>
                               <td class="width-20 active" rowspan="4"><label class="pull-right">客户信息：</label></td>
                           </tr>
                           <tr>
                               <td class="width-15 active"><label class="pull-right"> 客户单位：</label></td>
                               <td class="width-25" colspan="3">
                                       ${workEngineeringProject.workClientInfo.name}
                               </td>
                           </tr>
                           <tr>
                               <td class="width-15 active"><label class="pull-right">查看联系人：</label></td>
                               <td class="width-25">
                                   <select id="linkman_list" onchange="selectLinkman(this.value,'linkman')" class="linkman_list max-width-200 form-control" />
                               </td>
                               <td class="width-15 active"><label class="pull-right">职务：</label></td>
                               <td class="width-25">
                                   <input value="${workEngineeringProject.workClientInfo.workClientLinkmanList[0].position}" id="linkmanPosition" readonly="true" class="form-control linkman_attr"/>
                               </td>
                           </tr>
                           <tr>
                               <td class="width-15 active"><label class="pull-right"> 联系方式：</label></td>
                               <td class="width-25">
                                   <input value="${workEngineeringProject.workClientInfo.workClientLinkmanList[0].linkPhone}" id="linkmanPhone" readonly="true" class="form-control linkman_attr"/>
                               </td>
                               <td class="width-15 active"><label class="pull-right">E-mail：</label></td>
                               <td class="width-25">
                                   <input value="${workEngineeringProject.workClientInfo.workClientLinkmanList[0].email}" id="linkmanEmail" readonly="true" class="form-control linkman_attr"/>
                               </td>
                           </tr>
                           <tr>
                               <td class="width-20 active" rowspan="2"><label class="pull-right">部门安排:</label></td>
                           </tr>
                           <tr>
                               <td class="width-15 active"><label class="pull-right">主办</br>公司/部门：</label></td>
                               <td class="width-25">
                                       ${workEngineeringProject.hostOfficeName}
                               </td>
                               <td class="width-15 active"><label class="pull-right">协办</br>公司/部门：</label></td>
                               <td class="width-25">
                                       ${workEngineeringProject.jointlyOfficeName}
                               </td>
                           </tr>
                           <tr>
                               <td class="width-20 active" rowspan="5"><label class="pull-right">人员安排:</label></td>
                           </tr>
                           <tr>
                               <td class="width-15 active"><label class="pull-right">主办公司/部门</br>项目负责人：</label></td>
                               <td class="width-25">
                                       ${workEngineeringProject.hostOfficeMasterName}
                               </td>
                               <td class="width-15 active"><label class="pull-right">协办公司/部门</br>项目负责人：</label></td>
                               <td class="width-25">
                                       ${workEngineeringProject.jointlyOfficeMasterName}
                               </td>
                           </tr>
                           <tr>
                               <td class="width-15 active"><label class="pull-right">主办公司/部门</br>项目组成员：</label></td>
                               <td class="width-25" colspan="3">
                                       ${workEngineeringProject.hostOfficeMemberNames}
                               </td>
                           </tr>
                           <tr>
                               <td class="width-15 active"><label class="pull-right">协办公司/部门</br>项目组成员：</label></td>
                               <td class="width-25" colspan="3">
                                       ${workEngineeringProject.jointlyOfficeMemberNames}
                               </td>
                           </tr>
                       </tbody>
                </table>
        </div>
    </div>
</div>
</body>
</html>