15832144755
2021-08-27 3516f02277035cdc7ff137422709b16efe97ca4a
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
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no">
    <title>围栏列表</title>
    <link href="/hxzkoa/hxzk/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="/hxzkoa/hxzk/assets/img/favicon.ico" rel="icon" type="image/x-icon" />
    <link href="/hxzkoa/hxzk/assets/css/components/custom-modal.css" rel="stylesheet" type="text/css" />
    <link href="/hxzkoa/hxzk/assets/css/components/custom-sweetalert.css" rel="stylesheet" type="text/css" />
    <link href="/hxzkoa/hxzk/assets/css/dashboard/dash_2.css" rel="stylesheet" type="text/css" />
    <link href="/hxzkoa/hxzk/assets/css/elements/custom-pagination.css" rel="stylesheet" type="text/css" />
    <link href="/hxzkoa/hxzk/assets/css/loader.css" rel="stylesheet" type="text/css" />
    <link href="/hxzkoa/hxzk/assets/css/scrollspyNav.css" rel="stylesheet" type="text/css" />
    <link href="/hxzkoa/hxzk/assets/css/main.css" rel="stylesheet" type="text/css" />
    <link href="/hxzkoa/hxzk/assets/css/structure.css" rel="stylesheet" type="text/css" />
    <link href="/hxzkoa/hxzk/assets/css/elements/search.css" rel="stylesheet" type="text/css" />
    <link href="/hxzkoa/hxzk/plugins/apex/apexcharts.css" rel="stylesheet" type="text/css">
    <link href="/hxzkoa/hxzk/plugins/animate/animate.css" rel="stylesheet" type="text/css" />
    <link href="/hxzkoa/hxzk/plugins/highlight/styles/monokai-sublime.css" rel="stylesheet" type="text/css" />
    <link href="/hxzkoa/hxzk/plugins/sweetalerts/sweetalert2.min.css" rel="stylesheet" type="text/css" />
    <link href="/hxzkoa/hxzk/plugins/sweetalerts/sweetalert.css" rel="stylesheet" type="text/css" />
    <link href="/hxzkoa/hxzk/plugins/table/datatable/datatables.css" rel="stylesheet" type="text/css">
    <link href="/hxzkoa/hxzk/plugins/table/datatable/custom_dt_html5.css" rel="stylesheet" type="text/css">
    <link href="/hxzkoa/hxzk/plugins/table/datatable/dt-global_style.css" rel="stylesheet" type="text/css">
    <link href="/hxzkoa/hxzk/plugins/perfect-scrollbar/perfect-scrollbar.css" rel="stylesheet" type="text/css" />
    <link href="https://fonts.gstatic.com" rel="preconnect" >
    <link href="https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Quicksand:400,500,600,700&display=swap" rel="stylesheet">
    <style>
        .panel-head {
            font-size: 1rem;
            color: rgba(255, 255, 255, .7);
            line-height: 2rem;
            text-align: center;
            background: linear-gradient(rgb(0, 20, 30), rgb(0, 40, 70));
            border: 2px solid rgba(0, 90, 120, .3);
        }
        .table-bordered td, .table-bordered th {
            border: 1px solid #ebedf2;
        }
    </style>
    <script src="/hxzkoa/hxzk/assets/js/app.js"></script>
    <script src="/hxzkoa/hxzk/assets/js/dashboard/dash_2.js"></script>
    <script src="/hxzkoa/hxzk/assets/js/loader.js"></script>
    <script src="/hxzkoa/hxzk/assets/js/libs/jquery-3.1.1.min.js"></script>
    <script src="/hxzkoa/hxzk/bootstrap/js/bootstrap.min.js"></script>
    <script src="/hxzkoa/hxzk/bootstrap/js/popper.min.js"></script>
    <script src="/hxzkoa/hxzk/plugins/apex/apexcharts.min.js"></script>
    <script src="/hxzkoa/hxzk/plugins/table/datatable/button-ext/jszip.min.js"></script>
    <script src="/hxzkoa/hxzk/plugins/table/jquery.table2excel.js"></script>
    <script src="/hxzkoa/hxzk/plugins/sweetalerts/promise-polyfill.js"></script>
    <script src="/hxzkoa/hxzk/plugins/sweetalerts/sweetalert2.min.js"></script>
    <script src="/hxzkoa/hxzk/plugins/sweetalerts/custom-sweetalert.js"></script>
    <script src="/hxzkoa/hxzk/plugins/perfect-scrollbar/perfect-scrollbar.min.js"></script>
</head>
<body class="alt-menu sidebar-noneoverflow">
    <!-- BEGIN LOADER -->
    <div id="load_screen"> <div class="loader"> <div class="loader-content">
        <div class="spinner-grow align-self-center"></div>
    </div></div></div>
    <!--  END LOADER -->    
    <div class="border-left" style="opacity:0.4;float:left;position:absolute;z-index:1;left:120px;height:20px;"><img alt="" src="/hxzkoa/resources/images/border.png" class="img-left"></div>
    <div class="border-right" style="opacity:0.4;float:right;position:absolute;z-index:2;right:120px;"><img alt="" src="/hxzkoa/resources/images/border2.png" class="img-right"></div>
    <!--  BEGIN NAVBAR  -->
    <div class="login-page"></div>
    <!--  END NAVBAR  -->
    <!--  BEGIN MAIN CONTAINER  -->
    <div class="main-container" id="container">
        <div class="overlay"></div>
        <div class="search-overlay"></div>
        <!--  BEGIN TOPBAR  -->
        <div class="header-page"></div>
        <!--  END TOPBAR  -->
        <!--  BEGIN MODAL  -->
        <div class="modal fade modifyNew" tabindex="-1" role="dialog"
            aria-labelledby="myExtraLargeModalLabel" aria-hidden="true">
            <div class="modal-dialog modal-xl" role="document" style="width:30%;">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="myExtraLargeModalLabel">修改</h5>
                        <button type="button" class="close" data-dismiss="modal"
                            aria-label="Close">
                            <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
                                width="24" height="24" viewBox="0 0 24 24" fill="none"
                                stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                stroke-linejoin="round" class="feather feather-x">
                                <line x1="18" y1="6" x2="6" y2="18"></line>
                                <line x1="6" y1="6" x2="18" y2="18"></line></svg>
                        </button>
                    </div>
                    <div class="modal-body">
                        <form action="form_action.asp" method="get">
                            <div class="form-group row  mb-4">
                                <label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm" style ="font-size:12px;">关联对象:</label>
                                <div class="col-sm-10">
                                    <input class="form-control" type="hidden" id="id_m" />
                                    <select class="form-control form-control-lg" id="bumen_m" style ="font-size:15px;">
                                        <c:forEach items="${department}" var="list">
                                            <option value="${list.departmentName}">${list.departmentName}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group row  mb-4">
                                <label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm" style ="font-size:12px;">围栏名称:</label>
                                <div class="col-sm-10">
                                    <input
                                        class="form-control" type="text" id="name_m" style ="font-size:15px;"/>
                                </div>
                            </div>
                            <div class="form-group row  mb-4">
                                <label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm" style ="font-size:12px;">有效范围:</label>
                                <div class="col-sm-10">
                                    <input
                                        class="form-control" type="text" id="zuobiao_m" style ="font-size:15px;"/>
                                </div>
                            </div>
                            <div class="form-group row  mb-4">
                                <label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm" style ="font-size:12px;">生效时间:</label>
                                <div class="col-sm-10">
                                    <input
                                        class="form-control" type="text" id="start_m" style ="font-size:15px;"/>
                                </div>
                            </div>
                            <div class="form-group row  mb-4">
                                <label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm" style ="font-size:12px;">失效时间:</label>
                                <div class="col-sm-10">
                                    <input
                                        class="form-control" type="text" id="stop_m" style ="font-size:15px;"/>
                                </div>
                            </div>
                            
                            <div class="modal-footer"
                                style="margin-top:10%; margin-left:10%;float:left;">
                                <button type="button" class="btn btn-primary modify">保存</button>
                                <a><c:forEach var="i" begin="1" end="28">&nbsp</c:forEach></a>
                                <button class="btn" data-dismiss="modal">
                                    <i class="flaticon-cancel-12"></i>取消
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <!--  END MODAL  -->
        <!--  BEGIN CONTENT PART  -->
        <div id="content" class="main-content">
            <div class="layout-px-spacing">
                <div class="row layout-top-spacing" id="cancel-row">
                    <div class="col-xl-12 col-lg-12 col-sm-12  layout-spacing">
                        <div class="widget-content widget-content-area br-6">
                            <div class="table-responsive mb-4 mt-4">
                                <table id="html5-extension" class="table table-hover" style="width:100%">
                                        <div><div class="search-input-group-style input-group mb-3" style="width:15%;float:left;margin-left:15px;margin-right:15px;">
                                            <div class="input-group-prepend">
                                            <span class="input-group-text search" id="basic-addon1"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg></span>
                                            </div>
                                            <input type="text" id="search_input" class="form-control" placeholder="请输入围栏类型" aria-label="Username" aria-describedby="basic-addon1">
                                        </div>
                                        
                                            <button type="button" class="btn btn-secondary reset">刷新</button>
                                            <button type="button" class="btn btn-secondary initModify" data-toggle="modal" data-target=".modifyNew" id="modifyButton">修改</button>
                                            <button type="button" class="btn btn-secondary delete" id="deleteButton">删除</button>
                                            <button type="button" class="btn btn-secondary deleteAll" id="deleteAllButton">全部删除</button>
                                            <button type="button" class="btn btn-secondary toExcel">导出表格</button>
                                        </div>
                                            <thead>
                                                <tr align="center">
                                                    <th class="noExl">选择</th>
                                                    <th>序号</th>
                                                    <th>图层</th>
                                                    <th>围栏类型</th>
                                                    <th>关联对象</th>
                                                    <th>围栏名称</th>
                                                    <th>有效范围</th>
                                                    <th>形状</th>
                                                    <th>生效时间</th>
                                                    <th>失效时间</th>
                                                    <th>添加时间</th>
                                                    <th>颜色</th>
                                                </tr>
                                            </thead>
                                            <tbody id="nr">
                                                <c:forEach items="${fenceList}" var="list">
                                                    <tr align="center">
                                                        <td class="noExl custom-control custom-checkbox"><input type="checkbox"
                                                            class="custom-control-input" id="${list.id}"
                                                            name="selectIds"><label
                                                            class="custom-control-label" for="${list.id}"
                                                            style="position:raletive;left:20px;bottom:4px;"></label></td>
                                                        <td>${list.id}</td>
                                                        <td>${list.floor}</td>
                                                        <td>${list.type}</td>
                                                        <td>${list.bumen}</td>
                                                        <td>${list.name}</td>
                                                        <td>${list.zuobiao}</td>
                                                        <td>${list.shape}</td>
                                                        <td>${list.start}</td>
                                                        <td>${list.stop}</td>
                                                        <td>${list.addtime}</td>
                                                        <td>${list.color}</td>
                                                    </tr>
                                                </c:forEach>
                                            </tbody>
                                        </table>
                                    </div>
                               </div>
                           </div>
                       </div>
                 </div>
             </div>
        <!--  END CONTENT PART  -->
    </div>
    <%
        String superuser =(String)session.getAttribute("superuser");
        String deleteq =(String)session.getAttribute("deleteq");
        String alertq =(String)session.getAttribute("alertq");
        String deleteall =(String)session.getAttribute("deleteall");
        String username=(String)session.getAttribute("username");
        if(username==null || username.equals("")){
        request.getRequestDispatcher("/hxzk/login.jsp").forward(request,response);
        return;
        }
    %>
    <input type="hidden" name="superuser" id="superuser" value="<%=superuser%>">
    <input type="hidden" name="deleteq" id="deleteq" value="<%=deleteq%>">
    <input type="hidden" name="alertq" id="alertq" value="<%=alertq%>">
    <input type="hidden" name="deleteall" id="deleteall" value="<%=deleteall%>">
    <!-- END MAIN CONTAINER -->
    <script>
    // 页面初始化
    $(document).ready(function() {
        App.init();$.ajax({async : false, type : "POST",url : "/hxzkoa/getSysSetting_list.do",data : {},dataType : "json",success:function(data){/* title = data[0].title;document.title = title; */},});
        $("#page_1").addClass("active");
        var superuser = document.getElementById("superuser").value;
        var deleteq = document.getElementById("deleteq").value;
        var alertq = document.getElementById("alertq").value;
        var deleteall = document.getElementById("deleteall").value;
        //console.log(superuser)
        if (superuser == "访客"){
            $("#addButton").attr("disabled","true");
            $("#deleteButton").attr("disabled","true");
            $("#modifyButton").attr("disabled","true");
            $("#deleteAllButton").attr("disabled","true");
            $("#modifyAllButton").attr("disabled","true");
            $("#importButton").attr("disabled","true");
        }
        if (deleteq == "否"){ 
            $("#deleteButton").attr("disabled","true");
        }
        if (alertq == "否"){
            $("#modifyButton").attr("disabled","true");
            $("#modifyAllButton").attr("disabled","true");
        }
        if (deleteall == "否"){
            $("#deleteAllButton").attr("disabled","true");
        }
    });
    // 加载head复用页面
    $('.header-page').load('/hxzkoa/hxzk/top.html');$('.login-page').load('/hxzkoa/hxzk/head.html');
    // 刷新功能
    $(".reset").click(function() {
        setTimeout("window.location.reload()", 1000);
    });
    // 修改功能初始化
    $('.initModify').on('click', function() {
        var tr,state,firstId;
        $('input[name="selectIds"]').each(
            function(){
                state = $(this).prop('checked');
                if(state){
                    firstId = $(this).attr('id');
                    tr = $(this).parent().parent()[0];
                    $("#id_m").val(tr.children[1].innerHTML);
                    $("#bumen_m").val(tr.children[4].innerHTML);
                    $("#name_m").val(tr.children[5].innerHTML);
                    $("#zuobiao_m").val(tr.children[6].innerHTML);
                    $("#start_m").val(tr.children[8].innerHTML);
                    $("#stop_m").val(tr.children[9].innerHTML);
                    return false;
                }
            }
        );
        if(!state){
            $('input[name="selectIds"]').each(
                function(){
                    state = $(this).prop('checked');
                    if(!state){
                        firstId = $(this).attr('id');
                        tr = $(this).parent().parent()[0];
                        $("#id_m").val(tr.children[1].innerHTML);
                        $("#bumen_m").val(tr.children[4].innerHTML);
                        $("#name_m").val(tr.children[5].innerHTML);
                        $("#zuobiao_m").val(tr.children[6].innerHTML);
                        $("#start_m").val(tr.children[8].innerHTML);
                        $("#stop_m").val(tr.children[9].innerHTML);
                        return false;
                    }
                    
                }
            );
            alert("请选中一条数据进行修改,当前默认第一条!");
        }
    });
    // 修改功能
    $('.modify').on('click', function() {
        var id = $("#id_m").val();
        var bumen = $('#bumen_m option:selected').val();
        var name = $("#name_m").val();
        var zuobiao = $("#zuobiao_m").val();
        var start = $("#start_m").val();
        var stop = $("#stop_m").val();
        $.ajax({
            async : false, //同步的
            type : "POST",
            url : "/hxzkoa/fenceList_modify.do",
            data : {
                id : id,
                bumen : bumen,
                name : name,
                zuobiao : zuobiao,
                start : start,
                stop : stop
            },
            dataType : "json"
        });
        swal({title:"Modified!",
           text:"修改成功!",
           type:"success",
           showCancelButton:false,
           showConfirmButton:false,
           buttons: false
        })
        setTimeout("window.location.reload()",1000);
    });
    // 删除功能
    $('.delete').on('click', function() {
        swal({
            title : '确定要删除么?',
            text : "删除之后无法恢复!",
            type : 'warning',
            showCancelButton : true,
            confirmButtonText : '删除',
            cancelButtonText : '取消',
            padding : '2em'
        }).then(function(result) {
            if (result.value) {
                    //获取选中数据
                var checkVal = [];
                var obj = document.getElementsByName("selectIds");
                for (var k in obj) {
                    if (obj[k].checked) {
                        checkVal.push(obj[k].id);
                    }
                }
                if (checkVal.length>0){
                    $.ajax({
                        async : false, //同步的
                        type : "POST",
                        url : "/hxzkoa/fenceList_delete.do",
                        data : {
                            checkVal : checkVal.toString()
                        },
                        dataType : "json"
                    });
                    swal({title:"Deleted!",
                       text:"删除成功!",
                       type:"success",
                       showCancelButton:false,
                       showConfirmButton:false,
                       buttons: false
                    })
                    setTimeout("window.location.reload()",1000);
                }else{
                    swal(
                        '删除失败!',
                        '请先选择删除的内容',
                        'error'
                    )
                }
            }
        })
    });
    // 全部删除
    $('.deleteAll').on('click', function() {
        swal({
            title : '确定要全部删除么?',
            text : "删除之后无法恢复!",
            type : 'warning',
            showCancelButton : true,
            confirmButtonText : '删除',
            cancelButtonText : '取消',
            padding : '2em'
        }).then(function(result) {
            if (result.value) {
                //获取选中数据
                var checkVal = [];
                var obj = document.getElementsByName("selectIds");
                for (var k in obj) {
                    if (obj[k].checked) {
                        checkVal.push(obj[k].id);
                    }
                }
                $.ajax({
                    async : false, //同步的
                    type : "POST",
                    url : "/hxzkoa/fenceList_deleteAll.do",
                    data : {
                        checkVal : checkVal.toString()
                    },
                    dataType : "json"
                });
                swal({title:"Deleted!",
                       text:"删除成功!",
                       type:"success",
                       showCancelButton:false,
                       showConfirmButton:false,
                       buttons: false
                })
                setTimeout("window.location.reload()",1000);
            }
        })
    });
    // 搜索功能
    $(".search").click(function() {
        var input = $("#search_input").val();
        if (input == "") {
            swal('输入有误','输入不能为空!','error');return;
        }
        $.ajax({
            async : false, //同步的
            type : "POST",
            url : "/hxzkoa/fenceList_search.do",
            data : {
                input : input
            },
            dataType : "json",
            success : function(data) {
                //搜索完成后刷新页面,只显示查到的部分
                var str = "";
                for (var k in data.dataList) {
                    str += "<tr align=\"center\"><td><input type=\"checkbox\" class=\"custom-control-input\" id=" + data.dataList[k].id + " name=\"selectIds\"><label class=\"custom-control-label\" for=" + data.dataList[k].id + " style=\"position:raletive;left:20px;bottom:5px;\"></label></td><td>" + data.dataList[k].floor + "</td><td>" + data.dataList[k].type + "</td><td>" + data.dataList[k].bumen + "</td><td>" + data.dataList[k].name + "</td><td>" + data.dataList[k].zuobiao + "</td><td>" + data.dataList[k].shape + "</td><td>" + data.dataList[k].start + "</td><td>" + data.dataList[k].stop + "</td><td>" + data.dataList[k].addtime + "</td><td>" + data.dataList[k].color + "</td></tr>";
                }
                $("#nr").html(str);
            },
            error : function() {
                //console.log('error');
            }
        });
    });
    // 导出表格
    $(".toExcel").click(function() {
        $(".table-responsive").table2excel({
                // 不被导出的表格行的CSS class类
                exclude: ".noExl",
                // 导出的Excel文档的名称
                name: "围栏列表",
                // Excel文件的名称
                filename: "围栏列表",
                //文件后缀名
                fileext: ".xls",
                //是否排除导出图片
                exclude_img: false,
                //是否排除导出超链接
                exclude_links: false,
                //是否排除导出输入框中的内容
                exclude_inputs: false
            });
            swal({title:"Downloaded!",
               text:"下载成功!",
               type:"success",
               showCancelButton:false,
               showConfirmButton:false,
               buttons: false,
               timer: 1000
         })
    });
    $(".table tbody").on('click', 'tr',function(e){
                //console.log(e.target.type)
                if(e.target.type!='checkbox'){
                    if($(this).find(":checkbox").prop("checked")==true){
                    $(this).find(":checkbox").prop("checked",false);
                    }else{
                        $(this).find(":checkbox").prop("checked",true);
                    }
                } else {
                    return false;
                } 
            });
    </script>
</body>
</html>