123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- class SysCompManagerAction extends CommonAction {
- const tableName = 'sys_comp_manager';
- const pkName = 'ID';
-
-
- function sys_add( ){
- $form = new \Jms\Gui\ClForm();
- $form->before_display = function(&$data){
- $data['Password'] = '';
- };
- $form->before_add = function(&$data){
- //检查用户名是否重复
- $where = array('UserName'=>$data['UserName']);
- if( M('uc_user')->where($where)->count() > 0 ){
- json_fail('用户名已存在');
- }
- //检查密码格式
- if(strlen($data['Password']) < 4 ){
- json_fail('密码长度必须大于4位');
- }
- //检查手机号是否重复(可通过手机号码登录)
- $where = array('Mobile'=>$data['Mobile']);
- if( $data['Mobile'] !== '' && M('uc_user')->where($where)->count() > 0 ){
- json_fail('手机号码已注册');
- }
- $data['Password'] = \Zndp\User\Util::encPwd( trim($data['Password']) );
- $data['RoleId'] = \Zndp\User\RoleEnum::COMPANY_ADMINISTRATOR; //公司管理员
- };
- $form->before_modify = function(&$data){
-
- };
- $form->form_filter = function(&$form){
- $depart_list = get_depart_option();
- $form['fields']['OrganizationId']['editor'] = array('options'=>$depart_list);
- };
- $form->display($this);
- }
-
-
- function sys_list( ){
- $list = new \Jms\Gui\ClGrid();
- $list->sql_sort = 'OrganizationId asc';
- $list->sql_filter = function($search,&$cond){
- $cond['RoleId'] = \Zndp\User\RoleEnum::COMPANY_ADMINISTRATOR;
- };
- $list->row_filter = function(&$row){
-
- };
- $list->display($this);
- }
-
-
- function sys_edit( ){
- $form = new \Jms\Gui\ClForm();
- $form->before_display = function(&$data){
- $data['Password'] = '';
- };
- $form->before_add = function(&$data){
- //检查用户名是否重复
- $where = array('UserName'=>$data['UserName']);
- if( M('uc_user')->where($where)->count() > 0 ){
- json_fail('用户名已存在');
- }
- //检查密码格式
- if(strlen($data['Password']) < 4 ){
- json_fail('密码长度必须大于4位');
- }
- //检查手机号是否重复(可通过手机号码登录)
- $where = array('Mobile'=>$data['Mobile']);
- if( $data['Mobile'] !== '' && M('uc_user')->where($where)->count() > 0 ){
- json_fail('手机号码已注册');
- }
- $data['Password'] = \Zndp\User\Util::encPwd( trim($data['Password']) );
- $data['RoleId'] = \Zndp\User\RoleEnum::COMPANY_ADMINISTRATOR; //公司管理员
- };
- $form->before_modify = function(&$data){
-
- };
- $form->form_filter = function(&$form){
- $depart_list = get_depart_option();
- $form['fields']['OrganizationId']['editor'] = array('options'=>$depart_list);
- };
- $form->display($this);
- }
-
- }
|