<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>绩效自评</title>
	<meta name="decorator" content="default"/>
	<style type="text/css">
		.btn-file{
			margin-top:8px;
		}
	</style>
	<script src="${ctxStatic}/layer-v2.3/laydate/laydate.js"></script>
	<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){
                    var len = $("#showPeo span").length;
                    if(len<=0){
                        parent.layer.msg("请选择审批人!",{icon:5});
                        return false;
                    }
					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);
					}
				}
			});
		});
        function selectPeople(objId,objName){
            var showPeo = $("#showPeo").html();
            var len = $("#showPeo span").length;
            if(len > 4){
                parent.layer.msg("最多添加5个审批人",{icon:5})
                return;
            }
            var arr = [];
            var a = $("#showPeo span").each(function(){
                var dataId = $(this).attr("data-id");
                arr.push(dataId)
            })
            if(arr.indexOf(objId) != -1){
                parent.layer.msg("该审批人已被选择，不能重复选择！！！",{icon:5})
                return ;
            }
            showPeo = showPeo + '<span class="badge badge-success fontSpan" data-id="'+objId+'">'+objName+'&nbsp;&nbsp;&nbsp;' +
                '<i onclick=deletePeo(this) class="fa fa-close"></i><input type="hidden" name=adds['+len+'] value="'+objId+'"></span>';
            $("#showPeo").html(showPeo)
        }
        //删除选择的人员
        function deletePeo(obj){
            $(obj).parent().remove()
        }

	</script>
</head>
<body class="hideScroll">
<div class="wrapper wrapper-content">
<div class="ibox">
	<div class="ibox-title" style="height: 70px;">
		<h5>
			<ul class="nav nav-tabs">
				<li><a href="${ctx}/oaperformance/oaPerformance/list">绩效自评</a></li>
				<li><a href="${ctx}/oaperformance/oaPerformance/oaPerformanceTodoList">待办任务</a></li>
				<li><a href="${ctx}/oaperformance/oaPerformance/oaPerformanceHistoricList">已办任务</a></li>
				<li class="active"><a href="${ctx}/oaperformance/oaPerformance/form">绩效自评申请</a></li>
			</ul>
		</h5>
		<%--<div class="ibox-tools">
			<a class="collapse-link">
				<i class="fa fa-chevron-up"></i>
			</a>
			<a class="dropdown-toggle" data-toggle="dropdown" href="javascript:void(0)">
				<i class="fa fa-wrench"></i>
			</a>

		</div>--%>
	</div>

	<div class="ibox-content">
		<form:form id="inputForm" modelAttribute="oaPerformance" action="${ctx}/oaperformance/oaPerformance/save" method="post" class="form-horizontal">
			<form:hidden path="id"/>
			<sys:message content="${message}"/>
			<div class="control-group">
				<label class="control-label"><font color="red">*</font>上月工作任务：</label>
				<div class="controls">
					<textarea id="lastWork" name="lastWork" maxlength="200" class="form-control required" rows="3" aria-required="true"></textarea>
					<span class="help-inline"></span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><font color="red">*</font>实际完成任务：</label>
				<div class="controls">
					<textarea id="finishWork" name="finishWork" maxlength="200" class="form-control required" rows="3" aria-required="true"></textarea>
					<span class="help-inline"></span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><font color="red">*</font>任务达成率：</label>
				<div class="controls">
					<input id="finishRate" name="finishRate" maxlength="20" class="form-control required" rows="3" aria-required="true"></input>
					<span class="help-inline"></span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><font color="red">*</font>上月工作自评：</label>
				<div class="controls">
					<textarea id="lastPerformance" name="lastPerformance" maxlength="200" class="form-control required" rows="3" aria-required="true"></textarea>
					<span class="help-inline"></span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><font color="red">*</font>本月工作任务：</label>
				<div class="controls">
					<textarea id="nowWork" name="nowWork" maxlength="200" class="form-control required" rows="3" aria-required="true"></textarea>
					<span class="help-inline"></span>
				</div>
			</div>

			<div class="control-group">
				<label class="control-label"><font color="red">*</font>本月工作计划：</label>
				<div class="controls">
					<textarea id="nowPlan" name="nowPlan" maxlength="200" class="form-control required" rows="3" aria-required="true"></textarea>
					<span class="help-inline"></span>
				</div>
			</div>

			<div class="control-group">
				<label class="control-label"><font color="red">*</font>抄送人：</label>
				<div id="CCId" class="controls">
					<sys:treeselect id="CCId" name="CCId" value="${leave.CCId}" labelName="idNames" labelValue="${leave.idNames}"
									title="用户" url="/sys/office/treeDataAll?type=3&isAll=false" cssClass="form-control required" notAllowSelectParent="true" checked="true"/>
					<span class="help-inline"></span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"><font color="red">*</font>审批人：</label>
				<div id="addida" class="controls">
					<sys:treeselectleave id="ida" name="ida" value="${leave.ida}" labelName="idNamea" labelValue="${leave.idNamea}"
										 title="用户" url="/sys/office/treeDataAll?type=3&isAll=false" cssClass="form-control" notAllowSelectParent="true"/>
					<span class="help-inline"></span>
				</div>
				<div id="showPeo" class="controls">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">备注信息：</label>
				<div class="controls">
					<td class="width-15 active"></td>
					<td class="width-35">
						<form:textarea path="remarks" htmlEscape="false" rows="4"    class="form-control "/>
					</td>
				</div>
			</div>
			<div class="form-actions">
				<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
				<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
			</div>
		</form:form>
	</div>
</div>
</div>
</body>
</html>