lxw
2020-07-11 9db52f2f2dd3665fe9da1ae5657e0167c3a34d40
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
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
<%@ 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="User_manage"/></title>
    <link href="css/infor.css" type="text/css" rel="stylesheet" />
    <link href="css/basic.css" type="text/css" rel="stylesheet" />
    <link href="css/staffInfor.css" type="text/css" rel="stylesheet" />
    <link href="css/confirm.css" type="text/css" rel="stylesheet" />
    <link href="src/css/layui.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="js/jquery-1.8.3.js"></script>
    <!-- <script type="text/javascript" src="js/base.js"></script> -->
    <style>
        .b8cfe5{
            background-color:#b8cfe5;
        }
        .red{
            color:red;
        }
        .blue{
            color:blue;
        }
    </style>
</head>
<body>
    <!--头部内容开始-->
    <jsp:include page="Top.jsp" flush="true"/>
    <!--头部内容结束-->
    <div id="main">
        <!--导航开始-->
        <jsp:include page="nav.jsp" flush="true"/>    
        <!--导航结束-->
        <div id="tbHead"><!-- 员工信息表头部 --></div>
        <div id="staff-infor">
            <!-- 员工信息表 -->
            <div class="slide"></div>
        </div>
        <!-- 清除浮动 -->
        <div class="clear"></div>
        <!-- 包机人左侧信息 -->
        <div id="left">
            <p class="fweight"><s:text name="Chartere_room_(chartered_room_equipment)"/>(<span id="stationNum">0</span>)</p>            <!-- 包机机房(或包机机房设备) -->
            <div id="tb-room-infor"><!-- 机房信息表格的内容 --></div>
        </div>
        <!-- 包机人右侧信息 -->
        <div id="right">
            <!-- 包机机房详细内容 -->
            <table>
                <thead>
                  <tr>
                    <th><s:text name="Chartere_room_(chartered_room_equipment)"/></th>                <!-- 包机机房(或包机机房设备) -->
                    <th><s:text name="Charter_battery_pack"/>(<span id="battNum">0</span>)</th>        <!-- 包机电池组 -->
                  <tr>
                </thead>
            </table>
            <div id="tb-room"></div>
        </div>
        <form id="export_excel" action="ExportTable.servlet" method="post">
            <input type="hidden" name="PageName" value="infor_manage.jsp"/>
            <input type="hidden" id="table_th_arr" name="table_th_arr"/>
            <input type="hidden" id="table_td_arr" name="table_td_arr"/>
        </form>    
        <!-- 清除浮动 -->
        <div class="clear"></div>
        <!-- 分页内容 -->
        <div id="paging">
            <form id="search_form" method="get">
                <input type="hidden" value="1" name="bup.page.pageCurr" id="pageCurr" />
                <input type="hidden" value="10" name="bup.page.pageSize" id="pageSize" />
            </form>
            <a href="javascript:" class="search"><s:text name="Search"/><!-- 查询 --></a>
            <a href="javascript:" class="export"><s:text name="Export"/><!-- 导出 --></a>
            <a href="javascript:" class="cardOpt"><s:text name="Table_options"/><!-- 表格选项 --></a>
            <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" onfocus="this.type='text'" autoComplete="off">
                    <input type="text" style="display:none;" id="456" value="1" onfocus="this.type='text'" autoComplete="off">
                <a href="javascript:" id="go"><s:text name="Jump"/><!-- 跳转 --></a>
            </span>
        </div>
    </div>
    <!-- 表格选项内容 -->
    <div id="cardOption">
        <span><s:text name="Options"/></span>        <!-- 选项 -->
        <div class="tbHead"></div>
        <div class="con_table"></div>
        <div class="input_container">
            <input type="button" id="enCardOption" value="<s:text name='Determine'/>">        <!-- 确定 -->
            <input type="button" id="outCardOption" value="<s:text name='Return'/>">        <!-- 返回 -->
        </div>
    </div>
    
    <!--用户的编辑和添加-->
    <div id="staffInfor">
        <div class="staff-head"><s:text name="Add_user"/></div>                <!-- 添加用户 -->
        <div class="container">
            <div class="content">
                <div class="cont-head staff-basic-img"><s:text name="Employee_basic_information"/></div>        <!-- 员工基础信息 -->
                <div class="cont-list">
                    <span><s:text name="Maintenance_area"/>:</span>                <!-- 维护区 -->
                    <select class="area">
                    </select>
                    <span><s:text name="Full_name"/>:</span><input type="text" class="staff-name" />            <!-- 姓名 -->
                    <span><s:text name="Password"/>:</span><input type="password" class="staff-pwd"/>            <!-- 密码 -->
                    <span><s:text name="Sex"/>:</span>                                                            <!-- 性别 -->
                    <select class="sex">
                        <option value="男"><s:text name="Man"/></option>            <!-- 男 -->
                        <option value="女"><s:text name="Woman"/></option>        <!-- 女 -->
                    </select>
                </div>
                <div class="cont-list">
                    <span><s:text name="ID_number"/>:</span><input type="text" class="staff-id-card"/>                        <!-- 身份证 -->
                    <span><s:text name="Employee_number"/>:</span><input type="text" class="staff-num">                        <!-- 员工编号 -->
                    <span><s:text name="Birthday"/>:</span><input type="text" class="staff-birth" readonly="readonly">        <!-- 出生日期 -->
                </div>
                
                <div class="cont-head staff-tel-img"><s:text name="Employee_contact_method"/></div>                            <!-- 员工联系方式 -->
                <div class="cont-list">
                    <span><s:text name="Telephone"/>:</span><input type="text" class="staff-tel"/>        <!-- 电话 -->
                    <span><s:text name="Handset"/>:</span><input type="text" class="staff-phone">        <!-- 手机 -->
                    <span><s:text name="Mailbox"/>:</span><input type="text" class="staff-email">        <!-- 邮箱 -->
                </div>
                <div class=cont-list>
                    <span><s:text name="Address"/>:</span><input type="text" class="staff-addr">        <!-- 地址 -->
                </div>
                
                <div class="cont-head staff-work-img"><s:text name="Staff_work_content"/></div>            <!-- 员工工作内容 -->
                <div class="cont-list">
                    <span><s:text name="Technical_title"/>:</span><input type="text" class="staff-pos" />    <!-- 职称 -->
                    <span><s:text name="Entry_date"/>:</span><input type="text" class="start-work-time" readonly="readonly">    <!-- 入职日期 -->
                    <span><s:text name="Remark"/>:</span><input type="text" class="remarks" />                <!-- 备注 -->
                </div>
                <div class="cont-list">
                    <span><s:text name="Job_content"/>:</span><input type="text" class="work-cont" />            <!-- 工作内容 -->
                    <span><s:text name="Operating_duty"/>:</span><input type="text" class="work-duty">            <!-- 工作职责 -->
                    <span><s:text name="Work_team"/>:</span><select class="work-group"></select>                <!-- 工作班组 -->
                </div>
                <div class="cont-list">
                    <span><s:text name="Permission_description"/>:</span><input type="text" class="power-dscb">    <!-- 权限描述 -->
                    <!-- <span>权限组名称:</span><input type="text" class="power-group"/> -->
                    <span><s:text name="IsorNot_charte_person"/>:</span>                <!-- 是否包机人 -->
                    <select class="is-charter">
                        <option value="1"><s:text name="Yes"/></option>            <!-- 是 -->
                        <option value="0"><s:text name="No"/></option>            <!-- 否 -->
                    </select>
                </div>
                <div class="cont-list end">
                    <input type="button" class="ensure" value="<s:text name='Determine'/>">            <!-- 确定 -->
                    <input type="button" class="out" value="<s:text name='Exit'/>">                    <!-- 退出 -->
                </div>
            </div>
        </div>
    </div>
    
    <!-- 整体透明遮罩层 -->
    <div id="allShade" style="z-index: 9997"></div>
</body>
<script type="text/javascript" src="js/createTab.js"></script>
<script type="text/javascript" src="js/myConfirm.js"></script>
<script type="text/javascript" src="src/layui.all.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 uidlist;                        //所有的用户id信息    
    var btttList;                        //存放电池组中的所有信息
    var userlist;                        //当前所有的用户对象数组
    var newuserlist=new Array();        //存放当前新添加的用户
    var Page;                            //分页信息
    
    // 对用户表格选项进行定义
    var userTh=new Array();    //用户表格选项的头部内容
    var userTd=new Array();    //定义用户表格选项的内容
    var userState=new Array();    //记录用户表格选项的状态
    userTh=["<s:text name='Number'/>","<s:text name='Option_Name'/>","<input type='checkbox' /><s:text name='IsChecked'/>"];    /* 编号    选择名称    是否显示 */
    userTd[0]=['1','<s:text name="Maintenance_area"/>','<input type=checkbox />'];        /* 维护区 */
    userTd[1]=['2','<s:text name="Full_name"/>','<input type="checkbox" />'];            /* 姓名 */
    userTd[2]=['3','<s:text name="ID_number"/>','<input type="checkbox" />'];            /* 身份证号 */
    userTd[3]=['4','<s:text name="Employee_number"/>','<input type="checkbox" />'];        /* 员工编号 */
    userTd[4]=['5','<s:text name="Telephone"/>','<input type="checkbox" />'];            /* 电话 */
    userTd[5]=['6','<s:text name="Handset"/>','<input type="checkbox" />'];                /* 手机 */
    userTd[6]=['7','<s:text name="Mailbox"/>','<input type="checkbox" />'];                /* 邮箱 */
    userTd[7]=['8','<s:text name="Address"/>','<input type="checkbox" />'];                /* 地址 */
    userTd[8]=['9','<s:text name="Birthday"/>','<input type="checkbox" />'];            /* 出生日期 */
    userTd[9]=['10','<s:text name="Entry_date"/>','<input type="checkbox" />'];                /* 入职日期 */
    userTd[10]=['11','<s:text name="Sex"/>','<input type="checkbox" />'];                    /* 性别 */
    userTd[11]=['12','<s:text name="Technical_title"/>','<input type="checkbox" />'];            /* 职称 */
    userTd[12]=['13','<s:text name="Permission_description"/>','<input type="checkbox" />'];    /* 权限描述 */
    userTd[13]=['14','<s:text name="Work_team"/>','<input type="checkbox" />'];                    /* 工作班组 */
    userTd[14]=['15','<s:text name="Operating_duty"/>','<input type="checkbox" />'];            /* 工作职责 */
    userTd[15]=['16','<s:text name="Job_content"/>','<input type="checkbox" />'];                /* 工作内容 */
    userTd[16]=['17','<s:text name="IsorNot_charte_person"/>','<input type="checkbox" />'];        /* 是否包机人 */
    userTd[17]=['18','<s:text name="Remark"/>','<input type="checkbox" />'];                    /* 备注 */
    userTd[18]=['19','<s:text name="Permission_group"/>','<input type="checkbox" />'];            /* 权限组 */
    //生成用户表格选项
    createCard($('#cardOption .tbHead'),userTh,userTd);
    createCard($('#cardOption .con_table'),userTh,userTd);
    //将表格选项设为全选
    $('#cardOption .tbHead thead input[type="checkbox"]').prop('checked',true);
    $('#cardOption .con_table tbody input[type="checkbox"]').prop('checked',true);
    $('#cardOption .tbHead thead input[type="checkbox"]').click(function(){
        if($(this).is(':checked'))
        {
            $('#cardOption .con_table tbody input[type="checkbox"]').prop('checked',true);
        }else{
            $('#cardOption .con_table tbody input[type="checkbox"]').prop('checked',false);
        }
    });
    for(var i=0;i<userTd.length;i++)
    {
        userState[i]=1;
    }
    //定义页面的表格数据
    var ArrTh=new Array();    //存储员工信息的表头信息
    //var ArrTd=new Array();    //存储员工信息的表内数据
    //定义表头数据
    for(var i=0;i<userTd.length;i++)
    {
        ArrTh[i]=userTd[i][1];
    }
    //初始化页面内容
    $(document).ready(function(){
        
        var hdWidth=$('#tbHead').width();    //获取表格头部的宽度
        var hdTbWidth=$('#tbHead .tbFixed').width();    //获取表头内的表格的宽度
        if(hdWidth>hdTbWidth)
        {
            $('#tbHead .tbFixed').width(hdWidth-20);
            $('#staff-infor .tbScroll').width(hdWidth-20);
        }
        $('#staff-infor').scroll(function(){
            var scrollX=$(this).scrollLeft();
            $('#tbHead .tbFixed').css('left',-scrollX+'px');
        });
        //初始化页面高度
        var screenHei=$(document).height();    //获取浏览器的可视高度
        var bodyHei=$('body').height();    //获取body的高度
        var staffHei=$('#staff-infor').height();    //获取员工信息表的高度
        $('#staff-infor').css('height',staffHei+screenHei-bodyHei+'px');
    });
    //拖动滑块改变上下的高度
    $(document).ready(function(){
        $('#staff-infor .slide').mousedown(function(e){
            var mouseY=(e||event).clientY;        //获取鼠标点击的位置
            var staffHei=$('#staff-infor').height();
            var leftHei=$('#tb-room-infor').height();
            var rightHei=$('#tb-room').height();
            $(document).mousemove(function(e){
                var mouseMoveY=(e||event).clientY;    //鼠标移动是的位置
                var slideHeight=mouseY-mouseMoveY;    //获取滑动的高度
                var holdnum=staffHei-slideHeight;    //设置阀值最大为400,最小为50
                if(holdnum<320 && holdnum>50)
                {
                    $('#staff-infor').css('height',staffHei-slideHeight+'px');
                    $('#tb-room-infor').css('height',leftHei+slideHeight+'px');
                    $('#tb-room').css('height',rightHei+slideHeight+'px');
                }else{
                    return false;
                }
            });
        });
        $(document).mouseup(function(){
            $(document).unbind('mousemove');    //鼠标松开后解除鼠标移动事件
        });
        //使滑块的位置一直在容器的底部
        $('#staff-infor').scroll(function(){
            var scrollY=$(this).scrollTop();    //容器上下滚动的高度
            var scrollX=$(this).scrollLeft();    //容器左右滚动的宽度
            $('#staff-infor .slide').css('bottom',-scrollY+'px');
            $('#staff-infor .slide').css('left',scrollX+'px');
        });
    });
    
    //获取不能删除用户的数组
    function getTrarrindex(){
        var temp = new Array();
        if(userlist != undefined){
            for(var i=0;i<userlist.length;i++){
                if(userlist[i].UId == 1001 || userlist[i].UId == 1002){
                    temp.push(i);
                }
            }
        }
        return temp;
    }
    
    var newRightTh;        //右表格的表头
    //根据用户名查询其机房和包机组
    function searchStationAndBatt(uid){
        if(uid!=undefined){
            createWait($('#tb-room-infor'));
            createWait($('#tb-room'));
            //createAllMask($('body'),0);    
            $.post("User_battgroup_baojigroup_battgroupAction!serchByCondition","user_inf.UId="+uid,function(data){
                // 生成等待框
                
                data=data.result;
                data=eval("("+data+")");
                //console.info(data);
                var stationList=new Array();        //存放下方左边表格的信息
                var s_index=0;
                btttList=new Array();                //存放所有电池机房信息
                var b_index=-1;
                var battinfo=new Array();            //存放所有电池组的信息        
                var info_index=0;
                var stationName="";
                var totalbattNum=0;
                if(data.code==1 && data.data.length>0){
                    var index=0;
                    totalbattNum=data.data.length;
                    for(var i=0;i<data.data.length;i++){
                        //console.info(data.data[i]);
                        battinfo[info_index++]=data.data[i].StationName;
                        battinfo[info_index++]=data.data[i].BattGroupName;
                        if(stationName==data.data[i].StationName){
                            btttList[b_index][index++]=data.data[i].StationName;
                            btttList[b_index][index++]=data.data[i].BattGroupName;
                        }else{
                            stationName=data.data[i].StationName;
                            index=0;                        
                            stationList[s_index++]=data.data[i].StationName;
                            btttList[++b_index]=new Array();
                            btttList[b_index][index++]=data.data[i].StationName;
                            btttList[b_index][index++]=data.data[i].BattGroupName;
                        }
                    }
                }
                $('#stationNum').text(stationList.length);
                $('#stationNum1').text(stationList.length);
                $('#battNum').text(totalbattNum);
                
                //console.info(stationList);
                //console.info(btttList);
                //console.info(battinfo);
                //自定义左表格内数据
                var newLeftTh=new Array();
                //var newLeftTd=new Array();
                //newLeftTd=['当减肥啦是的房间里睡觉地方地方','路上的风景连锁酒店发生','时代发生的发生大水法','啊时代发生的发生地方','时代发生的发生短发','当减肥啦是的房间里睡觉地方地方','路上的风景连锁酒店发生','时代发生的发生大水法','啊时代发生的发生地方','时代发生的发生短发','当减肥啦是的房间里睡觉地方地方','路上的风景连锁酒店发生','时代发生的发生大水法','啊时代发生的发生地方','时代发生的发生短发'];
                //定义右表格内的数据
                newRightTh=new Array();
                //定义右表格头数据
                newRightTh=['<s:text name="Chartere_room_(chartered_room_equipment)"/>','<s:text name="Charter_battery_pack"/>'];        /* 包机机房        包机电池组 */
                
                // 清理左包机机房表格内容
                $('#tb-room-infor table').remove();
                // 清理右包机机房表格内容
                $('#tb-room table').remove();
                
                //生成左表格
                createTable('tb-room-infor','tbScroll',1,newLeftTh,stationList);
                //生成右表格
                createTable('tb-room','tbScroll',newRightTh.length,newRightTh,battinfo);
                //给左表格每行添加背景色
                $('#tb-room-infor table tbody tr').css('background-color','#b8cfe5');
                
                // 清除警告框
                $('#tb-room .wait').remove();
                var roomWidth=$('#tb-room').width();    //获取右容器的宽度
                $('#right table').width(roomWidth-20);
                $('#tb-room .tbScroll').width(roomWidth-20);
                removeWait($('#tb-room-infor'));
                removeWait($('#tb-room'));
                //$('body').children('.mask').remove();
                
            });
        }        
    }
        
    //根据选中的行数获取用户的id
    function getUid(index){
        if(uidlist!=undefined){
            return uidlist[index];
        }
        return undefined;
    }
    
    //页面点击事件
    $(document).ready(function(){
        //点击查询按钮生成表格
        $('#paging .search').click(function(){
            searchUser_inf();        
            
        });
        
    
        //左部分包机机房内表格的点击事件
        $('#tb-room-infor table tbody tr').live('click',function(){
            //点击的行变色
            $('#tb-room-infor table tbody tr').css('background-color','#fff');
            $(this).css('background-color','#b8cfe5');
            
            var stationIndex=$(this).index();
            // 清理右包机机房表格内容
            $('#tb-room table').remove();
            if(btttList!=undefined && btttList.length>0){
                //生成右表格
                createTable('tb-room','tbScroll',newRightTh.length,newRightTh,btttList[stationIndex]);
                $('#battNum').text(btttList[stationIndex].length/2);
            }
        });
        //有部分包机机房表格点击事件
        $('#tb-room table tbody tr').live('click',function(){
            
            //当前行变色其他行不变
            $('#tb-room table tbody tr').removeClass('b8cfe5');
            $(this).addClass('b8cfe5');
            
        });
        //点击用户表格选项
        $('#paging .cardOpt').click(function(){
            //显示表格选项内容
            $('#cardOption').show();
            $('#allShade').show();
        });
        //点击确定按钮执行内容
        $('#enCardOption').click(function(){
            //检测表格选项选项卡的状态给userState赋值
            // 定义jquery变量
            var tbInput=$('#cardOption .con_table tbody input[type="checkbox"]');
            for(var i=0;i<userState.length;i++)
            {
                if(tbInput.eq(i).is(':checked'))
                {
                    userState[i]=1;
                }else{
                    userState[i]=0;
                }
            }
            newuserlist = new Array();        //清空添加用户数组
            // 根据userState生成表格
            var newArrTh=new Array();
            var newArrTd=new Array();
            //根据userState生成表格头部
            newArrTh=getArrTh(userState,ArrTh);
            // 根据userState生成表格内容
            newArrTd=getArrTd(userState,ArrTd);
            // 清除表格内容
            $('#staff-infor .tbScroll').remove();
            $('#tbHead .tbFixed').remove();
            //生成用户表格
            createTable('tbHead','tbFixed',newArrTh.length,newArrTh,newArrTd);
            createTable('staff-infor','tbScroll',newArrTh.length,newArrTh,newArrTd);
            //var tblScroll=$('#staff-infor').scrollLeft();
            //$('#staff-infor table').css('left',tblScroll+'px');
            $('#staff-infor').scrollLeft(0);
            // 隐藏用户表格选项
            $('#cardOption').hide();
            $('#allShade').hide();
        });
    });
    
    $(document).ready(function(){
        searchUser_inf();
        
        $(window).resize(function() {
            setTblWidth($('#tbHead'), $('#staff-infor'));
        });
    });
    
    var User_all;
    function searchUser_inf(){
        userlist=new Array();
        // 生成等待框
        var load = layer.load(1);    
        $.post("User_infAction!searchAll",$('#search_form').serialize(),function(data){
            data=data.result;
            data=eval("("+data+")");
            if(data.code==1){
                User_all=new Array();
                uidlist=new Array();
                var index=0;
                //console.info(data.data[0].page);
                for(var i=0;i<data.data.length;i++){
                    userlist.push(data.data[i].uinf);
                    Page=data.data[i].page;
                    uidlist[i]=data.data[i].uinf.UId;
                    User_all[index++]=data.data[i].uinf.UDepartment;        //维护区
                    User_all[index++]=data.data[i].uinf.UName;                //姓名
                    User_all[index++]=data.data[i].uinf.UShenFenId;            //身份证号
                    User_all[index++]=data.data[i].uinf.UEmployeeId;        //员工编号
                    User_all[index++]=data.data[i].uinf.UTelephone;            //电话
                    User_all[index++]=data.data[i].uinf.UMobilephone;        //手机
                    User_all[index++]=data.data[i].uinf.UEmail;                //邮箱
                    User_all[index++]=data.data[i].uinf.UAddr;                //地址
                    User_all[index++]=data.data[i].uinf.UBirthDay.substr(0,10);            //出生日期
                    //alert(data.data[i].uinf.UBirthDay.substr(0,10));
                    User_all[index++]=data.data[i].uinf.UAccessionDay.substr(0,10);        //入职日期
                    User_all[index++]=data.data[i].uinf.USex;                //性别
                    User_all[index++]=data.data[i].uinf.UProTitle;            //职称
                    User_all[index++]=data.data[i].uinf.UAuthority;            //权限描述
                    User_all[index++]=data.data[i].uinf.UJobGroup;            //工作班组
                    User_all[index++]=data.data[i].uinf.UDuties;            //工作职责
                    User_all[index++]=data.data[i].uinf.UTasks;                //工作内容
                    User_all[index++]=data.data[i].uinf.UBaojiusr==1?"<input type='checkbox' checked  disabled/>":"<input type='checkbox' disabled/>";        //是否包机人
                    User_all[index++]=data.data[i].uinf.UNote;                //备注
                    User_all[index++]=data.data[i].uinf.PermitgroupName;    //管理组
                }
                ArrTd=User_all;
                //console.info(ArrTh);
                // 根据userState生成表格
                var newArrTh=new Array();
                var newArrTd=new Array();
                //根据userState生成表格头部
                newArrTh=getArrTh(userState,ArrTh);
                // 根据userState生成表格内容
                newArrTd=getArrTd(userState,ArrTd);
                // 清除表格内容
                $('#staff-infor .tbScroll').remove();
                $('#tbHead .tbFixed').remove();
                //生成用户表格
                createTable('tbHead','tbFixed',newArrTh.length,newArrTh,newArrTd);
                createTable('staff-infor','tbScroll',newArrTh.length,newArrTh,newArrTd); 
                setTblWidth($('#tbHead'), $('#staff-infor'));
            }else{
                User_all=undefined;    
                uidlist=undefined;
                Page=undefined;            
            }
            if(Page!=undefined){
                var PageSize=$('#pageSize').attr('value');
                var pageNum=Math.ceil(Page.pageAll/PageSize);                
                $('#current').text($('#pageCurr').attr('value')+"/"+pageNum);
                $('#total').text(Page.pageAll);
            }else{
                $('#current').text(0);
                $('#total').text(0);
            }
            
            layer.close(load);
        });
    }
    
    //报表导出
    $('#paging .export').click(function(){
        exprotTable($('#staff-infor .tbScroll thead th'),$('#staff-infor .tbScroll tbody td'),$('#export_excel'),$('#table_th_arr'),$('#table_td_arr'));
    });
    
    
    
    
    //首页
    $('#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){
            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'));
        }        
    });
    
    
    $(document).ready(function(){
        
        //右键菜单内容鼠标事件
        $('body').on('mouseover','#rightMenu a',function(){
           $(this).css({
               'background-color':'#25aacd',
               'color':'#fff'
           });
        });
        $('body').on('mouseout','#rightMenu a',function(){
            $(this).css({
                'background-color':'#fff',
                'color':'#000'
            });
        });
        //屏蔽员工信息表内右键菜单
        document.oncontextmenu=function(){
            return false;
        };
        var isCanEdit;    //判断是否可以编辑
        isCanEdit=findValIsExist('usr_edit_permit',permits);
        //添加右键内容
        var staffObj=[
            {txt:'<s:text name="Add_user"/>',cla:'add-staff'},            /* 添加用户 */
            {txt:'<s:text name="Edit"/>',cla:'edit-staff'},                /* 编辑 */
            {txt:'<s:text name="Delete"/>',cla:'del-staff'}                /* 删除 */
        ];
        var trIndex=0;    //记录当前行的位置
        //点击员工信息表
        $('#staff-infor').on('mousedown','table tbody tr',function(e) {
            //利用jquery的方式获取当前点击的是否是右键
            var newindex=$(this).index();
            $('#staff-infor .tbScroll tbody tr').removeClass('b8cfe5');
            $(this).addClass('b8cfe5');
            //当前行变色其他行不变
            if(newindex!=trIndex){
                searchStationAndBatt(getUid(newindex));
                trIndex=newindex;
            }
            if (e.which == 3) {
                console.info(getTrarrindex());
                //当前行变色其他行不变
                $('#staff-infor table tbody tr').removeClass('b8cfe5');
                $(this).addClass('b8cfe5');
                if(isCanEdit)
                {
                    getRightMenuItem(trIndex, getTrarrindex());
                    setTimeout(function () {
                        var disX = (e || event).clientX + 10;    //获取鼠标点击的横坐标
                        var disY = (e || event).clientY + 10;    // 获取鼠标点击的纵坐标
                        var scrollY = $(document).scrollTop();
                        $('#rightMenu').css('top', disY + scrollY + 'px');
                        $('#rightMenu').css('left', disX + 'px');
                        $('#rightMenu').show();
                        setPosition($("#rightMenu"),disX, disY);
                    }, 30);
                }
                
            }
            return false;
        });
        
        $('#staff-infor').on('mousedown',function(e) {
            //添加右键内容
            var staffObj1 = [
                {txt:'<s:text name="Add_user"/>',cla:'add-staff'}            /* 添加用户 */
            ]; 
            if (e.which == 3) {
                if(isCanEdit)
                {
                    createRightMenu(staffObj1);
                    setTimeout(function () {
                        var disX = (e || event).clientX + 10;    //获取鼠标点击的横坐标
                        var disY = (e || event).clientY + 10;    // 获取鼠标点击的纵坐标
                        var scrollY = $(document).scrollTop();
                        $('#rightMenu').css('top', disY + scrollY + 'px');
                        $('#rightMenu').css('left', disX + 'px');
                        $('#rightMenu').show();
                        setPosition($("#rightMenu"),disX, disY);
                    }, 30);
                }
                
            }
        });
        
        //点击div清除右键菜单
        $('body').on('click','div',function(){
            $('body').children('#rightMenu').remove();    
        });
        
        //根据表格选项给行添加下标
        function addIndex(ele,state){
            //根据userState给行添加下标tdIndex
            ele.each(function(){
                var k=0;
                for(var n=0;n<state.length;n++)
                {
                    if(state[n]==1)
                    {
                        $(this).find('td').eq(k).attr('tdIndex',n);
                        k=k+1;
                    }
                }
            });
        }
        
        
        
        /*显示编辑或修改窗口_staffVal
            _staffVal当前用户的value值
            _staffList为所有用户的信息或固定的内容
        */
        function showEditRevise(_staffVal,_staffList)
        {
            if($('#staffInfor .staff-pwd').length!=0)
            {
                $('#staffInfor .staff-name').next('span').remove();
                $('#staffInfor .staff-pwd').remove();
            }
            //清空内容对窗口进行初始化
            $('#staffInfor .staff-head').text('');
            $('#staffInfor input[type="text"]').val('');
            
            var _myObj=new Object();
            //_staffList和_staffVal的值显示内容
            if(_staffVal == null)
            {    
                
                $('#staffInfor .staff-head').text('<s:text name="Add"/><s:text name="New_users"/>');                //添加新用户
                _myObj=_staffList;
                $('#staffInfor .ensure').addClass('add-user').removeClass('edit-user');
                var _pwd='<span><s:text name="Password"/>:<span><input type="password" class="staff-pwd">';                //密码
                $('#staffInfor .staff-name').after(_pwd);
                $('#staffInfor .staff-pwd').val(_myObj.USnId);     //密码
            }else{
                $('#staffInfor .staff-head').text('<s:text name="Edit"/><s:text name="User_information"/>');        //编辑用户信息    
                $('#staffInfor .ensure').addClass('edit-user').removeClass('add-user');
                //通过遍历确定编辑用户的信息
                for(var i=0;i<_staffList.length;i++)
                {
                    if(_staffVal == _staffList[i].UId)
                    {
                        _myObj=_staffList[i];
                        break;
                    }
                }
            }
            
            //console.info(_myObj);
            //根据_myObj对窗口的框和下拉框进行赋值
            $('#staffInfor .staff-name').val(_myObj.UName);        //姓名
            $('#staffInfor .staff-id-card').val(_myObj.UShenFenId);    //身份证
            $('#staffInfor .staff-tel').val(_myObj.UTelephone);        //电话
            $('#staffInfor .staff-phone').val(_myObj.UMobilephone);        //手机
            $('#staffInfor .staff-email').val(_myObj.UEmail);        //email
            $('#staffInfor .staff-addr').val(_myObj.UAddr);        //地址
            $('#staffInfor .staff-birth').val(_myObj.UBirthDay.substr(0,10));        //出生日期
            $('#staffInfor .start-work-time').val(_myObj.UAccessionDay.substr(0,10));    //入职日期
            $('#staffInfor .staff-pos').val(_myObj.UProTitle);        //职称
            $('#staffInfor .power-dscb').val(_myObj.UAuthority);        //权限描述
            $('#staffInfor .work-group').val(_myObj.UJobGroup);        //工作班组        
            $('#staffInfor .work-duty').val(_myObj.UDuties);        //工作职责
            $('#staffInfor .work-cont').val(_myObj.UTasks);        //工作内容
            $('#staffInfor .remarks').val(_myObj.UNote);        //备注
            $('#staffInfor .power-group').val(_myObj.UPermitgroupName);        //权限组名称
            $('#staffInfor .staff-num').val(_myObj.UEmployeeId);        //权限组名称
            getSelcted($('#staffInfor .is-charter'), _myObj.UBaojiusr);    //是否包机
            getSelcted($('#staffInfor .sex'), _myObj.USex);    //性别
            getSelcted($('#staffInfor .area'), _myObj.UDepartmer);    //维护区
            //显示内容
            $('#staffInfor').show();
            $('#allShade').show();
        }
        
        $('body').on('click','#rightMenu .del-staff',function(){
            var index=$('#staff-infor .tbScroll tbody tr.b8cfe5').prevAll().length;
            var user=getUserByIndex(index, userlist);
            if(user!=undefined){
                console.info(user);
                if(user.UId != 1001){
                    if(confirm('<s:text name="Confirm_del"/>'+user.UName+'?')){                /* 确认删除 */
                        var json=window.JSON.stringify(user);
                        $.post('User_infAction!delete','upjson='+json,function(data){
                            var model=eval("("+data.result+")");
                            if(model.code==1){
                                alert('<s:text name="Delete_success"/>');                    /* 删除成功 */
                            }else{
                                alert('<s:text name="Delete"/><s:text name="Fail"/>');        /* 删除失败 */
                            }
                            searchUser_inf();
                        });
                    }
                }else{
                    alert("该用户不能删除!!!");
                }                
            }            
        });
        
        $('body').on('click','#rightMenu .add-staff',function(){
            $.post('User_infAction!createNewUser',null,function(data){
                var model=eval("("+data.result+")");
                if(model.code==1){
                    //showEditRevise(null,model.data);
                    showAddPopup(null,model.data);                
                }
            });
            
        });
        //点击编辑按钮
        $('body').on('click','#rightMenu .edit-staff',function(){
            var index=$('#staff-infor .tbScroll tbody tr.b8cfe5').prevAll().length;
            var user=getUserByIndex(index, userlist);
            var list=new Array();
            list.push(user);
            //console.info(user);
            showEditRevise(user.UId,list);
        });
        
        
        function hideAlert(){
            /*
                点击确定后执行的内容
            */            
            //隐藏
            $('#__calendarPanel').css('visibility','hidden');
            $('#staffInfor').hide();
            $('#allShade').hide();
        }
        
        
        //点击退出隐藏窗口
        $('#staffInfor .out').click(function(){
            //隐藏
            $('#__calendarPanel').css('visibility','hidden');
            $('#staffInfor').hide();
            $('#allShade').hide();
        });
        
        
        
        //点击指定的文本框生成日期
        $('#staffInfor .start-work-time').click(function(){
            new Calendar().show(this);    //入职日期
        });
        $('#staffInfor .staff-birth').click(function(){
            new Calendar().show(this);    //出生日期
        });
        
        
    });
    
    
    function hideAlert(){
        /*
            隐藏显示的div
        */            
        //隐藏
        $('#__calendarPanel').css('visibility','hidden');
        $('#staffInfor').hide();
        $('#allShade').hide();
    }
    
    //对于弹出串口进行定位(position:fixed)
    function centerDiv(ele){
        //获取屏幕的高度对弹出窗口进行定位
        var srnHei=$(window).height();    //屏幕的高度
        var eleHei=ele.height();    //弹出窗口的高度
        var topHei=parseInt((srnHei-eleHei)/2);    //获取居中高度
        ele.css({
            'top':topHei
        });
        
    }
    //对用户添加和编辑界面进行定位
    $(document).ready(function(){
        //页面加载时查询维护区中的枢纽类型
        $.post("BattInfAction_serchByStation",null,function(data){
            data=data.result;
            data=eval("("+data+")");
            //console.info(data);
            if(data.code==1 && data.data.length>0){
                //console.info(data.data);
                var oarea=$('#staffInfor .cont-list .area');
                oarea.text('');
                for(var i=0;i<data.data.length;i++){
                    var option=$("<option></option>");
                    option.attr('value',data.data[i].StationName1);
                    option.text(data.data[i].StationName1);
                    oarea.append(option);
                }                
            }
        });
    
        //使窗口的位置在屏幕的中间
        centerDiv($('#staffInfor'));
        //解决窗口改变后位置bug
        $(window).resize(function(){
            centerDiv($('#staffInfor'));
        });
    });
    $(document).ready(function(){
        $('#staffInfor').on('click','.edit-user',function(){
            var user=getUserByDiv();
            console.info(user);
            var pregUName = pregEnName(user.UName);
            if(pregUName != '输入合法') {
                myConfirm.show({
                    content:'姓名'+pregUName+'!',
                    type: 'alert',
                });
                return;
            }
            if(user!=undefined){
                var index=$('#staff-infor .tbScroll tbody tr.b8cfe5').prevAll().length;
                var temp=getUserByIndex(index, userlist);
                if(temp!=undefined){
                    user.UId=temp.UId;
                    var json=window.JSON.stringify(user);
                    $.post('User_infAction!update','upjson='+json,function(data){
                        var model=eval("("+data.result+")");
                        if(model.code==1){
                            alert('<s:text name="Chage_Success"/>');        /* 修改成功 */
                        }else{
                            alert('<s:text name="Chage_failed"/>');            /* 修改失败 */
                        }
                        searchUser_inf();
                        hideAlert();
                    });
                }
            }
        });
        $('#staffInfor').on('click','.add-user',function(){
            var user=getUserByDiv();
            var pregUName = pregEnName(user.UName);
            if(pregUName != '输入合法') {
                myConfirm.show({
                    content:'姓名'+pregUName+'!',
                    type: 'alert',
                });
                return;
            }
            var pregUPwd = pregPwd(user.USnId); 
            if(pregUPwd != '输入合法') {
                myConfirm.show({
                    content:'密码'+pregUPwd+'!',
                    type: 'alert',
                });
                return;
            }
            if(user!=undefined){
                var json=window.JSON.stringify(user);
                console.info(json);
                $.post("User_infAction!add","addjson="+json,function(data){
                    var model=eval("("+data.result+")");
                    if(model.code==1){
                        myConfirm.show({
                            content:'<s:text name="Add"/><s:text name="Success"/>',
                            type: 'alert',
                        });    /* 添加成功 */
                    }else{
                        myConfirm.show({
                            content:model.msg,
                            type: 'alert',
                        });        /* 添加失败 */
                        
                        return;
                    }
                    searchUser_inf();
                    hideAlert();    
                });
            }
        });
    });
    
    //根据下标获取对象
    function getUserByIndex(index,list){
        if(index!=undefined && index>=0 && list!=undefined){
            return list[index];
        }
        return undefined;
    }
    
    //通过div构造用户对象
    function getUserByDiv(){
        var user={
            UId:0,
            Upassword:$('#staffInfor .cont-list .staff-pwd').val(),
            USnId:$('#staffInfor .cont-list .staff-pwd').val(),
            UName:$('#staffInfor .cont-list .staff-name').val(),
            UShenFenId:$('#staffInfor .cont-list .staff-id-card').val(),
            UTelephone:$('#staffInfor .cont-list .staff-tel').val(),
            UEmail:$('#staffInfor .cont-list .staff-email').val(),
            UAddr:$('#staffInfor .cont-list .staff-addr').val(),
            UBirthDay:$('#staffInfor .cont-list .staff-birth').val(),
            UAccessionDay:$('#staffInfor .cont-list .start-work-time').val(),
            USex:$('#staffInfor .cont-list .sex').val(),
            UDepartment:$('#staffInfor .cont-list .area').val(),
            UProTitle:$('#staffInfor .cont-list .staff-pos').val(),
            UJobGroup:$('#staffInfor .cont-list .work-group').val(),
            UDuties:$('#staffInfor .cont-list .work-duty').val(),
            UTasks:$('#staffInfor .cont-list .work-cont').val(),
            UBaojiusr:$('#staffInfor .cont-list .is-charter').val(),
            UNote:$('#staffInfor .cont-list .remarks').val(),
            UAuthority:$('#staffInfor .cont-list .power-dscb').val(),
            UMobilephone:$('#staffInfor .cont-list .staff-phone').val(),
            UEmployeeId:$('#staffInfor .cont-list .staff-num').val()            
        };
        //console.info(user);
        return user;
    }
    // 生成右键菜单
    function createRightMenu(obj){
        //创建前清除右键内容
           $('#rightMenu').remove();
           //创建标签
              var __div=$('<div id="rightMenu"></div>');
           var __a=new Array();
           //根据obj的值生成a标签并添加到div中
        for(var i in obj)
        {
            __a[i]=$('<a href="javascript:void(0);" class="'+obj[i].cla+'">'+obj[i].txt+'</a>');
            __div.append(__a[i]);
        }
        //将div添加到body中
        $('body').append(__div);
        //定义菜单的样式
        $('#rightMenu').css({
            'display':'none',
            'position':'absolute',
            'top':'200px',
            'left':'0',
            'border-top':'1px solid #25aacd',
            'border-left':'1px solid #25aacd',
            'border-right':'1px solid #25aacd'
        });
        $('#rightMenu a').css({
            'display':'block',
            'padding':'4px 6px',
            'text-decoration':'none',
            'color':'#000000',
            'background-color':'#FFFFFF',
            'border-bottom':'1px solid #9bbaf3'
        });
    }
    
    /**
     * 设置右键菜单内容
     * @param  int trIndex  表格行号(tr的下标)
     * @param  array arrIndex 表格显示特殊右键菜单的行号
     */
    function getRightMenuItem(trIndex, arrIndex) {
        var objItem = [
            {txt:'<s:text name="Add_user"/>',cla:'add-staff'},            /* 添加用户 */
            {txt:'<s:text name="Edit"/>',cla:'edit-staff'},                /* 编辑 */
            {txt:'<s:text name="Delete"/>',cla:'del-staff'}                /* 删除 */
        ];
        for(var i = 0; i < arrIndex.length; i++) {
            if(trIndex == arrIndex[i]) {
                objItem = [
                    {txt:'<s:text name="Add_user"/>',cla:'add-staff'},        /* 添加用户 */
                    {txt:'<s:text name="Edit"/>',cla:'edit-staff'}            /* 编辑 */
                ];
                break;
            }
        }
        createRightMenu(objItem);
    }
    
    function showAddPopup(_staffVal,_staffList) {
        if($('#staffInfor .staff-pwd').length!=0)
            {
                $('#staffInfor .staff-name').next('span').remove();
                $('#staffInfor .staff-pwd').remove();
            }
            //清空内容对窗口进行初始化
            $('#staffInfor .staff-head').text('');
            $('#staffInfor input[type="text"]').val('');
            
            var _myObj=new Object();
            //_staffList和_staffVal的值显示内容
            if(_staffVal == null)
            {    
                
                $('#staffInfor .staff-head').text('<s:text name="Add"/><s:text name="New_users"/>');                //添加新用户
                _myObj=_staffList;
                $('#staffInfor .ensure').addClass('add-user').removeClass('edit-user');
                var _pwd='<span><s:text name="Password"/>:<span><input type="password" class="staff-pwd">';                //密码
                $('#staffInfor .staff-name').after(_pwd);
                $('#staffInfor .staff-pwd').val("");     //密码
            }else{
                $('#staffInfor .staff-head').text('<s:text name="Edit"/><s:text name="User_information"/>');        //编辑用户信息    
                $('#staffInfor .ensure').addClass('edit-user').removeClass('add-user');
                //通过遍历确定编辑用户的信息
                for(var i=0;i<_staffList.length;i++)
                {
                    if(_staffVal == _staffList[i].UId)
                    {
                        _myObj=_staffList[i];
                        break;
                    }
                }
            }
            
            //console.info(_myObj);
            //根据_myObj对窗口的框和下拉框进行赋值
            $('#staffInfor .staff-name').val("");        //姓名
            $('#staffInfor .staff-id-card').val("");    //身份证
            $('#staffInfor .staff-tel').val("");        //电话
            $('#staffInfor .staff-phone').val("");        //手机
            $('#staffInfor .staff-email').val("");        //email
            $('#staffInfor .staff-addr').val("");        //地址
            $('#staffInfor .staff-birth').val(_myObj.UBirthDay.substr(0,10));        //出生日期
            $('#staffInfor .start-work-time').val(_myObj.UAccessionDay.substr(0,10));    //入职日期
            $('#staffInfor .staff-pos').val("");        //职称
            $('#staffInfor .power-dscb').val("");        //权限描述
            $('#staffInfor .work-group').val("");        //工作班组        
            $('#staffInfor .work-duty').val("");        //工作职责
            $('#staffInfor .work-cont').val("");        //工作内容
            $('#staffInfor .remarks').val("");        //备注
            $('#staffInfor .power-group').val(_myObj.UPermitgroupName);        //权限组名称
            $('#staffInfor .staff-num').val("");        //权限组名称
            getSelcted($('#staffInfor .is-charter'), _myObj.UBaojiusr);    //是否包机
            getSelcted($('#staffInfor .sex'), _myObj.USex);    //性别
            getSelcted($('#staffInfor .area'), _myObj.UDepartmer);    //维护区
            //显示内容
            $('#staffInfor').show();
            $('#allShade').show();
    }
    
    // 根据数据生成下拉
    function getSelcted(ele,__opt)
    {
        ele.children('option').each(function(){
            if($(this).val() == __opt)
            {
                $(this).attr('selected','selected');
            }
        });
    }
    
    searchjobgroup();
    //查询所有的工作班组
    function searchjobgroup(){
        $('.content .cont-list .work-group').text('');
        var option = "";
        $.ajax({     
            type: "post",                 
            url: "User_ChartAction!searchAll",                
            async:true,                
            dataType:'text',
            data:null,        
            success: function(data){ 
                data = eval("("+data+")");
                var model = eval("("+data.result+")");
                //console.info(model);
                if(model.code==1){
                    for(var i=0;i<model.data.length;i++){
                        option+="<option value='"+model.data[i].Chart_name+"'>"+model.data[i].Chart_name+"</option>";
                    }
                }else{
                    option = "<option value='暂无班组'>暂无班组</option>";
                }        
                $('.content .cont-list .work-group').html(option);
            },
            error:function(){
                option = "<option value='暂无班组'>暂无班组</option>";
                $('.content .cont-list .work-group').html(option);
            }            
        });
    }
</script>
</html>