//专业应用--借调单
shr.defineClass("shr.affair.hrman.LoanBizBillHrManEditEx", shr.affair.hrman.LoanBizBillHrManEdit, {
	
	initalizeDOM : function () {
		var _self = this;
		shr.affair.hrman.LoanBizBillHrManEditEx.superClass.initalizeDOM.call(this);			
	},
	
	applierF7ChangeEvent:function(){
		var self = this;
		if (self.getOperateState() != 'VIEW') {
			$("#entrys_person").shrPromptBox("option",{
				verifyBeforeOpenCallback: function(event){
					var $hrOrgUnit = self.getField("hrOrgUnit");
					var hrOrgUnitF7Value = $hrOrgUnit.shrPromptBox("getValue");
					if(!hrOrgUnitF7Value || hrOrgUnitF7Value.id == ""){
						shr.showError({
							message:jsBizMultLan.emp_shrAffairBillBaseHrManEdit_i18n_10
						});
						return false;
					}
				}
			});
			
			$("#entrys_person").shrPromptBox("option", {
				onchange : function(e, value) {
					if(value.current){
						var personF7Id = value.current.id;
						if(personF7Id==null){
							return;						
						}
						shr.callService({
							serviceName : "getPersonPosOrgInfo",
							param :{
								personID: personF7Id,
								uiClass : self._uiClass
							},
							async : true,
							success : function (data) {
								if ( data&&data.length>0 ) {
									self._currentPersonOrgInfo = data[0];
									self.updateActionF7ByPerson(data);//该方法中的，actionF7.setValue的时候就会触发hrBizDefineF7ChangeEvent，初始化变动类型F7,变动原因F7,用工关系F7
									//调用父类更新单据字段方法
									self.updateCommonAffairBizBillData(data);
									// 调用子类方法更新员工相关字段，子类可能重写了
									self.initShrAffairBizBillData(data);
									//员工状态检查,必须等待hrBizDefineF7ChangeEvent事件完成,hrBizDefineF7ChangeEvent中更新了变动操作的范围和设置了self._currentHRBizdefine
									self.checkHrBizDefineInEmployeeType(self._currentHRBizdefine);
									//根据所选员工反写人事业务组织
									self.initHrOrgUnitF7ByPerson(data);
									//调用osf关联查询出字段显示在单据上
                                    self.initDataFromStructure(personF7Id);

                                    var positionId = $("#entrys_oldPosition_el").val();
									shr.callHandler({
										handler : "com.kingdee.shr.affair.web.handler.hrman.FluctuationBizBillHrManEditHandlerEx",
										action : 'getEmpOrgRelation',
										async : false,
										type : "POST",
										param : {
												"personId" : personF7Id,
												"positionId" : positionId
												},
										success:function(data){
											//【调动前直属上级】
											$("#entrys_lmanager").shrPromptBox("setValue", {id:data.leaderId,name:data.leaderName});
											
											//【员工类别】 
											$("#entrys_wcategory").shrPromptBox("setValue", {id:data.personTypeId,name:data.personTypeName});
																						
											//【Academic Title】
											$("#entrys_academictitle").shrPromptBox("setValue", {id:data.academicId,name:data.academicName});
											
											//【Admin Title】
											self.getField("entrys_admintitle").shrTextField('setValue',data.admint);
											
											//【当前时薪】
											self.getField("entrys_hwage").shrTextField('setValue',data.hourlywage);
											
											//【Job2】
											self.getField("entrys_jobs").shrPromptBox('setValue',{id:data.jobTwoId,name:data.jobTwoName});
										},
										error: function (response) {
											shr.showWarning({message:"根据员工获取变动信息失败"});
										}
									});
								}
							}
						})
						self.callChildBillDefinedOsf(personF7Id);
					}
				}
			});
		}
	}

});