mode_userinfoAction.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. $deptdata = false;
  32. if($this->loadci==1 && $this->post('showdept')=='1'){
  33. $drows = m('dept')->getall('1=1','`id`,`name`,`pid`');
  34. $deptdata = $this->depttreeshu($drows, '0', '0');
  35. }
  36. return array(
  37. 'statearr' => $this->flow->statearrs,
  38. 'isadd' => false,
  39. 'deptdata' => $deptdata,
  40. );
  41. }
  42. //组织结构活动得到树形数据
  43. private function depttreeshu($rows, $pid, $fids)
  44. {
  45. $barr = array();
  46. foreach($rows as $k=>$rs){
  47. if($rs['pid']==$pid){
  48. $rs['children'] = $this->depttreeshu($rows, $rs['id'], $fids);
  49. $rs['expanded'] = $pid==$fids;
  50. $barr[] = $rs;
  51. }
  52. }
  53. return $barr;
  54. }
  55. //人员状态切换保存后处理
  56. public function userstateafter($table, $cans, $id)
  57. {
  58. $optlx = $this->post('optlx');
  59. $quitdt = $cans['quitdt'];
  60. $state = array($cans,'state');
  61. $workdate = $cans['workdate'];
  62. $uarr = array();
  63. if($optlx!='my'){
  64. $uarr['workdate'] = $workdate;
  65. $uarr['quitdt'] = $quitdt;
  66. if(!isempt($quitdt) || $state=='5')$uarr['status']='0';//离职状态
  67. }
  68. if(isset($cans['tel']))$uarr['tel'] = $cans['tel'];
  69. if(isset($cans['mobile']))$uarr['mobile'] = $cans['mobile'];
  70. if(isset($cans['sex']))$uarr['sex'] = $cans['sex'];
  71. if($id==1){
  72. unset($uarr['status']);
  73. unset($uarr['quitdt']);
  74. }
  75. if($uarr){
  76. m('admin')->update($uarr, $id);
  77. c('cache')->del('deptuserjson');
  78. }
  79. }
  80. //获取打开记录
  81. public function gethetongAjax()
  82. {
  83. $guid = (int)$this->get('guid','0');
  84. $ind = (int)$this->get('ind','0');
  85. $bh = 'userract';
  86. $zd = 'uid';
  87. if($ind==4){
  88. $bh = 'reward';
  89. $zd = 'objectid';
  90. }
  91. if($ind==5){
  92. $bh = 'hrpositive';
  93. }
  94. if($ind==6){
  95. $bh = 'hrredund';
  96. }
  97. if($ind==7){
  98. $bh = 'hrtrsalary';
  99. }
  100. if($ind==8){
  101. $bh = 'hrtransfer';
  102. $zd = 'tranuid';
  103. }
  104. $flow = m('flow')->initflow($bh);
  105. $cont = $flow->getrowstable('all','and {asqom}`'.$zd.'`='.$guid.'');
  106. return $cont;
  107. }
  108. }
粤ICP备19079148号