<%@ 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;
        var count = 0;
        $(document).ready(function() {
            if($("#changeDate").val()==null || $("#changeDate").val()==''){
                $("#changeDate").val(getNowFormatDate());
            }
            validateForm = $("#inputForm").validate({
                submitHandler: function(form){
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                rules:{
                },
                messages:{
                },
                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);
                    }
                }
            });

        });
        function deleteRow(obj,index){
            $(obj).parent().parent().remove();
            str[index] = " ";
            mon[index] = 0;

        }
        function getNowFormatDate() {
            var date = new Date();
            var seperator1 = "-";
            var seperator2 = ":";
            var month = date.getMonth() + 1;
            var strDate = date.getDate();
            month = (month < 10)?"0"+month:month;
            strDate = (strDate < 10)?"0"+strDate:strDate;
            var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;
            return currentdate;
        }

	</script>
	<style>
		/*超过5个汉字，调整label的长度，以下是配套的*/
		.layui-item .layui-form-label{
			width:90px;
		}
		.form-group .layui-item .layui-input-block,
		.query .layui-input-block {
			margin-left: 116px;
		}
	</style>
</head>
<body>
<div class="single-form">
	<div class="container view-form">
		<form:form id="inputForm" modelAttribute="workOfficeChange" action="${ctx}/workofficechange/workOfficeChange/save" method="post" class="form-horizontal" >
			<form:hidden path="id"/>
			<form:hidden  path="changer"/>
			<div class="form-group layui-row first">
				<div class="form-group-label"><h2>基础信息</h2></div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>调入部门：</label>
					<div class="layui-input-block">
						<form:input id="changeOfficeName" readonly="true" path="changeOfficeName" htmlEscape="false" class="form-control   layui-input"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>调转编号：</label>
					<div class="layui-input-block">
						<div class="input-group">
							<form:input path="number" htmlEscape="false"  readonly="true"  class="form-control  layui-input"/>
							<span class="input-group-btn">
                                <label class="form-status"><c:choose><c:when test="${not empty workOfficeChange.state}">${fns:getDictLabel(workOfficeChange.state, 'audit_state', '')}</c:when><c:otherwise>新添</c:otherwise></c:choose></label>
                             </span>
						</div>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>调转日期：</label>
					<div class="layui-input-block">
						<input id="changeDate" readonly="true" name="changeDate" type="text"  maxlength="20" class="laydate-icondate form-control layer-date  layui-input laydate-icon"
							   value="<fmt:formatDate value="${workOfficeChange.changeDate}" pattern="yyyy-MM-dd"/>"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>调转人：</label>
					<div class="layui-input-block">
						<form:input id="userName" readonly="true" path="userName" htmlEscape="false" class="form-control   layui-input"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm12  with-textarea">
					<label class="layui-form-label">调转事由：</label>
					<div class="layui-input-block">
						<form:textarea path="changeFor" readonly="true" htmlEscape="false" rows="4"    maxlength="255" class="form-control "/>
					</div>
				</div>
			</div>

			<div class="form-group layui-row">
				<div class="form-group-label"><h2>调转成员</h2></div>
				<div class="layui-item layui-col-xs12 form-table-container" >
					<table id="contentTable" class="table table-bordered table-condensed can-edit no-bottom-margin">
						<thead>
						<tr>
							<th width="200px">工号</th>
							<th width="200px">姓名</th>
							<th width="150px">部门</th>
							<th width="200px">身份证号</th>
							<th width="200px">员工状态</th>
							<th width="200px">职级</th>
							<th width="200px">新职级</th>
						</tr>
						</thead>
						<tbody id="workOfficeChangeUserList">
						<c:if test="${not empty workOfficeChange.workOfficeChangeUserList}">
							<c:forEach items="${workOfficeChange.workOfficeChangeUserList}" var="workOfficeChangeUser" varStatus="index">
								<tr id="workItemCollarCatalogList${index.index}">
									<td class="hide">
										<input id="workOfficeChangeUserList${index.index}_id" name="workOfficeChangeUserList[${index.index}].id" type="hidden" value="${workOfficeChangeUser.id}"/>
										<input id="workOfficeChangeUserList${index.index}_basicInfoId" name="workOfficeChangeUserList[${index.index}].basicInfoId" type="hidden" value="${workOfficeChangeUser.basicInfoId}"/>
										<input id="workOfficeChangeUserList${index.index}_userId" name="workOfficeChangeUserList[${index.index}].userId" type="hidden" value="${workOfficeChangeUser.userId}"/>
										<input id="workOfficeChangeUserList${index.index}_delFlag" name="workOfficeChangeUserList[${index.index}].delFlag" type="hidden" value="0"/>
									</td>
									<td>
										<input id="workOfficeChangeUserList${index.index}_1"  readonly="true"   type="text" value="${workOfficeChangeUser.workStaffBasicInfo.no}"   class="form-control "/>
									</td>
									<td>
										<input id="workOfficeChangeUserList${index.index}_2"  readonly="true"   type="text" value="${workOfficeChangeUser.workStaffBasicInfo.name}"   class="form-control "/>
									</td>
									<td>
										<input id="workOfficeChangeUserList${index.index}_3"  readonly="true"    type="text" value="${workOfficeChangeUser.oldOfficeName}"   class="form-control "/>
									</td>
									<td>
										<input id="workOfficeChangeUserList${index.index}_4"  readonly="true"    type="text" value="${workOfficeChangeUser.workStaffBasicInfo.idCard}"   class="form-control "/>
									</td>
									<td>
										<input id="workOfficeChangeUserList${index.index}_5"  readonly="true"    type="text" value="${workOfficeChangeUser.workStaffBasicInfo.status}"  class="form-control "/>
									</td>
									<td>
										<input id="workOfficeChangeUserList${index.index}_6"  readonly="true"  name="workOfficeChangeUserList[${index.index}].jobGrade1.name"  type="text" value="${workOfficeChangeUser.jobGrade1.name}"   class="form-control "/>
									</td>
									<td>
										<input id="workOfficeChangeUserList${index.index}_after"  readonly="true"  name="workOfficeChangeUserList[${index.index}].jobGrade2.name"  type="text" value="${workOfficeChangeUser.jobGrade2.name}"   class="form-control "/>
									</td>
								</tr>
							</c:forEach>
						</c:if>
						</tbody>
					</table>
				</div>
			</div>
			<div class="form-group layui-row page-end"></div>
		</form:form>
	</div>
</div>
</body>
</html>