正在显示
7 个修改的文件
包含
178 行增加
和
193 行删除
| @@ -55,24 +55,7 @@ class Mechanism extends BaseController | @@ -55,24 +55,7 @@ class Mechanism extends BaseController | ||
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | 57 | ||
| 58 | - /** | ||
| 59 | - * 获取机构列表 | ||
| 60 | - */ | ||
| 61 | 58 | ||
| 62 | - public function getMechanism(){ | ||
| 63 | - $list= Db::table('sos_user_mechanism')->select()->toArray(); | ||
| 64 | - echo json_encode($list); | ||
| 65 | - } | ||
| 66 | - | ||
| 67 | - /** | ||
| 68 | - * 获取机构下部门列表 | ||
| 69 | - */ | ||
| 70 | - | ||
| 71 | - public function getdepartment(Request $request){ | ||
| 72 | - $data = $request->get(); | ||
| 73 | - $list= Db::table('sos_user_department')->where('mechanismId',$data['id'])->select()->toArray(); | ||
| 74 | - echo json_encode($list); | ||
| 75 | - } | ||
| 76 | 59 | ||
| 77 | /** | 60 | /** |
| 78 | * @param Request $request | 61 | * @param Request $request |
| @@ -83,7 +66,18 @@ class Mechanism extends BaseController | @@ -83,7 +66,18 @@ class Mechanism extends BaseController | ||
| 83 | public function mechanism_add(Request $request) | 66 | public function mechanism_add(Request $request) |
| 84 | { | 67 | { |
| 85 | $data = $request->param(); | 68 | $data = $request->param(); |
| 86 | - $data['password']=md5(md5($data['password'])); | 69 | + $row['username']=$data['username']; |
| 70 | + $list= Db::table('sos_user_mechanism')->where($row)->select()->toArray(); | ||
| 71 | + if($list){ | ||
| 72 | + $data=[ | ||
| 73 | + 'code'=>100, | ||
| 74 | + 'msg'=>'登录账号已存在' | ||
| 75 | + ]; | ||
| 76 | + return $data; | ||
| 77 | + } | ||
| 78 | + if(isset($data['password']) && !empty($data['password']) && $data['password']!='******'){ | ||
| 79 | + $data['password']=md5(md5($data['password'])); | ||
| 80 | + } | ||
| 87 | 81 | ||
| 88 | if(isset($data['mechanism_id']) && !empty($data['mechanism_id'])){ | 82 | if(isset($data['mechanism_id']) && !empty($data['mechanism_id'])){ |
| 89 | $data['updateTime']=time(); | 83 | $data['updateTime']=time(); |
| @@ -111,22 +105,6 @@ class Mechanism extends BaseController | @@ -111,22 +105,6 @@ class Mechanism extends BaseController | ||
| 111 | return $data; | 105 | return $data; |
| 112 | } | 106 | } |
| 113 | 107 | ||
| 114 | - /** | ||
| 115 | - * @param Request $request | ||
| 116 | - * @return \think\response\Json | ||
| 117 | - * 自动生成员工编号 | ||
| 118 | - */ | ||
| 119 | - | ||
| 120 | - public function generateNumber(Request $request){ | ||
| 121 | - $data = $request->get(); | ||
| 122 | - $rule_name= Db::table('sos_user_rule')->where('mechanismId',$data['id'])->find(); | ||
| 123 | - $rule_num= Db::table('sos_user_role')->order('id desc')->find(); | ||
| 124 | - | ||
| 125 | - $rule_number['num']=$rule_name['rule'].(substr($rule_num['personalNumber'], 2, 7)+1); | ||
| 126 | - | ||
| 127 | - echo json_encode($rule_number); | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | 108 | ||
| 131 | 109 | ||
| 132 | } | 110 | } |
| @@ -67,8 +67,8 @@ class Role extends BaseController | @@ -67,8 +67,8 @@ class Role extends BaseController | ||
| 67 | $list[$key]['department']=$val['department'] == 0? '男' : $department['departmentName']; | 67 | $list[$key]['department']=$val['department'] == 0? '男' : $department['departmentName']; |
| 68 | $list[$key]['status']=$type[$val['status']]; | 68 | $list[$key]['status']=$type[$val['status']]; |
| 69 | 69 | ||
| 70 | - $list[$key]['entryTime']=date('Y-m-d H:i:s',$val['entryTime']); | ||
| 71 | - $list[$key]['quitTime']=$val['quitTime'] == ''? '' : date('Y-m-d H:i:s',$val['entryTime']); | 70 | + $list[$key]['entryTime']=date('Y-m-d',$val['entryTime']); |
| 71 | + $list[$key]['quitTime']=$val['quitTime'] == ''? '' : date('Y-m-d',$val['entryTime']); | ||
| 72 | 72 | ||
| 73 | } | 73 | } |
| 74 | $result["total"] =$total; | 74 | $result["total"] =$total; |
| @@ -106,14 +106,18 @@ class Role extends BaseController | @@ -106,14 +106,18 @@ class Role extends BaseController | ||
| 106 | { | 106 | { |
| 107 | $data = $request->param(); | 107 | $data = $request->param(); |
| 108 | 108 | ||
| 109 | - | ||
| 110 | if(isset($data['sex']) && $data['sex']=='on'){ | 109 | if(isset($data['sex']) && $data['sex']=='on'){ |
| 111 | $data['sex']=1; | 110 | $data['sex']=1; |
| 112 | }else{ | 111 | }else{ |
| 113 | $data['sex']=2; | 112 | $data['sex']=2; |
| 114 | } | 113 | } |
| 115 | - $data['entryTime']=$data['entryTime'] == ''? '' :strtotime($data['entryTime']); | ||
| 116 | - $data['quitTime']=$data['quitTime'] == ''? '' :strtotime($data['quitTime']); | 114 | + if(isset($data['entryTime']) && !empty($data['entryTime'])){ |
| 115 | + $data['entryTime']=strtotime($data['entryTime']); | ||
| 116 | + } | ||
| 117 | + if(isset($data['quitTime']) && !empty($data['quitTime'])){ | ||
| 118 | + $data['quitTime']=strtotime($data['quitTime']); | ||
| 119 | + } | ||
| 120 | + | ||
| 117 | if(isset($data['user_id']) && !empty($data['user_id'])){ | 121 | if(isset($data['user_id']) && !empty($data['user_id'])){ |
| 118 | $data['updateTime']=time(); | 122 | $data['updateTime']=time(); |
| 119 | $where['id']=$data['user_id']; | 123 | $where['id']=$data['user_id']; |
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | namespace app\web\controller; | 3 | namespace app\web\controller; |
| 4 | 4 | ||
| 5 | use think\Request; | 5 | use think\Request; |
| 6 | +use think\Session; | ||
| 6 | use think\Validate; | 7 | use think\Validate; |
| 7 | use think\Controller as thinkController; | 8 | use think\Controller as thinkController; |
| 8 | use app\common\service\Render as RenderTrait; | 9 | use app\common\service\Render as RenderTrait; |
| @@ -18,9 +19,10 @@ class BaseController extends thinkController | @@ -18,9 +19,10 @@ class BaseController extends thinkController | ||
| 18 | */ | 19 | */ |
| 19 | public function _initialize() | 20 | public function _initialize() |
| 20 | { | 21 | { |
| 21 | - if (!session('user')) { | ||
| 22 | - | ||
| 23 | - // return Request::instance()->isAjax() ? json($this->renderError('您尚未登录系统')) : $this->redirect(url('web/passport/login')); | 22 | + $user = Session::get('name'); |
| 23 | + if($user === ''){ | ||
| 24 | + // if (Session::get('name')) { | ||
| 25 | + return Request::instance()->isAjax() ? json($this->renderError('您尚未登录系统')) : $this->redirect(url('web/index/login')); | ||
| 24 | } | 26 | } |
| 25 | } | 27 | } |
| 26 | 28 | ||
| @@ -33,7 +35,7 @@ class BaseController extends thinkController | @@ -33,7 +35,7 @@ class BaseController extends thinkController | ||
| 33 | $validate = new Validate($rules, $message); | 35 | $validate = new Validate($rules, $message); |
| 34 | 36 | ||
| 35 | if (!$validate->check($data)) { | 37 | if (!$validate->check($data)) { |
| 36 | - return $validate->getError(); | 38 | + return $validate->getError(); |
| 37 | 39 | ||
| 38 | } | 40 | } |
| 39 | 41 |
| @@ -3,9 +3,11 @@ | @@ -3,9 +3,11 @@ | ||
| 3 | namespace app\web\controller; | 3 | namespace app\web\controller; |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | +use think\Db; | ||
| 6 | use think\Request; | 7 | use think\Request; |
| 7 | 8 | ||
| 8 | use think\Cookie; | 9 | use think\Cookie; |
| 10 | +use think\Session; | ||
| 9 | /** | 11 | /** |
| 10 | * 首页 | 12 | * 首页 |
| 11 | * Class Index | 13 | * Class Index |
| @@ -23,16 +25,19 @@ class Index extends Controller | @@ -23,16 +25,19 @@ class Index extends Controller | ||
| 23 | { | 25 | { |
| 24 | $data = $request->param(); | 26 | $data = $request->param(); |
| 25 | 27 | ||
| 26 | - $name="ybao"; | ||
| 27 | - $pwd="ybao888"; | ||
| 28 | - if($name != $data['name']){ | 28 | + $where['username']=$data['name']; |
| 29 | + $list= Db::table('sos_user_admin')->where($where)->find(); | ||
| 30 | + if(empty($list)){ | ||
| 31 | + $list= Db::table('sos_user_mechanism')->where($where)->find(); | ||
| 32 | + } | ||
| 29 | 33 | ||
| 34 | + if(empty($list)){ | ||
| 30 | $data=[ | 35 | $data=[ |
| 31 | 'code'=>100, | 36 | 'code'=>100, |
| 32 | 'msg'=>'用户名错误' | 37 | 'msg'=>'用户名错误' |
| 33 | ]; | 38 | ]; |
| 34 | return json_encode($data); | 39 | return json_encode($data); |
| 35 | - }elseif($pwd != $data['pwd']){ | 40 | + }elseif($list['password'] != md5(md5($data['pwd']))){ |
| 36 | 41 | ||
| 37 | $data=[ | 42 | $data=[ |
| 38 | 'code'=>100, | 43 | 'code'=>100, |
| @@ -40,9 +45,11 @@ class Index extends Controller | @@ -40,9 +45,11 @@ class Index extends Controller | ||
| 40 | ]; | 45 | ]; |
| 41 | return json_encode($data); | 46 | return json_encode($data); |
| 42 | }else{ | 47 | }else{ |
| 43 | - Cookie::set('name',$name); | ||
| 44 | - //session('name', $name); | 48 | + //Cookie::set('name',$name); |
| 49 | + session('name', $list['username']); | ||
| 50 | +// session('id', $list['id']); | ||
| 45 | $data=[ | 51 | $data=[ |
| 52 | + 'data'=>$list['username'], | ||
| 46 | 'code'=>200, | 53 | 'code'=>200, |
| 47 | 'msg'=>'验证成功' | 54 | 'msg'=>'验证成功' |
| 48 | ]; | 55 | ]; |
| @@ -61,7 +68,8 @@ class Index extends Controller | @@ -61,7 +68,8 @@ class Index extends Controller | ||
| 61 | */ | 68 | */ |
| 62 | public function index() | 69 | public function index() |
| 63 | { | 70 | { |
| 64 | - $user=Cookie::get('name'); | 71 | + //$user=Cookie::get('name'); |
| 72 | + $user = Session::get('name'); | ||
| 65 | if(!$user){ | 73 | if(!$user){ |
| 66 | //重定向到指定的URL地址 | 74 | //重定向到指定的URL地址 |
| 67 | $this->error('您未进行登录', 'web/index/login'); exit; | 75 | $this->error('您未进行登录', 'web/index/login'); exit; |
| @@ -73,12 +81,13 @@ class Index extends Controller | @@ -73,12 +81,13 @@ class Index extends Controller | ||
| 73 | 81 | ||
| 74 | public function loginout() | 82 | public function loginout() |
| 75 | { | 83 | { |
| 76 | - Cookie::delete('name'); | 84 | + //Cookie::delete('name'); |
| 85 | + Session::clear(); | ||
| 77 | $this->view->engine->layout(false); | 86 | $this->view->engine->layout(false); |
| 78 | return $this->fetch('login'); | 87 | return $this->fetch('login'); |
| 79 | } | 88 | } |
| 80 | 89 | ||
| 81 | - public function quick_menu() | 90 | + public function quick_menu() |
| 82 | { | 91 | { |
| 83 | $this->view->engine->layout(false); | 92 | $this->view->engine->layout(false); |
| 84 | return $this->fetch('quick_menu'); | 93 | return $this->fetch('quick_menu'); |
| @@ -66,14 +66,14 @@ | @@ -66,14 +66,14 @@ | ||
| 66 | url:'/web/index/tologin', | 66 | url:'/web/index/tologin', |
| 67 | onSubmit: function(){ | 67 | onSubmit: function(){ |
| 68 | console.log($(this)) | 68 | console.log($(this)) |
| 69 | - | ||
| 70 | }, | 69 | }, |
| 71 | success:function(data){ | 70 | success:function(data){ |
| 72 | - | ||
| 73 | var arr = JSON.parse(data); | 71 | var arr = JSON.parse(data); |
| 72 | + | ||
| 74 | if(arr.code == 100){ | 73 | if(arr.code == 100){ |
| 75 | $.messager.alert("提示", arr.msg); | 74 | $.messager.alert("提示", arr.msg); |
| 76 | }else{ | 75 | }else{ |
| 76 | + localStorage.setItem("user",arr.data) | ||
| 77 | $.messager.alert("提示", arr.msg); | 77 | $.messager.alert("提示", arr.msg); |
| 78 | window.location.href="/"; | 78 | window.location.href="/"; |
| 79 | } | 79 | } |
| @@ -61,12 +61,12 @@ | @@ -61,12 +61,12 @@ | ||
| 61 | </div> | 61 | </div> |
| 62 | 62 | ||
| 63 | 63 | ||
| 64 | -<div id="win" class="easyui-dialog" title="提示" style="width: 800px; padding: 10px 20px; height: auto" closed="true" buttons="#dlg-buttons"> | 64 | +<div id="win" class="easyui-dialog" title="提示" style="width: 500px; padding: 10px 20px; height: auto" closed="true" buttons="#dlg-buttons"> |
| 65 | <form id="fm" name="frm" method="post" style="margin-top: 20px; margin-left: 20px;"> | 65 | <form id="fm" name="frm" method="post" style="margin-top: 20px; margin-left: 20px;"> |
| 66 | <table style="padding: 10px 20px;" cellspacing="10"> | 66 | <table style="padding: 10px 20px;" cellspacing="10"> |
| 67 | <tr> | 67 | <tr> |
| 68 | <td>用户名称:</td> | 68 | <td>用户名称:</td> |
| 69 | - <td><input class="easyui-textbox" type="text" name="name" id="name" /></td> | 69 | + <td><input class="easyui-textbox" type="text" name="name" id="name" data-options="required:true,validType:'length[2,5]'"/></td> |
| 70 | <input class="easyui-textbox" id="user_id" name="user_id" type="hidden"> | 70 | <input class="easyui-textbox" id="user_id" name="user_id" type="hidden"> |
| 71 | </tr> | 71 | </tr> |
| 72 | <tr> | 72 | <tr> |
| @@ -75,7 +75,7 @@ | @@ -75,7 +75,7 @@ | ||
| 75 | </tr> | 75 | </tr> |
| 76 | <tr> | 76 | <tr> |
| 77 | <td>电话:</td> | 77 | <td>电话:</td> |
| 78 | - <td><input class="easyui-textbox" type="text" name="phone" id="phone" /></td> | 78 | + <td><input class="easyui-textbox" type="text" name="phone" id="phone" data-options="required:true" validType='phoneNum'"/></td> |
| 79 | </tr> | 79 | </tr> |
| 80 | <tr> | 80 | <tr> |
| 81 | <td>所属机构:</td> | 81 | <td>所属机构:</td> |
| @@ -98,7 +98,7 @@ | @@ -98,7 +98,7 @@ | ||
| 98 | <!-- }--> | 98 | <!-- }--> |
| 99 | <!-- })--> | 99 | <!-- })--> |
| 100 | <!-- }">--> | 100 | <!-- }">--> |
| 101 | - <input id="cc1" name="mechanism" class="easyui-combobox" data-options=" | 101 | + <input id="cc1" name="mechanism" class="easyui-combobox" required="true" data-options=" |
| 102 | valueField: 'id', | 102 | valueField: 'id', |
| 103 | textField: 'mechanismName', | 103 | textField: 'mechanismName', |
| 104 | url: '/products/role/getMechanism', | 104 | url: '/products/role/getMechanism', |
| @@ -133,7 +133,7 @@ | @@ -133,7 +133,7 @@ | ||
| 133 | </tr> | 133 | </tr> |
| 134 | <tr> | 134 | <tr> |
| 135 | <td>所属部门:</td> | 135 | <td>所属部门:</td> |
| 136 | - <td><input id="cc2" class="easyui-combobox" name="department" data-options="valueField:'id',textField:'departmentName'"></td> | 136 | + <td><input id="cc2" class="easyui-combobox" name="department" data-options="valueField:'id',textField:'departmentName'" required="true"></td> |
| 137 | </tr> | 137 | </tr> |
| 138 | <tr> | 138 | <tr> |
| 139 | <td>个人编号:</td> | 139 | <td>个人编号:</td> |
| @@ -143,11 +143,15 @@ | @@ -143,11 +143,15 @@ | ||
| 143 | </td> | 143 | </td> |
| 144 | </tr> | 144 | </tr> |
| 145 | <tr> | 145 | <tr> |
| 146 | + <td>职位名称:</td> | ||
| 147 | + <td><input class="easyui-textbox" type="text" name="job" id="job" data-options="required:true"/></td> | ||
| 148 | + </tr> | ||
| 149 | + <tr> | ||
| 146 | <td>入职时间:</td> | 150 | <td>入职时间:</td> |
| 147 | 151 | ||
| 148 | <!-- <td><input class="easyui-datebox" name="entryTime" id="entryTime" disabled/></td>--> | 152 | <!-- <td><input class="easyui-datebox" name="entryTime" id="entryTime" disabled/></td>--> |
| 149 | 153 | ||
| 150 | - <td><input class="easyui-datebox" name="entryTime" id="entryTime" /></td> | 154 | + <td><input class="easyui-datebox" name="entryTime" id="entryTime" required="true"/></td> |
| 151 | </tr> | 155 | </tr> |
| 152 | <tr> | 156 | <tr> |
| 153 | <td>离职时间:</td> | 157 | <td>离职时间:</td> |
| @@ -155,22 +159,20 @@ | @@ -155,22 +159,20 @@ | ||
| 155 | </tr> | 159 | </tr> |
| 156 | <tr> | 160 | <tr> |
| 157 | <td>当前状态:</td> | 161 | <td>当前状态:</td> |
| 158 | - <td><input class="easyui-combobox" style="width:160px" name="status" id="status" | 162 | + <td><input class="easyui-combobox" style="width:160px" name="status" id="status" |
| 159 | data-options="valueField:'id', | 163 | data-options="valueField:'id', |
| 160 | textField:'text', | 164 | textField:'text', |
| 161 | data: | 165 | data: |
| 162 | - [{ 'id':0, | ||
| 163 | - 'text':'请选择' , | ||
| 164 | - selected:true | ||
| 165 | - },{ 'id':1, | 166 | + [{ 'id':1, |
| 166 | 'text':'试用期' , | 167 | 'text':'试用期' , |
| 168 | + | ||
| 167 | },{ 'id':2, | 169 | },{ 'id':2, |
| 168 | 'text':'正式员工' , | 170 | 'text':'正式员工' , |
| 169 | },{ | 171 | },{ |
| 170 | 'id':3, | 172 | 'id':3, |
| 171 | 'text':'已离职' | 173 | 'text':'已离职' |
| 172 | }] ,panelHeight:'auto' | 174 | }] ,panelHeight:'auto' |
| 173 | - "/></td> | 175 | + " required="true"/></td> |
| 174 | </tr> | 176 | </tr> |
| 175 | 177 | ||
| 176 | <div id="dlg-buttons" style="display: block"> | 178 | <div id="dlg-buttons" style="display: block"> |
| @@ -189,6 +191,26 @@ | @@ -189,6 +191,26 @@ | ||
| 189 | <script type="text/javascript" src="/assets/web/js/src/common_fu.js"></script> | 191 | <script type="text/javascript" src="/assets/web/js/src/common_fu.js"></script> |
| 190 | 192 | ||
| 191 | <script> | 193 | <script> |
| 194 | + $(function(){ | ||
| 195 | + $.extend($.fn.validatebox.defaults.rules, { | ||
| 196 | + phoneNum: { //验证手机号 | ||
| 197 | + validator: function(value, param){ | ||
| 198 | + return /^1[3-8]+\d{9}$/.test(value); | ||
| 199 | + }, | ||
| 200 | + message: '请输入正确的手机号码。' | ||
| 201 | + }, | ||
| 202 | + comboxValidate : { | ||
| 203 | + validator : function(value, param,missingMessage) { | ||
| 204 | + if($('#'+param).combobox('getValue')!='' && $('#'+param).combobox('getValue')!=null){ | ||
| 205 | + return true; | ||
| 206 | + } | ||
| 207 | + return false; | ||
| 208 | + }, | ||
| 209 | + message : "{1}" | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + }); | ||
| 213 | + }) | ||
| 192 | 214 | ||
| 193 | var rule_id=''; | 215 | var rule_id=''; |
| 194 | //下拉框搜索 | 216 | //下拉框搜索 |
| @@ -263,13 +285,13 @@ | @@ -263,13 +285,13 @@ | ||
| 263 | arr.push({ | 285 | arr.push({ |
| 264 | field: 'mechanism', | 286 | field: 'mechanism', |
| 265 | title: '所属机构', | 287 | title: '所属机构', |
| 266 | - width: 200, | 288 | + width: 220, |
| 267 | align: 'center' | 289 | align: 'center' |
| 268 | }); | 290 | }); |
| 269 | arr.push({ | 291 | arr.push({ |
| 270 | field: 'department', | 292 | field: 'department', |
| 271 | title: '所属部门', | 293 | title: '所属部门', |
| 272 | - width: 150, | 294 | + width: 200, |
| 273 | align: 'center' | 295 | align: 'center' |
| 274 | }); | 296 | }); |
| 275 | arr.push({ | 297 | arr.push({ |
| @@ -279,6 +301,12 @@ | @@ -279,6 +301,12 @@ | ||
| 279 | align: 'center' | 301 | align: 'center' |
| 280 | }); | 302 | }); |
| 281 | arr.push({ | 303 | arr.push({ |
| 304 | + field: 'job', | ||
| 305 | + title: '职位名称', | ||
| 306 | + width: 150, | ||
| 307 | + align: 'center' | ||
| 308 | + }); | ||
| 309 | + arr.push({ | ||
| 282 | field: 'status', | 310 | field: 'status', |
| 283 | title: '当前状态', | 311 | title: '当前状态', |
| 284 | width: 150, | 312 | width: 150, |
| @@ -287,13 +315,13 @@ | @@ -287,13 +315,13 @@ | ||
| 287 | arr.push({ | 315 | arr.push({ |
| 288 | field: 'entryTime', | 316 | field: 'entryTime', |
| 289 | title: '入职时间', | 317 | title: '入职时间', |
| 290 | - width: 200, | 318 | + width: 150, |
| 291 | align: 'center' | 319 | align: 'center' |
| 292 | }); | 320 | }); |
| 293 | arr.push({ | 321 | arr.push({ |
| 294 | field: 'quitTime', | 322 | field: 'quitTime', |
| 295 | title: '离职时间', | 323 | title: '离职时间', |
| 296 | - width: 200, | 324 | + width: 150, |
| 297 | align: 'center' | 325 | align: 'center' |
| 298 | }); | 326 | }); |
| 299 | arr.push({ | 327 | arr.push({ |
| @@ -314,7 +342,6 @@ | @@ -314,7 +342,6 @@ | ||
| 314 | //添加 | 342 | //添加 |
| 315 | $('#name_add_but').linkbutton({ | 343 | $('#name_add_but').linkbutton({ |
| 316 | onClick: function () { | 344 | onClick: function () { |
| 317 | - | ||
| 318 | addFile(); | 345 | addFile(); |
| 319 | } | 346 | } |
| 320 | }); | 347 | }); |
| @@ -324,7 +351,7 @@ | @@ -324,7 +351,7 @@ | ||
| 324 | $('#win').form('clear') | 351 | $('#win').form('clear') |
| 325 | $('#win').dialog({ | 352 | $('#win').dialog({ |
| 326 | title: '新增', | 353 | title: '新增', |
| 327 | - width: 800, | 354 | + width: 500, |
| 328 | height: "auto", | 355 | height: "auto", |
| 329 | top:20, | 356 | top:20, |
| 330 | closed: false,//显示对话框 | 357 | closed: false,//显示对话框 |
| @@ -332,55 +359,8 @@ | @@ -332,55 +359,8 @@ | ||
| 332 | modal: true | 359 | modal: true |
| 333 | }); | 360 | }); |
| 334 | } | 361 | } |
| 335 | - // //修改 | ||
| 336 | - // function showUser(row){ | ||
| 337 | - // if(row){ | ||
| 338 | - // // alert(row); | ||
| 339 | - // var id=row; | ||
| 340 | - // var result = { | ||
| 341 | - // id | ||
| 342 | - // } | ||
| 343 | - // $("#win").dialog("open").dialog("setTitle","人员信息修改"); | ||
| 344 | - // | ||
| 345 | - // //ajax请求数据 | ||
| 346 | - // $.ajax({ | ||
| 347 | - // type: "post", | ||
| 348 | - // data: result, | ||
| 349 | - // async: false, | ||
| 350 | - // url: "/products/role/getUsers", | ||
| 351 | - // success: function(data) { | ||
| 352 | - // var arr = JSON.parse(data); | ||
| 353 | - // | ||
| 354 | - // $('#user_id').textbox('setValue',arr.rows[0].id); | ||
| 355 | - // | ||
| 356 | - // $('#username').textbox('setValue',arr.rows[0].username); | ||
| 357 | - // $('#password').textbox('setValue',arr.rows[0].password); | ||
| 358 | - // $('#name').textbox('setValue',arr.rows[0].name); | ||
| 359 | - // $('#personalNumber').textbox('setValue',arr.rows[0].personalNumber); | ||
| 360 | - // // | ||
| 361 | - // if(arr.rows[0].sex == "男") { | ||
| 362 | - // $('#statusId').switchbutton('check'); | ||
| 363 | - // }else { | ||
| 364 | - // $('#statusId').switchbutton('uncheck'); | ||
| 365 | - // } | ||
| 366 | - // $('#phone').textbox('setValue',arr.rows[0].phone); | ||
| 367 | - // $('#entryTime').textbox('setValue',arr.rows[0].entryTime); | ||
| 368 | - // $('#quitTime').textbox('setValue',arr.rows[0].quitTime); | ||
| 369 | - // | ||
| 370 | - // $('#materialname').combobox('setValue', $('#materialname option')[2].value); | ||
| 371 | - // | ||
| 372 | - // | ||
| 373 | - // }, | ||
| 374 | - // error:function(data){ | ||
| 375 | - // console.log(data) | ||
| 376 | - // } | ||
| 377 | - // }); | ||
| 378 | - // } | ||
| 379 | - // } | ||
| 380 | //修改 | 362 | //修改 |
| 381 | function showUser(row){ | 363 | function showUser(row){ |
| 382 | - | ||
| 383 | - | ||
| 384 | if(row){ | 364 | if(row){ |
| 385 | // alert(row); | 365 | // alert(row); |
| 386 | var id=row; | 366 | var id=row; |
| @@ -407,6 +387,7 @@ | @@ -407,6 +387,7 @@ | ||
| 407 | $('#username').textbox('setValue',arr.rows[0].username); | 387 | $('#username').textbox('setValue',arr.rows[0].username); |
| 408 | $('#password').textbox('setValue',arr.rows[0].password); | 388 | $('#password').textbox('setValue',arr.rows[0].password); |
| 409 | $('#name').textbox('setValue',arr.rows[0].name); | 389 | $('#name').textbox('setValue',arr.rows[0].name); |
| 390 | + $('#job').textbox('setValue',arr.rows[0].job); | ||
| 410 | $('#personalNumber').textbox('setValue',arr.rows[0].personalNumber); | 391 | $('#personalNumber').textbox('setValue',arr.rows[0].personalNumber); |
| 411 | $.ajax({ | 392 | $.ajax({ |
| 412 | url:'/products/role/getMechanism', | 393 | url:'/products/role/getMechanism', |
| @@ -458,24 +439,28 @@ | @@ -458,24 +439,28 @@ | ||
| 458 | $('#fm').form('submit', { | 439 | $('#fm').form('submit', { |
| 459 | url:'/products/role/user_add', | 440 | url:'/products/role/user_add', |
| 460 | onSubmit: function(){ | 441 | onSubmit: function(){ |
| 461 | - console.log($(this)) | 442 | + return $(this).form('validate'); |
| 462 | // do some check | 443 | // do some check |
| 463 | // return false to prevent submit; | 444 | // return false to prevent submit; |
| 464 | }, | 445 | }, |
| 465 | success:function(data){ | 446 | success:function(data){ |
| 466 | - console.log(data); | ||
| 467 | var arr = JSON.parse(data); | 447 | var arr = JSON.parse(data); |
| 468 | $.messager.alert("提示", arr.msg); | 448 | $.messager.alert("提示", arr.msg); |
| 469 | - $('#dg').datagrid('reload'); | ||
| 470 | - // console.log(data); | ||
| 471 | - //$.messager.alert('',msg); | ||
| 472 | - //console.log(data); | ||
| 473 | - //alert(data) | 449 | + if(arr.code==200){ |
| 450 | + $('#win').dialog({ | ||
| 451 | + closed: true, // 隱藏列表 | ||
| 452 | + }); | ||
| 453 | + $('#dg').datagrid('reload'); | ||
| 454 | + } | ||
| 455 | + | ||
| 456 | + // // console.log(data); | ||
| 457 | + // //$.messager.alert('',msg); | ||
| 458 | + // //console.log(data); | ||
| 459 | + // //alert(data) | ||
| 460 | + | ||
| 474 | } | 461 | } |
| 475 | }); | 462 | }); |
| 476 | - $('#win').dialog({ | ||
| 477 | - closed: true, // 隱藏列表 | ||
| 478 | - }); | 463 | + |
| 479 | } | 464 | } |
| 480 | 465 | ||
| 481 | 466 |
| @@ -4,19 +4,19 @@ | @@ -4,19 +4,19 @@ | ||
| 4 | <meta charset="UTF-8"> | 4 | <meta charset="UTF-8"> |
| 5 | <title>机构列表</title> | 5 | <title>机构列表</title> |
| 6 | <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/easyui.css" /> | 6 | <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/easyui.css" /> |
| 7 | - <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/menu.css" /> | 7 | + <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/menu.css" /> |
| 8 | <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/icon.css" /> | 8 | <link rel="stylesheet" type="text/css" href="/assets/common/css/themes/icon.css" /> |
| 9 | - <link rel="stylesheet" type="text/css" href="/assets/web/css/jitnry.css" /> | ||
| 10 | - <link rel="stylesheet" type="text/css" href="/assets/web/css/common_car.css" /> | 9 | + <link rel="stylesheet" type="text/css" href="/assets/web/css/jitnry.css" /> |
| 10 | + <link rel="stylesheet" type="text/css" href="/assets/web/css/common_car.css" /> | ||
| 11 | <script type="text/javascript" src="/assets/common/js/jquery.min.1.9.4.js"></script> | 11 | <script type="text/javascript" src="/assets/common/js/jquery.min.1.9.4.js"></script> |
| 12 | - <script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script> | 12 | + <script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script> |
| 13 | <script type="text/javascript" src="/assets/common/js/jquery.cookie.1.4.1.js"></script> | 13 | <script type="text/javascript" src="/assets/common/js/jquery.cookie.1.4.1.js"></script> |
| 14 | - <!-- 插件调用 ---> | ||
| 15 | - <script type="text/javascript" src="/assets/common/js/datagrid-detailview.js"></script> | ||
| 16 | - <script type="text/javascript" src="/assets/common/locale/easyui-lang-zh_CN.js"></script> | ||
| 17 | - <!-- 基础 JS 调用 --> | ||
| 18 | - <script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script> | ||
| 19 | - <script type="text/javascript" src="/assets/web/js/src/allCity.js"></script> | 14 | + <!-- 插件调用 ---> |
| 15 | + <script type="text/javascript" src="/assets/common/js/datagrid-detailview.js"></script> | ||
| 16 | + <script type="text/javascript" src="/assets/common/locale/easyui-lang-zh_CN.js"></script> | ||
| 17 | + <!-- 基础 JS 调用 --> | ||
| 18 | + <script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script> | ||
| 19 | + <script type="text/javascript" src="/assets/web/js/src/allCity.js"></script> | ||
| 20 | <style> | 20 | <style> |
| 21 | #fm>div { | 21 | #fm>div { |
| 22 | width: 100%; | 22 | width: 100%; |
| @@ -30,59 +30,59 @@ | @@ -30,59 +30,59 @@ | ||
| 30 | </style> | 30 | </style> |
| 31 | </head> | 31 | </head> |
| 32 | <body style="margin-bottom: 54px;"> | 32 | <body style="margin-bottom: 54px;"> |
| 33 | - <div class="easyui-layout" data-options="fit:true"> | ||
| 34 | - <div data-options="split:false,region:'west',collapsible:true,footer:'#win_base_org_form_footer'" title="机构列表" id="saveBox" style="width:100%;"> | ||
| 35 | - <div class="easyui-panel" style="width:100%;max-width:100%;padding: 5px 5px"> | ||
| 36 | - <div style="margin-bottom:5px;"> | ||
| 37 | - <a id="name_add_but" href="#" data-options="iconCls:'icon-add'" class="my_but" style="vertical-align: middle;">新增</a> | ||
| 38 | - </div> | 33 | +<div class="easyui-layout" data-options="fit:true"> |
| 34 | + <div data-options="split:false,region:'west',collapsible:true,footer:'#win_base_org_form_footer'" title="机构列表" id="saveBox" style="width:100%;"> | ||
| 35 | + <div class="easyui-panel" style="width:100%;max-width:100%;padding: 5px 5px"> | ||
| 36 | + <div style="margin-bottom:5px;"> | ||
| 37 | + <a id="name_add_but" href="#" data-options="iconCls:'icon-add'" class="my_but" style="vertical-align: middle;">新增</a> | ||
| 39 | </div> | 38 | </div> |
| 40 | - <table id="dg" style="width: 100%; height: 92%" | ||
| 41 | - data-options="rownumbers:true,singleSelect:true,pagination:true,toolbar:'#tb'"> | ||
| 42 | - </table> | ||
| 43 | - | ||
| 44 | - <div id="tb" style="padding:5px;height:auto"> | ||
| 45 | - <div> | ||
| 46 | - 机构名称: <input class="easyui-textbox" type="text" id='names' name='names'> | ||
| 47 | - 起始时间: <input class="easyui-datebox" id='start' name='start' style="width:180px"> | ||
| 48 | - 截止时间: <input class="easyui-datebox" id='end' name='end' style="width:180px"> | ||
| 49 | - <a href="#" class="easyui-linkbutton" id="search_buttn" iconCls="icon-search">搜索</a> | ||
| 50 | -<!-- <a id="derive_btn" href="/products/fu_ji_tong/to_excel" class="easyui-linkbutton" style="height:28px" data-options="iconCls:'icon-undo'">导出</a>--> | ||
| 51 | - </div> | 39 | + </div> |
| 40 | + <table id="dg" style="width: 100%; height: 92%" | ||
| 41 | + data-options="rownumbers:true,singleSelect:true,pagination:true,toolbar:'#tb'"> | ||
| 42 | + </table> | ||
| 43 | + | ||
| 44 | + <div id="tb" style="padding:5px;height:auto"> | ||
| 45 | + <div> | ||
| 46 | + 机构名称: <input class="easyui-textbox" type="text" id='names' name='names'> | ||
| 47 | + 起始时间: <input class="easyui-datebox" id='start' name='start' style="width:180px"> | ||
| 48 | + 截止时间: <input class="easyui-datebox" id='end' name='end' style="width:180px"> | ||
| 49 | + <a href="#" class="easyui-linkbutton" id="search_buttn" iconCls="icon-search">搜索</a> | ||
| 50 | + <!-- <a id="derive_btn" href="/products/fu_ji_tong/to_excel" class="easyui-linkbutton" style="height:28px" data-options="iconCls:'icon-undo'">导出</a>--> | ||
| 52 | </div> | 51 | </div> |
| 53 | </div> | 52 | </div> |
| 54 | - </div> | ||
| 55 | - | ||
| 56 | - | ||
| 57 | - <div id="win" class="easyui-dialog" title="提示" style="width: 500px; padding: 10px 20px; height: auto" closed="true" buttons="#dlg-buttons"> | ||
| 58 | - <form id="fm" name="frm" method="post" style="margin-top: 20px; margin-left: 20px;"> | ||
| 59 | - <table style="padding: 10px 20px;" cellspacing="10"> | ||
| 60 | - <tr> | ||
| 61 | - <td>登录账号:</td> | ||
| 62 | - <td><input class="easyui-textbox" type="text" name="username" id="username" /></td> | ||
| 63 | - <input class="easyui-textbox" id="mechanism_id" name="mechanism_id" type="hidden"> | ||
| 64 | - </tr> | ||
| 65 | - <tr> | ||
| 66 | - <td>登录密码:</td> | ||
| 67 | - <td><input class="easyui-textbox" placeholder="这里输入文字" type="text" name="password" id="password" /></td> | ||
| 68 | - </tr> | ||
| 69 | - <tr> | ||
| 70 | - <td>机构名称:</td> | ||
| 71 | - <td><input class="easyui-textbox" type="text" name="mechanismName" id="mechanismName" /></td> | ||
| 72 | - </tr> | ||
| 73 | - <tr> | ||
| 74 | - <td>编号规则:</td> | ||
| 75 | - <td><input class="easyui-textbox" type="text" name="rule" id="rule" /></td> | ||
| 76 | - </tr> | ||
| 77 | - <div id="dlg-buttons" style="display: block"> | ||
| 78 | - <a id="confirm" href="javascript:void(0)" class="easyui-linkbutton c6" iconcls="icon-ok" onclick="submitForm()" style="width: 90px">提交</a> | ||
| 79 | - <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#win').dialog('close')" style="width: 90px">取消</a> | ||
| 80 | - </div> | ||
| 81 | - | ||
| 82 | - | ||
| 83 | - </table> | ||
| 84 | - </form> | ||
| 85 | </div> | 53 | </div> |
| 54 | +</div> | ||
| 55 | + | ||
| 56 | + | ||
| 57 | +<div id="win" class="easyui-dialog" title="提示" style="width: 500px; padding: 10px 20px; height: auto" closed="true" buttons="#dlg-buttons"> | ||
| 58 | + <form id="fm" name="frm" method="post" style="margin-top: 20px; margin-left: 20px;"> | ||
| 59 | + <table style="padding: 10px 20px;" cellspacing="10"> | ||
| 60 | + <tr> | ||
| 61 | + <td>登录账号:</td> | ||
| 62 | + <td><input class="easyui-textbox" type="text" name="username" id="username" data-options="required:true,validType:'length[3,10]'"/></td> | ||
| 63 | + <input class="easyui-textbox" id="mechanism_id" name="mechanism_id" type="hidden"> | ||
| 64 | + </tr> | ||
| 65 | + <tr> | ||
| 66 | + <td>登录密码:</td> | ||
| 67 | + <td><input class="easyui-textbox" type="text" name="password" id="password" data-options="required:true,validType:'length[5,10]'"/></td> | ||
| 68 | + </tr> | ||
| 69 | + <tr> | ||
| 70 | + <td>机构名称:</td> | ||
| 71 | + <td><input class="easyui-textbox" type="text" name="mechanismName" id="mechanismName" data-options="required:true"/></td> | ||
| 72 | + </tr> | ||
| 73 | + <tr> | ||
| 74 | + <td>编号规则:</td> | ||
| 75 | + <td><input class="easyui-textbox" type="text" name="rule" id="rule" data-options="required:true,validType:'length[0,2]'"/></td> | ||
| 76 | + </tr> | ||
| 77 | + <div id="dlg-buttons" style="display: block"> | ||
| 78 | + <a id="confirm" href="javascript:void(0)" class="easyui-linkbutton c6" iconcls="icon-ok" onclick="submitForm()" style="width: 90px">提交</a> | ||
| 79 | + <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#win').dialog('close')" style="width: 90px">取消</a> | ||
| 80 | + </div> | ||
| 81 | + | ||
| 82 | + | ||
| 83 | + </table> | ||
| 84 | + </form> | ||
| 85 | +</div> | ||
| 86 | 86 | ||
| 87 | 87 | ||
| 88 | </body> | 88 | </body> |
| @@ -188,6 +188,7 @@ | @@ -188,6 +188,7 @@ | ||
| 188 | } | 188 | } |
| 189 | }); | 189 | }); |
| 190 | function addFile(){ | 190 | function addFile(){ |
| 191 | + $('#win').form('clear') | ||
| 191 | $('#win').dialog({ | 192 | $('#win').dialog({ |
| 192 | title: '新增', | 193 | title: '新增', |
| 193 | width: 500, | 194 | width: 500, |
| @@ -200,6 +201,7 @@ | @@ -200,6 +201,7 @@ | ||
| 200 | } | 201 | } |
| 201 | //修改 | 202 | //修改 |
| 202 | function showUser(row){ | 203 | function showUser(row){ |
| 204 | + $('#win').form('clear') | ||
| 203 | if(row){ | 205 | if(row){ |
| 204 | // alert(row); | 206 | // alert(row); |
| 205 | var id=row; | 207 | var id=row; |
| @@ -219,6 +221,7 @@ | @@ -219,6 +221,7 @@ | ||
| 219 | $('#mechanism_id').textbox('setValue',arr.rows[0].id); | 221 | $('#mechanism_id').textbox('setValue',arr.rows[0].id); |
| 220 | 222 | ||
| 221 | $('#username').textbox('setValue',arr.rows[0].username); | 223 | $('#username').textbox('setValue',arr.rows[0].username); |
| 224 | + $('#password').textbox('setValue','******'); | ||
| 222 | 225 | ||
| 223 | $('#mechanismName').textbox('setValue',arr.rows[0].mechanismName); | 226 | $('#mechanismName').textbox('setValue',arr.rows[0].mechanismName); |
| 224 | $('#rule').textbox('setValue',arr.rows[0].rule); | 227 | $('#rule').textbox('setValue',arr.rows[0].rule); |
| @@ -242,19 +245,23 @@ | @@ -242,19 +245,23 @@ | ||
| 242 | // return false to prevent submit; | 245 | // return false to prevent submit; |
| 243 | }, | 246 | }, |
| 244 | success:function(data){ | 247 | success:function(data){ |
| 245 | - console.log(data); | ||
| 246 | var arr = JSON.parse(data); | 248 | var arr = JSON.parse(data); |
| 247 | $.messager.alert("提示", arr.msg); | 249 | $.messager.alert("提示", arr.msg); |
| 248 | - $('#dg').datagrid('reload'); | 250 | + |
| 251 | + if(arr.code==200){ | ||
| 252 | + $('#win').dialog({ | ||
| 253 | + closed: true, // 隱藏列表 | ||
| 254 | + }); | ||
| 255 | + $('#dg').datagrid('reload'); | ||
| 256 | + } | ||
| 257 | + | ||
| 249 | // console.log(data); | 258 | // console.log(data); |
| 250 | //$.messager.alert('',msg); | 259 | //$.messager.alert('',msg); |
| 251 | //console.log(data); | 260 | //console.log(data); |
| 252 | //alert(data) | 261 | //alert(data) |
| 253 | } | 262 | } |
| 254 | }); | 263 | }); |
| 255 | - $('#win').dialog({ | ||
| 256 | - closed: true, // 隱藏列表 | ||
| 257 | - }); | 264 | + |
| 258 | } | 265 | } |
| 259 | 266 | ||
| 260 | 267 |
-
请 注册 或 登录 后发表评论