作者 niuyongqing

管理员模块

  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: Administrator
  5 + * Date: 2020/6/24
  6 + * Time: 15:30
  7 + */
  8 +
  9 +namespace app\products\controller;
  10 +use app\web\controller\BaseController;
  11 +
  12 +use think\Db;
  13 +use think\Request;
  14 +
  15 +class Mechanism extends BaseController
  16 +{
  17 + //获取用户列表
  18 + public function getMechanismList(Request $request){
  19 + $data = $request->param();
  20 + $page = isset($_POST['page']) ? intval($_POST['page']) : 1;
  21 + $rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
  22 + $offset=($page-1)*$rows;
  23 + $data['offset']=$offset;
  24 + $data['rows']=$rows;
  25 + $where=[];
  26 + if(!empty($data['id']) && isset($data['id'])){
  27 + $where['id']=$data['id'];
  28 + }
  29 + if (isset($data['start']) && !empty($data['start']) && isset($data['end']) && !empty($data['end'])) {
  30 + $start_time = strtotime($data['start'].' 00:00:01');
  31 + $end_time = strtotime($data['end'].' 23:59:59');
  32 + $where['createTime'] = ['between', [$start_time, $end_time]];
  33 + } else if (isset($data['start']) && !empty($data['start']) && isset($data['end']) == false) {
  34 + $start_time = strtotime($data['start'].' 00:00:01');
  35 + $where['createTime'] = ['egt', $start_time];
  36 + } else if (isset($data['start']) == false && isset($data['end']) && !empty($data['end'])) {
  37 + $end_time = strtotime($data['end'].' 23:59:59');
  38 + $where['createTime'] = ['elt', $end_time];
  39 + }
  40 +
  41 + if(!empty($data['names'])){
  42 + $where['mechanismName']=$data['names'];
  43 + }
  44 + //$org_id = session('organization.org_id');
  45 + $list= Db::table('sos_user_mechanism')->where($where)->limit($offset,$rows)->select()->toArray();
  46 + $total= Db::table('sos_user_mechanism')->where($where)->count();
  47 +
  48 + foreach($list as $key=>$val ){
  49 + $list[$key]['createTime']=$val['createTime'] == ''? '' : date('Y-m-d H:i:s',$val['createTime']);
  50 +
  51 + }
  52 + $result["total"] =$total;
  53 + $result['rows']=$list;
  54 + echo json_encode($result);
  55 + }
  56 +
  57 +
  58 + /**
  59 + * 获取机构列表
  60 + */
  61 +
  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 +
  77 + /**
  78 + * @param Request $request
  79 + * @return array|mixed|null
  80 + * 添加用户
  81 + */
  82 +
  83 + public function mechanism_add(Request $request)
  84 + {
  85 + $data = $request->param();
  86 + $data['password']=md5(md5($data['password']));
  87 +
  88 + if(isset($data['mechanism_id']) && !empty($data['mechanism_id'])){
  89 + $data['updateTime']=time();
  90 + $where['id']=$data['mechanism_id'];
  91 + unset($data['mechanism_id']);
  92 + $res = Db::table('sos_user_mechanism')->where($where)->update($data);
  93 + }else{
  94 + unset($data['mechanism_id']);
  95 + $data['createTime']=time();
  96 +
  97 + $res = Db::table('sos_user_mechanism')->insert($data);
  98 + }
  99 + $json=json_decode($res,true);
  100 + if(is_numeric($json)){
  101 + $data=[
  102 + 'code'=>200,
  103 + 'msg'=>'成功'
  104 + ];
  105 + }else{
  106 + $data=[
  107 + 'code'=>100,
  108 + 'msg'=>'失败'
  109 + ];
  110 + }
  111 + return $data;
  112 + }
  113 +
  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 +
  131 +
  132 +}
@@ -14,20 +14,43 @@ use think\Request; @@ -14,20 +14,43 @@ use think\Request;
14 14
15 class Role extends BaseController 15 class Role extends BaseController
16 { 16 {
17 -  
18 - public function user_management(){  
19 -  
20 - return $this->fetch();  
21 - }  
22 //获取用户列表 17 //获取用户列表
23 public function getUsers(Request $request){ 18 public function getUsers(Request $request){
24 $data = $request->param(); 19 $data = $request->param();
  20 + $page = isset($_POST['page']) ? intval($_POST['page']) : 1;
  21 + $rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
  22 + $offset=($page-1)*$rows;
  23 + $data['offset']=$offset;
  24 + $data['rows']=$rows;
25 $where=[]; 25 $where=[];
26 if(!empty($data['id']) && isset($data['id'])){ 26 if(!empty($data['id']) && isset($data['id'])){
27 $where['id']=$data['id']; 27 $where['id']=$data['id'];
28 } 28 }
  29 +
  30 + if (isset($data['start']) && !empty($data['start']) && isset($data['end']) && !empty($data['end'])) {
  31 + $start_time = strtotime($data['start'].' 00:00:01');
  32 + $end_time = strtotime($data['end'].' 23:59:59');
  33 + $where['entryTime'] = ['between', [$start_time, $end_time]];
  34 + } else if (isset($data['start']) && !empty($data['start']) && isset($data['end']) == false) {
  35 + $start_time = strtotime($data['start'].' 00:00:01');
  36 + $where['entryTime'] = ['egt', $start_time];
  37 + } else if (isset($data['start']) == false && isset($data['end']) && !empty($data['end'])) {
  38 + $end_time = strtotime($data['end'].' 23:59:59');
  39 + $where['entryTime'] = ['elt', $end_time];
  40 + }
  41 + if(!empty($data['xiala'])){
  42 + $where['mechanism']=$data['xiala'];
  43 + }
  44 + if(!empty($data['names'])){
  45 + $where['name']=$data['names'];
  46 + }
  47 + if(!empty($data['tel'])){
  48 + $where['phone']=$data['tel'];
  49 + }
  50 +
29 //$org_id = session('organization.org_id'); 51 //$org_id = session('organization.org_id');
30 - $list= Db::table('sos_user_role')->where($where)->select()->toArray(); 52 + $list= Db::table('sos_user_role')->where($where)->limit($offset,$rows)->select()->toArray();
  53 + $total= Db::table('sos_user_role')->where($where)->count();
31 54
32 $type=['','试用期','正式员工','已离职']; 55 $type=['','试用期','正式员工','已离职'];
33 foreach($list as $key=>$val ){ 56 foreach($list as $key=>$val ){
@@ -48,7 +71,7 @@ class Role extends BaseController @@ -48,7 +71,7 @@ class Role extends BaseController
48 $list[$key]['quitTime']=$val['quitTime'] == ''? '' : date('Y-m-d H:i:s',$val['entryTime']); 71 $list[$key]['quitTime']=$val['quitTime'] == ''? '' : date('Y-m-d H:i:s',$val['entryTime']);
49 72
50 } 73 }
51 - $result["total"] =count($list); 74 + $result["total"] =$total;
52 $result['rows']=$list; 75 $result['rows']=$list;
53 echo json_encode($result); 76 echo json_encode($result);
54 } 77 }
@@ -59,7 +82,6 @@ class Role extends BaseController @@ -59,7 +82,6 @@ class Role extends BaseController
59 */ 82 */
60 83
61 public function getMechanism(){ 84 public function getMechanism(){
62 -  
63 $list= Db::table('sos_user_mechanism')->select()->toArray(); 85 $list= Db::table('sos_user_mechanism')->select()->toArray();
64 echo json_encode($list); 86 echo json_encode($list);
65 } 87 }
@@ -69,7 +91,6 @@ class Role extends BaseController @@ -69,7 +91,6 @@ class Role extends BaseController
69 */ 91 */
70 92
71 public function getdepartment(Request $request){ 93 public function getdepartment(Request $request){
72 -  
73 $data = $request->get(); 94 $data = $request->get();
74 $list= Db::table('sos_user_department')->where('mechanismId',$data['id'])->select()->toArray(); 95 $list= Db::table('sos_user_department')->where('mechanismId',$data['id'])->select()->toArray();
75 echo json_encode($list); 96 echo json_encode($list);
@@ -85,7 +106,7 @@ class Role extends BaseController @@ -85,7 +106,7 @@ class Role extends BaseController
85 { 106 {
86 $data = $request->param(); 107 $data = $request->param();
87 108
88 - $data['password']=md5(md5($data['password'])); 109 +
89 if(isset($data['sex']) && $data['sex']=='on'){ 110 if(isset($data['sex']) && $data['sex']=='on'){
90 $data['sex']=1; 111 $data['sex']=1;
91 }else{ 112 }else{
@@ -127,58 +148,21 @@ class Role extends BaseController @@ -127,58 +148,21 @@ class Role extends BaseController
127 148
128 public function generateNumber(Request $request){ 149 public function generateNumber(Request $request){
129 $data = $request->get(); 150 $data = $request->get();
130 - $rule_name= Db::table('sos_user_rule')->where('mechanismId',$data['id'])->find();  
131 - $rule_num= Db::table('sos_user_role')->order('id desc')->find();  
132 -  
133 - $rule_number['num']=$rule_name['rule'].(substr($rule_num['personalNumber'], 2, 7)+1);  
134 -  
135 - echo json_encode($rule_number);  
136 - }  
137 -  
138 -  
139 -  
140 -  
141 -  
142 -  
143 -  
144 -  
145 -  
146 - //修改用户  
147 - public function edit(Request $request){  
148 - $data = $request->post();  
149 - if($data['id']){  
150 - $data['uid'] = $data['id'];  
151 - }  
152 -  
153 - $validate = new UserValidate();  
154 - $err_msg = $validate->scene("update")->check($data);  
155 -  
156 - if ($err_msg) {  
157 - return json($this->renderError($validate->getError())); 151 + $rule_name= Db::table('sos_user_mechanism')->where('id',$data['id'])->find();
  152 + if(isset($data['rule_id']) && !empty($data['rule_id'])){
  153 + $rule_num= Db::table('sos_user_role')->where('id',$data['rule_id'])->find();
  154 + $rule_number['num']=$rule_name['rule'].(substr($rule_num['personalNumber'], 2, 7));
  155 + }else{
  156 + $rule_num= Db::table('sos_user_role')->order('id desc')->find();
  157 + $rule_number['num']=$rule_name['rule'].(substr($rule_num['personalNumber'], 2, 7)+1);
158 } 158 }
159 159
160 - $res = json_decode(curlPost($this->getUrl('edit'), $data),true);  
161 160
162 - if ($res['code'] == self::SUCCESS_CODE) {  
163 - return json($this->renderSuccess());  
164 - }  
165 161
166 - return json($res);  
167 162
  163 + echo json_encode($rule_number);
168 } 164 }
169 - //删除用户  
170 - public function del(Request $request){  
171 - $data = $request->get();  
172 165
173 - if (empty($data['id']) && $data['id'] !== 0) {  
174 - return json($this->renderError("删除失败!"));  
175 - }  
176 - $res = json_decode(curlPost($this->getUrl("del"),['uid'=>$data['id']]),true);  
177 166
178 - if ($res['code'] != self::SUCCESS_CODE) {  
179 - return json($res);  
180 - }  
181 167
182 - return json($this->renderSuccess());  
183 - }  
184 } 168 }
@@ -14,11 +14,18 @@ use app\web\validate\User as UserValidate; @@ -14,11 +14,18 @@ use app\web\validate\User as UserValidate;
14 */ 14 */
15 class Role extends BaseController 15 class Role extends BaseController
16 { 16 {
17 - //列表 17 + //人员列表
18 public function index() 18 public function index()
19 { 19 {
20 $this->view->engine->layout(false); 20 $this->view->engine->layout(false);
21 return $this->fetch(); 21 return $this->fetch();
22 } 22 }
23 23
  24 + //机构列表树
  25 + public function mechanism()
  26 + {
  27 + $this->view->engine->layout(false);
  28 + return $this->fetch();
  29 + }
  30 +
24 } 31 }
@@ -207,62 +207,62 @@ @@ -207,62 +207,62 @@
207 </div> 207 </div>
208 <div data-options="region:'west',split:true,hideCollapsedContent:false,collapsed:false,title:'菜单',dataType:'json'" style="width:180px;min-width:160px;"> 208 <div data-options="region:'west',split:true,hideCollapsedContent:false,collapsed:false,title:'菜单',dataType:'json'" style="width:180px;min-width:160px;">
209 <div class="easyui-menu" data-options="inline:true,fit:true,itemHeight:40" style="border:0px;"> 209 <div class="easyui-menu" data-options="inline:true,fit:true,itemHeight:40" style="border:0px;">
210 -<!-- <div data-options="iconCls:'icon-cancel'">-->  
211 -<!-- <span>客户管理</span>-->  
212 -<!-- <div style="width:180px;">-->  
213 -<!-- <div data-options="iconCls:'icon-clear'"><b>客户管理</b></div>-->  
214 -<!-- <div data-options="iconCls:'icon-edit'">客户导入</div>-->  
215 -<!-- <div data-options="iconCls:'icon-remove'">客户调配</div>-->  
216 -<!-- <div data-options="iconCls:'icon-save'">数据处理</div>-->  
217 -<!-- <div class="menu-sep"></div>-->  
218 -<!-- <div data-options="iconCls:'icon-cut'">招聘管理</div>-->  
219 -<!-- <div data-options="iconCls:'icon-ok'">下发回收</div>-->  
220 -<!-- <div data-options="iconCls:'icon-no'">故障报修</div>-->  
221 -<!-- </div>-->  
222 -<!-- </div>-->  
223 -<!-- <div class="menu-selected" data-options="iconCls:'hr-loading'">-->  
224 -<!-- <span>我的助手</span>-->  
225 -<!-- <div style="width:180px;">-->  
226 -<!-- <div><b>我的消息</b></div>-->  
227 -<!-- <div>消息提醒</div>-->  
228 -<!-- <div>通话记录</div>-->  
229 -<!-- <div>未接来电</div>-->  
230 -<!-- <div>公告管理</div>-->  
231 -<!-- <div>通讯录</div>-->  
232 -<!-- <div>个人设置</div>-->  
233 -<!-- <div>帮助向导</div>-->  
234 -<!-- </div>-->  
235 -<!-- </div>-->  
236 -<!---->  
237 - <div data-options="iconCls:'icon-reload'">  
238 - <span>转盘抽奖</span>  
239 - <div style="width:180px;">  
240 - <div onclick="$.h.menu.onMenuTurnPrizeManage();"><b>奖项列表</b></div>  
241 - <div onclick="$.h.menu.onMenuTurnPrizeUserManage();"><b>用户列表</b></div>  
242 - <div onclick="$.h.menu.onMenuTurnPrizeRuleManage();"><b>规则设置</b></div>  
243 - </div>  
244 - </div>  
245 - <div data-options="iconCls:'icon-reload'">  
246 - <span>抽奖管理</span>  
247 - <div style="width:180px;">  
248 - <div onclick="$.h.menu.onMenuPrizeManage();"><b>奖项列表</b></div>  
249 - <div onclick="$.h.menu.onMenuPrizeUserManage();"><b>用户列表</b></div>  
250 - <div onclick="$.h.menu.onMenuPrizeRuleManage();"><b>规则设置</b></div>  
251 - </div>  
252 - </div>  
253 - <div data-options="iconCls:'icon-reload'">  
254 - <span>产品管理</span>  
255 - <div style="width:180px;">  
256 - <div onclick="$.h.menu.onMenuProductManage();"><b>产品列表</b></div>  
257 - <div onclick="$.h.menu.onMenuProductOrderManage();"><b>订单列表</b></div>  
258 - </div>  
259 - </div>  
260 - <div data-options="iconCls:'icon-reload'">  
261 - <span>获客管理</span>  
262 - <div style="width:180px;">  
263 - <div onclick="$.h.menu.onMenuFuJiTongManage();"><b>客户列表</b></div>  
264 - </div>  
265 - </div> 210 + <!-- <div data-options="iconCls:'icon-cancel'">-->
  211 + <!-- <span>客户管理</span>-->
  212 + <!-- <div style="width:180px;">-->
  213 + <!-- <div data-options="iconCls:'icon-clear'"><b>客户管理</b></div>-->
  214 + <!-- <div data-options="iconCls:'icon-edit'">客户导入</div>-->
  215 + <!-- <div data-options="iconCls:'icon-remove'">客户调配</div>-->
  216 + <!-- <div data-options="iconCls:'icon-save'">数据处理</div>-->
  217 + <!-- <div class="menu-sep"></div>-->
  218 + <!-- <div data-options="iconCls:'icon-cut'">招聘管理</div>-->
  219 + <!-- <div data-options="iconCls:'icon-ok'">下发回收</div>-->
  220 + <!-- <div data-options="iconCls:'icon-no'">故障报修</div>-->
  221 + <!-- </div>-->
  222 + <!-- </div>-->
  223 + <!-- <div class="menu-selected" data-options="iconCls:'hr-loading'">-->
  224 + <!-- <span>我的助手</span>-->
  225 + <!-- <div style="width:180px;">-->
  226 + <!-- <div><b>我的消息</b></div>-->
  227 + <!-- <div>消息提醒</div>-->
  228 + <!-- <div>通话记录</div>-->
  229 + <!-- <div>未接来电</div>-->
  230 + <!-- <div>公告管理</div>-->
  231 + <!-- <div>通讯录</div>-->
  232 + <!-- <div>个人设置</div>-->
  233 + <!-- <div>帮助向导</div>-->
  234 + <!-- </div>-->
  235 + <!-- </div>-->
  236 + <!---->
  237 + <!-- <div data-options="iconCls:'icon-reload'">-->
  238 + <!-- <span>转盘抽奖</span>-->
  239 + <!-- <div style="width:180px;">-->
  240 + <!-- <div onclick="$.h.menu.onMenuTurnPrizeManage();"><b>奖项列表</b></div>-->
  241 + <!-- <div onclick="$.h.menu.onMenuTurnPrizeUserManage();"><b>用户列表</b></div>-->
  242 + <!-- <div onclick="$.h.menu.onMenuTurnPrizeRuleManage();"><b>规则设置</b></div>-->
  243 + <!-- </div>-->
  244 + <!-- </div>-->
  245 + <!-- <div data-options="iconCls:'icon-reload'">-->
  246 + <!-- <span>抽奖管理</span>-->
  247 + <!-- <div style="width:180px;">-->
  248 + <!-- <div onclick="$.h.menu.onMenuPrizeManage();"><b>奖项列表</b></div>-->
  249 + <!-- <div onclick="$.h.menu.onMenuPrizeUserManage();"><b>用户列表</b></div>-->
  250 + <!-- <div onclick="$.h.menu.onMenuPrizeRuleManage();"><b>规则设置</b></div>-->
  251 + <!-- </div>-->
  252 + <!-- </div>-->
  253 + <!-- <div data-options="iconCls:'icon-reload'">-->
  254 + <!-- <span>产品管理</span>-->
  255 + <!-- <div style="width:180px;">-->
  256 + <!-- <div onclick="$.h.menu.onMenuProductManage();"><b>产品列表</b></div>-->
  257 + <!-- <div onclick="$.h.menu.onMenuProductOrderManage();"><b>订单列表</b></div>-->
  258 + <!-- </div>-->
  259 + <!-- </div>-->
  260 + <!-- <div data-options="iconCls:'icon-reload'">-->
  261 + <!-- <span>获客管理</span>-->
  262 + <!-- <div style="width:180px;">-->
  263 + <!-- <div onclick="$.h.menu.onMenuFuJiTongManage();"><b>客户列表</b></div>-->
  264 + <!-- </div>-->
  265 + <!-- </div>-->
266 266
267 267
268 268
@@ -281,12 +281,6 @@ @@ -281,12 +281,6 @@
281 <div onclick="$.h.menu.onMenuPersonnelManage();"><b>人员管理</b></div> 281 <div onclick="$.h.menu.onMenuPersonnelManage();"><b>人员管理</b></div>
282 </div> 282 </div>
283 </div> 283 </div>
284 - <div data-options="iconCls:'icon-reload'">  
285 - <span>编号规则</span>  
286 - <div style="width:180px;">  
287 - <div onclick="$.h.menu.onMenuNumberManage();"><b>编号列表</b></div>  
288 - </div>  
289 - </div>  
290 </div> 284 </div>
291 </div> 285 </div>
292 <div data-options="region:'center',border:false" style="overflow:hidden;"> 286 <div data-options="region:'center',border:false" style="overflow:hidden;">
@@ -31,54 +31,30 @@ @@ -31,54 +31,30 @@
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"> 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%;"> 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"> 35 <div class="easyui-panel" style="width:100%;max-width:100%;padding: 5px 5px">
36 <div style="margin-bottom: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> 37 <a id="name_add_but" href="#" data-options="iconCls:'icon-add'" class="my_but" style="vertical-align: middle;">新增</a>
38 </div> 38 </div>
39 </div> 39 </div>
40 - <table id="dg" style="width: 100%; height: 100%" 40 + <table id="dg" style="width: 100%; height: 92%"
41 data-options="rownumbers:true,singleSelect:true,pagination:true,toolbar:'#tb'"> 41 data-options="rownumbers:true,singleSelect:true,pagination:true,toolbar:'#tb'">
42 42
43 </table> 43 </table>
44 44
45 <div id="tb" style="padding:5px;height:auto"> 45 <div id="tb" style="padding:5px;height:auto">
46 <div> 46 <div>
47 - 推送结果:  
48 - <input class="easyui-combobox" style="width:125px" name="materialname" id="materialname"  
49 - data-options="valueField:'id',  
50 - textField:'text',  
51 - data:  
52 - [{ 'id':0,  
53 - 'text':'全部' ,  
54 - selected:true  
55 - },{ 'id':1,  
56 - 'text':'成功' ,  
57 - },{  
58 - 'id':2,  
59 - 'text':'失败'  
60 - }] ,panelHeight:'auto'  
61 - "/>  
62 - 地区:  
63 - <input class="easyui-combobox" style="width:125px" name="type" id="new_type"  
64 - data-options="valueField:'id',  
65 - textField:'text',  
66 - data:  
67 - [  
68 - { 'id':0,  
69 - 'text':'全部' ,  
70 - selected:true  
71 - },{ 'id':1,  
72 - 'text':'湖南省内' ,  
73 - },{ 'id':2,  
74 - 'text':'湖南省外' ,  
75 - }] ,panelHeight:'auto'  
76 - "/>  
77 - 起始时间: <input class="easyui-datebox" id='start' name='start' style="width:180px"> 47 + 所属机构:
  48 + <input id="xiala" name="xiala" class="easyui-combobox" data-options="
  49 + valueField: 'id',
  50 + textField: 'mechanismName',
  51 + url: '/products/role/getMechanism'">
  52 + 入职时间: <input class="easyui-datebox" id='start' name='start' style="width:180px">
78 截止时间: <input class="easyui-datebox" id='end' name='end' style="width:180px"> 53 截止时间: <input class="easyui-datebox" id='end' name='end' style="width:180px">
79 - <!-- 电话: <input class="easyui-numberbox" type="text" id='phone' name='phone'>--> 54 + 姓名: <input class="easyui-textbox" type="text" id='names' name='names'>
  55 + 电话: <input class="easyui-numberbox" type="text" id='tel' name='tel'>
80 <a href="#" class="easyui-linkbutton" id="search_buttn" iconCls="icon-search">搜索</a> 56 <a href="#" class="easyui-linkbutton" id="search_buttn" iconCls="icon-search">搜索</a>
81 - <a id="derive_btn" href="/products/fu_ji_tong/to_excel" class="easyui-linkbutton" style="height:28px" data-options="iconCls:'icon-undo'">导出</a> 57 + <!-- <a id="derive_btn" href="/products/fu_ji_tong/to_excel" class="easyui-linkbutton" style="height:28px" data-options="iconCls:'icon-undo'">导出</a>-->
82 </div> 58 </div>
83 </div> 59 </div>
84 </div> 60 </div>
@@ -89,17 +65,9 @@ @@ -89,17 +65,9 @@
89 <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;">
90 <table style="padding: 10px 20px;" cellspacing="10"> 66 <table style="padding: 10px 20px;" cellspacing="10">
91 <tr> 67 <tr>
92 - <td>登录账号:</td>  
93 - <td><input class="easyui-textbox" type="text" name="username" id="username" /></td>  
94 - <input class="easyui-textbox" id="user_id" name="user_id" type="hidden">  
95 - </tr>  
96 - <tr>  
97 - <td>登录密码:</td>  
98 - <td><input class="easyui-textbox" type="text" name="password" id="password" /></td>  
99 - </tr>  
100 - <tr>  
101 <td>用户名称:</td> 68 <td>用户名称:</td>
102 <td><input class="easyui-textbox" type="text" name="name" id="name" /></td> 69 <td><input class="easyui-textbox" type="text" name="name" id="name" /></td>
  70 + <input class="easyui-textbox" id="user_id" name="user_id" type="hidden">
103 </tr> 71 </tr>
104 <tr> 72 <tr>
105 <td>性别:</td> 73 <td>性别:</td>
@@ -112,22 +80,53 @@ @@ -112,22 +80,53 @@
112 <tr> 80 <tr>
113 <td>所属机构:</td> 81 <td>所属机构:</td>
114 <td> 82 <td>
  83 + <!-- <input id="cc1" name="mechanism" class="easyui-combobox" data-options="-->
  84 + <!-- valueField: 'id',-->
  85 + <!-- textField: 'mechanismName',-->
  86 + <!-- url: '/products/role/getMechanism',-->
  87 + <!-- onSelect: function(rec){-->
  88 + <!-- var url = '/products/role/getDepartment?id='+rec.id;-->
  89 + <!-- $('#cc2').combobox('reload', url);-->
  90 + <!-- var url1 = '/products/role/generateNumber?id='+rec.id;-->
  91 + <!-- $.ajax({-->
  92 + <!-- url:url1,-->
  93 + <!-- success:function(e){-->
  94 + <!-- var arr = JSON.parse(e);-->
  95 + <!---->
  96 + <!-- $('#personalNumber').textbox('setValue',arr.num);-->
  97 + <!-- $('#personalNumber1').textbox('setValue',arr.num);-->
  98 + <!-- }-->
  99 + <!-- })-->
  100 + <!-- }">-->
115 <input id="cc1" name="mechanism" class="easyui-combobox" data-options=" 101 <input id="cc1" name="mechanism" class="easyui-combobox" data-options="
116 valueField: 'id', 102 valueField: 'id',
117 textField: 'mechanismName', 103 textField: 'mechanismName',
118 url: '/products/role/getMechanism', 104 url: '/products/role/getMechanism',
119 onSelect: function(rec){ 105 onSelect: function(rec){
120 var url = '/products/role/getDepartment?id='+rec.id; 106 var url = '/products/role/getDepartment?id='+rec.id;
121 - $('#cc2').combobox('reload', url);  
122 - var url1 = '/products/role/generateNumber?id='+rec.id;  
123 $.ajax({ 107 $.ajax({
124 - url:url1,  
125 - success:function(e){  
126 - var arr = JSON.parse(e);  
127 -  
128 - $('#personalNumber').textbox('setValue',arr.num);  
129 - } 108 + url:url,
  109 + success:function(a){
  110 + var arr1=JSON.parse(a);
  111 + console.log(JSON.parse(a))
  112 + $('#cc2').combobox({
  113 + data:JSON.parse(a),
  114 + valueField:'id',
  115 + textField: 'departmentName',
  116 + });
  117 + var url1 = '/products/role/generateNumber?id='+rec.id+'&rule_id='+rule_id;
  118 + $.ajax({
  119 + url:url1,
  120 + success:function(e){
  121 + var arr = JSON.parse(e);
  122 +
  123 + $('#personalNumber').textbox('setValue',arr.num);
  124 + $('#personalNumber1').textbox('setValue',arr.num);
  125 + }
  126 + })
  127 + }
130 }) 128 })
  129 +
131 }"> 130 }">
132 131
133 </td> 132 </td>
@@ -138,10 +137,16 @@ @@ -138,10 +137,16 @@
138 </tr> 137 </tr>
139 <tr> 138 <tr>
140 <td>个人编号:</td> 139 <td>个人编号:</td>
141 - <td><input class="easyui-textbox" type="text" name="personalNumber" id="personalNumber" disabled/></td> 140 + <td>
  141 + <input class="easyui-textbox" type="text" id="personalNumber" disabled/>
  142 + <input class="easyui-textbox" id="personalNumber1" name="personalNumber" type="hidden">
  143 + </td>
142 </tr> 144 </tr>
143 <tr> 145 <tr>
144 <td>入职时间:</td> 146 <td>入职时间:</td>
  147 +
  148 + <!-- <td><input class="easyui-datebox" name="entryTime" id="entryTime" disabled/></td>-->
  149 +
145 <td><input class="easyui-datebox" name="entryTime" id="entryTime" /></td> 150 <td><input class="easyui-datebox" name="entryTime" id="entryTime" /></td>
146 </tr> 151 </tr>
147 <tr> 152 <tr>
@@ -185,6 +190,7 @@ @@ -185,6 +190,7 @@
185 190
186 <script> 191 <script>
187 192
  193 + var rule_id='';
188 //下拉框搜索 194 //下拉框搜索
189 init_datagrid('/products/role/getUsers', 0); 195 init_datagrid('/products/role/getUsers', 0);
190 196
@@ -193,30 +199,25 @@ @@ -193,30 +199,25 @@
193 199
194 $('#search_buttn').bind('click', function() { 200 $('#search_buttn').bind('click', function() {
195 201
196 - var _data = $('#dg').data('datagrid'); // 拿到datagrid初始化的数据缓存  
197 - if(_data && _data.options){  
198 - _data.options.pageNumber = 1; // 修改缓存  
199 - }  
200 - $.data($('#dg')[0], 'datagrid', _data); // 把修改写回去 202 + var xiala=$('#xiala').combobox('getValue');
201 203
202 204
203 - var result=$('#materialname').combobox('getValue');  
204 - var new_type=$('#new_type').combobox('getValue');  
205 var start = $("#start").val(); 205 var start = $("#start").val();
206 var end = $("#end").val(); 206 var end = $("#end").val();
207 - var phone = $("#phone").val();  
208 - if(phone.length>0){  
209 - if(phone.length!=11){ 207 + var tel = $("#tel").val();
  208 + var names = $("#names").val();
  209 + if(tel.length>0){
  210 + if(tel.length!=11){
210 $.messager.alert('检索手机号','手机号格式错误,请重新输入'); 211 $.messager.alert('检索手机号','手机号格式错误,请重新输入');
211 return false; 212 return false;
212 } 213 }
213 } 214 }
214 var result = { 215 var result = {
215 - result,  
216 - new_type, 216 + xiala,
217 start, 217 start,
218 end, 218 end,
219 - phone 219 + tel,
  220 + names
220 } 221 }
221 // console.log(result);return false; 222 // console.log(result);return false;
222 init_datagrid('/products/role/getUsers', result); 223 init_datagrid('/products/role/getUsers', result);
@@ -242,12 +243,6 @@ @@ -242,12 +243,6 @@
242 function dg_columns() { 243 function dg_columns() {
243 var arr = new Array(); 244 var arr = new Array();
244 arr.push({ 245 arr.push({
245 - field: 'username',  
246 - title: '登录账号',  
247 - width: 120,  
248 - align: 'center'  
249 - });  
250 - arr.push({  
251 field: 'name', 246 field: 'name',
252 title: '用户名称', 247 title: '用户名称',
253 width: 80, 248 width: 80,
@@ -324,6 +319,9 @@ @@ -324,6 +319,9 @@
324 } 319 }
325 }); 320 });
326 function addFile(){ 321 function addFile(){
  322 + rule_id='';
  323 + $('#entryTime').textbox({disabled:false})
  324 + $('#win').form('clear')
327 $('#win').dialog({ 325 $('#win').dialog({
328 title: '新增', 326 title: '新增',
329 width: 800, 327 width: 800,
@@ -334,11 +332,62 @@ @@ -334,11 +332,62 @@
334 modal: true 332 modal: true
335 }); 333 });
336 } 334 }
  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 + // }
337 //修改 380 //修改
338 function showUser(row){ 381 function showUser(row){
  382 +
  383 +
339 if(row){ 384 if(row){
340 // alert(row); 385 // alert(row);
341 var id=row; 386 var id=row;
  387 + rule_id=id;
  388 + if (rule_id){
  389 + $('#entryTime').textbox({disabled:true})
  390 + }
342 var result = { 391 var result = {
343 id 392 id
344 } 393 }
@@ -351,16 +400,43 @@ @@ -351,16 +400,43 @@
351 async: false, 400 async: false,
352 url: "/products/role/getUsers", 401 url: "/products/role/getUsers",
353 success: function(data) { 402 success: function(data) {
  403 + // console.log(data);
354 var arr = JSON.parse(data); 404 var arr = JSON.parse(data);
355 -  
356 - console.log(arr.rows[0]);  
357 -  
358 - $('#user_id').textbox('setValue',arr.rows[0].user_id); 405 + $('#user_id').textbox('setValue',arr.rows[0].id);
359 406
360 $('#username').textbox('setValue',arr.rows[0].username); 407 $('#username').textbox('setValue',arr.rows[0].username);
361 $('#password').textbox('setValue',arr.rows[0].password); 408 $('#password').textbox('setValue',arr.rows[0].password);
362 $('#name').textbox('setValue',arr.rows[0].name); 409 $('#name').textbox('setValue',arr.rows[0].name);
363 $('#personalNumber').textbox('setValue',arr.rows[0].personalNumber); 410 $('#personalNumber').textbox('setValue',arr.rows[0].personalNumber);
  411 + $.ajax({
  412 + url:'/products/role/getMechanism',
  413 + success:function(e){
  414 + var mechanism=JSON.parse(e).find((v)=>{
  415 + if(v.mechanismName===arr.rows[0].mechanism){
  416 + $('#cc1').combobox('select',v.id);
  417 + $.ajax({
  418 + url:"/products/role/getDepartment?id="+v.id,
  419 + success:function(ee){
  420 + // console.log(JSON.parse(ee))
  421 + var department=JSON.parse(ee).find((vv)=>{
  422 + if(vv.departmentName===arr.rows[0].department){
  423 + $('#cc2').combobox('select',vv.id);
  424 + }
  425 +
  426 + })
  427 + }
  428 + })
  429 + }
  430 +
  431 + })
  432 + }
  433 + })
  434 + var statusData=$('#status').combobox('getData');
  435 + var status=statusData.find((ss)=>{
  436 + if(ss.text===arr.rows[0].status){
  437 + $('#status').combobox('select',ss.id);
  438 + }
  439 + })
364 // 440 //
365 if(arr.rows[0].sex == "男") { 441 if(arr.rows[0].sex == "男") {
366 $('#statusId').switchbutton('check'); 442 $('#statusId').switchbutton('check');
@@ -370,10 +446,7 @@ @@ -370,10 +446,7 @@
370 $('#phone').textbox('setValue',arr.rows[0].phone); 446 $('#phone').textbox('setValue',arr.rows[0].phone);
371 $('#entryTime').textbox('setValue',arr.rows[0].entryTime); 447 $('#entryTime').textbox('setValue',arr.rows[0].entryTime);
372 $('#quitTime').textbox('setValue',arr.rows[0].quitTime); 448 $('#quitTime').textbox('setValue',arr.rows[0].quitTime);
373 -  
374 $('#materialname').combobox('setValue', $('#materialname option')[2].value); 449 $('#materialname').combobox('setValue', $('#materialname option')[2].value);
375 -  
376 -  
377 }, 450 },
378 error:function(data){ 451 error:function(data){
379 console.log(data) 452 console.log(data)
@@ -381,7 +454,6 @@ @@ -381,7 +454,6 @@
381 }); 454 });
382 } 455 }
383 } 456 }
384 -  
385 function submitForm(){ 457 function submitForm(){
386 $('#fm').form('submit', { 458 $('#fm').form('submit', {
387 url:'/products/role/user_add', 459 url:'/products/role/user_add',
@@ -392,7 +464,6 @@ @@ -392,7 +464,6 @@
392 }, 464 },
393 success:function(data){ 465 success:function(data){
394 console.log(data); 466 console.log(data);
395 - return false;  
396 var arr = JSON.parse(data); 467 var arr = JSON.parse(data);
397 $.messager.alert("提示", arr.msg); 468 $.messager.alert("提示", arr.msg);
398 $('#dg').datagrid('reload'); 469 $('#dg').datagrid('reload');
  1 +<!DOCTYPE html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
  2 +<html>
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <title>机构列表</title>
  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" />
  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" />
  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>
  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>
  20 + <style>
  21 + #fm>div {
  22 + width: 100%;
  23 + display: flex;
  24 + justify-content: space-around;
  25 + margin: 10px 0;
  26 + }
  27 + #fm>div input{
  28 + width: 180px;
  29 + }
  30 + </style>
  31 +</head>
  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>
  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>-->
  51 + </div>
  52 + </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" /></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>
  86 +
  87 +
  88 +</body>
  89 +<tbody id="html_table"></tbody>
  90 +<script type="text/javascript" src="/assets/web/js/src/common_fu.js"></script>
  91 +
  92 +<script>
  93 +
  94 + //下拉框搜索
  95 + init_datagrid('/products/Mechanism/getMechanismList', 0);
  96 +
  97 + //下拉框搜索
  98 +
  99 +
  100 + $('#search_buttn').bind('click', function() {
  101 +
  102 + var _data = $('#dg').data('datagrid'); // 拿到datagrid初始化的数据缓存
  103 + if(_data && _data.options){
  104 + _data.options.pageNumber = 1; // 修改缓存
  105 + }
  106 + $.data($('#dg')[0], 'datagrid', _data); // 把修改写回去
  107 +
  108 + var names = $("#names").val();
  109 +
  110 + var start = $("#start").val();
  111 + var end = $("#end").val();
  112 +
  113 +
  114 + var result = {
  115 + names,
  116 + start,
  117 + end
  118 +
  119 + }
  120 + // console.log(result);return false;
  121 + init_datagrid('/products/Mechanism/getMechanismList', result);
  122 + });
  123 +
  124 +
  125 + function init_datagrid(data_url, res) {
  126 +
  127 + //表头字段
  128 + var arr_columns = dg_columns();
  129 + $("#dg").datagrid({
  130 + rownumbers:true,
  131 + singleSelect:true,
  132 + pagination:true,
  133 + url:data_url,
  134 + queryParams: res,
  135 + method:'post',
  136 + columns: [arr_columns],
  137 + loadMsg: '正在加载数据',
  138 + emptyMsg: '列表为空',
  139 + });
  140 + }
  141 + function dg_columns() {
  142 + var arr = new Array();
  143 + arr.push({
  144 + field: 'username',
  145 + title: '登录账号',
  146 + width: 120,
  147 + align: 'center'
  148 + });
  149 + arr.push({
  150 + field: 'mechanismName',
  151 + title: '机构名称',
  152 + width: 250,
  153 + align: 'center'
  154 + });
  155 + arr.push({
  156 + field: 'rule',
  157 + title: '编号规则',
  158 + width: 80,
  159 + align: 'center'
  160 + });
  161 + arr.push({
  162 + field: 'createTime',
  163 + title: '创建时间',
  164 + width: 200,
  165 + align: 'center'
  166 + });
  167 + arr.push({
  168 + field: 'id',
  169 + title: '操作',
  170 + width: 90,
  171 + align: 'center',
  172 + formatter:formatOper
  173 + });
  174 + // console.log(arr)
  175 + return arr;
  176 + }
  177 + //操作框
  178 + function formatOper(val, row, index) {
  179 + return '<a href="javascript:void(0)" onclick="showUser(' + val + ')">编辑</a> <a href="javascript:void(0)" onclick="showUser(' + val + ')">查看</a>';
  180 +
  181 + }
  182 +
  183 + //添加
  184 + $('#name_add_but').linkbutton({
  185 + onClick: function () {
  186 +
  187 + addFile();
  188 + }
  189 + });
  190 + function addFile(){
  191 + $('#win').dialog({
  192 + title: '新增',
  193 + width: 500,
  194 + height: "auto",
  195 + top:20,
  196 + closed: false,//显示对话框
  197 + cache: false,
  198 + modal: true
  199 + });
  200 + }
  201 + //修改
  202 + function showUser(row){
  203 + if(row){
  204 + // alert(row);
  205 + var id=row;
  206 + var result = {
  207 + id
  208 + }
  209 + $("#win").dialog("open").dialog("setTitle","人员信息修改");
  210 +
  211 + //ajax请求数据
  212 + $.ajax({
  213 + type: "post",
  214 + data: result,
  215 + async: false,
  216 + url: "/products/Mechanism/getMechanismList",
  217 + success: function(data) {
  218 + var arr = JSON.parse(data);
  219 + $('#mechanism_id').textbox('setValue',arr.rows[0].id);
  220 +
  221 + $('#username').textbox('setValue',arr.rows[0].username);
  222 +
  223 + $('#mechanismName').textbox('setValue',arr.rows[0].mechanismName);
  224 + $('#rule').textbox('setValue',arr.rows[0].rule);
  225 +
  226 +
  227 +
  228 + },
  229 + error:function(data){
  230 + console.log(data)
  231 + }
  232 + });
  233 + }
  234 + }
  235 +
  236 + function submitForm(){
  237 + $('#fm').form('submit', {
  238 + url:'/products/Mechanism/mechanism_add',
  239 + onSubmit: function(){
  240 + console.log($(this))
  241 + // do some check
  242 + // return false to prevent submit;
  243 + },
  244 + success:function(data){
  245 + console.log(data);
  246 + var arr = JSON.parse(data);
  247 + $.messager.alert("提示", arr.msg);
  248 + $('#dg').datagrid('reload');
  249 + // console.log(data);
  250 + //$.messager.alert('',msg);
  251 + //console.log(data);
  252 + //alert(data)
  253 + }
  254 + });
  255 + $('#win').dialog({
  256 + closed: true, // 隱藏列表
  257 + });
  258 + }
  259 +
  260 +
  261 +
  262 +</script>
  263 +</html>
@@ -2,138 +2,138 @@ @@ -2,138 +2,138 @@
2 * 通用菜单函数 2 * 通用菜单函数
3 */ 3 */
4 (function($){ 4 (function($){
5 - /**  
6 - * 声明主窗口 ID  
7 - */  
8 - var id_MainTabs = '#main_tabs'; 5 + /**
  6 + * 声明主窗口 ID
  7 + */
  8 + var id_MainTabs = '#main_tabs';
9 var id_MainIframe = '#main_iframe'; 9 var id_MainIframe = '#main_iframe';
10 - $.h.menu = {  
11 - /** 10 + $.h.menu = {
  11 + /**
12 * 首页 12 * 首页
13 - * SysMain 13 + * SysMain
14 */ 14 */
15 - onMenuSysMain : function(e) {  
16 -  
17 - var objMainTabs = $(id_MainTabs);  
18 - if (objMainTabs.tabs("existsById", 'SysMain')) {  
19 - objMainTabs.tabs('selectById', 'SysMain');  
20 - } else { 15 + onMenuSysMain : function(e) {
  16 +
  17 + var objMainTabs = $(id_MainTabs);
  18 + if (objMainTabs.tabs("existsById", 'SysMain')) {
  19 + objMainTabs.tabs('selectById', 'SysMain');
  20 + } else {
21 objMainTabs.tabs('update', { 21 objMainTabs.tabs('update', {
22 tab: objMainTabs.tabs('getTab',0), 22 tab: objMainTabs.tabs('getTab',0),
23 options: { 23 options: {
24 - id: 'SysMain', 24 + id: 'SysMain',
25 title: '首页' 25 title: '首页'
26 } 26 }
27 }); 27 });
28 $(id_MainIframe).attr('src','/manage/index/main'); 28 $(id_MainIframe).attr('src','/manage/index/main');
29 - objMainTabs.tabs('selectById', 'SysMain'); 29 + objMainTabs.tabs('selectById', 'SysMain');
30 } 30 }
31 - },  
32 - /** 31 + },
  32 + /**
33 * 用户冲账 33 * 用户冲账
34 - * UserStrikeList 34 + * UserStrikeList
35 */ 35 */
36 - onMenuUserStrikeList : function(e) {  
37 - var objMainTabs = $(id_MainTabs);  
38 - if (objMainTabs.tabs("existsById", 'UserStrikeList')) {  
39 - objMainTabs.tabs('selectById', 'UserStrikeList');  
40 - } else { 36 + onMenuUserStrikeList : function(e) {
  37 + var objMainTabs = $(id_MainTabs);
  38 + if (objMainTabs.tabs("existsById", 'UserStrikeList')) {
  39 + objMainTabs.tabs('selectById', 'UserStrikeList');
  40 + } else {
41 objMainTabs.tabs('update', { 41 objMainTabs.tabs('update', {
42 tab: objMainTabs.tabs('getTab',0), 42 tab: objMainTabs.tabs('getTab',0),
43 options: { 43 options: {
44 - id: 'UserStrikeList', 44 + id: 'UserStrikeList',
45 title: '用户冲账' 45 title: '用户冲账'
46 } 46 }
47 }); 47 });
48 $(id_MainIframe).attr('src','/manage/user/user_strike_main'); 48 $(id_MainIframe).attr('src','/manage/user/user_strike_main');
49 - objMainTabs.tabs('selectById', 'UserStrikeList'); 49 + objMainTabs.tabs('selectById', 'UserStrikeList');
50 } 50 }
51 - }, 51 + },
52 /** 52 /**
53 * 用户分润 53 * 用户分润
54 - * UserRewardList 54 + * UserRewardList
55 */ 55 */
56 - onMenuUserRewardList : function(e) {  
57 - var objMainTabs = $(id_MainTabs);  
58 - if (objMainTabs.tabs("existsById", 'UserRewardList')) {  
59 - objMainTabs.tabs('selectById', 'UserRewardList');  
60 - } else { 56 + onMenuUserRewardList : function(e) {
  57 + var objMainTabs = $(id_MainTabs);
  58 + if (objMainTabs.tabs("existsById", 'UserRewardList')) {
  59 + objMainTabs.tabs('selectById', 'UserRewardList');
  60 + } else {
61 objMainTabs.tabs('update', { 61 objMainTabs.tabs('update', {
62 tab: objMainTabs.tabs('getTab',0), 62 tab: objMainTabs.tabs('getTab',0),
63 options: { 63 options: {
64 - id: 'UserRewardList', 64 + id: 'UserRewardList',
65 title: '用户分润' 65 title: '用户分润'
66 } 66 }
67 }); 67 });
68 $(id_MainIframe).attr('src','/manage/user/user_reward_main'); 68 $(id_MainIframe).attr('src','/manage/user/user_reward_main');
69 - objMainTabs.tabs('selectById', 'UserRewardList'); 69 + objMainTabs.tabs('selectById', 'UserRewardList');
70 } 70 }
71 - },  
72 - /** 71 + },
  72 + /**
73 * 用户流水 73 * 用户流水
74 - * UserFlowList 74 + * UserFlowList
75 */ 75 */
76 - onMenuUserFlowList : function(e) {  
77 - var objMainTabs = $(id_MainTabs);  
78 - if (objMainTabs.tabs("existsById", 'UserFlowList')) {  
79 - objMainTabs.tabs('selectById', 'UserFlowList');  
80 - } else { 76 + onMenuUserFlowList : function(e) {
  77 + var objMainTabs = $(id_MainTabs);
  78 + if (objMainTabs.tabs("existsById", 'UserFlowList')) {
  79 + objMainTabs.tabs('selectById', 'UserFlowList');
  80 + } else {
81 objMainTabs.tabs('update', { 81 objMainTabs.tabs('update', {
82 tab: objMainTabs.tabs('getTab',0), 82 tab: objMainTabs.tabs('getTab',0),
83 options: { 83 options: {
84 - id: 'UserFlowList', 84 + id: 'UserFlowList',
85 title: '用户流水' 85 title: '用户流水'
86 } 86 }
87 }); 87 });
88 $(id_MainIframe).attr('src','/manage/user/user_flow_main'); 88 $(id_MainIframe).attr('src','/manage/user/user_flow_main');
89 - objMainTabs.tabs('selectById', 'UserFlowList'); 89 + objMainTabs.tabs('selectById', 'UserFlowList');
90 } 90 }
91 - },  
92 - /** 91 + },
  92 + /**
93 * 团队结构 93 * 团队结构
94 - * UserTeamTree 94 + * UserTeamTree
95 */ 95 */
96 - onMenuUserTeamTree : function(e) {  
97 - var objMainTabs = $(id_MainTabs);  
98 - if (objMainTabs.tabs("existsById", 'UserTeamTree')) {  
99 - objMainTabs.tabs('selectById', 'UserTeamTree');  
100 - } else { 96 + onMenuUserTeamTree : function(e) {
  97 + var objMainTabs = $(id_MainTabs);
  98 + if (objMainTabs.tabs("existsById", 'UserTeamTree')) {
  99 + objMainTabs.tabs('selectById', 'UserTeamTree');
  100 + } else {
101 objMainTabs.tabs('update', { 101 objMainTabs.tabs('update', {
102 tab: objMainTabs.tabs('getTab',0), 102 tab: objMainTabs.tabs('getTab',0),
103 options: { 103 options: {
104 - id: 'UserTeamTree', 104 + id: 'UserTeamTree',
105 title: '团队结构' 105 title: '团队结构'
106 } 106 }
107 }); 107 });
108 $(id_MainIframe).attr('src','/manage/user/user_team_tree_main'); 108 $(id_MainIframe).attr('src','/manage/user/user_team_tree_main');
109 - objMainTabs.tabs('selectById', 'UserTeamTree'); 109 + objMainTabs.tabs('selectById', 'UserTeamTree');
110 } 110 }
111 - },  
112 - /**  
113 - * 审核管理*  
114 - * AuthManage 111 + },
  112 + /**
  113 + * 审核管理*
  114 + * AuthManage
115 */ 115 */
116 - onMenuAuthManage : function(e) {  
117 - var objMainTabs = $(id_MainTabs);  
118 - if (objMainTabs.tabs("existsById", 'AuthManage')) {  
119 - objMainTabs.tabs('selectById', 'AuthManage');  
120 - } else { 116 + onMenuAuthManage : function(e) {
  117 + var objMainTabs = $(id_MainTabs);
  118 + if (objMainTabs.tabs("existsById", 'AuthManage')) {
  119 + objMainTabs.tabs('selectById', 'AuthManage');
  120 + } else {
121 objMainTabs.tabs('update', { 121 objMainTabs.tabs('update', {
122 tab: objMainTabs.tabs('getTab',0), 122 tab: objMainTabs.tabs('getTab',0),
123 options: { 123 options: {
124 - id: 'AuthManage', 124 + id: 'AuthManage',
125 title: '审核管理' 125 title: '审核管理'
126 } 126 }
127 }); 127 });
128 $(id_MainIframe).attr('src','/manage/auth/auth_manage_main'); 128 $(id_MainIframe).attr('src','/manage/auth/auth_manage_main');
129 - objMainTabs.tabs('selectById', 'AuthManage'); 129 + objMainTabs.tabs('selectById', 'AuthManage');
130 } 130 }
131 - }, 131 + },
132 /** 132 /**
133 - * 组织机构管理 133 + * 组织机构管理
134 * @param e 134 * @param e
135 */ 135 */
136 - onMenuOrgManage:function(e){ 136 + onMenuOrgManage:function(e){
137 var objMainTabs = $(id_MainTabs); 137 var objMainTabs = $(id_MainTabs);
138 if (objMainTabs.tabs("existsById", 'OrgManage')) { 138 if (objMainTabs.tabs("existsById", 'OrgManage')) {
139 objMainTabs.tabs('selectById', 'OrgManage'); 139 objMainTabs.tabs('selectById', 'OrgManage');
@@ -148,7 +148,7 @@ @@ -148,7 +148,7 @@
148 $(id_MainIframe).attr('src','/web/organization/org_manage_main'); 148 $(id_MainIframe).attr('src','/web/organization/org_manage_main');
149 objMainTabs.tabs('selectById', 'OrgManage'); 149 objMainTabs.tabs('selectById', 'OrgManage');
150 } 150 }
151 - }, 151 + },
152 152
153 /** 153 /**
154 * 转盘抽奖管理 154 * 转盘抽奖管理
@@ -210,30 +210,30 @@ @@ -210,30 +210,30 @@
210 console.log("onMenuPrizeManage") 210 console.log("onMenuPrizeManage")
211 var objMainTabs = $(id_MainTabs); 211 var objMainTabs = $(id_MainTabs);
212 212
213 - objMainTabs.tabs('update', {  
214 - tab: objMainTabs.tabs('getTab',0),  
215 - options: {  
216 - id: 'AgentCarManage',  
217 - title: '抽奖管理'  
218 - }  
219 - });  
220 - $(id_MainIframe).attr('src','/web/prize/index');  
221 - objMainTabs.tabs('selectById', 'AgentCarManage'); 213 + objMainTabs.tabs('update', {
  214 + tab: objMainTabs.tabs('getTab',0),
  215 + options: {
  216 + id: 'AgentCarManage',
  217 + title: '抽奖管理'
  218 + }
  219 + });
  220 + $(id_MainIframe).attr('src','/web/prize/index');
  221 + objMainTabs.tabs('selectById', 'AgentCarManage');
222 222
223 }, 223 },
224 onMenuPrizeUserManage:function(e){ 224 onMenuPrizeUserManage:function(e){
225 - console.log("onMenuPrizeUserManage") 225 + console.log("onMenuPrizeUserManage")
226 var objMainTabs = $(id_MainTabs); 226 var objMainTabs = $(id_MainTabs);
227 227
228 - objMainTabs.tabs('update', {  
229 - tab: objMainTabs.tabs('getTab',0),  
230 - options: {  
231 - id: 'AgentCarManage',  
232 - title: '用户管理'  
233 - }  
234 - });  
235 - $(id_MainIframe).attr('src','/web/prize/user');  
236 - objMainTabs.tabs('selectById', 'AgentCarManage'); 228 + objMainTabs.tabs('update', {
  229 + tab: objMainTabs.tabs('getTab',0),
  230 + options: {
  231 + id: 'AgentCarManage',
  232 + title: '用户管理'
  233 + }
  234 + });
  235 + $(id_MainIframe).attr('src','/web/prize/user');
  236 + objMainTabs.tabs('selectById', 'AgentCarManage');
237 237
238 }, 238 },
239 onMenuPrizeRuleManage:function(e){ 239 onMenuPrizeRuleManage:function(e){
@@ -326,7 +326,7 @@ @@ -326,7 +326,7 @@
326 title: '机构管理' 326 title: '机构管理'
327 } 327 }
328 }); 328 });
329 - $(id_MainIframe).attr('src','/web/Fu_ji_tong/index'); 329 + $(id_MainIframe).attr('src','/web/Role/mechanism');
330 objMainTabs.tabs('selectById', 'AgentCarManage'); 330 objMainTabs.tabs('selectById', 'AgentCarManage');
331 }, 331 },
332 /** 332 /**
@@ -364,26 +364,8 @@ @@ -364,26 +364,8 @@
364 objMainTabs.tabs('selectById', 'AgentCarManage'); 364 objMainTabs.tabs('selectById', 'AgentCarManage');
365 }, 365 },
366 366
367 - /**  
368 - * 人事管理 编号规则  
369 - * @param e  
370 - */  
371 - onMenuNumberManage:function(e){  
372 - var objMainTabs = $(id_MainTabs);  
373 367
374 - objMainTabs.tabs('update', {  
375 - tab: objMainTabs.tabs('getTab',0),  
376 - options: {  
377 - id: 'AgentSecondaryManage',  
378 - title: '编号管理'  
379 - }  
380 - });  
381 - $(id_MainIframe).attr('src','/web/Fu_ji_tong/index');  
382 - objMainTabs.tabs('selectById', 'AgentCarManage');  
383 - },  
384 -  
385 -  
386 - } 368 + }
387 })(jQuery); 369 })(jQuery);
388 //表单验证 手机号 370 //表单验证 手机号
389 $.extend($.fn.validatebox.defaults.rules, { 371 $.extend($.fn.validatebox.defaults.rules, {