D:/workspace/chenjingjing/git/gx_tieta/gx_tieta/.gitignore
2019-01-09 c88ddedda422835b2337a68a993db645f42f8458
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
<%@ 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="Battery_discharge_test"/></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;
        }
        /*右键菜单内容*/
        #right-menu{
            display:none;
            _display:none;
            position:absolute;
            width:200px;
            border:1px solid #b6c1fa;
            background-color:#fff;
            font-size: 12px;
            top:0;
            left:0;
            z-index:99999999;
        }
        #right-menu a{
            display:block;
            _display:block;
            padding:8px 16px;
            color:#000;
            text-decoration:none;
        }
        #right-menu a:hover{
            background-color:#aae5f7;
        }
        #right-menu a:visited{
            color:#000;
        }
        #right-menu .hide-menu{
            border-bottom:1px solid #b6c1fa;
        }
        /*添加权限组*/
        #addPwr{
            display:none;
            position:absolute;
            width:260px;
            background-color:#fff;
            left:50%;
            margin-left:-150px;
            top:200px;
            z-index: 99999990;
        }
        #addPwr span{
            display: block;
            width:100%;
            height:30px;
            text-indent:1.5em;
            line-height:30px;
            font-weight:bold;
            background:url(image/table_th_bg.gif) repeat-x;
        }
        #addPwr .txt-con{
            width:100%;
            height:60px;
        }
        #addPwr .txt-con input[type="text"]{
            width:180px;
            height:30px;
            line-height: 30px;
            margin-top:20px;
            margin-left:30px;
            border:1px solid #b8cfe5;
        }
        #addPwr .btn-con{
            width:100%;
            margin-top:10px;
            margin-bottom:20px;
        }
        #addPwr .btn-con input[type="button"]{
            /*初始化按钮*/
            font-size: 12px;
            text-decoration: none!important;
            font-family: Helvetica, Arial, sans serif;
            padding: 6px 12px;
            border-radius: 3px;
            -moz-border-radius: 3px;
            box-shadow: inset 0px 0px 2px #fff;
            -o-box-shadow: inset 0px 0px 2px #fff;
            -webkit-box-shadow: inset 0px 0px 2px #fff;
            -moz-box-shadow: inset 0px 0px 2px #fff;
            /*定义颜色和样式*/
            color: #41788c;
            border: 1px solid #6fb1c7;
            background-image: -moz-linear-gradient(#aae5f7, #73d0f1);
            background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#73d0f1), to(#aae5f7));
            background-image: -webkit-linear-gradient(#aae5f7, #73d0f1);
            background-image: -o-linear-gradient(#aae5f7, #73d0f1);
            text-shadow: 1px 1px 1px #bfeafb;
            background-color: #73d0f1;
            /*按钮的上右下左的距离*/
            margin-left:40px;
        }
        #addPwr .btn-con input[type="button"]:hover{
            border: 1px solid #4690ad;
            background-image: -moz-linear-gradient(#73d0f1, #aae5f7);
            background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#aae5f7), to(#73d0f1));
            background-image: -webkit-linear-gradient(#73d0f1, #aae5f7);
            background-image: -o-linear-gradient(#73d0f1, #aae5f7);
            background-color: #aae5f7;
        }
        /*重命名权限组*/
        #rename{
            display:none;
            position:absolute;
            width:260px;
            background-color:#fff;
            left:50%;
            margin-left:-150px;
            top:200px;
            z-index: 99999990;
        }
        #rename span{
            display: block;
            width:100%;
            height:30px;
            line-height:30px;
            text-indent:1.5em;
            font-weight:bold;
            background:url(image/table_th_bg.gif) repeat-x;
        }
        #rename .txt-con{
            width:100%;
            height:60px;
        }
        #rename .txt-con input[type="text"]{
            width:180px;
            height:30px;
            line-height: 30px;
            margin-top:20px;
            margin-left:30px;
            border:1px solid #b8cfe5;
        }
        #rename .btn-con{
            width:100%;
            margin-top:10px;
            margin-bottom:20px;
        }
        #rename .btn-con input[type="button"]{
            /*初始化按钮*/
            font-size: 12px;
            text-decoration: none!important;
            font-family: Helvetica, Arial, sans serif;
            padding: 6px 12px;
            border-radius: 3px;
            -moz-border-radius: 3px;
            box-shadow: inset 0px 0px 2px #fff;
            -o-box-shadow: inset 0px 0px 2px #fff;
            -webkit-box-shadow: inset 0px 0px 2px #fff;
            -moz-box-shadow: inset 0px 0px 2px #fff;
            /*定义颜色和样式*/
            color: #41788c;
            border: 1px solid #6fb1c7;
            background-image: -moz-linear-gradient(#aae5f7, #73d0f1);
            background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#73d0f1), to(#aae5f7));
            background-image: -webkit-linear-gradient(#aae5f7, #73d0f1);
            background-image: -o-linear-gradient(#aae5f7, #73d0f1);
            text-shadow: 1px 1px 1px #bfeafb;
            background-color: #73d0f1;
            /*按钮的上右下左的距离*/
            margin-left:40px;
        }
        #rename .btn-con input[type="button"]:hover{
            border: 1px solid #4690ad;
            background-image: -moz-linear-gradient(#73d0f1, #aae5f7);
            background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#aae5f7), to(#73d0f1));
            background-image: -webkit-linear-gradient(#73d0f1, #aae5f7);
            background-image: -o-linear-gradient(#73d0f1, #aae5f7);
            background-color: #aae5f7;
        }
        
        #paging a{
            margin-right:40px;
        }
        #paging .empty{
            margin-left:50px;
        }
    </style>
</head>
<body>
    <!--头部内容开始-->
    <div id="top">
        <div id="top_cont">
            <img src="image/top_img01.jpg" alt="" title="福建福光有限公司" />
            <!--用户登录后显示用户名鼠标经过显示下拉菜单-->
            <div id="sign_out">
                <a href="javascript:void(0)" id="user_name"></a><span class="triangle"></span>
                <ul>
                    <!-- 密码修改 -->
                    
                    <li><a href="pwdChange.jsp" target="_self"><s:text
                                name="Change_password"></s:text>
                    </a>
                    </li>
                    <!-- 安全退出 -->
                    <li><a href="javascript:exitUser()" id="li_a"><s:text
                                name="Logging_out"></s:text>
                    </a>
                    </li>
                    
                </ul>
            </div>
        </div>
    </div>
    <!--头部内容结束-->
    <!-- 主体内容 -->
    <div id="main">
        <!--导航开始-->
        <div id="nav"></div>
        <!--导航结束-->
        <div id="eleInfor">
            <span class="summary">显示和隐藏查询条件</span>
            <div class="checkCon">
                <table>
                    <tr class="fWeight">
                        <td>维护区</td>
                        <td>机房站点(或机房设备)</td>
                        <td>蓄电池组</td>
                    </tr>
                    <tr>
                        <td>
                            <select name="" id="station_name1">
                                
                            </select>
                        </td>
                        <td>
                            <select name="" id="station_name">
                                
                            </select>
                        </td>
                        <td>
                            <select name="" id="battgroup_name">
                                
                            </select>
                        </td>
                    </tr>
                </table>
            </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="addsingle">添加单组电池组</a>
            <a href="javascript:" class="addbatch">添加整个机房电池组</a>
            <label>共</label><span id="total">0</span>&nbsp;&nbsp;&nbsp;&nbsp;<label>个电池组</label>
            <a href="javascript:" class="empty">启动测试</a>
            <a href="javascript:" class="upload">停止测试</a>
        </div>
    </div>
    <!-- 主体内容结束 -->
    <!-- 右键菜单内容 -->
    <div id="right-menu">
        <a href="javascript:;" class="re-current">批量修改测试电流</a>
        <a href="javascript:;" class="re-test-time">批量修改测试时间</a>
        <a href="javascript:;" class="remove-tr">移除被测电池组</a>
        <a href="javascript:;" class="all-pitch">选择全部</a>
    </div>
    <!-- 批量修改测试电流 -->
    <div id="addPwr">
        <span>修改测试电流值(0-2000A)</span>
        <div class="txt-con">
            <input type="text" value="" placeholder="测试电流值">
        </div>
        <div class="btn-con">
            <input type="button" class="enSure" value="确定">
            <input type="button" class="outAdd" value="退出">
        </div>
    </div>
    <!-- 批量修改测试时间 -->
    <div id="rename">
        <span>修改测试时间(1-2400分钟)</span>
        <div class="txt-con">
            <input type="text" value="" placeholder="测试时间">
        </div>
        <div class="btn-con">
            <input type="button" class="enSure" value="确定">
            <input type="button" class="out" value="退出">
        </div>
    </div>
    <div id="allShade"></div>
    <!--清除浮动-->
    <div class="clear"></div>
</body>
<script type="text/javascript" src="js/buildNav.js"></script>
<script type="text/javascript" src="js/createTab.js"></script>
<script type="text/javascript" src="js/base.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);
    <%    }    %>
 
    //屏蔽浏览器右键菜单功能
    $(document).ready(function(){
        setUserName();
        document.oncontextmenu=function(){
                return false;
        };
    });
    //初始化页面内容
    $(document).ready(function(){
        //定义页面高度
        var srnHt=$(window).height();    //浏览器可以区域的高度
        var bodyHt=$('body').height();    //body的高度
        var tbHt=$('#tbBrdw').height();    //表格容器的高度
        //对比浏览器和body高度
        if(srnHt>bodyHt)
        {
            $('#tbBrdw').height(tbHt+srnHt-bodyHt);
        }
        $(window).resize(function(){
            var newSrnHt=$(window).height();    //浏览器可以区域的高度
            var newBodyHt=$('body').height();    //body的高度
            var newTbHt=$('#tbBrdw').height();    //表格容器的高度
            $('#tbBrdw').height(newTbHt+newSrnHt-newBodyHt);
        });
        //点击显示和隐藏,隐藏和显示查询条件
        var flag=1;    //判断查询条件是否被隐藏
        var checkConHt=$('#eleInfor .checkCon').height();    //获取查询条件容器的高度
        $('#eleInfor .summary').click(function(){
            var tbHt=$('#tbBrdw').height();    //获取表格容器的高度
            if(flag==1)
            {
                flag=0;    //改变值表示为隐藏
                $('#eleInfor .checkCon').slideUp(300);
                //设置延时防止页面溢出,出现滚动条
                setTimeout(function(){
                    $('#tbBrdw').height(tbHt+checkConHt);
                },302);
            }else{
                flag=1;    //显示
                $('#tbBrdw').height(tbHt-checkConHt);
                $('#eleInfor .checkCon').slideDown();
            }
        });
    });
    
    
    
    //生成表格并对表格进行操作
    $(document).ready(function(){
        //定义表格数据数组变量
        var ArrTh=new Array();
        var ArrTd=new Array();
        //定义表格头部数据
        ArrTh=['电池组ID','电池组名称','测试类型','测试电流(A)','测试时长(M)','测试状态','已测时间'];
        //生成表格头部
        createTable('tbHead','tbFixed',ArrTh.length,ArrTh,ArrTd);
        createTable('tbBrdw','tbScroll',ArrTh.length,ArrTh,ArrTd);
        // 让表格宽度自适应容器大小
        var tbWidth=$('#tbHead').width();    //获取容器的大小
        $('#tbHead table').width(tbWidth-20);
        $('#tbBrdw table').width(tbWidth-20);
        //上下滚动同步
        $("#tbBrdw").scroll(function(){
            var scrollX=$(this).scrollLeft();
            $('#tbHead table').css('left',-scrollX);
        });
        function addTd(ele,len,__ArrTd){
            //定义tr和td标签
            var __ArrTagTr=new Array();
            var __ArrTagTd=new Array();
            var __TrLength=0;
            __TrLength=Math.ceil(__ArrTd.length/len);
            //创建tr
            for(var i=0;i<__TrLength;i++)
            {
                __ArrTagTr[i]=$('<tr></tr>');
            }
            //给每个td添加文本
            for(var i=0;i<__ArrTd.length;i++)
            {
                __ArrTagTd[i]=$('<td>'+__ArrTd[i]+'</td>');
            }
            var n=0;
            //根据len将td添加到对应的行
            for(var i=0;i<__TrLength;i++)
            {
                for(var k=0;k<len;k++)
                {
                    __ArrTagTr[i].append(__ArrTagTd[n]);
                    n++;
                }
            }
            for(var i=0;i<__TrLength;i++)
            {
                ele.append(__ArrTagTr[i]);
            }
        }
        
        //向表格中添加数据
        function addTable(model){    
            //alert(ArrTd);
            ArrTd=new Array();
            if(model!=undefined && model.code==1 && model.data.length>0){
                var index=0;
                var length=0;
                var battgroupids=new Array();
                $('#tbBrdw table tr .eleid').each(function(i){
                    battgroupids[i]=$(this).text();
                });        
                //alert(battgroupids);    
                for(var i=0;i<model.data.length;i++){
                    var flag=true;
                    var data=model.data[i];
                    for(var j=0;j<battgroupids.length;j++){
                        //console.info(data);
                        if(battgroupids[j]==data.BattGroupId){                            
                            flag=false;
                            alert("蓄电池组:"+data.StationName+""+data.BattGroupName+"已经存在!");
                            break;
                        }                            
                    }
                    if(flag){
                        length++;                        
                        ArrTd[index++]=data.BattGroupId;                                //电池组id
                        ArrTd[index++]=data.StationName+""+data.BattGroupName;            //电池组名称
                        ArrTd[index++]="拉闸放电";                                            //测试类型                    
                        ArrTd[index++]=100;                                                //测试电流
                        ArrTd[index++]=60;                                                //测试时长
                        ArrTd[index++]="已停止";                                            //测试状态
                        ArrTd[index++]="00:00:00";                                        //已测时间
                    }                        
                }
                var num=$('#total').text()
                $('#total').text(parseInt(num)+length);
                addTd($('#tbHead table tbody'),ArrTh.length,ArrTd);
                addTd($('#tbBrdw table tbody'),ArrTh.length,ArrTd);
                //遍历tr给tr的第三个单元格添加class="sel"和"ipt"
                $('#tbBrdw table tbody tr').each(function(){
                    $(this).find('td').eq(0).addClass('eleid');
                    $(this).find('td').eq(2).addClass('sel');
                    $(this).find('td').eq(3).addClass('ipt');
                    $(this).find('td').eq(4).addClass('ipt');
                });
                
                // 表格隐藏部分做同样的事情
                $('#tbHead table tbody tr').each(function(){
                    $(this).find('td').eq(2).addClass('sel');
                    $(this).find('td').eq(3).addClass('ipt');
                    $(this).find('td').eq(4).addClass('ipt');
                });
            }
        }
        
        //点击添加单个电池组
        $('#paging .addsingle').click(function(){
            var battgroupid=$('#battgroup_name').prop('value');
            if(battgroupid!=undefined && battgroupid>0){
                $.post("BattInfAction!searchBattBybattgroupid","bif.BattGroupId="+battgroupid,function(data){
                    model=eval("("+data.result+")");
                    //console.info(model);
                    addTable(model);
                });
            }else{
                alert("请先选择一组电池");
            }            
        });
        
        //点击添加机房
        $('#paging .addbatch').click(function(){
            var stationname=$('#station_name').find(":selected").prop('value');
            //alert(stationname);
            if(stationname!=0 && stationname!=''){
                $.post("BattInfAction!serchByBattGroupName","bif.StationName1=&bif.StationName="+stationname,function(data){
                    model=eval("("+data.result+")");
                    addTable(model);
                });
            }else{
                alert("请先选择一个机房");
            }        
        });
        
        var trIndex=0;    //获取当前行的下标
        //点击表格变色(给点击的行添加class)
        $('#tbBrdw').on('click','table tbody tr',function(){
            trIndex=$(this).index();
            //点击当前行的被境改变
            $('#tbBrdw table tbody tr').removeClass('b8cfe5');
            $(this).addClass('b8cfe5');
        });
        //点击表格当前行变色
        $('#tbBrdw table tbody tr').live('mousedown',function(e){
            //如果当前行不存在class="b8cfe5"
            if($(this).hasClass('b8cfe5')==false)
            {
                //点击当前行的被境改变
                $('#tbBrdw table tbody tr').removeClass('b8cfe5');
                $(this).addClass('b8cfe5');
            }
            //利用jquery的方式获取当前点击的是否是右键
            if(e.which==3)
            {
                trIndex=$(this).index();    //获取点击的是第几个tr
                var disX=(e||event).clientX+10;    //获取鼠标点击的横坐标
                var disY=(e||event).clientY+10;    //获取鼠标点击的纵坐标
                var scrollY=$(document).scrollTop();
                $('#right-menu').css('top',disY+scrollY+'px');
                $('#right-menu').css('left',disX+'px');
                $('#right-menu').show();
            }
        });
        //点击移除被测电阻,移除当前带class="b8cfe5"的行
        $('#right-menu .remove-tr').click(function(){
            //移除选项
            $('#tbBrdw table tbody .b8cfe5').remove();
        });
        //点击全部选中选中整个表格
        $('#right-menu .all-pitch').click(function(){
            //添加class
            $('#tbBrdw table tbody tr').addClass('b8cfe5');
        });
        
        //点击批量修改测试电流按钮
        $('#right-menu .re-current').click(function(){
            //显示弹出框
            $('#addPwr').show();
            //生成遮罩层
            createAllMask($('body'),0.5);
        });
        //点击批量修改电流窗口的确定
        $('#addPwr .btn-con .enSure').click(function(){
            var txtVal=$('#addPwr .txt-con input[type="text"]').val();
            if(txtVal>=0 && txtVal<=2000){
                //遍历每行第一个class='ipt'的单元格并给txtVal
                $('#tbBrdw table tbody tr').each(function(){
                    $(this).children('.ipt').eq(0).text(txtVal);
                });
                //表格隐藏部分
                $('#tbHead table tbody tr').each(function(){
                    $(this).children('.ipt').eq(0).text(txtVal);
                });
            }else{
                alert("请输入正确的数值格式!!!");
            }
            //隐藏窗口
            $('#addPwr').hide();
            //删除遮罩层
            $('body').children('.mask').hide();            
            
        });
        //点击批量修改点测试电流窗口的退出
        $('#addPwr .btn-con .outAdd').click(function(){
            //隐藏窗口
            $('#addPwr').hide();
            //删除遮罩层
            $('body').children('.mask').hide();
        });
        //点击批量修改测试电流按钮
        $('#right-menu .re-test-time').click(function(){
            //显示弹出框
            $('#rename').show();
            //生成遮罩层
            createAllMask($('body'),0.5);
        });
        
        //点击批量修改电流窗口的确定
        $('#rename .btn-con .enSure').click(function(){
            var txtVal=$('#rename .txt-con input[type="text"]').val();
            if(txtVal>=1 && txtVal<=2400){
                //遍历每行第一个class='ipt'的单元格并给txtVal
                $('#tbBrdw table tbody tr').each(function(){
                    $(this).children('.ipt').eq(1).text(txtVal);
                });
                //表格隐藏部分
                $('#tbHead table tbody tr').each(function(){
                    $(this).children('.ipt').eq(1).text(txtVal);
                });                
            }else{
                alert("请输入正确的数值格式!!!");
            }
            //隐藏窗口
            $('#rename').hide();
            //删除遮罩层
            $('body').children('.mask').hide();
        });
        //点击批量修改测试时长窗口的退出
        $('#rename .btn-con .out').click(function(){
            //隐藏窗口
            $('#rename').hide();
            //删除遮罩层
            $('body').children('.mask').hide();
        });
        
        //点击页面的其他位置右键菜单消失
        $('div:not("#tb-body")').click(function(){
            $('#right-menu').hide();
        });
        //点击表格的测试类型列生成下拉框
        $('#tbBrdw').on('click','table tbody tr .sel',function(){
            //获取点击的是几个sel
            var selIndex=$(this).index('#tbBrdw .sel');
            //使选中标签为激活状态
            $('#tbBrdw table tbody tr .sel').removeClass('sel-action');
            $(this).addClass('sel-action');
            //给隐藏的表格添加同样事件
            $('#tbHead table tbody tr .sel').removeClass('sel-action');
            $('#tbHead .sel').eq(selIndex).addClass('sel-action');
            var optArr=new Array();
            optArr=['拉闸放电','核对性放电','容量测试放电','充电'];
            var txt=$(this).text();
            if($(this).find('select').length==0)
            {
                //清除表格内容
                $(this).text('');
                $('#tbHead .sel').eq(selIndex).text('');
                createSelect($(this),optArr,txt);
                createSelect($('#tbHead .sel').eq(selIndex),optArr,txt);
            }
        });
        //点击表格其他位置下拉消失
        $('#tbBrdw').on('mousedown','table tbody tr td:not(".sel-action")',function(){
            if($('#tbBrdw table tbody tr .sel-action').length>0)
            {
                var selTxt=$('#tbBrdw table tbody tr .sel-action').find(
                'option:selected').text();
                //清除select
                $('#tbBrdw table tbody tr .sel select').remove();
                $('#tbHead table tbody tr .sel select').remove();
                //将被选值添加到表格内
                $('#tbBrdw table tbody tr .sel-action').text(selTxt);
                $('#tbHead table tbody tr .sel-action').text(selTxt);
                //移除class="sel-action"
                $('#tbBrdw table tbody tr .sel').removeClass('sel-action');
                $('#tbHead table tbody tr .sel').removeClass('sel-action');
            }
        });
        //双击页面特定列表格变为input
        $('#tbBrdw').on('dblclick','table tbody tr .ipt',function(){
            var txtIndex=$(this).index('#tbBrdw .ipt');
            if($(this).find('input').length==0)
            {
                var txt=$(this).text();
                //表格处在激活状态
                $(this).addClass('ipt-action');
                $('#tbHead .ipt').eq(txtIndex).addClass('ipt-action');
                //清除表格内容
                $(this).text('');
                $('#tbHead .ipt').eq(txtIndex).text('');
                var iptTag=$('<input type="text" value="'+txt+'" />');
                var hideTag=$('<input type="text" value="'+txt+'" />');
                $(this).append(iptTag);
                $('#tbHead .ipt').eq(txtIndex).append(hideTag);
            }
        });
        //点击表格其他位置文本框消失
        $('#tbBrdw').on('click','table tbody tr td:not(".ipt-action")',function(){
            if($('#tbBrdw table tbody tr .ipt-action').length>0)
            {
                var txtIpt=$('#tbBrdw table tbody tr .ipt-action input').val();
                //清除input
                $('#tbBrdw table tbody tr .ipt-action input').remove();
                $('#tbHead table tbody tr .ipt-action input').remove();
                //将值添加到表格中
                $('#tbBrdw table tbody tr .ipt-action').text(txtIpt);
                $('#tbHead table tbody tr .ipt-action').text(txtIpt);
                // 移除class="ipt-action"
                $('#tbBrdw table tbody tr .ipt').removeClass('ipt-action');
                $('#tbHead table tbody tr .ipt').removeClass('ipt-action');
            }
        });
    });    
    
    //页面加载时查询维护区中的枢纽类型
    $.post("BattInfAction_serchByStation",null,function(data){
        data=data.result;
        data=eval("("+data+")");
        //console.info(data);
        if(data.code==1 && data.data.length>0){
            var Ostation_name1=document.getElementById("station_name1");
            Ostation_name1.innerHTML="";
            for(var i=0;i<=data.data.length;i++){
                option=createEle("option");
                if(i==0){
                    option.innerHTML="全部(共"+data.sum+"种)";    
                    option.setAttribute("value", "");            
                }else{
                    option.innerHTML=data.data[i-1].StationName1;
                    option.setAttribute("value",data.data[i-1].StationName1);    
                }                    
                Ostation_name1.appendChild(option);
            }                
        }
        findStationNamebyStationname1();        
    });
    
    //查询不重复的电池组
    $.post("BattInfAction_serchByStationName1",null,function(data){
        model=eval("("+data.result+")");
        var Obattgroup_name = document.getElementById("battgroup_name");
        Obattgroup_name.innerHTML="";
        if(model.code==1 && model.data.length>0){
            for(var i=0;i<model.data.length;i++){
                data=model.data[i];
                option=createEle("option");
                if(i!=0){
                    option.innerHTML=data.BattGroupName+"-"+data.MonCount+"节";
                    option.setAttribute("value",data.BattGroupId);
                    option.setAttribute("oldvalue",data.StationName+""+data.BattGroupName);
                }else{
                    option.innerHTML="全部蓄电池组(共"+model.sum+"组)";
                    option.setAttribute("value", "0");
                }
                Obattgroup_name.appendChild(option);
                
            }
        }
    });
    
    //当维护区的值变换时更新机房站点
    $('#station_name1').change(function(){
        findStationNamebyStationname1()
    });
    
    //根据维护区查询站点
    function findStationNamebyStationname1(){
        var selectvalue=$("#station_name1 option:selected").val();
        //alert(selectvalue);
        $.post("BattInfAction_serchByStationName","bif.StationName1="+selectvalue,function(data){
            //console.info(data);
            data=data.result;
            data=eval("("+data+")");
            if(data.code==1 && data.data.length>0){
                
                var Ostttion_name = document.getElementById("station_name");
                Ostttion_name.innerHTML="";                
                for(var i=0;i<=data.data.length;i++){
                    option=createEle("option");
                    if(i==0){
                        option.innerHTML="全部(共"+data.sum+"种)";    
                        option.setAttribute("value", "");            
                    }else{
                        option.innerHTML=data.data[i-1].StationName;
                        option.setAttribute("value",data.data[i-1].StationName);    
                    }                    
                    Ostttion_name.appendChild(option);
                }
            }
            findserchByBattGroupNamebystationname();
        });
        $('#station_name').change(function(){
            findserchByBattGroupNamebystationname();
        });
    }
    
    //根据维护区和机房查询蓄电池组
    function findserchByBattGroupNamebystationname(){
        var station_name1=$("#station_name1 option:selected").val();
        var station_name=$("#station_name option:selected").val();
        
        $.post("BattInfAction_serchByBattGroupName","bif.StationName1="+station_name1+"&bif.StationName="+station_name,function(data){
            data=data.result;
            //console.info(data);
            data=eval("("+data+")");
            //console.info(data.data);        
            if(data.code==1 && data.data.length>0){
                //console.info(data.data);
                var Obattgroup_name = document.getElementById("battgroup_name");
                Obattgroup_name.innerHTML="";
                
                for(var i=0;i<=data.data.length;i++){
                    option=createEle("option");
                    if(i!=0){
                        option.innerHTML=data.data[i-1].BattGroupName+"-"+data.data[i-1].MonCount+"节";
                        option.setAttribute("value",data.data[i-1].BattGroupId);
                        option.setAttribute("oldvalue",data.data[i-1].StationName+""+data.data[i-1].BattGroupName);
                    }else{
                        option.innerHTML="全部蓄电池组(共"+data.sum+"组)";
                        option.setAttribute("value", "0");
                    }
                    Obattgroup_name.appendChild(option);
                }
            }
        });
    }
</script>
</html>