shrEmployeeNotLaborContractEditExt.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. shr.defineClass("shr.empContract.shrEmployeeNotLaborContractEditExt", shr.empContract.shrEmployeeNotLaborContractEdit, {
  2. initalizeDOM : function () {
  3. var _self = this;
  4. shr.empContract.shrEmployeeNotLaborContractEditExt.superClass.initalizeDOM.call(this);
  5. if(this.getOperateState() == 'ADDNEW'){
  6. _self.defaultInitalize();
  7. }
  8. },
  9. /*setInitDate : function(){
  10. var self = this;
  11. //合同签订组织
  12. $("#hrOrgUnit").shrPromptBox("setValue", {id:"00000000-0000-0000-0000-000000000000CCE7AED4", name:"Guangdong Technion Israel Institute of Technology"});
  13. //甲方劳动合同主体
  14. $("#labContractFirstParty").shrPromptBox("setValue", {id:"bHdk2ak5RIyQIAgXzXz/wo6rEMM=", name:"Guangdong Technion Israel Institute of Technology"});
  15. //合同协议
  16. $("#contractTemplet_contractType").shrPromptBox("setValue", {id:"mlcyHoWATgOPmeAQgwbE9AUpjB4=", name:"Agreement"});
  17. var contractType = this.getFieldValue('contractTemplet_contractType');
  18. if(contractType){
  19. $("#contractTemplet").shrPromptBox("setFilter","contractType.id in ('" + contractType + "')");
  20. }
  21. },*/
  22. //页面初始化默认值
  23. defaultInitalize:function(){
  24. var _self = this;
  25. _self.remoteCall({
  26. method: "getDefaultHrOrg",
  27. param: {},
  28. async: false,
  29. success: function(response) {
  30. if(response.hrOrgId){
  31. var responseObejct = {id: response.hrOrgId,name: response.hrOrgName};
  32. $("#hrOrgUnit").shrPromptBox("setValue", responseObejct);
  33. }
  34. },
  35. error : function(){
  36. }
  37. });
  38. _self.remoteCall({
  39. method: "getDefaultContractParty",
  40. param: {},
  41. async: false,
  42. success: function(response) {
  43. if(response.contractPartyId){
  44. var responseObejct = {id: response.contractPartyId,name: response.contractPartyName};
  45. $("#labContractFirstParty").shrPromptBox("setValue", responseObejct);
  46. }
  47. },
  48. error : function(){
  49. }
  50. });
  51. // _self.remoteCall({
  52. // method: "getDefaultContractType",
  53. // param: {},
  54. // async: false,
  55. // success: function(response) {
  56. // if(response.contractTypeId){
  57. // var responseObejct = {id: response.contractTypeId,name: response.contractTypeName};
  58. // $("#contractTemplet_contractType").shrPromptBox("setValue", responseObejct);
  59. // $("#entrys_contractTemplet").shrPromptBox("setFilter","contractType.id = '" + response.contractTypeId + "'");
  60. // }
  61. // },
  62. // error : function(){
  63. // }
  64. // });
  65. },
  66. //标准产品代码覆盖
  67. labContractPartyChangeHandler: function(listenProId, changeProId1, changeProId2) {
  68. var _self = this;
  69. if (_self.getOperateState() != 'VIEW') {
  70. var $labContractFirstParty = _self.getField(listenProId);
  71. $labContractFirstParty.shrPromptBox("option", {
  72. onchange: function(e, value) {
  73. var currentObj = value.current;
  74. var previousObj = value.previous;
  75. if (currentObj && currentObj.id && previousObj && currentObj.id != previousObj.id) {
  76. _self.remoteCall({
  77. method: "getFirstPartyInfoById",
  78. param: {
  79. "id": currentObj.id
  80. },
  81. success: function(data) {
  82. if (data) {
  83. if (data.status == "success") {
  84. if (null != data.delegatePerson_l1 && "" != data.delegatePerson_l1) {
  85. _self.getField(changeProId1).shrMultiLangBox("setValue", data.delegatePerson_l1, 'l1');
  86. }
  87. if (null != data.delegatePerson_l2 && "" != data.delegatePerson_l2) {
  88. _self.getField(changeProId1).shrMultiLangBox("setValue", data.delegatePerson_l2, 'l2');
  89. }
  90. if (null != data.delegatePerson_l3 && "" != data.delegatePerson_l3) {
  91. _self.getField(changeProId1).shrMultiLangBox("setValue", data.delegatePerson_l3, 'l3');
  92. }
  93. if (null != data.toUnitAddress_l1 && "" != data.toUnitAddress_l1) {
  94. _self.getField(changeProId2).shrMultiLangBox("setValue", data.toUnitAddress_l1, 'l1');
  95. }
  96. if (null != data.delegatePerson_l2 && "" != data.delegatePerson_l2) {
  97. _self.getField(changeProId2).shrMultiLangBox("setValue", data.toUnitAddress_l2, 'l2');
  98. }
  99. if (null != data.delegatePerson_l3 && "" != data.delegatePerson_l3) {
  100. _self.getField(changeProId2).shrMultiLangBox("setValue", data.toUnitAddress_l3, 'l3');
  101. }
  102. _self._currentContractFirstParty = {
  103. id: data.id,
  104. name: data.name
  105. };
  106. } else if (data.status == "fail") { //如果缓存的数据已被删掉,则清掉缓存。
  107. _self._currentContractFirstParty = null;
  108. //清除覆盖值
  109. //$labContractFirstParty.shrPromptBox("setValueNoTrigger", null);
  110. }
  111. }
  112. }
  113. });
  114. } else {
  115. _self._currentContractFirstParty = null;
  116. }
  117. }
  118. });
  119. }
  120. }
  121. });