hdw
2019-01-18 8306010ebd06cdef8237fa06c32463b7ecf3e3c6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户密码重置</title>    
    <link rel="stylesheet" type="text/css" href="css/basic.css">
    <link rel="stylesheet" type="text/css" href="css/query.css">
    <link rel="stylesheet" type="text/css" href="css/confirm.css">
    <link rel="stylesheet" type="text/css" href="css/nocontent.css">
    <link rel="stylesheet" type="text/css" href="jqueryui/jquery-ui.css">
    
    <style type="text/css" media="screen">
        .search-user {
            position: fixed;
            width: 30px;
            right: 20px;
            bottom: 60px;
            z-index: 99;
            background-color: #FFFFFF;
            border: 1px solid #aaa;
            border-radius: 16px;            
        }
 
        .search-user:hover {
            width: 235px;
        }
        .search-user .search-input {
            float: left;
            display: none;
            margin-left: 20px;
        }
        .search-user:hover .search-input {
            display: block;
        }
        .search-user .search-input input {
            width: 180px;
            height: 30px;
            outline: none;
        }
        .search-user .search-btn {
            float: left;
        }
        .search-user .search-btn a{
            display: block;
            width: 30px;
            height: 30px;
            background-image: url('image/user-search.gif');
            background-position: 4px;
            background-repeat: no-repeat;
        }
        .reset-pwd {
            cursor: pointer;
        }
    </style>
</head>
<body>
    <!--头部内容开始-->
    <jsp:include page="Top.jsp" flush="true"/>
    <!--头部内容结束-->
    <!--导航开始-->
    <jsp:include page="nav.jsp" flush="true"/>
    
    <!--头部内容结束-->
    <div id="main">
        <div class="tbl-header"></div>        
        <div class="tbl-body"></div>        
        <!-- 分页内容 -->
        <div id="paging">
            当前<span id="current">1/1</span>
            <span>每页<input type="text" id="number" value="10"/>条</span>
            &nbsp;&nbsp;数据总量<span id="total">10</span>
            <a href="javascript:" id="home">首页</a>
            <a href="javascript:" id="pre">上一页</a>
            <a href="javascript:" id="next_p">下一页</a>
            <a href="javascript:" id="last">尾页</a>
        </div>                
    </div>
    <!-- 用户查询 -->
    <div class="search-user">
        <div class="search-input"><input type="text" id="keyword" placeholder="请输入关键字"></div>
        <div class="search-btn"><a href="javascript:searchUser();" title="查询"></a></div>
    </div>    
    <script type="text/javascript" src="js/buildNav.js"></script>
    <script type="text/javascript" src="js/createTab.js"></script>
    <script type="text/javascript" src="js/query.js"></script>
    <script type="text/javascript" src="js/myConfirm.js"></script>
    <script type="text/javascript" src="js/nocontent.js"></script>
    <script type="text/javascript" src="js/pageUtil.js"></script>
    <script type="text/javascript">
        var Page = {
            pageCurr:1,
            pageSize:10,
            pageAll:0
        };
        var alluser = new Array();
        var arrTh = new Array();
        var arrTd = new Array();
        arrTh = [
            '员工编号', '员工姓名', '性别', '身份证号', '职称', '手机号码', '密码重置'
        ];
 
        $(function () {
            /* arrTd = [
                '10001', '张三', '男', '463485228455895', '软件工程师', '12456243247', '<img src="image/reset-pwd.gif" class="reset-pwd" title="重置密码"/>',
                '10001', '张三', '男', '463485228455895', '软件工程师', '12456243247', '<img src="image/reset-pwd.gif" class="reset-pwd" title="重置密码"/>'
            ]; */
            //createFullTbl($('.tbl-header'), $('.tbl-body'), arrTh, arrTd);
        });
 
        $(function() {
            $('.tbl-body').on('click', '.reset-pwd', function() {
                var trIndex= $(this).parent().parent().index();
                var obj = alluser[trIndex];
                var cont = "是否重置'"+obj.UName+"'的密码?<input type='hidden' kk='"+obj.UName+"' id='user-uid' value='"+obj.UId+"'>";
                myConfirm.show({content: cont, class: 'reset-pwd-btn'});
            });
 
            myConfirm.confirm.on('click','.reset-pwd-btn',function() {
                //myConfirm.hide();
                //noContent.showNoContent('重置成功!!!');
                resetPass({
                    UId:$('#user-uid').val(),
                    UName:$('#user-uid').attr('kk')
                });
            });
        });    
        
        //重置用户密码
        function resetPass(temp){
            $.ajax({     
                type: "post",                 
                url: "User_infAction!resetPassword",                
                async:true,                
                dataType:'text',
                data:"upjson="+JSON.stringify(temp),        
                success: function(data){ 
                    data = eval("("+data+")");
                    var model = eval("("+data.result+")");
                    console.info(model);
                    if(model.code==1){
                        noContent.showNoContent("密码重置成功!");
                    }else{
                        noContent.showNoContent("密码重置失败!");
                    }
                    myConfirm.hide();
                },
                error:function(){
                    myConfirm.hide();
                    noContent.showNoContent("密码重置失败,请检查网络连接!");
                }            
            });
        }        
        
        searchUser();
        //模糊查询用户
        function searchUser(){
            loading.showLoading($('#main'));
            var temp = {
                uinf:{
                    UName:$('#keyword').val(),
                    UEmployeeId:$('#keyword').val(),
                },
                page:Page
            };
            arrTd = new Array();
            alluser = new Array();
            $.ajax({     
                type: "post",                 
                url: "User_infAction!searchByNameOrId",                
                async:true,                
                dataType:'text',
                data:"upjson="+JSON.stringify(temp),        
                success: function(data){ 
                    data = eval("("+data+")");
                    var model = eval("("+data.result+")");
                    console.info(model);
                    alluser = model.data;
                    if(model.code==1){
                        for(var i=0;i<model.data.length;i++){
                            arrTd.push(model.data[i].UEmployeeId);
                            arrTd.push(model.data[i].UName);
                            arrTd.push(model.data[i].USex);
                            arrTd.push(model.data[i].UShenFenId);
                            arrTd.push(model.data[i].UAuthority);
                            arrTd.push(model.data[i].UMobilephone);
                            arrTd.push('<img src="image/reset-pwd.gif" class="reset-pwd" title="重置密码"/>');
                            Page.pageAll = parseInt(model.data[i].UNote);
                        }
                    }else{
                        Page.pageAll = 0;
                        Page.pageCurr = 1;
                        noContent.showNoContent("暂无查询数据");
                    }
                    var pagenum = Math.ceil(Page.pageAll/Page.pageSize);
                    $('#current').text(Page.pageCurr+'/'+pagenum);
                    $('#total').text(Page.pageAll);
                    loading.hideLoading($('#main'));
                    createFullTbl($('.tbl-header'), $('.tbl-body'), arrTh, arrTd);        
                },
                error:function(){
                    loading.hideLoading($('#main'));
                }            
            });
        }    
        
        //当用户按回车时相当于查询
        $(window).keypress(function(){
            if(event.keyCode==13) 
                searchUser();
        });
        
        
        $(function(){
            //跳转到首页
            $('#home').click(function(){
                GotoFirstPage(Page,searchUser);
            });
            
            //跳转到上一页
            $('#pre').click(function(){
                GotoPrePage(Page,searchUser);
            });
            
            //跳转到下一页
            $('#next_p').click(function(){
                GotoNextPage(Page,searchUser);
            });
            
            //跳转到尾页
            $('#last').click(function(){
                GotoLastPage(Page,searchUser);
            });
            
            $('#number').blur(function(){
                var pagesize = $(this).val();
                if(pagesize>0){
                    Page.pageSize = parseInt(pagesize);
                }else{
                    noContent.showNoContent("请输入规范的整数");
                    $(this).val(Page.pageSize);
                }
            });
        });
    </script>        
</body>
</html>