wang-hao-jie
2022-08-25 57dcc73636bb7d8dce89c808eb8cc988a7512264
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
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('指纹读头列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                门名称:<input type="text" name="doorName"/>
                            </li>
                            <li>
                                区域名称:<input type="text" name="areaName"/>
                            </li>
                            <!--<li>-->
                                <!--<label>品牌:</label>-->
                                <!--<input type="text" name="brand"/>-->
                            <!--</li>-->
                            <!--<li>-->
                                <!--<label>型号:</label>-->
                                <!--<input type="text" name="model"/>-->
                            <!--</li>-->
                            <li>
                                控制读头标识:<input type="text" name="identification"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
 
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="station:head:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="station:head:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
     <input id="teamId" type="hidden">
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('station:head:edit')}]];
        var removeFlag = [[${@permission.hasPermi('station:head:remove')}]];
        var prefix = ctx + "station/head";
 
        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "指纹读头",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'doorId',
                    title: '门id',
                    visible: false
                },
                {
                    field: 'doorName',
                    title: '门的名字'
                },
                {
                    field: 'areaId',
                    title: '区域父id',
                    visible: false
                },
                {
                    field: 'areaName',
                    title: '区域名称'
                },
                {
                    field: 'ipOrOther',
                    title: 'IP地址或其他标识'
                },
                {
                    field: 'port',
                    title: 'port'
                },
                // {
                //     field: 'brand',
                //     title: '品牌'
                // },
                // {
                //     field: 'model',
                //     title: '型号'
                // },
                {
                    field: 'direction',
                    title: '进门/出门',
                    formatter : function (value, row, index) {
                        if(value == 0) {
                            return "进门"
                        }else if(value == 1) {
                            return "出门";
                        }else {
                            return "未知"
                        }
                    }
                },
                 {
                    field: 'newOldStatus',
                    title: '新/旧设备',
                    formatter : function (value, row, index) {
                        if(value == 0) {
                            return "Smart 5F"
                        }else if(value == 1) {
                            return "MA300";
                        }else {
                            return "未知"
                        }
                    }
                },
                // {
                //     field: 'bindingStatus',
                //     title: '是否绑定',
                //     formatter : function (value, row, index) {
                //         if(value == 0) {
                //             return "未绑定"
                //         }else if(value == 1) {
                //             return "绑定";
                //         }else {
                //             return "未知"
                //         }
                //     }
                // },
                // {
                //     field: 'identification',
                //     title: '控制读头标识',
                //     formatter : function (value, row, index) {
                //         if(value == 0) {
                //             return "中控"
                //         }else if(value == 1) {
                //             return "霍尼韦尔";
                //         }else {
                //             return "未知"
                //         }
                //     }
                // },
                // {
                //     field: 'status',
                //     title: '是否禁用0/未禁用1/禁用',
                //     formatter : function (value, row, index) {
                //         if(value == 0) {
                //             return "未禁用"
                //         }else if(value == 1) {
                //             return "禁用";
                //         }else {
                //             return "未知"
                //         }
                //     }
                // },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var $row = JSON.stringify(row).replace(/\"/g,"'");
                        var actions = [];
                        actions.push('<a class="btn btn-info' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        /*actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="resetUser(' + $row + ')"><i class="fa fa-remove"></i>清除用户指纹信息</a>');*/
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="cleanFingerInfo(' + $row + ')"><i class="fa fa-remove"></i>清除用户指纹信息</a>');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="restartHead(' + $row + ')"><i class="fa fa-remove"></i>重启设备</a>');
                        // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="getConnectStatus(' + $row + ')"><i class="fa fa-remove"></i>获取连接状态</a>');
                        // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="register(' + $row + ')"><i class="fa fa-remove"></i>注册</a>');
                        actions.push('<a class="btn btn-info' + editFlag + '" href="javascript:void(0)" onclick="find(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看授权</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
 
        //清除指纹读头对应用户信息
        function resetUser(row) {
            $.modal.confirm("确认要清除选中读头中的用户数据吗?", function() {
                $.operate.submit("/station/workUser/removeUserTmp", "post", "json", row);
            });
        }
 
        //清除用户指纹信息
        function cleanFingerInfo(row) {
            $.modal.confirm("确认要清除选中读头中的用户数据吗?", function() {
                $.ajax({
                    url: "/station/workUser/cleanFingerInfo",
                    data: row,
                    type: "post",
                    success: function(res) {
                        if(res.code == 0) {
                            $.modal.alertSuccess(res.msg)
                        }else {
                            $.modal.alertError(res.msg);
                        }
                    }
                })
            });
        }
 
        //重启读头
        function restartHead(row) {
            $.modal.confirm("确认要重启读头吗?", function() {
                $.ajax({
                    url: "/station/workUser/restartHead",
                    data: row,
                    type: "post",
                    success: function(res) {
                        if(res.code == 0) {
                            $.modal.alertSuccess(res.msg)
                        }else {
                            $.modal.alertError(res.msg);
                        }
                    }
                })
            });
        }
 
        //获取读头连接状态
        function getConnectStatus(row) {
            $.ajax({
                url: "/station/workUser/getConnectStatus",
                data: row,
                type: "post",
                success: function(res) {
                    if(res.code == 0) {
                        $.modal.alertSuccess(res.msg)
                    }else {
                        $.modal.alertError(res.msg);
                    }
                }
            })
        }
        //注册
        function register(row) {
            $.ajax({
                url: "/station/workUser/register",
                data: row,
                type: "post",
                success: function(res) {
                    if(res.code == 0) {
                        $.modal.alertSuccess(res.msg)
                    }else {
                        $.modal.alertError(res.msg);
                    }
                }
            })
        }
 
        function find(id){
            $('#teamId').val(id)
            $.modal.open("授权状况", "head/find2",'900','600');
        }
    </script>
</body>
</html>