多单位版国产化地质资料管理系统
zhai
2025-12-18 3c6f6c1e3016e38146a4c46be6e7b625c35591f2
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
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" trimDirectiveWhitespaces="true" %>
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
 
<!DOCTYPE HTML>
<html>
<head>
    <base href="<%=basePath%>">
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>用户管理</title>
    <!--[if !IE]><!-->
    <link href="static/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
    <!--<![endif]-->
    <!--[if gte IE 8]>
    <link href="static/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
    <![endif]-->
    <link href="static/plugins/jquery-easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="static/styles/initialize.css" type="text/css">
    <link rel="stylesheet" href="static/styles/common.css" type="text/css">
    <link rel="stylesheet" href="static/plugins/layer/skin/default/layer.css" type="text/css">
    <script type="text/javascript" src="static/plugins/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="static/plugins/jquery-easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="static/plugins/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="static/plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <script type="text/javascript" src="static/plugins/layer/layer.js"></script>
 
    <script type="text/javascript" src="static/plugins/spinjs/spin.js"></script>
    <script type="text/javascript" src="static/plugins/spinjs/jquery.spin.js"></script>
    <script type="text/javascript" src="static/plugins/jquery.blockUI.js"></script>
 
    <script type="text/javascript" src="static/wcp/scripts/wcp.js"></script>
    <script type="text/javascript" src="static/wcp/scripts/libs/wcp.layer.js"></script>
    <script type="text/javascript" src="static/wcp/scripts/libs/wcp.blockUI.js"></script>
    <script type="text/javascript" src="static/wcp/scripts/libs/wcp.spin.js"></script>
    <script type="text/javascript" src="static/wcp/scripts/libs/wcp.jquery.js"></script>
 
    <!--[if lt IE 9]>
    <script type="text/javascript" src="static/plugins/json2.js"></script>
    <![endif]-->
 
    <style>
        html, body {
            height: 100%;
            width: 100%;
            overflow: hidden;
        }
    </style>
</head>
<div>
    <div class="pt-main-top clear">
        <div class="pt-nav">
            <span class="pt-title-icon"> <i class="fa fa-user-circle"></i>
            </span>
            <div class="pt-title">
                <div>
                    <h4>用户管理</h4>
                </div>
            </div>
        </div>
        <div class="pt-search">
            <p class="pt-retrieval">
                <input id="txtKeySearch" type="text" placeholder="请输入用户名或真实姓名进行搜索">
                <button id="btnKeySearch">
                    <i class="fa fa-search"></i>
                </button>
            </p>
            <shiro:hasPermission name="SYS_MANAGE.ORGANIZATION.USER.OPERATION.ADD">
                <button id="btnAdd" class="pt-btn pt-btn-primary">
                    <i class="fa fa-plus"></i> 新增
                </button>
            </shiro:hasPermission>
            <shiro:hasPermission name="SYS_MANAGE.ORGANIZATION.USER.OPERATION.SAVE">
                <button id="initPassword" class="pt-btn pt-btn-success">
                    <i class="fa fa-pencil-square-o"></i> 初始化密码
                </button>
            </shiro:hasPermission>
            <shiro:hasPermission name="SYS_MANAGE.ORGANIZATION.USER.OPERATION.DELETE">
                <button id="btnDelete" class="pt-btn pt-btn-danger">
                    <i class="fa fa-trash-o"></i> 删除
                </button>
            </shiro:hasPermission>
        </div>
    </div>
    <div class="pt-left-menu pt-tree" style="padding:0px 10px;">
        <div class="easyui-panel">
            <ul id="ul_dept"></ul>
        </div>
    </div>
    <div class="pt-right-main">
        <div id="right">
            <div>
                <table id="dg_user" style="width:100%;">
                </table>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="static/scripts/ResizeScroll.js"></script>
<script>
    //定义页面全局变量
    var NowSelectedDeptId = null;
 
    $(function () {
        //初始化部门树
        $("#ul_dept").tree({
            method: "get",
            url: "management/dept/listDeptByTree",
            animate: true,
            onBeforeLoad: function (node, param) {
                new ResizeScroll({
                    "id": "#ul_dept",
                    fun: function () {
 
                        var wh = $(window).height();
                        //$("#ul_dept").height(wh-79-39);
                        return (wh - 79 - 20);
                    }
                });
 
                wcp.ui.setBusy("#ul_dept");
            },
            onLoadSuccess: function (node, data) {
                wcp.ui.clearBusy("#ul_dept");
                new ResizeScroll({
                    "id": "#ul_dept",
                    "fun": function () {
 
                        var wh = $(window).height();
                        //$("#ul_dept").height(wh-79-39);
                        return (wh - 79 - 20);
 
                    }
                });
            },
            onLoadError: function (args) {
                wcp.ui.clearBusy("#ul_dept");
            },
            onClick: function (node) {
                NowSelectedDeptId = node.id;
                $('#dg_user').datagrid('load', {
                    deptId: NowSelectedDeptId
                });
            }
        })
 
        var wh = $(window).height();
        var dgHeight = wh - 98;
        //初始化表格
        $('#dg_user').datagrid({
            url: 'management/user/getUserList',
            fitColumns: true,
            striped: true,
            idField: "userId",
            rownumbers: true,
            pagination: true,
            checkOnSelect: false,
            selectOnCheck: false,
            singleSelect: true,
            sortName: "sort_num",
            sortOrder: "asc",
            height: dgHeight,
            pageSize: 50,
            columns: [[
                {
                    field: 'ck',
                    checkbox: true
                },
                {
                    field: 'userName',
                    title: '用户名',
                    width: 100,
                    sortable: true
                },
                {
                    field: 'trueName',
                    title: '真实姓名',
                    width: 100,
                    sortable: true
                },
                {
                    field: 'employeeNum',
                    title: '工号',
                    width: 100
                },
                {
                    field: 'deptName',
                    title: '所属部门',
                    width: 100
                },
                {
                    field: 'mobilePhone',
                    title: '手机号码',
                    width: 100
                },
                {
                    field: 'enableLogin',
                    title: '是否允许登录',
                    width: 100,
                    align: 'center',
                    formatter: function (value, row, index) {
                        return value == 1 ? "是" : "否";
                    }
                },
                {
                    field: 'securityLevel',
                    title: '密级',
                    width: 100,
                    align: 'center',
                    formatter: function (value, row, index) {
                        // if(value == 0){
                        //   return '公开'
                        // }else if(value == 1){
                        //   return '内部'
                        // }else if(value == 2){
                        //   return '秘密'
                        // }else if(value == 3){
                        //   return '机密'
                        // }else if(value == 4){
                        //   return '绝密'
                        // }
                        if (value == 2) {
                            return '一般';
                        } else if (value == 3) {
                            return '重要';
                        }
                    }
                },
                {
                    field: 'createTime',
                    title: '创建时间',
                    width: 120,
                    align: 'center',
                    sortable: true
                },
                {
                    field: 'userId',
                    title: '操作',
                    width: 100,
                    align: 'center',
                    formatter: function (value, row, index) {
                        var ret = "";
                        <shiro:hasPermission name="SYS_MANAGE.ORGANIZATION.USER.OPERATION.SAVE">
                        ret += "<a onclick=\"editUser('" + value + "');\" class='pt-color-success'><i class='fa fa-pencil' title='编辑'></i></a>";
                        </shiro:hasPermission>
                        <shiro:hasPermission name="SYS_MANAGE.ORGANIZATION.USER.OPERATION.DELETE">
                        ret += "<a onclick=\"deleteUser('" + value + "');\" class='pt-color-danger'><i class='fa fa-trash-o' title='删除'></i></a>";
                        </shiro:hasPermission>
                        <shiro:hasPermission name="SYS_MANAGE.ORGANIZATION.USER.OPERATION.LOGINPOWERSET">
                        var iconCls = "fa-toggle-on";
                        var colorCls = "pt-color-success";
                        var title = "允许用户登录";
                        if (row.enableLogin == 1) {
                            iconCls = "fa-toggle-off";
                            colorCls = "pt-color-danger";
                            title = "不允许用户登录";
                        }
                        ret += "<a onclick=\"changeLoginPower('" + value + "');\" class='" + colorCls + "'><i class='fa " + iconCls + "' title='" + title + "'></i></a>";
                        </shiro:hasPermission>
                        return ret;
                    }
                }
            ]]
        });
 
        new ResizeScroll({
            "id": ".right",
            "fun": function () {
                var wh = $(window).height();
                //$(".pt-form").height(wh-79-48);
                return (wh - 81 - 20);
            }
        });
 
        //绑定按钮事件
        //新增按钮事件
        $("#btnAdd").click(function () {
            editUser(0, NowSelectedDeptId);
        });
 
        //删除按钮事件
        $("#btnDelete").click(function () {
            //获取dg选中的数据行
            var checkRows = $("#dg_user").datagrid("getChecked");
            if (checkRows.length == 0) {
                wcp.message.info("请选择需要删除的用户!");
            } else {
                var ids = new Array();
                $.each(checkRows, function (index, value) {
                    ids.push(value.userId);
                });
 
                deleteUsers(ids);
            }
        });
 
        //初始化密码事件
        $("#initPassword").click(function () {
            //获取dg选中的数据行
            var checkRows = $("#dg_user").datagrid("getChecked");
            if (checkRows.length == 0) {
                wcp.message.info("请选择需要初始化的用户!");
            } else {
                var ids = new Array();
                $.each(checkRows, function (index, value) {
                    ids.push(value.userId);
                });
 
                initPassword(ids);
            }
        });
 
 
        //绑定关键字检索输入框回车事件
        $("#btnKeySearch").click(function () {
            SearchKey();
        });
 
        //关键字检索按钮事件
        $('#txtKeySearch').bind('keypress', function (event) {
            if (event.keyCode == "13") {
                SearchKey();
            }
        });
    })
 
    //关键字搜索方法
    function SearchKey() {
        var keyValue = $("#txtKeySearch").val();
        $('#dg_user').datagrid('load', {
            deptId: NowSelectedDeptId,
            searchText: keyValue
        });
    }
 
    //用户信息编辑方法
    function editUser(userId, deptId) {
        if (!deptId) {
            deptId = 0;
        }
        var url = "management/user/editUser?userId=" + userId + "&deptId=" + deptId;
        var title = userId == 0 ? "新增用户" : "编辑用户";
 
        //openUrlByTab(url, title, null, "yes")
        top.layer.open({
            title: title,
            type: 2,
            area: ["850px", "680px"],
            fixed: false,
            content: url,
            success: function (layero, index) {
                var body = window.top.layer.getChildFrame('body', index);
                var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
 
                //将回调函数传给子页面
                iframeWin.params.callBack = refreshData;
            }
        });
    }
 
    function changeLoginPower(userId) {
        layer.confirm("确定要修改用户的登录权限吗?", {
            icon: 3,
            title: '提示'
        }, function (index) {
            wcp.ui.setBusy("body", wcp.ajax({
                url: "management/user/changeLoginPower?userId=" + userId
            }).done(function (result) {
                wcp.notify.success('用户登录权限修改成功!');
 
                //刷新数据
                refreshData();
            }));
 
            layer.close(index);
        });
    }
 
    //刷新表格数据
    function refreshData() {
        $('#dg_user').datagrid('reload');
 
        //清除已经选择的数据
        $('#dg_user').datagrid('clearSelections');
        $('#dg_user').datagrid('clearChecked');
    }
 
    //删除单个用户事件
    function deleteUser(userId) {
        deleteUsers([userId]);
    }
 
    //删除多个用户事件
    function deleteUsers(userIds) {
        layer.confirm("确定要删除选择的用户吗?", {
            icon: 3,
            title: '提示'
        }, function (index) {
            wcp.ui.setBusy("body", wcp.ajax({
                url: "management/user/deleteUser",
                data: JSON.stringify(userIds),
            }).done(function (result) {
                wcp.notify.success('删除成功!');
                //刷新数据
                refreshData();
            }));
 
            layer.close(index);
        });
    }
 
    //通过Tab页签打开窗口//scrolling 扩展,是否显示滚动条 ,yes no
    function openUrlByTab(pageUrl, title, ids, scrolling) {
        if (top.addPanel) {
            top.addPanel(pageUrl, title, scrolling);
            var curTabWin = null;
            var curTab = top.$('#tt').tabs('getSelected');
            if (curTab && curTab.find('iframe').length > 0) {
                curTabWin = curTab.find('iframe')[0].contentWindow;
                //将回调函数传给子页面
                $(curTabWin).load(function () {
                    if (curTabWin.params) {
                        //将回调函数传给子页面
                        if (ids) {
                            curTabWin.params.ids = ids;
                        }
 
                        curTabWin.params.parent = window;
                        curTabWin.params.callBack = refreshData;
                    }
                });
            }
        } else {
            openUrlByWindow(pageUrl);
        }
    }
 
    function initPassword(userIds) {
        layer.prompt({
            formType: 1,
            value: '',
            title: '请输入初始密码'
        }, function (value, index, elem) {
            wcp.ui.setBusy("body", wcp.ajax({
                url: "management/user/initPassword?value=" + value,
                data: JSON.stringify(userIds),
            }).done(function (result) {
                top.wcp.notify.success("保存成功!");
                refreshData();
                layer.close(index);
            }));
        });
    }
</script>
</html>