resignBizBillHrManEditEx.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /**
  2. * 离职申请:专业用户
  3. */
  4. shr.defineClass("shr.affair.hrman.ResignBizBillHrManEditEx", shr.affair.hrman.ResignBizBillHrManEdit, {
  5. initalizeDOM: function () {
  6. shr.affair.hrman.ResignBizBillHrManEditEx.superClass.initalizeDOM.call(this);
  7. var self = this;
  8. self.quittempEvent();
  9. self.beforeFilterFields();
  10. self.setRequiredquittemp();
  11. self.setRequiredSocialElec();
  12. self.setLabCont();
  13. },
  14. /**
  15. * 点击前过滤字段
  16. */
  17. beforeFilterFields: function () {
  18. var quittemp_el = $('#entrys_quittemp');
  19. if (quittemp_el.length > 0) {
  20. quittemp_el.shrPromptBox("setFilter", "BaseInfo.name like '%离职证明%'");
  21. }
  22. var socialtemp = $('#entrys_socialtemp');
  23. if (socialtemp.length > 0) {
  24. socialtemp.shrPromptBox("setFilter", "BaseInfo.name like '%社保%'");
  25. }
  26. },
  27. setRequiredquittemp: function () {
  28. var self = this;
  29. var entrys_quitElec = $("#entrys_quitElec");
  30. if (entrys_quitElec.shrCheckbox('isSelected')) {
  31. $('#entrys_quittemp').shrPromptBox("enable");
  32. $('#entrys_quittemp').shrPromptBox('option', 'required', true);
  33. } else {
  34. $('#entrys_quittemp').shrPromptBox("disable");
  35. }
  36. },
  37. setRequiredSocialElec: function () {
  38. var entrys_socialElec = $("#entrys_socialElec");
  39. if (entrys_socialElec.shrCheckbox('isSelected')) {
  40. $('#entrys_socialtemp').shrPromptBox("enable");
  41. $('#entrys_socialtemp').shrPromptBox('option', 'required', true);
  42. } else {
  43. $('#entrys_socialtemp').shrPromptBox("disable");
  44. }
  45. },
  46. setLabCont: function () {
  47. var entrys_quitElec = $("#entrys_quitElec");
  48. var entrys_socialElec = $("#entrys_socialElec");
  49. if (entrys_socialElec.shrCheckbox('isSelected')
  50. || entrys_quitElec.shrCheckbox('isSelected')) {
  51. $('#entrys_labContractFirstParty').shrPromptBox("enable");
  52. $('#entrys_labContractFirstParty').shrPromptBox('option', 'required', true);
  53. } else {
  54. $('#entrys_labContractFirstParty').shrPromptBox("disable");
  55. }
  56. },
  57. /**
  58. * 值改变事件
  59. */
  60. quittempEvent: function () {
  61. var self = this;
  62. var entrys_quitElec = $("#entrys_quitElec");
  63. var entrys_socialElec = $("#entrys_socialElec");
  64. if (entrys_quitElec) {
  65. entrys_quitElec.change(function (val, e) {
  66. self.setRequiredquittemp();
  67. self.checkContractSubject();
  68. });
  69. }
  70. if (entrys_socialElec) {
  71. entrys_socialElec.change(function () {
  72. self.setRequiredSocialElec();
  73. self.checkContractSubject();
  74. });
  75. }
  76. if (this.getOperateState() == "EDIT") {
  77. self.fiveinsurances()
  78. }
  79. // .社保公积金缴纳情况 若“社保公积金缴纳情况”为“是”时,则社保/公积金减员日期、社保扣款、社保相关其他费用说明为必填项。反之,则无需填写。
  80. var entrys_fiveinsurances = $("#entrys_fiveinsurances");
  81. if (entrys_fiveinsurances) {
  82. entrys_fiveinsurances.change(function () {
  83. console.log($("#entrys_fiveinsurances").val());
  84. self.fiveinsurances()
  85. });
  86. }
  87. },
  88. fiveinsurances(){
  89. var fiveinsurances = $("#entrys_fiveinsurances").val()
  90. if (fiveinsurances == "是") {
  91. //社保扣款
  92. $("#entrys_deduction").attr('style', 'background-color:#daeef8');
  93. $("#entrys_deduction").attr('validate', "{required:true,maxlength:128}");
  94. //于____年__月 日前办理社会保险/公积金减员
  95. $("#entrys_suspensionDate").attr('style', 'background-color:#daeef8');
  96. $("#entrys_suspensionDate").attr('validate', "{required:true,maxlength:128}");
  97. // 社保相关其他费用说明
  98. $("#entrys_otherSocialInfo").attr('style', 'background-color:#daeef8');
  99. $("#entrys_otherSocialInfo").attr('validate', "{required:true,maxlength:128}");
  100. } else {
  101. $("#entrys_deduction").attr('style', 'padding-right: 0px;');
  102. $("#entrys_deduction").attr('validate', "{maxlength:128}");
  103. $("#entrys_suspensionDate").attr('style', 'padding-right: 0px;');
  104. $("#entrys_suspensionDate").attr('validate', "{maxlength:128}");
  105. $("#entrys_otherSocialInfo").attr('style', 'padding-right: 0px;');
  106. $("#entrys_otherSocialInfo").attr('validate', "{maxlength:128}");
  107. }
  108. }
  109. ,
  110. /**
  111. * 判断两个选择框是否有其中一个被选中
  112. * 如果选中则合同主体必填
  113. */
  114. checkContractSubject: function () {
  115. var entrys_quitElec = $("#entrys_quitElec");
  116. var entrys_socialElec = $("#entrys_socialElec");
  117. if (entrys_quitElec.length > 0 && entrys_socialElec.length > 0) {
  118. if (entrys_quitElec.shrCheckbox('isSelected') || entrys_socialElec.shrCheckbox('isSelected')) {
  119. $('#entrys_labContractFirstParty').shrPromptBox('option', 'required', true);
  120. } else {
  121. $('#entrys_labContractFirstParty').shrPromptBox('option', 'required', false);
  122. }
  123. }
  124. },
  125. });