DpyhDepartRoleAction.class.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. class DpyhDepartRoleAction extends CommonAction {
  3. const tableName = 'dpyh_depart_role';
  4. const pkName = 'ID';
  5. function sys_addedit( ){
  6. $form = new \Jms\Gui\ClForm();
  7. $form->display($this);
  8. }
  9. function sys_list( ){
  10. $list = new \Jms\Gui\ClGrid();
  11. $list->sql_sort = 'OrderNum asc';
  12. $list->sql_filter = function($search,&$cond){
  13. //$cond['ID'] = array('not in',array(\Zndp\User\RoleEnum::SUPER_ADMINISTRATOR,\Zndp\User\RoleEnum::GENERAL_ADMINISTRATOR));
  14. };
  15. $list->row_filter = function(&$row)use($list){
  16. $level_arr = array('总公司','工作站','服务部','种植基地');
  17. $row['Level_text'] = $level_arr[$row['Level']];
  18. $row['IsLocked_text'] = $row['IsLocked'] ? '禁用' : '启用';
  19. $row['IsAllowAdmin_text'] = $row['IsAllowAdmin'] ? '有': '无';
  20. $options = array('rule'=>array('pattern'=>'number'));
  21. $row['OrderNum'] = $list->renderXEditableInput('排序',$row,'OrderNum',$options);
  22. };
  23. $list->display($this);
  24. }
  25. public function sys_del( ){
  26. // 检查是否有该角色账号
  27. $id = I('get.id');
  28. $cond = array('RoleId'=>$id);
  29. $count = M('uc_user')->where($cond)->count();
  30. if($count > 0){
  31. json_fail('有'.$count.'个该角色账号正在使用,无法删除');
  32. }
  33. $grid = new \Jiaruan\GridData();
  34. $grid->deleteByPk($this);
  35. }
  36. }