<%@ 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">
        function doSubmit(obj){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
            if(validateForm.form()){
                if(obj == 1){
                    $('#flag').val('yes');
                }else{
                    $('#flag').val('no');
                }
                $("#inputForm").submit();
                return true;
            }

            return false;
        }
        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 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="workChangeJob" action="${ctx}/workchangejob/workChangeJob/saveAudit" method="post" class="form-horizontal" >
			<form:hidden path="id"/>
			<form:hidden  path="changer"/>
			<form:hidden path="home"/>
			<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"/>
			<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="userName" readonly="true" path="userName" 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 workChangeJob.state}">${fns:getDictLabel(workChangeJob.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" name="changeDate" readonly="true" type="text"  maxlength="20" class="laydate-icondate form-control layer-date  layui-input laydate-icon"
							   value="<fmt:formatDate value="${workChangeJob.changeDate}" pattern="yyyy-MM-dd"/>"/>
					</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="workChangeJobUserList">
						<c:if test="${not empty workChangeJob.workChangeJobUserList}">
							<c:forEach items="${workChangeJob.workChangeJobUserList}" var="workChangeJobUser" varStatus="index">
								<tr id="workChangeJobUserList${index.index}">
									<td class="hide">
										<input id="workChangeJobUserList${index.index}_id" name="workChangeJobUserList[${index.index}].id" type="hidden" value="${workChangeJobUser.id}"/>
										<input id="workChangeJobUserList${index.index}_basicInfoId" name="workChangeJobUserList[${index.index}].basicInfoId" type="hidden" value="${workChangeJobUser.basicInfoId}"/>
										<input id="workChangeJobUserList${index.index}_userId" name="workChangeJobUserList[${index.index}].userId" type="hidden" value="${workChangeJobUser.userId}"/>
										<input id="workChangeJobUserList${index.index}_before" name="workChangeJobUserList[${index.index}].before" type="hidden" value="${workChangeJobUser.before}"/>
										<input id="workChangeJobUserList${index.index}_after"  name="workChangeJobUserList[${index.index}].after" type="hidden" value="${workChangeJobUser.after}"/>
										<input id="workChangeJobUserList${index.index}_delFlag" name="workChangeJobUserList[${index.index}].delFlag" type="hidden" value="0"/>
									</td>
									<td>
										<input id="workChangeJobUserList${index.index}_1"  readonly="true"   type="text" value="${workChangeJobUser.workStaffBasicInfo.no}"   class="form-control "/>
									</td>
									<td>
										<input id="workChangeJobUserList${index.index}_2"  readonly="true"   type="text" value="${workChangeJobUser.workStaffBasicInfo.name}"   class="form-control "/>
									</td>
									<td>
										<input id="workChangeJobUserList${index.index}_3"  readonly="true"    type="text" value="${workChangeJobUser.workStaffBasicInfo.office.name}"   class="form-control "/>
									</td>
									<td>
										<input id="workChangeJobUserList${index.index}_4"  readonly="true"    type="text" value="${workChangeJobUser.workStaffBasicInfo.idCard}"   class="form-control "/>
									</td>
									<td>
										<input id="workChangeJobUserList${index.index}_5"  readonly="true"    type="text" value="${workChangeJobUser.workStaffBasicInfo.status}"  class="form-control "/>
									</td>
									<td>
										<input id="workChangeJobUserList${index.index}_6"  readonly="true"    type="text" value="${workChangeJobUser.beforeName}"   class="form-control "/>
									</td>
									<td>
										<input id="workChangeJobUserList${index.index}_afterName"  readonly="true"    type="text" value="${workChangeJobUser.afterName}"  class="form-control "/>
									</td>
								</tr>
							</c:forEach>
						</c:if>
						</tbody>
					</table>
				</div>
			</div>
			<div class="form-group layui-row">
				<div class="form-group-label"><h2>审批意见</h2></div>
				<div class="layui-item layui-col-xs12 with-textarea" >
					<label class="layui-form-label">审批意见：</label>
					<div class="layui-input-block">
						<form:textarea path="act.comment" class="form-control" rows="4" maxlength="127" />
					</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" >
					<act:flowChart procInsId="${workChangeJob.act.procInsId}"/>
					<act:histoicFlow procInsId="${workChangeJob.act.procInsId}"/>
				</div>
			</div>
			<div class="form-group layui-row page-end"></div>
		</form:form>
	</div>
</div>
</body>
</html>