mode_userinfoAction.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. /**
  3. * 此文件是流程模块【userinfo.人员信息】对应接口文件。
  4. */
  5. class mode_userinfoClassAction extends inputAction{
  6. public function companydata()
  7. {
  8. return m('company')->getselectdata(1);
  9. }
  10. protected function savebefore($table, $arr, $id, $addbo){
  11. $mobile = $arr['mobile'];
  12. $optlx = $this->post('optlx');
  13. if(!c('check')->ismobile($mobile)){
  14. return '手机号格式有误';
  15. }
  16. //if(m('admin')->rows("`mobile`='$mobile' and `id`<>'$id'")>0){
  17. // return '手机号['.$mobile.']已存在';
  18. //}
  19. $notsave = 'name,deptname,ranking,email';//不保存字段
  20. if($id==1)$notsave.=',quitdt';
  21. if($optlx=='my')$notsave.=',state,workdate,syenddt,positivedt,quitdt,companyid'; //个人编辑不保存
  22. return array(
  23. 'notsave' => $notsave
  24. );
  25. }
  26. protected function saveafter($table, $arr, $id, $addbo){
  27. $this->userstateafter($table, $arr, $id);
  28. }
  29. public function storeafter($table, $rows)
  30. {
  31. return array(
  32. 'statearr' => $this->flow->statearrs,
  33. 'isadd' => false
  34. );
  35. }
  36. //人员状态切换保存后处理
  37. public function userstateafter($table, $cans, $id)
  38. {
  39. $optlx = $this->post('optlx');
  40. $quitdt = $cans['quitdt'];
  41. $state = array($cans,'state');
  42. $workdate = $cans['workdate'];
  43. $uarr = array();
  44. if($optlx!='my'){
  45. $uarr['workdate'] = $workdate;
  46. $uarr['quitdt'] = $quitdt;
  47. if(!isempt($quitdt) || $state=='5')$uarr['status']='0';//离职状态
  48. }
  49. if(isset($cans['tel']))$uarr['tel'] = $cans['tel'];
  50. if(isset($cans['mobile']))$uarr['mobile'] = $cans['mobile'];
  51. if($id==1){
  52. unset($uarr['status']);
  53. unset($uarr['quitdt']);
  54. }
  55. if($uarr){
  56. m('admin')->update($uarr, $id);
  57. c('cache')->del('deptuserjson');
  58. }
  59. }
  60. //获取打开记录
  61. public function gethetongAjax()
  62. {
  63. $guid = (int)$this->get('guid','0');
  64. $ind = (int)$this->get('ind','0');
  65. $bh = 'userract';
  66. $zd = 'uid';
  67. if($ind==4){
  68. $bh = 'reward';
  69. $zd = 'objectid';
  70. }
  71. if($ind==5){
  72. $bh = 'hrpositive';
  73. }
  74. if($ind==6){
  75. $bh = 'hrredund';
  76. }
  77. if($ind==7){
  78. $bh = 'hrtrsalary';
  79. }
  80. if($ind==8){
  81. $bh = 'hrtransfer';
  82. $zd = 'tranuid';
  83. }
  84. $flow = m('flow')->initflow($bh);
  85. $cont = $flow->getrowstable('all','and {asqom}`'.$zd.'`='.$guid.'');
  86. return $cont;
  87. }
  88. }
粤ICP备19079148号