Commit 1b5c65fa8fc5c2b8f0b45799be82822aa6a2a1f9

Authored by 王通
2 parents 66a9e32b 6f9b560e

Merge branch 'chengdu' into changsha

src/main/java/com/bsth/controller/sys/UserController.java
... ... @@ -193,7 +193,7 @@ public class UserController extends BaseController<SysUser, Integer> {
193 193 }
194 194  
195 195 // 检验密码有效期
196   - Date lastPwdDate = user.getLastPwdDate();
  196 + /*Date lastPwdDate = user.getLastPwdDate();
197 197 if (lastPwdDate != null) {
198 198 if (user.getPwdExpiredDate().before(new Date())) {
199 199 return put(rs, "msg", "密码已过期,不能登录,请联系管理员");
... ... @@ -209,7 +209,7 @@ public class UserController extends BaseController<SysUser, Integer> {
209 209 }
210 210 } else {
211 211 return put(rs, "msg", "从未更新过密码,不能登录,请联系管理员");
212   - }
  212 + }*/
213 213  
214 214 // 弱密码检查
215 215 Matcher matcher = pattern.matcher(password);
... ...
src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java
... ... @@ -7,6 +7,7 @@ import com.bsth.data.gpsdata_v2.handlers.*;
7 7 import com.bsth.email.SendEmailController;
8 8 import com.bsth.email.entity.EmailBean;
9 9 import com.bsth.util.IpUtils;
  10 +import com.fasterxml.jackson.databind.JsonNode;
10 11 import com.fasterxml.jackson.databind.ObjectMapper;
11 12 import com.google.common.collect.ArrayListMultimap;
12 13 import org.apache.commons.lang3.StringUtils;
... ... @@ -94,10 +95,10 @@ public class DataHandleProcess {
94 95 dataListMap.putAll(threadIndex, multimap.get(deviceList.get(i)));
95 96 }
96 97 Set<Integer> ks = dataListMap.keySet();
97   - logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size());
  98 + logger.info("gps: " + JSON.toJSONString(list));
98 99 CountDownLatch count = new CountDownLatch(ks.size());
99 100  
100   - logger.info(JSON.toJSONString(ks));
  101 + logger.info("ks: " + JSON.toJSONString(ks));
101 102 for (Integer index : ks) {
102 103 threadPool.execute(new SignalHandleThread(dataListMap.get(index), count));
103 104 }
... ...
src/main/java/com/bsth/data/gpsdata_v2/entity/GpsEntity.java
... ... @@ -118,6 +118,11 @@ public class GpsEntity implements Cloneable{
118 118 */
119 119 private int energy = -1;
120 120  
  121 + /**
  122 + * 站内外 -1无效 0站外 1站内
  123 + */
  124 + private int inOrOutStation;
  125 +
121 126 public Object clone() {
122 127 try {
123 128 return super.clone();
... ... @@ -418,4 +423,12 @@ public class GpsEntity implements Cloneable{
418 423 public void setEnergy(int energy) {
419 424 this.energy = energy;
420 425 }
  426 +
  427 + public int getInOrOutStation() {
  428 + return inOrOutStation;
  429 + }
  430 +
  431 + public void setInOrOutStation(int inOrOutStation) {
  432 + this.inOrOutStation = inOrOutStation;
  433 + }
421 434 }
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/StationInsideProcess.java
1   -package com.bsth.data.gpsdata_v2.handlers;
2   -
3   -import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
4   -import com.bsth.data.gpsdata_v2.cache.GpsCacheData;
5   -import com.bsth.data.gpsdata_v2.entity.GpsEntity;
6   -import com.bsth.data.gpsdata_v2.entity.StationRoute;
7   -import com.bsth.data.gpsdata_v2.utils.GeoUtils;
8   -import org.springframework.stereotype.Component;
9   -
10   -import java.util.List;
11   -
12   -/**
13   - * 站内 场内判定
14   - * Created by panzhao on 2017/11/16.
15   - */
16   -@Component
17   -public class StationInsideProcess {
18   -
19   - public void process(GpsEntity gps) {
20   - //是否在场内
21   - String parkCode = GeoUtils.gpsInCarpark(gps);
22   -
23   - if (parkCode != null) {
24   - gps.setInstation(2);
25   - gps.setStopNo(parkCode);
26   - gps.setCarparkNo(parkCode);
27   - }
28   -
29   - //是否在站内
30   - List<StationRoute> srs = GeoCacheData.getStationRoute(gps.getLineId(), gps.getUpDown());
31   - StationRoute station = GeoUtils.gpsInStation(gps, srs);
32   - if (station != null) {
33   - gps.setInstation(1);
34   - gps.setStopNo(station.getCode());
35   - gps.setStation(station);
36   - }
37   -
38   - //是否在进站前置围栏内
39   - String premiseCode = GeoUtils.gpsInPremiseGeo(gps);
40   - gps.setPremiseCode(premiseCode);
41   -
42   - //上一个点位
43   - GpsEntity prev = GpsCacheData.getPrev(gps);
44   -
45   - if (null != prev) {
46   - //继承前置围栏状态
47   - if (null == premiseCode && null != prev.getPremiseCode())
48   - gps.setPremiseCode(prev.getPremiseCode());
49   -
50   - //在场,站外
51   - if (gps.getInstation() == 0) {
52   - gps.setStopNo(prev.getStopNo());//继承上一个点的站点编码
53   - }
54   - }
55   - }
56   -}
  1 +package com.bsth.data.gpsdata_v2.handlers;
  2 +
  3 +import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
  4 +import com.bsth.data.gpsdata_v2.cache.GpsCacheData;
  5 +import com.bsth.data.gpsdata_v2.entity.GpsEntity;
  6 +import com.bsth.data.gpsdata_v2.entity.StationRoute;
  7 +import com.bsth.data.gpsdata_v2.utils.GeoUtils;
  8 +import com.bsth.entity.Station;
  9 +import org.springframework.stereotype.Component;
  10 +
  11 +import java.util.List;
  12 +
  13 +/**
  14 + * 站内 场内判定
  15 + * Created by panzhao on 2017/11/16.
  16 + */
  17 +@Component
  18 +public class StationInsideProcess {
  19 +
  20 + public void process(GpsEntity gps) {
  21 + //是否在场内
  22 + String parkCode = GeoUtils.gpsInCarpark(gps);
  23 +
  24 + if (parkCode != null) {
  25 + gps.setInstation(2);
  26 + gps.setCarparkNo(parkCode);
  27 + }
  28 +
  29 + //是否在站内
  30 + List<StationRoute> srs = GeoCacheData.getStationRoute(gps.getLineId(), gps.getUpDown());
  31 + StationRoute station = null;
  32 + for (StationRoute sr : srs) {
  33 + if (sr.getCode().equals(gps.getStopNo())) {
  34 + station = sr;
  35 + }
  36 + }
  37 + if (gps.getInOrOutStation() == 1) {
  38 + gps.setInstation(1);
  39 + gps.setStation(station);
  40 + }
  41 +
  42 + //是否在进站前置围栏内
  43 + String premiseCode = GeoUtils.gpsInPremiseGeo(gps);
  44 + gps.setPremiseCode(premiseCode);
  45 +
  46 + //上一个点位
  47 + GpsEntity prev = GpsCacheData.getPrev(gps);
  48 +
  49 + if (null != prev) {
  50 + //继承前置围栏状态
  51 + if (null == premiseCode && null != prev.getPremiseCode())
  52 + gps.setPremiseCode(prev.getPremiseCode());
  53 +
  54 + //在场,站外
  55 + if (gps.getInstation() == 0) {
  56 + gps.setStopNo(prev.getStopNo());//继承上一个点的站点编码
  57 + }
  58 + }
  59 + }
  60 +}
... ...
src/main/resources/static/pages/permission/authorize_all/user_auth.html
... ... @@ -159,37 +159,7 @@
159 159 //分公司名称映射(只用于分组展示,就写死)
160 160  
161 161 var fgs_name_mapp = {
162   - '55_3': '上南公司(六分公司)',
163   - '55_1': '上南公司(二分公司)',
164   - '55_2': '上南公司(三分公司)',
165   - '55_4': '上南公司(一分公司)',
166   - '55_5': '上南公司(培训部)',
167   - '22_2': '金高公司(二分公司)',
168   - '22_1': '金高公司(四分公司)',
169   - '22_3': '金高公司(三分公司)',
170   - '22_5': '金高公司(一分公司)',
171   - '26_3': '南汇公司(三分公司)',
172   - '26_2': '南汇公司(南汇二分)',
173   - '26_1': '南汇公司(南汇一分)',
174   - '26_4': '南汇公司(南汇维修公司)',
175   - '26_5': '南汇公司(南汇公司)',
176   - '26_6': '南汇公司(南汇六分)',
177   - '26_7': '南汇公司(南汇五分)',
178   - '05_5': '杨高公司(杨高分公司)',
179   - '05_6': '杨高公司(周浦分公司)',
180   - '05_3': '杨高公司(芦潮港分公司)',
181   - '05_1': '杨高公司(川沙分公司)',
182   - '05_2': '杨高公司(金桥分公司)',
183   - '26_11': '南汇公司(川沙分公司)',
184   - '26_12': '南汇公司(新场分公司)',
185   - '26_13': '南汇公司(惠南分公司)',
186   - '77_78': '闵行公司',
187   - '300_301': '金球公交',
188   - '99_100': '青浦公交',
189   - '24_1': '一车队',
190   - '24_2': '二车队',
191   - '24_3': '三车队',
192   - '77_1': '临港公交'
  162 + '100_101': '新城市公交'
193 163 };
194 164  
195 165 var defauleConfig;
... ...
src/main/resources/static/pages/permission/user/edit.html
1   -<div class="page-head">
2   - <div class="page-title">
3   - <h1>编辑用户</h1>
4   - </div>
5   -</div>
6   -
7   -<ul class="page-breadcrumb breadcrumb">
8   - <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
9   - <li><span class="active">权限管理</span> <i class="fa fa-circle"></i></li>
10   - <li><a href="list.html" data-pjax>用户管理</a> <i class="fa fa-circle"></i></li>
11   - <li><span class="active">编辑用户</span></li>
12   -</ul>
13   -
14   -<div class="portlet light bordered">
15   - <div class="portlet-title">
16   - <div class="caption">
17   - <i class="icon-equalizer font-red-sunglo"></i> <span
18   - class="caption-subject font-red-sunglo bold uppercase">表单</span>
19   - </div>
20   - </div>
21   - <div class="portlet-body form">
22   - <form action="/addUser" class="form-horizontal" id="user_edit_form" >
23   - <div class="alert alert-danger display-hide">
24   - <button class="close" data-close="alert"></button>
25   - 您的输入有误,请检查下面的输入项
26   - </div>
27   - <div class="form-body">
28   - <div class="form-group">
29   - <label class="col-md-3 control-label">登录名</label>
30   - <div class="col-md-4">
31   - <input type="hidden" id="id" name="id">
32   - <input type="text" class="form-control" id="userName" name="userName" readonly="readonly">
33   - <span class="help-block"> 登录时的帐号</span>
34   - </div>
35   - </div>
36   - <div class="form-group">
37   - <label class="col-md-3 control-label">姓名</label>
38   - <div class="col-md-4">
39   - <input type="text" class="form-control" id="name" name="name" readonly="readonly">
40   - </div>
41   - </div>
42   - <div class="form-group">
43   - <label class="col-md-3 control-label">所属机构</label>
44   - <div class="col-md-4">
45   - <input type="text" class="form-control" id="agencies" name="agencies" >
46   - </div>
47   - </div>
48   -
49   - <div class="form-group">
50   - <label class="col-md-3 control-label">角色</label>
51   - <div class="col-md-4">
52   - <select class="form-control" id="role" name="roles[]" style="width: 160px;" multiple="multiple">
53   -
54   - </select>
55   - </div>
56   - </div>
57   -
58   - <div class="form-group">
59   - <label class="col-md-3 control-label">是否启用</label>
60   - <div class="col-md-4">
61   - <div class="input-group">
62   - <select class="form-control" id="enabled" name="enabled" style="width: 160px;">
63   - <option value="1">可用</option>
64   - <option value="0">禁用</option>
65   - </select>
66   - </div>
67   - </div>
68   - </div>
69   - </div>
70   - <div>
71   - <!--<iframe src="authorize.html?origin=real_control_iframe" frameborder="0" style="height: 600px;width: 100%;"></iframe>-->
72   - </div>
73   - <div class="form-actions">
74   - <div class="row">
75   - <div class="col-md-offset-3 col-md-4">
76   - <!--<a href="main.html" class="btn green" id="nextStep" ><i class="fa fa-check"></i> 下一步</a>-->
77   - <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
78   - <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
79   - </div>
80   - </div>
81   - </div>
82   - </form>
83   - <!-- END FORM-->
84   - </div>
85   -</div>
86   -
87   -<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;left: 50%;
88   - top: 50%;transform: translate(-50%,-50%);min-width:50%;overflow: visible;bottom: inherit; right: inherit;">
89   - <div class="modal-dialog">
90   - <div class="modal-content">
91   - <div class="modal-body" style="text-align: center;"></div>
92   - <div class="modal-footer" style="margin: 0 auto;">
93   - <center>
94   - <button type="button" class="btn btn-primary" data-dismiss="modal" id="noNext" style="margin-right: 20%;padding:5px 35px;background-color: #337AB7;color: white;">&nbsp;完&nbsp;成&nbsp;</button>
95   - <button type="button" class="btn btn-primary" id="yesNext">继续配置授权</button>
96   - </center>
97   - </div>
98   - </div><!-- /.modal-content -->
99   - </div><!-- /.modal -->
100   -</div>
101   -<script>
102   - $(function(){
103   - var id = $.url().param('no');
104   - if(id){
105   - $get('/user/'+id,null,function(obj){
106   - $("#id").attr('value',obj.id);
107   - $("#userName").attr('value',obj.userName);
108   - $("#name").attr('value',obj.name);
109   - $("#agencies").attr('value',obj.agencies);
110   - /*$get('/role/all',null,function(result){
111   - $.each(result,function(i,r){
112   - $("#role").append("<option value='"+r.id+"'>"+r.roleName+"</option>");
113   - });
114   - $.each(obj.roles,function(i,obt){
115   - $("#role option[value="+obt.id+"]").attr("selected",true);
116   - });
117   - });*/
118   - // 查询下级角色
119   - $.get('/role/findSubordinate', function (rs) {
120   - if(rs.status == "SUCCESS"){
121   - $.each(rs.list,function(i,obj){
122   - $("#role").append("<option value='"+obj.id+"'>"+obj.roleName+"</option>");
123   - });
124   - }
125   - $.each(obj.roles,function(i,obt){
126   - $("#role option[value="+obt.id+"]").attr("selected",true);
127   - });
128   - });
129   - if(obj.enabled){
130   - $("#enabled option[value=1]").attr("selected",true);
131   - }else{
132   - $("#enabled option[value=0]").attr("selected",true);
133   - }
134   - });
135   -
136   - }else {
137   -
138   - // 缺少ID
139   - layer.confirm('【ID缺失,请点击返回,重新进行修改操作】', {btn : [ '返回' ],icon: 3, title:'提示'}, function(index){
140   -
141   - // 关闭弹出层
142   - layer.close(index);
143   -
144   - // 跳转到list页面
145   - loadPage('list.html');
146   -
147   - });
148   - }
149   -
150   - var form = $('#user_edit_form');
151   - var error = $('.alert-danger', form);
152   -
153   - //表单 validate
154   - form.validate({
155   - errorElement : 'span',
156   - errorClass : 'help-block help-block-error',
157   - focusInvalid : false,
158   - rules : {
159   - 'userName' : {
160   - required : true,
161   - maxlength: 25
162   - },
163   - 'name' : {
164   - required : true,
165   - maxlength: 25
166   - },
167   - 'role' : {
168   - required : true,
169   - minlength: 1
170   - }
171   - },
172   - invalidHandler : function(event, validator) {
173   - error.show();
174   - App.scrollTo(error, -200);
175   - },
176   -
177   - highlight : function(element) {
178   - $(element).closest('.form-group').addClass('has-error');
179   - },
180   -
181   - unhighlight : function(element) {
182   - $(element).closest('.form-group').removeClass('has-error');
183   - },
184   -
185   - success : function(label) {
186   - label.closest('.form-group').removeClass('has-error');
187   - },
188   -
189   - submitHandler : function(f) {
190   - var params = form.serializeJSON();
191   - error.hide();
192   - console.log(params);
193   -
194   - //检查一下用户是否存在
195   - $.ajax({
196   - url: '/user',
197   - type: 'POST',
198   - traditional: true,
199   - data: params,
200   - success: function(res){
201   - layer.msg('修改用户信息成功.');
202   - $('#myModal').modal();
203   - //loadPage('list.html');
204   - }
205   - });
206   - }
207   - });
208   -
209   - $('#noNext').click(function () {
210   - $('#myModal').modal('hide');
211   - $('.modal-backdrop').remove();
212   -
213   - loadPage('list.html');
214   - })
215   - $('#yesNext').click(function () {
216   - var storage = window.localStorage;
217   - storage.setItem("editUser",$('#id').val());
218   - $('#myModal').modal('hide');
219   - window.location.href='main.html'
220   - })
221   - });
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>编辑用户</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  9 + <li><span class="active">权限管理</span> <i class="fa fa-circle"></i></li>
  10 + <li><a href="list.html" data-pjax>用户管理</a> <i class="fa fa-circle"></i></li>
  11 + <li><span class="active">编辑用户</span></li>
  12 +</ul>
  13 +
  14 +<div class="portlet light bordered">
  15 + <div class="portlet-title">
  16 + <div class="caption">
  17 + <i class="icon-equalizer font-red-sunglo"></i> <span
  18 + class="caption-subject font-red-sunglo bold uppercase">表单</span>
  19 + </div>
  20 + </div>
  21 + <div class="portlet-body form">
  22 + <form action="/addUser" class="form-horizontal" id="user_edit_form" >
  23 + <div class="alert alert-danger display-hide">
  24 + <button class="close" data-close="alert"></button>
  25 + 您的输入有误,请检查下面的输入项
  26 + </div>
  27 + <div class="form-body">
  28 + <div class="form-group">
  29 + <label class="col-md-3 control-label">登录名</label>
  30 + <div class="col-md-4">
  31 + <input type="hidden" id="id" name="id">
  32 + <input type="hidden" id="jobCode" name="jobCode">
  33 + <input type="hidden" id="realName" name="realName">
  34 + <input type="hidden" id="lastPwdDate" name="lastPwdDate">
  35 + <input type="hidden" id="pwdValidPeriod" name="pwdValidPeriod">
  36 + <input type="text" class="form-control" id="userName" name="userName" readonly="readonly">
  37 + <span class="help-block"> 登录时的帐号</span>
  38 + </div>
  39 + </div>
  40 + <div class="form-group">
  41 + <label class="col-md-3 control-label">姓名</label>
  42 + <div class="col-md-4">
  43 + <input type="text" class="form-control" id="name" name="name" readonly="readonly">
  44 + </div>
  45 + </div>
  46 + <div class="form-group">
  47 + <label class="col-md-3 control-label">所属机构</label>
  48 + <div class="col-md-4">
  49 + <input type="text" class="form-control" id="agencies" name="agencies" >
  50 + </div>
  51 + </div>
  52 +
  53 + <div class="form-group">
  54 + <label class="col-md-3 control-label">角色</label>
  55 + <div class="col-md-4">
  56 + <select class="form-control" id="role" name="roles[]" style="width: 160px;" multiple="multiple">
  57 +
  58 + </select>
  59 + </div>
  60 + </div>
  61 +
  62 + <div class="form-group">
  63 + <label class="col-md-3 control-label">是否启用</label>
  64 + <div class="col-md-4">
  65 + <div class="input-group">
  66 + <select class="form-control" id="enabled" name="enabled" style="width: 160px;">
  67 + <option value="1">可用</option>
  68 + <option value="0">禁用</option>
  69 + </select>
  70 + </div>
  71 + </div>
  72 + </div>
  73 + </div>
  74 + <div>
  75 + <!--<iframe src="authorize.html?origin=real_control_iframe" frameborder="0" style="height: 600px;width: 100%;"></iframe>-->
  76 + </div>
  77 + <div class="form-actions">
  78 + <div class="row">
  79 + <div class="col-md-offset-3 col-md-4">
  80 + <!--<a href="main.html" class="btn green" id="nextStep" ><i class="fa fa-check"></i> 下一步</a>-->
  81 + <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  82 + <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
  83 + </div>
  84 + </div>
  85 + </div>
  86 + </form>
  87 + <!-- END FORM-->
  88 + </div>
  89 +</div>
  90 +
  91 +<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;left: 50%;
  92 + top: 50%;transform: translate(-50%,-50%);min-width:50%;overflow: visible;bottom: inherit; right: inherit;">
  93 + <div class="modal-dialog">
  94 + <div class="modal-content">
  95 + <div class="modal-body" style="text-align: center;"></div>
  96 + <div class="modal-footer" style="margin: 0 auto;">
  97 + <center>
  98 + <button type="button" class="btn btn-primary" data-dismiss="modal" id="noNext" style="margin-right: 20%;padding:5px 35px;background-color: #337AB7;color: white;">&nbsp;完&nbsp;成&nbsp;</button>
  99 + <button type="button" class="btn btn-primary" id="yesNext">继续配置授权</button>
  100 + </center>
  101 + </div>
  102 + </div><!-- /.modal-content -->
  103 + </div><!-- /.modal -->
  104 +</div>
  105 +<script>
  106 + $(function(){
  107 + var id = $.url().param('no');
  108 + if(id){
  109 + $get('/user/'+id,null,function(obj){
  110 + $("#id").attr('value',obj.id);
  111 + $("#userName").attr('value',obj.userName);
  112 + $("#name").attr('value',obj.name);
  113 + $("#agencies").attr('value',obj.agencies);
  114 + $("#jobCode").attr('value',obj.jobCode);
  115 + $("#realName").attr('value',obj.realName);
  116 + $("#lastPwdDate").attr('value',obj.lastPwdDate);
  117 + $("#pwdValidPeriod").attr('value',obj.pwdValidPeriod);
  118 + /*$get('/role/all',null,function(result){
  119 + $.each(result,function(i,r){
  120 + $("#role").append("<option value='"+r.id+"'>"+r.roleName+"</option>");
  121 + });
  122 + $.each(obj.roles,function(i,obt){
  123 + $("#role option[value="+obt.id+"]").attr("selected",true);
  124 + });
  125 + });*/
  126 + // 查询下级角色
  127 + $.get('/role/findSubordinate', function (rs) {
  128 + if(rs.status == "SUCCESS"){
  129 + $.each(rs.list,function(i,obj){
  130 + $("#role").append("<option value='"+obj.id+"'>"+obj.roleName+"</option>");
  131 + });
  132 + }
  133 + $.each(obj.roles,function(i,obt){
  134 + $("#role option[value="+obt.id+"]").attr("selected",true);
  135 + });
  136 + });
  137 + if(obj.enabled){
  138 + $("#enabled option[value=1]").attr("selected",true);
  139 + }else{
  140 + $("#enabled option[value=0]").attr("selected",true);
  141 + }
  142 + });
  143 +
  144 + }else {
  145 +
  146 + // 缺少ID
  147 + layer.confirm('【ID缺失,请点击返回,重新进行修改操作】', {btn : [ '返回' ],icon: 3, title:'提示'}, function(index){
  148 +
  149 + // 关闭弹出层
  150 + layer.close(index);
  151 +
  152 + // 跳转到list页面
  153 + loadPage('list.html');
  154 +
  155 + });
  156 + }
  157 +
  158 + var form = $('#user_edit_form');
  159 + var error = $('.alert-danger', form);
  160 +
  161 + //表单 validate
  162 + form.validate({
  163 + errorElement : 'span',
  164 + errorClass : 'help-block help-block-error',
  165 + focusInvalid : false,
  166 + rules : {
  167 + 'userName' : {
  168 + required : true,
  169 + maxlength: 25
  170 + },
  171 + 'name' : {
  172 + required : true,
  173 + maxlength: 25
  174 + },
  175 + 'role' : {
  176 + required : true,
  177 + minlength: 1
  178 + }
  179 + },
  180 + invalidHandler : function(event, validator) {
  181 + error.show();
  182 + App.scrollTo(error, -200);
  183 + },
  184 +
  185 + highlight : function(element) {
  186 + $(element).closest('.form-group').addClass('has-error');
  187 + },
  188 +
  189 + unhighlight : function(element) {
  190 + $(element).closest('.form-group').removeClass('has-error');
  191 + },
  192 +
  193 + success : function(label) {
  194 + label.closest('.form-group').removeClass('has-error');
  195 + },
  196 +
  197 + submitHandler : function(f) {
  198 + var params = form.serializeJSON();
  199 + error.hide();
  200 + console.log(params);
  201 +
  202 + //检查一下用户是否存在
  203 + $.ajax({
  204 + url: '/user',
  205 + type: 'POST',
  206 + traditional: true,
  207 + data: params,
  208 + success: function(res){
  209 + layer.msg('修改用户信息成功.');
  210 + $('#myModal').modal();
  211 + //loadPage('list.html');
  212 + }
  213 + });
  214 + }
  215 + });
  216 +
  217 + $('#noNext').click(function () {
  218 + $('#myModal').modal('hide');
  219 + $('.modal-backdrop').remove();
  220 +
  221 + loadPage('list.html');
  222 + })
  223 + $('#yesNext').click(function () {
  224 + var storage = window.localStorage;
  225 + storage.setItem("editUser",$('#id').val());
  226 + $('#myModal').modal('hide');
  227 + window.location.href='main.html'
  228 + })
  229 + });
222 230 </script>
223 231 \ No newline at end of file
... ...