humanResource.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. $(function() {
  2. //工号选择
  3. $('select[node-hrNature]').change(function() {
  4. var nature=$(this).val();
  5. if(nature==1){
  6. $('#regularStaff').show();
  7. $('#internStaff').hide();
  8. }else{
  9. $('#internStaff').show();
  10. $('#regularStaff').hide();
  11. }
  12. });
  13. //审批和抄送的cidKey交互
  14. $('a[node-employeeApprovals]').click(function() {
  15. $("#cidKey").val($(this).attr("node-cidKey"));
  16. });
  17. $('a[node-employeeCC]').click(function() {
  18. $("#CCcidKey").val($(this).attr("node-cidKey"));
  19. });
  20. $("input[id^='verify_']").click(function(){
  21. var uid=$(this).val();
  22. var uname=$(this).attr('data');
  23. var ischeck=$(this).attr('checked');
  24. if(ischeck==undefined){
  25. alert('请清空重新设置审批流程');
  26. return ;
  27. }else{
  28. $(this).attr("disabled","disabled");
  29. }
  30. var chk_value =[];
  31. $('input[name="staff[]"]:checked').each(function(){
  32. chk_value.push($(this).val());
  33. });
  34. if(chk_value.length==1){
  35. $("#AUTDO").html(uname);
  36. $('#uidlist').val(uid);
  37. }else{
  38. var html2=$("#AUTDO").html();
  39. $("#AUTDO").html(html2+'->'+uname);
  40. var uil=$('#uidlist').val();
  41. $('#uidlist').val(uil+','+uid);
  42. }
  43. return ;
  44. });
  45. //设置抄送人员
  46. $("input[node-approvalsStaff]").click(function(){
  47. var didkey=$(this).attr('node-didkey');
  48. var cidkey=$(this).val();
  49. if($(this).is(':checked')) {
  50. if(didkey=='')
  51. $("input[node-cidKey="+cidkey+"]").attr("checked",true);
  52. else
  53. $("input[node-didKey="+cidkey+"_"+didkey+"]").attr("checked",true);
  54. }else{
  55. if(didkey=='')
  56. $("input[node-cidKey="+cidkey+"]").attr("checked",false);
  57. else
  58. $("input[node-didKey="+cidkey+"_"+didkey+"]").attr("checked",false);
  59. }
  60. });
  61. //获得入职审批数据
  62. $("a[node-approvals]").click(function(){
  63. var sidkey=$(this).attr('node-sidKey');
  64. var type='STAFF';
  65. var url = "/ajaxGetStaffInfoByType";
  66. $.ajax({
  67. url : url,
  68. type : "post",
  69. cache : false,
  70. dataType : "json",
  71. data : {
  72. serial : sidkey,
  73. type:type
  74. },
  75. global : true,
  76. success : function(data) {
  77. if (data.status == 1) {
  78. $("#sidKey").val(data.sidKey);
  79. $("#staffDetailNC").html(data.html);
  80. } else
  81. $("div[loading-msg='true']").html("illegal request");
  82. },
  83. error : function(err) {
  84. $("div[loading-msg='true']").html("");
  85. }
  86. });
  87. });
  88. //获得离职审批数据
  89. $("a[node-approvalsRegular]").click(function(){
  90. var sidkey=$(this).attr('node-sidKey');
  91. var type='STAFF';
  92. var url = "/ajaxGetStaffInfoByType";
  93. $.ajax({
  94. url : url,
  95. type : "post",
  96. cache : false,
  97. dataType : "json",
  98. data : {
  99. serial : sidkey,
  100. type:type
  101. },
  102. global : true,
  103. success : function(data) {
  104. if (data.status == 1) {
  105. $("#sidKeyRegular").val(data.sidKey);
  106. $("#staffDetailAD").html(data.html);
  107. } else
  108. $("div[loading-msg='true']").html("illegal request");
  109. },
  110. error : function(err) {
  111. $("div[loading-msg='true']").html("");
  112. }
  113. });
  114. });
  115. //获得离职审批数据
  116. $("a[node-approvalsDimission]").click(function(){
  117. var sidkey=$(this).attr('node-sidKey');
  118. var type='STAFF';
  119. var url = "/ajaxGetStaffInfoByType";
  120. $.ajax({
  121. url : url,
  122. type : "post",
  123. cache : false,
  124. dataType : "json",
  125. data : {
  126. serial : sidkey,
  127. type:type
  128. },
  129. global : true,
  130. success : function(data) {
  131. if (data.status == 1) {
  132. $("#sidKeyDimission").val(data.sidKey);
  133. $("#staffDetailAD").html(data.html);
  134. } else
  135. $("div[loading-msg='true']").html("illegal request");
  136. },
  137. error : function(err) {
  138. $("div[loading-msg='true']").html("");
  139. }
  140. });
  141. });
  142. //获得员工更新数据
  143. $("a[node-employeeInfo]").click(function(){
  144. var sidkey=$(this).attr('node-sidKey');
  145. var type='EMPLOYEE';
  146. var url = "/ajaxGetStaffInfoByType";
  147. $.ajax({
  148. url : url,
  149. type : "post",
  150. cache : false,
  151. dataType : "json",
  152. data : {
  153. serial : sidkey,
  154. type:type
  155. },
  156. global : true,
  157. success : function(data) {
  158. if (data.status == 1) {
  159. $("#sidKeyEmployeeInfo").val(data.sidKey);
  160. $("#EMPLOYEENC").html(data.html);
  161. } else
  162. $("div[loading-msg='true']").html("illegal request");
  163. },
  164. error : function(err) {
  165. $("div[loading-msg='true']").html("");
  166. }
  167. });
  168. });
  169. //转职为试用
  170. $("a[node-Transfer]").click(function(){
  171. var sidkey=$(this).attr('node-sidKey');
  172. var url = "/ajaxGetStaffInfoBySid";
  173. $.ajax({
  174. url : url,
  175. type : "post",
  176. cache : false,
  177. dataType : "json",
  178. data : {
  179. serial : sidkey
  180. },
  181. global : true,
  182. success : function(data) {
  183. if (data.status == 1) {
  184. $("#sidKeyTRIAL").val(data.detail.sidKey);
  185. $("#transferJobNumber").html(data.detail.jobNumber);
  186. $("#transferUsername").html(data.detail.username);
  187. var cateDepart=data.detail.category;
  188. if(data.detail.department)
  189. cateDepart+=data.detail.department.departmentName;
  190. $("#transferCategory").html(cateDepart);
  191. $("#transferPosition").html(data.detail.position);
  192. $("#transferHiredate").html(data.detail.hiredate);
  193. $("#transferHiredate2").html(' 已入职 '+data.detail.workforce+' 天');
  194. } else
  195. $("div[loading-msg='true']").html("illegal request");
  196. },
  197. error : function(err) {
  198. }
  199. });
  200. });
  201. //转职为正式
  202. $("a[node-TransferFORMAL]").click(function(){
  203. var sidkey=$(this).attr('node-sidKey');
  204. var url = "/ajaxGetStaffInfoBySid";
  205. $.ajax({
  206. url : url,
  207. type : "post",
  208. cache : false,
  209. dataType : "json",
  210. data : {
  211. serial : sidkey
  212. },
  213. global : true,
  214. success : function(data) {
  215. if (data.status == 1) {
  216. $("#sidKeyREGULARS").val(data.detail.sidKey);
  217. $("#formalJobNumber").html(data.detail.jobNumber);
  218. $("#formalUsername").html(data.detail.username);
  219. var cateDepart=data.detail.category;
  220. if(data.detail.department)
  221. cateDepart+=data.detail.department.departmentName;
  222. $("#formalCategory").html(cateDepart);
  223. $("#formalPosition").html(data.detail.position);
  224. $("#formalHiredate").html(data.detail.hiredate);
  225. $("#formalHiredate2").html(' 已入职 '+data.detail.workforce+' 天');
  226. $("#formalProbationaryDate").html(data.detail.probationaryDate);
  227. } else
  228. $("div[loading-msg='true']").html("illegal request");
  229. },
  230. error : function(err) {
  231. }
  232. });
  233. });
  234. //转职为离职
  235. $("a[node-TransferDimission]").click(function(){
  236. var sidkey=$(this).attr('node-sidKey');
  237. var url = "/ajaxGetStaffInfoBySid";
  238. $.ajax({
  239. url : url,
  240. type : "post",
  241. cache : false,
  242. dataType : "json",
  243. data : {
  244. serial : sidkey
  245. },
  246. global : true,
  247. success : function(data) {
  248. if (data.status == 1) {
  249. console.log(data);
  250. $("#sidKeyDismiss").val(data.detail.sidKey);
  251. $("#DimissionJobNumber").html(data.detail.jobNumber);
  252. $("#DimissionUsername").html(data.detail.username);
  253. var cateDepart=data.detail.category;
  254. if(data.detail.departmentID!=0)
  255. cateDepart+="/"+data.detail.department.departmentName;
  256. $("#DimissionCategory").html(cateDepart);
  257. $("#DimissionPosition").html(data.detail.position);
  258. $("#DimissionHiredate").html(data.detail.hiredate);
  259. $("#DimissionHiredate2").html(' 已入职 '+data.detail.workforce+' 天');
  260. } else
  261. $("div[loading-msg='true']").html("illegal request");
  262. },
  263. error : function(err) {
  264. }
  265. });
  266. });
  267. //在入职
  268. $("a[node-TransferReentry]").click(function(){
  269. var sidkey=$(this).attr('node-sidKey');
  270. var url = "/ajaxGetStaffInfoBySid";
  271. $.ajax({
  272. url : url,
  273. type : "post",
  274. cache : false,
  275. dataType : "json",
  276. data : {
  277. serial : sidkey
  278. },
  279. global : true,
  280. success : function(data) {
  281. if (data.status == 1) {
  282. $("#sidKeyReentry").val(data.detail.sidKey);
  283. $("#ReentryJobNumber").html(data.detail.jobNumber);
  284. $("#ReentryUsername").html(data.detail.username);
  285. var cateDepart=data.detail.category;
  286. if(data.detail.department)
  287. cateDepart+=data.detail.department.departmentName;
  288. $("#ReentryCategory").html(cateDepart);
  289. $("#ReentryPosition").html(data.detail.position);
  290. $("#ReentryHiredate").html(data.detail.hiredate);
  291. $("#ReentryHiredate2").html(' 已离职 '+data.detail.workforceDimission+' 天');
  292. } else
  293. $("div[loading-msg='true']").html("illegal request");
  294. },
  295. error : function(err) {
  296. }
  297. });
  298. });
  299. //员工的筛选
  300. $('select[node-pendStatus]').change(function() {
  301. $('#hrEmployee').submit();
  302. });
  303. $('select[node-nature]').change(function() {
  304. $('#hrEmployee').submit();
  305. });
  306. $('select[node-cid_did]').change(function() {
  307. $('#hrEmployee').submit();
  308. });
  309. //编辑员工CLD访问权限
  310. $('a[employee-access]').click(function() {
  311. var sidkey=$(this).attr('node-sidKey');
  312. $("#sidKeyAccess").val(sidkey);
  313. });
  314. //编辑员工访问客户地区权限
  315. $('a[employee-district]').click(function() {
  316. var sidkey=$(this).attr('node-sidKey');
  317. $("#sidKeyDistrict").val(sidkey);
  318. var url = "/ajaxGetDistrictByLv1";
  319. $.ajax({
  320. url : url,
  321. type : "post",
  322. cache : false,
  323. dataType : "json",
  324. data : {
  325. serial : sidkey
  326. },
  327. global : true,
  328. success : function(data) {
  329. if (data.status == 1) {
  330. $("#StaffDistrictHtml").html(data.html);
  331. } else
  332. $("#StaffDistrictHtml").html("illegal request");
  333. },
  334. error : function(err) {
  335. }
  336. });
  337. });
  338. //跳转到员工权限设置页面
  339. $('input[node-setApproval]').click(function() {
  340. window.location.replace("/hrEmployeeApprovalsSetting");
  341. });
  342. //跳转到员工页面
  343. $('input[node-employeeInfo]').click(function() {
  344. window.location.replace("/hrEmployee");
  345. });
  346. //岗位设置
  347. $("a[node-ediPosition]").click(function(){
  348. var pidkey=$(this).attr('pidKey');
  349. var url = "/ajaxGetPositionByPid";
  350. $.ajax({
  351. url : url,
  352. type : "post",
  353. cache : false,
  354. dataType : "json",
  355. data : {
  356. pidkey : pidkey
  357. },
  358. global : true,
  359. success : function(data) {
  360. if (data.status == 1) {
  361. $("#pidkeyUpdate").val(data.detail.pidKey);
  362. $("#positionNameEdi").val(data.detail.positionName);
  363. $("#positionDescribeEdi").val(data.detail.positionDescribe);
  364. $("#baseWageEdi").val(data.detail.baseWage);
  365. $("#postWageEdi").val(data.detail.postWage);
  366. $("#achievementBonusEdi").val(data.detail.achievementBonus);
  367. } else
  368. $("div[loading-msg='true']").html("illegal request");
  369. },
  370. error : function(err) {
  371. }
  372. });
  373. });
  374. $("a[node-delPosition]").click(function(){
  375. var pidkey=$(this).attr('pidKey');
  376. var url = "/ajaxGetPositionByPid";
  377. $.ajax({
  378. url : url,
  379. type : "post",
  380. cache : false,
  381. dataType : "json",
  382. data : {
  383. pidkey : pidkey
  384. },
  385. global : true,
  386. success : function(data) {
  387. if (data.status == 1) {
  388. $("#pidkeyDel").val(data.detail.pidKey);
  389. $("#delPositionHtml").html("是否删除岗位“"+data.detail.positionName+"“");
  390. } else
  391. $("div[loading-msg='true']").html("illegal request");
  392. },
  393. error : function(err) {
  394. }
  395. });
  396. });
  397. $("a[node-PositionStaff]").click(function(){
  398. var pidkey=$(this).attr('pidKey');
  399. var url = "/ajaxGetStaffByPid";
  400. $.ajax({
  401. url : url,
  402. type : "post",
  403. cache : false,
  404. dataType : "json",
  405. data : {
  406. pidkey : pidkey
  407. },
  408. global : true,
  409. success : function(data) {
  410. if (data.status == 1) {
  411. $("#positionStaffHTMl").html(data.html);
  412. } else
  413. $("#positionStaffHTMl").html("illegal request");
  414. },
  415. error : function(err) {
  416. }
  417. });
  418. });
  419. })
  420. function CLEARTUIL(){
  421. $('input[name="staff[]"]:checked').each(function(){
  422. $(this).removeAttr("disabled");
  423. $(this).attr('checked',false);
  424. });
  425. $("#AUTDO").html('');
  426. $('#uidlist').val('');
  427. }