1
13693261870
2022-09-16 21ddee1a38257297288b88bc6c0476ec96a5f867
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
var proxypath;
$(function () {
    // initSystemName();
    // initActionType();
    var appid = getAppId() != null ? getAppId() : null;
    // var proxypath = "http://71.3.251.51:8066";
    proxypath = "http://192.168.20.106:8066";
    //proxypath = "http://192.168.20.106:8066";
    // var ServerPath = "http://71.3.251.51:8067/manage";
    // var tokenjson = "E:/terraproxy/terraproxy/application.yml";
    // var servletpath = $("#appProp").val() != "" ? $("#appProp").val() :
    //     tokenjson;
    $("#jqGrid").jqGrid({
        ajaxGridOptions:{
            xhrFields:{
                withCredentials:false
            }
        },
        url: proxypath + '/log/selectWhiteList',
        // url:  proxypath + '/serv/queryServlet',
        datatype: "json",
        colModel: [
            { label: '白名单IP', name: 'requestip', index: 'requestip', width: 50, align: 'center' },
            { label: '生效日期', name: 'date', index: 'date', width: 50, align: 'center' },
            { label: '申请人', name: 'IDENTYINFO', index: 'IDENTYINFO', width: 100, align: 'center' },
            { label: 'token信息', name: 'TOKENINFO', index: 'TOKENINFO', width: 80, align: 'center' },
            { label: '白名单状态', name: 'status', index: 'status', width: 80, align: 'center',formatter: function (value, grid, rows, state) {
                 if (value == "3") {
                    return "白名单生效";
                }
                else if (value == "4") {
                    return "白名单失效";
                }
            } },
            // { label: '申请服务系统', name: 'fromSys', index: 'TITLE', width: 80,align:'center',formatter:function(value,grid,rows,state) {
            //         var id = rows.resourceid;
            //         if (id != null) {
            //             var html = "<a style='cursor:pointer;color:black;' onclick='openZY("+id+")'>"
            //                 +rows.title+"</a>";
            //             return html;
            //         } else {
            //             return "";
            //         }
            //     }
            // },
            // { label: '操作', name: 'right', index: 'right', width: 80,align:'center'},
            {
                label: '操作', name: 'right', index: 'right', align: 'center', width: 100, formatter: function (value, grid, rows, state) {
 
                    var id = rows.id;
                    var ip = rows.requestip
                    var status = rows.status
                    var template = `<input class="btn btn-danger" id = "yu" type="button" name="Submit" value="移除白名单" onclick="vm.del('${id}','${ip}','${status}')" /> `;
                    return template;
                    //return '<input style="background-color: #659cff !important;color: white;border: none;" id = "yu" type="button" name="Submit" value="移除白名单" onclick="dddd" />' + '&nbsp;&nbsp;' + '<input style="background-color: #659cff !important;color: white;border: none;" id = "yu" type="button" name="Submit" value="加入白名单" />'
                }
            },
            // { label: '生效日期', name: 'date', index: 'DODATE', width: 80,align:'center',formatter:function(value,grid,rows,state){
            //     var date =rows.dodate;
            //     var d=date.substring(0,11);
            //     return date;
            //      }            
            // },
            // { label: '黑名单状态', name: 'status', index: 'status',align:'center', width: 50},
            // { label: '操作', name: 'right', index: 'right',align:'center', width: 200}
 
        ],
        // postData:{'appid':appid},
        viewrecords: true,
        height: "auto",
        rowNum: 10,
        //rowList : [10,30,50],
        rownumbers: true,
        rownumWidth: 50,
        autowidth: true,
        pager: "#jqGridPager",
        jsonReader: {
            root: "data",
            // page: "page.currPage",
            page: "1",
            total: "totalpage",
            // total: "total",
            // records: "page.totalCount"
            records: "total"
        },
        prmNames: {
            page: "page",
            rows: "limit",
            // order: "order"
        },
        gridComplete: function () {
            //闅愯棌grid搴曢儴婊氬姩鏉�
            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x": "hidden" });
 
        },
        onSortCol: function (index, colindex, sortorder) {
            jQuery("#jqGrid").jqGrid('setGridParam', {
                page: $(".ui-pg-input").val()
            });
        }
    });
    $("#jqGrid").jqGrid('setLabel', 'rn', '序号', { 'text-align': 'center' }, '');
});
 
var vm = new Vue({
    el: '#rapp',
    data: {
        showList: true,
        title: null,
        action: {}
    },
    methods: {
        query: function () {
            // if (!checkDate()) {
            //     // $("#End_Date").focus();
            //     // $("#End_Date").focus();
            //     return false;
            // }
            vm.reload();
        },
        add: function () {
            vm.showList = false;
            vm.title = "鏂板";
            vm.action = {};
        },
        update: function () {
            var actionid = getSelectedRow();
            if (actionid == null) {
                return;
            }
            vm.showList = false;
            vm.title = "淇敼";
 
            vm.getInfo(actionid)
        },
        saveOrUpdate: function () {
            var url = vm.action.actionid == null ? "log/action/save" : "log/action/update";
            $.ajax({
                type: "POST",
                url: restServerBaseURL + url,
                contentType: "application/json",
                data: JSON.stringify(vm.action),
                success: function (r) {
                    if (r.code === 0) {
                        alert('鎿嶄綔鎴愬姛', function () {
                            vm.reload();
                        });
                    } else {
                        alert(r.msg);
                    }
                }
            });
        },
        del: function (id, ip,sta) {
            // var actionids = getSelectedRows();
            // if (actionids == null) {
            //     return;
            // }
            confirm("是否确认移除白名单", function () {
                $.ajax({
                    url: proxypath + '/log/updateWhite',
                    type: 'post',
                    data: {
                        id: id,
                        requestip: ip,
                        status:sta
 
                    },
                    dataType: 'text',
                    success: function (data) {
                        if (JSON.parse(data).msg === "操作成功") {
                            alert('操作成功', function () {
                                vm.reload();
                            });
                        } else {
                            alert(JSON.parse(data).msg);
                        }
                        // if (data == "success") {
                        //     alert("从redis中删除成功");
                        // }
                        // vm.reload();
                    },
                    error: function (s1, s2, s3) {
                        alert("error");
                    }
                });
            })
 
 
 
            // confirm('纭畾瑕佸垹闄ら€変腑鐨勮褰曪紵', function(){
            //     $.ajax({
            //         type: "POST",
            //         url: restServerBaseURL + "log/action/delete",
            //         contentType: "application/json",
            //         data: JSON.stringify(actionids),
            //         success: function(r){
            //             if(r.code == 0){
            //                 alert('鎿嶄綔鎴愬姛', function(){
            //                     vm.reload();
            //                 });
            //             }else{
            //                 alert(r.msg);
            //             }
            //         }
            //     });
            // });
        },
        getInfo: function (actionid) {
            $.get(restServerBaseURL + "log/action/info/" + actionid, function (r) {
                vm.action = r.action;
            });
        },
        reload: function () {
            debugger
            // var beginDate = $("#Begin_Date").val();
            // var endDate = $("#End_Date").val();
            // var UserName = $("#UserName").val();
            // var appid = $("#appidName").val();
            // var actiontype = $("#actionType").val();
            // var requestip = $("#requestip").val();
            var tokenbinder = $("#tokenbinder").val();
            var tokenstatus = $("#tokenstatus").val();
            vm.showList = true;
            var page = $("#jqGrid").jqGrid('getGridParam', 'page');
            $("#jqGrid").jqGrid('setGridParam', {
                postData: {
                    'tokenbinder': tokenbinder,
                    'tokenstatus': tokenstatus,
                    'identyinfo': ''
                }, page: 1
            }).trigger("reloadGrid");
        },
        refresh: function () {
            vm.showList = true;
            window.location.reload();
        }
    }
});
 
function initSystemName() {
    var local = window.location.href;
    $.ajax({
        type: "GET",
        url: restServerBaseURL + "sys/systeminfo/queryListAll",
        contentType: "application/json",
        success: function (msg) {
            var systemList = msg.systemList;
            jQuery("#appidName").append("<option value=''>鍏ㄩ儴</option>");
            var appid = '';
            if (getAppId() != null) {
                appid = getAppId();
            }
            jQuery.each(systemList, function (i, item) {
                if (appid == item.appid) {
                    jQuery("#appidName").append("<option value=" + item.appid + " selected = 'true'>" + item.appfullname + "</option>");
                }
                else {
                    jQuery("#appidName").append("<option value=" + item.appid + ">" + item.appfullname + "</option>");
                }
            });
        }
    });
}
 
function findUserByWord() {
    var username = $("#UserName").val();
    $("#UserName").autocomplete({
        source: restServerBaseURL + 'org/user/findUserByWord?keyWord=' + encodeURI(encodeURI(username)),  //璇锋眰鐨剈rl
        minLength: 1,
    });
}
 
function initActionType() {
    var local = window.location.href;
    $.ajax({
        type: "GET",
        url: restServerBaseURL + "log/action/actionType",
        contentType: "application/json",
        success: function (msg) {
            var list = msg.actionTypes;
            jQuery("#actionType").append("<option value=''>鍏ㄩ儴</option>");
            jQuery.each(list, function (i, item) {
                jQuery("#actionType").append("<option value=" + item + ">" + item + "</option>");
            });
        }
    });
}
 
//鎵撳紑璧勬簮鏌ョ湅椤甸潰
function openZY(id) {
    $.ajax({
        type: "GET",
        url: LanCatalogBaseURL + "api/cheackZYIsExist?resourceid=" + id,
        contentType: "application/json",
        success: function (data) {
            if (data) {
                window.open(LanCatalogBaseURL + "res/ZiYuan/ZiYuanBaseInfo?resourceid=" + id, "_blank");
            } else {
                alert("璇ヨ祫婧愬凡鍒犻櫎锛�");
            }
        }
    });
}
 
function checkDate() {
    var beginDate = $("#Begin_Date").val();
    var endDate = $("#End_Date").val();
    if (beginDate != "" && endDate != "") {
        var pubdatestart = new Date(beginDate.replace(/-/g, "/"));
        var pubdateend = new Date(endDate.replace(/-/g, "/"));
        if (pubdatestart > pubdateend) {
            alert("缁撴潫鏃堕棿涓嶈兘灏忎簬寮€濮嬫椂闂达紒", function () {
                $("#End_Date").focus();
                $("#End_Date").focus();
            });
            return false;
        }
        else {
            return true;
        }
    }
    else {
        return true;
    }
}