<%@ 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()){
              $("#name").val("allocation");
			  $("#inputForm").submit();
			  return true;
		  }
	
		  return false;
		}
        function doSubmit(obj){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
            if(validateForm.form()){
                if(obj == 1) {
                    $("#flag").val("yes");
                }else {
                    $("#flag").val("no");
                }
                $("#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/getProjectInfoo',
                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>
</head>
<body class="hideScroll">
		<form:form id="inputForm" modelAttribute="workEngineeringProject" action="${ctx}/workengineeringproject/workEngineeringProject/saveAudit" method="post" class="form-horizontal">
            <form:hidden path="act.taskId"/>
            <form:hidden path="act.taskName"/>
            <form:hidden path="act.taskDefKey"/>
            <form:hidden path="act.procInsId"/>
            <form:hidden path="act.procDefId"/>
            <form:hidden id="flag" path="act.flag"/>
            <form:hidden path="id"/>
            <form:hidden path="name" />

		<sys:message content="${message}"/>

			<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">主办</br>公司/部门：<font color="red">*</font></label></td>
                           <td class="width-25">
                               <sys:treeselect id="hostOffice" name="hostOffice" value="${workEngineeringProject.hostOffice}" labelName="hostOfficeName" labelValue="${workEngineeringProject.hostOfficeName}"
                                               title="部门" url="/sys/office/treeDataAll?type=2" cssClass="form-control required" allowClear="true" notAllowSelectParent="true"/>
                           </td>
                           <td class="width-15 active"><label class="pull-right">协办</br>公司/部门：</label></td>
                           <td class="width-25">
                               <sys:treeselect id="jointlyOffice" name="jointlyOffice" value="${workEngineeringProject.jointlyOffice}" labelName="jointlyOfficeName" labelValue="${workEngineeringProject.jointlyOfficeName}"
                                               title="部门" url="/sys/office/treeDataAll?type=2" cssClass="form-control" allowClear="true" notAllowSelectParent="true"/>
                           </td>
                       </tr>
                       <tr>
                           <td class="width-20 active" rowspan="3"><label class="pull-right">人员安排:</label></td>
                       </tr>
                       <tr>
                           <td class="width-15 active"><label class="pull-right">主办公司/部门</br>项目负责人：<font color="red">*</font></label></td>
                           <td class="width-25">
                               <sys:treeselect id="hostOfficeMaster" name="hostOfficeMaster" value="${workEngineeringProject.hostOfficeMaster}" labelName="hostOfficeMasterName" labelValue="${workEngineeringProject.hostOfficeMasterName}"
                                               title="负责人" url="/sys/office/treeDataAll?type=3&isAll=false" cssClass="form-control required"  checked="true" notAllowSelectParent="true"/>
                                </td>
                           <td class="width-15 active"><label class="pull-right">协办公司/部门</br>项目负责人：</label></td>
                           <td class="width-25">
                               <sys:treeselect id="jointlyOfficeMaster" name="jointlyOfficeMaster" value="${workEngineeringProject.jointlyOfficeMaster}" labelName="jointlyOfficeMasterName" labelValue="${workEngineeringProject.jointlyOfficeMasterName}"
                                               title="负责人" url="/sys/office/treeDataAll?type=3&isAll=false" cssClass="form-control"  checked="true" notAllowSelectParent="true"/>
                           </td>
                       </tr>
                       <tr>
                           <td class="width-15 active"><label class="pull-right">主办公司/部门</br>项目组成员：</label></td>
                           <td class="width-25">
                               <sys:treeselect id="hostOfficeMember" name="hostOfficeMember" value="${workEngineeringProject.hostOfficeMember}" labelName="hostOfficeMemberNames" labelValue="${workEngineeringProject.hostOfficeMemberNames}"
                                               title="选择成员" url="/sys/office/treeDataAll?type=3&isAll=false" cssClass="form-control" notAllowSelectParent="true" checked="true"/>
                           </td>
                           <td class="width-15 active"><label class="pull-right">协办公司/部门</br>项目组成员：</label></td>
                           <td class="width-25">
                               <sys:treeselect id="jointlyOfficeMember" name="jointlyOfficeMember" value="${workEngineeringProject.jointlyOfficeMember}" labelName="jointlyOfficeMemberNames" labelValue="${workEngineeringProject.jointlyOfficeMemberNames}"
                                               title="选择成员" url="/sys/office/treeDataAll?type=3&isAll=false" cssClass="form-control" checked="true" notAllowSelectParent="true"/>
                           </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">审批意见：</label></td>
                           <td class="width-25" colspan="3">
                               <form:textarea path="act.comment" class="form-control" rows="3" maxlength="20"/>
                           </td>
                       </tr>
                      <%--<tr>
                          <td class="width-20 active" rowspan="3"><label class="pull-right">合同信息:</label></td>
                      </tr>
                      <tr>
                          <td class="width-15 active"><label class="pull-right">合同名称：<font color="red">*</font></label></td>
                          <td class="width-25" colspan="3">
                              <sys:gridselectContract url="${ctx}/workengineeringproject/workEngineeringProject/selectcontractId" id="contractId" type="1,2" name="contractId.id"  value="${workEngineeringProject.contractId.id}"  title="选择合同信息" labelName="contractId.name"
                                                      labelValue="${workEngineeringProject.contractId.name}" cssClass="form-control required" fieldLabels="合同信息id" fieldKeys="name" searchLabel="合同名称" searchKey="name" ></sys:gridselectContract>
                          </td>
                      </tr>
                      <tr>
                          <td class="width-15 active"><label class="pull-right">合同编号：<font color="red">*</font></label></td>
                          <td class="width-25">
                              <form:input path="contractId.contractNum" id="contractNum" htmlEscape="false"  readonly="true"   class="form-control " cssStyle="width: 200px;"/>
                          </td>
                      </tr>
                      <tr>
                          <td class="width-20 active" rowspan="7"><label class="pull-right">项目信息:</label></td>
                      </tr>
                      <tr>
                          <td class="width-15 active"><label class="pull-right">项目名称：<font color="red">*</font></label></td>
                          <td class="width-25" colspan="3">
                              &lt;%&ndash;<sys:gridselectcallproject url="${ctx}/workengineeringproject/workEngineeringProject/selectprojectId" id="projectId" name="projectId.id"  value="${workEngineeringProject.projectId.id}"  title="选择报销项目" labelName="workEngineeringProject.projectId.projectName"
                                                         labelValue="${workEngineeringProject.projectId.projectName}" cssClass="form-control required" fieldLabels="工程" fieldKeys="projectName" searchLabel="工程名称" searchKey="projectName" ></sys:gridselectcallproject>&ndash;%&gt;
                                  <form:input path="projectId.name" id="" htmlEscape="false" readonly="true"  class="form-control required"  cssStyle="width: 200px;"/>
                          </td>
                      </tr>
                      <tr>
                          <td class="width-15 active"><label class="pull-right">项目编号：<font color="red">*</font></label></td>
                          <td class="width-25">
                              <form:input path="projectId.number" id="projectNumber" htmlEscape="false"  readonly="true"   class="form-control "  cssStyle="width: 200px;"/>
                          </td>
                          <td class="width-15 active"><label class="pull-right">业务类型：</label></td>
                          <td class="width-25">
                              <form:select path="businessType" class="form-control ">
                                  <form:option value="" label=""/>
                                  <form:options items="${fns:getMainDictList('business_type')}" itemLabel="label" itemValue="value" htmlEscape="false" cssStyle="width: 200px;"/>
                              </form:select>
                          </td>
                      </tr>
                      <tr>
                          <td class="width-15 active"><label class="pull-right">预送审金额：</label></td>
                          <td class="width-25">
                              <form:input path="preTrialAmount" htmlEscape="false"  readonly="true"  class="form-control  number"/>

                          </td>
                      </tr>
                      <tr>
                          <td class="width-15 active"><label class="pull-right">工作开始时间：<font color="red">*</font></label></td>
                          <td class="width-25">
                              <input id="workStartDate" name="workStartDate" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date "
                                     value="<fmt:formatDate value="${workEngineeringProject.workStartDate}" pattern="yyyy-MM-dd"/>"/>
                          </td>
                          <td class="width-25"> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;至
                          </td>
                          <td class="width-25" colspan="2">
                              <input id="workEndDate" name="workEndDate" type="text" readonly="readonly" disabled="true"  maxlength="20" class="laydate-icondate form-control layer-date "
                                     value="<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">
                              <form:textarea path="emploperRequire" htmlEscape="false" rows="3"  readonly="true"  class="form-control "/>
                          </td>
                      </tr>
                      <tr>
                          <td class="width-15 active"><label class="pull-right">所属公司/部门：</label></td>
                          <td class="width-25">
                              <sys:treeselect id="office" name="office.id" value="${workEngineeringProject.office.id}" disabled="d" labelName="office.name" labelValue="${workEngineeringProject.office.name}"
                                              title="部门" url="/sys/office/treeData?type=2" cssClass="form-control required" allowClear="true" notAllowSelectParent="true"/>

                          </td>
                          <td class="width-15 active"><label class="pull-right">工程所在地：</label></td>
                          <td class="width-25">
                              <sys:treeselect id="area" name="area.id" value="${workEngineeringProject.area.id}" labelName="area.name" labelValue="${workEngineeringProject.area.name}"
                                              title="区域" url="/sys/area/treeData" cssClass="form-control required" allowClear="true" notAllowSelectParent="true"/>
                          </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"> 客户单位：<font color="red">*</font></label></td>
                          <td class="width-25" colspan="3">
                              <form:input path="workClientInfo.name" id="contractName" htmlEscape="false"  readonly="true"  class="form-control "/>
                          </td>
                      </tr>
                      <tr>
                          <td class="width-15 active"><label class="pull-right">联系人姓名：</label></td>
                          <td class="width-25">
                              <form:input path="workClientLinkman.name" id="linkmanName" htmlEscape="false"  readonly="true"  class="form-control " cssStyle="width: 200px;"/>
                          </td>
                          <td class="width-15 active"><label class="pull-right">职务：</label></td>
                          <td class="width-25">
                              <form:input path="workClientLinkman.position" id="linkmanPosition" htmlEscape="false"  readonly="true"  class="form-control " cssStyle="width: 200px;"/>
                          </td>
                      </tr>
                      <tr>
                          <td class="width-15 active"><label class="pull-right"> 联系方式：</label></td>
                          <td class="width-25">
                              <form:input path="workClientLinkman.linkPhone" id="linkmanPhone" htmlEscape="false"  readonly="true"  class="form-control " cssStyle="width: 200px;"/>
                          </td>
                          <td class="width-15 active"><label class="pull-right">E-mail：</label></td>
                          <td class="width-25">
                              <form:input path="workClientLinkman.email" id="linkmanEmail" htmlEscape="false"  readonly="true"  class="form-control " cssStyle="width: 200px;"/>
                          </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">合同名称：<font color="red">*</font></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">合同编号：<font color="red">*</font></label></td>
                                   <td class="width-25">
                                           ${workEngineeringProject.contractId.contractNum}
                                   </td>
                               </c:otherwise>
                           </c:choose>
                       </tr>
                       <tr>
                           <td class="width-20 active" rowspan="7"><label class="pull-right">项目信息:</label></td>
                       </tr>
                       <tr>
                           <td class="width-15 active"><label class="pull-right">项目名称：<font color="red">*</font></label></td>
                           <td class="width-25" colspan="3">
                                   ${workEngineeringProject.projectId.name}
                           </td>
                       </tr>
                       <tr>
                           <td class="width-15 active"><label class="pull-right">项目编号：<font color="red">*</font></label></td>
                           <td class="width-25">
                                   ${workEngineeringProject.projectId.number}
                           </td>
                           <td class="width-15 active"><label class="pull-right">业务类型：</label></td>
                           <td class="width-25">
                                   ${fns:getMainDictLabel(workEngineeringProject.businessType, 'business_type', '')}
                           </td>
                       </tr>
                       <tr>
                           <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">工作开始时间：<font color="red">*</font></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"> 客户单位：<font color="red">*</font></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">
                                   ${workEngineeringProject.workClientLinkman.name}
                           </td>
                           <td class="width-15 active"><label class="pull-right">职务：</label></td>
                           <td class="width-25">
                                   ${workEngineeringProject.workClientLinkman.position}
                           </td>
                       </tr>
                       <tr>
                           <td class="width-15 active"><label class="pull-right"> 联系方式：</label></td>
                           <td class="width-25">
                                   ${workEngineeringProject.workClientLinkman.linkPhone}
                           </td>
                           <td class="width-15 active"><label class="pull-right">E-mail：</label></td>
                           <td class="width-25">
                                   ${workEngineeringProject.workClientLinkman.email}
                           </td>
                       </tr>
                 </tbody>
            </table>
	</form:form>
</body>
</html>