/** * 离职申请:专业用户 */ shr.defineClass("shr.affair.hrman.ResignBizBillHrManEditEx", shr.affair.hrman.ResignBizBillHrManEdit, { initalizeDOM: function () { shr.affair.hrman.ResignBizBillHrManEditEx.superClass.initalizeDOM.call(this); var self = this; self.quittempEvent(); self.beforeFilterFields(); self.setRequiredquittemp(); self.setRequiredSocialElec(); self.setLabCont(); }, /** * 点击前过滤字段 */ beforeFilterFields: function () { var quittemp_el = $('#entrys_quittemp'); if (quittemp_el.length > 0) { quittemp_el.shrPromptBox("setFilter", "BaseInfo.name like '%离职证明%'"); } var socialtemp = $('#entrys_socialtemp'); if (socialtemp.length > 0) { socialtemp.shrPromptBox("setFilter", "BaseInfo.name like '%社保%'"); } }, setRequiredquittemp: function () { var self = this; var entrys_quitElec = $("#entrys_quitElec"); if (entrys_quitElec.shrCheckbox('isSelected')) { $('#entrys_quittemp').shrPromptBox("enable"); $('#entrys_quittemp').shrPromptBox('option', 'required', true); } else { $('#entrys_quittemp').shrPromptBox("disable"); } }, setRequiredSocialElec: function () { var entrys_socialElec = $("#entrys_socialElec"); if (entrys_socialElec.shrCheckbox('isSelected')) { $('#entrys_socialtemp').shrPromptBox("enable"); $('#entrys_socialtemp').shrPromptBox('option', 'required', true); } else { $('#entrys_socialtemp').shrPromptBox("disable"); } }, setLabCont: function () { var entrys_quitElec = $("#entrys_quitElec"); var entrys_socialElec = $("#entrys_socialElec"); if (entrys_socialElec.shrCheckbox('isSelected') || entrys_quitElec.shrCheckbox('isSelected')) { $('#entrys_labContractFirstParty').shrPromptBox("enable"); $('#entrys_labContractFirstParty').shrPromptBox('option', 'required', true); } else { $('#entrys_labContractFirstParty').shrPromptBox("disable"); } }, /** * 值改变事件 */ quittempEvent: function () { var self = this; var entrys_quitElec = $("#entrys_quitElec"); var entrys_socialElec = $("#entrys_socialElec"); if (entrys_quitElec) { entrys_quitElec.change(function (val, e) { self.setRequiredquittemp(); self.checkContractSubject(); }); } if (entrys_socialElec) { entrys_socialElec.change(function () { self.setRequiredSocialElec(); self.checkContractSubject(); }); } if (this.getOperateState() == "EDIT") { self.fiveinsurances() } // .社保公积金缴纳情况 若“社保公积金缴纳情况”为“是”时,则社保/公积金减员日期、社保扣款、社保相关其他费用说明为必填项。反之,则无需填写。 var entrys_fiveinsurances = $("#entrys_fiveinsurances"); if (entrys_fiveinsurances) { entrys_fiveinsurances.change(function () { console.log($("#entrys_fiveinsurances").val()); self.fiveinsurances() }); } }, fiveinsurances(){ var fiveinsurances = $("#entrys_fiveinsurances").val() if (fiveinsurances == "是") { //社保扣款 $("#entrys_deduction").attr('style', 'background-color:#daeef8'); $("#entrys_deduction").attr('validate', "{required:true,maxlength:128}"); //于____年__月 日前办理社会保险/公积金减员 $("#entrys_suspensionDate").attr('style', 'background-color:#daeef8'); $("#entrys_suspensionDate").attr('validate', "{required:true,maxlength:128}"); // 社保相关其他费用说明 $("#entrys_otherSocialInfo").attr('style', 'background-color:#daeef8'); $("#entrys_otherSocialInfo").attr('validate', "{required:true,maxlength:128}"); } else { $("#entrys_deduction").attr('style', 'padding-right: 0px;'); $("#entrys_deduction").attr('validate', "{maxlength:128}"); $("#entrys_suspensionDate").attr('style', 'padding-right: 0px;'); $("#entrys_suspensionDate").attr('validate', "{maxlength:128}"); $("#entrys_otherSocialInfo").attr('style', 'padding-right: 0px;'); $("#entrys_otherSocialInfo").attr('validate', "{maxlength:128}"); } } , /** * 判断两个选择框是否有其中一个被选中 * 如果选中则合同主体必填 */ checkContractSubject: function () { var entrys_quitElec = $("#entrys_quitElec"); var entrys_socialElec = $("#entrys_socialElec"); if (entrys_quitElec.length > 0 && entrys_socialElec.length > 0) { if (entrys_quitElec.shrCheckbox('isSelected') || entrys_socialElec.shrCheckbox('isSelected')) { $('#entrys_labContractFirstParty').shrPromptBox('option', 'required', true); } else { $('#entrys_labContractFirstParty').shrPromptBox('option', 'required', false); } } }, });