hdw
2019-01-18 9c670af9d062caf6ee2a3835c52932ba11b05a3e
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
<%@ 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=EmulateIE10" />
    <title><s:text name="Operation_record_query"/></title>                <!-- 用户操作记录查询 -->
    <link rel="stylesheet" type="text/css" href="css/basic.css">
    <link rel="stylesheet" type="text/css" href="css/BrdwDeal.css">
    <script type="text/javascript" src="js/frame.js"></script>
    <script type="text/javascript" src="js/jquery-1.8.3.js"></script>
    <script type="text/javascript" src="js/base.js"></script>
    <style type="text/css">
        /*定义被鼠标点击的背景色*/
        .b8cfe5{
            background-color:#b8cfe5;
        }
    </style>
</head>
<body>
    <!--头部内容开始-->
    <jsp:include page="Top.jsp" flush="true"/>
    <!--头部内容结束-->
    <!-- 主体内容 -->
    <div id="main">
        <!-- 导航开始 -->
        <jsp:include page="nav.jsp" flush="true"/>
        <!-- 导航结束 -->
        <div id="eleInfor">
            <div class="checkCon">
                <input type="hidden" value="1" name="bup.page.pageCurr" id="pageCurr" />
                <input type="hidden" value="10" name="bup.page.pageSize" id="pageSize" />
                <form action="" id="search_form">
                <table>
                    <tr class="fWeight">
                        <td style="width:30%"><s:text name="Name_of_person"/></td>            <!-- 操作人姓名 -->
                        <td style="width:40%"><s:text name="Operation_type"/></td>            <!-- 操作类型 -->
                        <td colspan="2"><s:text name="Operation_record_time"/></td>            <!-- 操作记录时间段 -->
                    </tr>
                    <tr>
                        <td>
                            <select name="bup.uinf.UName" id="baojiren">                                
                            </select>
                        </td>
                        <td>
                            <select name="bup.ulog.uOprateType" id="uOprateType">
                                <option value="0"><s:text name="All"/></option>                    <!-- 全部 -->
                                <option value="1"><s:text name="Login_system"/></option>        <!-- 登录系统 -->
                                <option value="2"><s:text name="Logout_system"/></option>        <!-- 登出系统 -->
                                <option value="3"><s:text name="Increase"/></option>            <!-- 增加 -->
                                <option value="4"><s:text name="Alter"/></option>                <!-- 更改 -->
                                <option value="5"><s:text name="Delete"/></option>                <!-- 删除 -->
                                <option value="6"><s:text name="Set_up"/></option>                <!-- 设置 -->
                                <option value="7"><s:text name="Cancel"/></option>                <!-- 取消 -->
                                <option value="8"><s:text name="Start_up"/></option>            <!-- 启动 -->
                                <option value="9"><s:text name="End"/></option>                    <!-- 终止 -->
                                <option value="10">批量操作</option>                                <!-- 批量操作 -->
                            </select>
                        </td>
                        <td><input type="text" name="bup.ulog.uOprateDay" readonly="readonly" id="startrecorddate" value="2000-1-1" onfocus="showCalendar(this)"  class="FixedLen"></td>
                        <td><input type="text" name="bup.ulog.uOprateDay1" readonly="readonly" id="endrecorddate" onfocus="showCalendar(this)"  class="FixedLen"></td>
                    </tr>
                </table>
                </form>
            </div>
        </div>
        <!-- 表格固定的头部 -->
        <div id="tbHead">
            <!-- <table class="tbFixed">这里是表格固定头部的内容</table> -->
        </div>
        <!-- 表格滚动的部分 -->
        <div id="tbBrdw">
            <!-- <table class="tbScroll">这里是表格滚动的内容</table> -->
        </div>
        
        <!-- 分页内容 -->
        <div id="paging">
            <a href="javascript:" class="search"><s:text name="Search"/><!-- 查询 --></a>
            &nbsp;&nbsp;<s:text name="At_present"/><!-- 当前 --><span id="current">1/0</span>
            <span><s:text name="Each_page"/><!-- 每页 --><input type="text" id="number" value="10"/><s:text name="Item"/><!-- 条 --></span>
            &nbsp;&nbsp;<s:text name="Total_data"/><!-- 数据总量 --><span id="total">0</span>
            <a href="javascript:" id="home"><s:text name="HomePage"/><!-- 首页 --></a>
            <a href="javascript:" id="pre"><s:text name="Page_Up"/><!-- 上一页 --></a>
            <a href="javascript:" id="next_p"><s:text name="Page_Down"/><!-- 下一页 --></a>
            <a href="javascript:" id="last"><s:text name="End_Page"/><!-- 尾页 --></a>
            <span id="cont">
                <s:text name="Goto"/><!-- 转到 --><input type="text" id="page_num" value="1"/>
                <a href="javascript:" id="go"><s:text name="Jump"/><!-- 跳转 --></a>
            </span>
        </div>
    </div>
    <!-- 主体内容结束 -->
    <!--清除浮动-->
    <div class="clear"></div>
</body>
<script type="text/javascript" src="js/createTab.js"></script>
<script type="text/javascript">
    var permits;
    <%    Object obj=session.getAttribute("permits");
        if(obj!=null){
            String permits =obj.toString();  %>
            permits=<%=permits%>;
            //console.info(json);
    <%    }    %>
 
    var Page;        //分页信息    
 
    //初始化页面内容
    $(document).ready(function(){
        //setUserName();
        
        //定义页面高度
        var srnHt=$(window).height();    //浏览器可以区域的高度
        var bodyHt=$('body').height();    //body的高度
        var tbHt=$('#tbBrdw').height();    //表格容器的高度
        //对比浏览器和body高度
        if(srnHt>bodyHt)
        {
            $('#tbBrdw').height(tbHt+srnHt-bodyHt - 32);
        }
        $(window).resize(function(){
            var newSrnHt=$(window).height();    //浏览器可以区域的高度
            var newBodyHt=$('body').height();    //body的高度
            var newTbHt=$('#tbBrdw').height();    //表格容器的高度
            $('#tbBrdw').height(newTbHt+newSrnHt-newBodyHt);
        });
    });
    
    var ArrTd = [];        //表格内的数据
    var ArrTh = [];
    var formjson;
    //生成表格及表格内的事件
    $(document).ready(function(){
        //定义表格的数据
        ArrTh=new Array();    //定义表格头部数据
        ArrTd=new Array();    //定义表格内的数据
        // 自定义表格头部数据         用户ID            操作人姓名                                操作类型                                    操作时间                    终端IP                            操作事件
        ArrTh=['<s:text name="UserID"/>','<s:text name="Name_of_person"/>','<s:text name="Operation_type"/>','<s:text name="Operate_time"/>','<s:text name="Terminal_IP"/>','<s:text name="Operation_event"/>'];            
        //生成表格头部
        createTable('tbHead','tbFixed',ArrTh.length,ArrTh,ArrTd);
        //让表头适应容器
        var tbHeadWidth=$('#tbHead').width();    //容器的宽度
        $('#tbHead .tbFixed').width(tbHeadWidth-20);
        
        //点击查询按钮根据查询条件生成表格
        $('#paging .search').click(function(){
            searchAllOptNotes()
        });
        // 点击表格该行背景色改变
        $('#tbBrdw').on('click','.tbScroll tbody tr',function(){
            // 给被选中的行添加class='b8cfe5',未被选中的移除class='b8cfe5'
            $('#tbBrdw .tbScroll tbody tr').removeClass('b8cfe5');
            $(this).addClass('b8cfe5');
        });
    });
    
    //查询包机人
    $.post("User_infAction_searchAll",null,function(data){
        data=data.result;
        model=eval("("+data+")");
        //console.info(data);
        if(model.code==1 && model.data.length>0){
            var Obaojiren=document.getElementById("baojiren");
            Obaojiren.innerHTML="";
            //console.info(model)
            for(var i=0;i<=model.data.length;i++){
                var option=createEle("option");
                //console.info(model.data.length);
                if(i!=0){
                    option.innerHTML=model.data[i-1].UName;
                    option.setAttribute("value", model.data[i-1].UName);    
                }else{
                    option.innerHTML="全部(共"+model.data.length+"种)";
                    option.setAttribute("value", "");    
                }
                Obaojiren.appendChild(option);
                searchAllOptNotes(); // 查询所有的操作记录
            }
        }
    });
    
    //页面加载时初始化时间
    $(document).ready(function(){
        var date=new Date();
        //var date1=new Date(2000,1,1);
        
        var year=date.getFullYear();
        var month=date.getMonth()+1;
        var day=date.getDate();
        var today=year+"-"+month+"-"+day;
        $("#endrecorddate").attr("value",today);
    });    
    
    //根据操作类型获取操作
    function getuOprateType(type){
        var opaatetype="";
        if(type!=undefined && type>0){            
            switch(type){
                case 1:opaatetype="<s:text name='Login_system'/>";break;        /* 登录系统 */
                case 2:opaatetype="<s:text name='Logout_system'/>";break;        /* 登出系统 */
                case 3:opaatetype="<s:text name='Increase'/>";break;            /* 增加 */
                case 4:opaatetype="<s:text name='Alter'/>";break;                /* 更改 */
                case 5:opaatetype="<s:text name='Delete'/>";break;                /* 删除 */
                case 6:opaatetype="<s:text name='Set_up'/>";break;                /* 设置 */
                case 7:opaatetype="<s:text name='Cancel'/>";break;                /* 取消 */
                case 8:opaatetype="<s:text name='Start_up'/>";break;            /* 启动 */
                case 9:opaatetype="<s:text name='End'/>";break;                    /* 终止 */
                case 10:opaatetype="批量操作";break;                                /* 批量操作 */
            }            
        }
        return opaatetype;
    }
    
    // 查询所有的操作记录
    function searchAllOptNotes() {
        var jsontemp = $('#search_form').serialize();
        if(formjson != jsontemp){
            $('#pageCurr').val(1);
            formjson = jsontemp;
        }
    
        //生成等待框
        createWait($('#tbBrdw'));
        //清除表格内容
        $('#tbBrdw table').remove();
        ArrTd=new Array();
        Page=null;
        //console.info($("#search_form").serialize());
        var json = JSON.stringify(createSearchForm());
        //console.info(json);
        $.post("User_logAction!serchByCondition","result="+json,function(data){
            data=data.result;
            model=eval("("+data+")");
            if(model.code==1 && model.data.length>0){
                var index=0;
                for(var i=0;i<model.data.length;i++){
                    //console.info(model);
                    data=model.data[i];
                    //console.info(data);
                    Page=data.page;
                    ArrTd[index++]=data.ulog.uId;                            //用户id
                    ArrTd[index++]=data.uinf.UName;                            //操作人姓名
                    ArrTd[index++]=getuOprateType(data.ulog.uOprateType);    //操作类型
                    ArrTd[index++]=data.ulog.uOprateDay;                    //操作时间
                    ArrTd[index++]=data.ulog.uTerminalIp;                    //终端ip
                    ArrTd[index++]=data.ulog.uOprateMsg;                    //操作事件
                }
            }                
            
            //清除表格的头部
            $('#tbHead table').remove();
            //生成表格
            createTable('tbHead','tbFixed',ArrTh.length,ArrTh,ArrTd);
            createTable('tbBrdw','tbScroll',ArrTh.length,ArrTh,ArrTd);
            //清除等待框
            $('#tbBrdw .wait').remove();
            var tbHeadWidth=$('#tbHead').width();    //容器的宽度
            $('#tbHead .tbFixed').width(tbHeadWidth-20);
            $('#tbBrdw .tbScroll').width(tbHeadWidth-20);
            //console.info(Page);
            if(Page!=undefined && Page!=null){
                var pagesize=$('#pageSize').attr('value');
                var pagecurr=$('#pageCurr').attr('value');
                $('#total').text(Page.pageAll);
                var pageNum=Math.ceil(Page.pageAll/pagesize);
                $('#current').text(pagecurr+"/"+pageNum);
                $('#page_num').attr('value',pagecurr);
            }else{
                $('#pageCurr').attr('value',1);
                $('#total').text(0);
                $('#current').text(1+"/"+0);
                $('#page_num').attr('value',1);
            }                
        });
    }
    
    
    //首页
    $('#home').click(function(){        
        var currentPage=$('#pageCurr').attr('value');
        if(currentPage!=1){
            $("#pageCurr").attr("value",1);            
            $("#paging .search").click();
        }
    });
    
    //点击上一页
    $('#pre').click(function(){
        var currentPage=$('#pageCurr').attr('value');
        if(currentPage>1){
            $("#pageCurr").attr('value',currentPage-1);
            $("#paging .search").click();
        }
    });
    
    
    //点击下一页
    $("#next_p").click(function(){
        if(Page!=undefined){
            var PageCurr=$('#pageCurr').attr('value');
            var PageSize=$('#pageSize').attr('value');
            var pageNum=Math.ceil(Page.pageAll/PageSize);            
            if(PageCurr<pageNum){
                //console.info(Page);
                $('#pageCurr').attr('value',(parseInt(PageCurr)+1)+"");                                
                $("#paging .search").click();
            }
        }
    });
    
    //尾页
    $('#last').click(function(){
        if(Page !=undefined){
            var PageSize=$('#pageSize').attr('value');
            var pageNum=Math.ceil(Page.pageAll/PageSize);
            var currPage=Page.pageCurr;
            if(currPage<pageNum){
                $('#pageCurr').attr('value',pageNum);
                $("#paging .search").click();
            }
        }
    });
    
    
    //设置每页行数
    $('#number').blur(function(){
        var value=$('#number').attr("value");        
        //当输入的数大于0时
        if(value>0){
            value=parseInt(value);    
            if(value != $('#pageSize').val()){
                $('#pageCurr').val(1);
                $('#number').attr('value',value);
                $('#pageSize').attr('value',value);
            }        
        }else{
        //当输入非法数字时
            alert("<s:text name='Please_enter_the_legitimate_number!'/>");                /* 请输入合法的整数 */
            $('#number').attr('value',$('#pageSize').attr('value'));
        }
    });
    
    //填写完跳转到指定页
    $('#page_num').blur(function(){
        var tarpage=$('#page_num').attr('value');
        if(tarpage>0){                    
        }else{
            alert("<s:text name='Please_enter_the_legitimate_number!'/>");                /* 请输入合法的整数 */
            $('#page_num').attr('value',$('#pageCurr').attr('value'));
        }
    });
    
    //点击跳转
    $('#go').click(function(){
        var tarpage=$('#page_num').attr('value');
        tarpage=parseInt(tarpage);
        if(Page!=undefined && Page!=null){
            var PageSize=$('#pageSize').attr('value');
            var pageNum=Math.ceil(Page.pageAll/PageSize);
            if(tarpage>pageNum){
                tarpage=pageNum;
                $('#page_num').attr('value',pageNum);
            }
            $('#pageCurr').attr('value',tarpage);
            $("#paging .search").click();
        }else{
            $('#pageCurr').attr('value',$('#pageCurr').attr('value'));
        }        
    });    
    
    //构造查询条件对象
    function createSearchForm(){
        var temp={
            page:{
                pageCurr:$('#pageCurr').val(),
                pageSize:$('#pageSize').val(),
            },
            uinf:{
                UName:$('#baojiren').val(),
            },
            ulog:{
                uOprateType:$('#uOprateType').val(),
                uOprateDay:$('#startrecorddate').val()+" 00:00:00",
                uOprateDay1:$('#endrecorddate').val()+" 23:59:59",
            }
        };
        return temp;
    }
 
    
</script>
</html>