1
13693261870
2022-09-16 762f2fb45db004618ba099aa3c0bd89dba1eb843
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
var vm = new Vue({
    el:'#rapp',
    data:{
        showList: true,
        title: null,
        userAuth: {}
    },
    methods: {
        query: function () {
            vm.reload();
        },
        add: function(){
            vm.showList = false;
            vm.title = "新增";
            vm.userAuth = {};
        },
        update: function () {
            var authId = getSelectedRow();
            if(authId == null){
                return ;
            }
            vm.showList = false;
            vm.title = "修改";
            
            vm.getInfo(authId)
        },
        saveOrUpdate: function () {
            var url = vm.userAuth.authId == null ? "org/userauth/save" : "org/userauth/update";
            $.ajax({
                type: "POST",
                url: restServerBaseURL + url,
                contentType: "application/json",
                data: JSON.stringify(vm.userAuth),
                success: function(r){
                    if(r.code === 0){
                        alert('操作成功', function(){
                            vm.reload();
                        });
                    }else{
                        alert(r.msg);
                    }
                }
            });
        },
        del: function (authIds) {
//            var authIds = getSelectedRows();
            if(authIds == null){
                return ;
            }
//            
            confirm('确定要删除选中的记录?', function(){
                $.ajax({
                    type: "POST",
                    url: restServerBaseURL + "org/userauth/delete",
                    contentType: "application/json",
                    data: JSON.stringify(authIds),
                    success: function(r){
                        if(r.code == 0){
                            alert('操作成功', function(){
                                vm.reload();
                            });
                        }else{
                            alert(r.msg);
                        }
                    }
                });
            });
        },
        getInfo: function(authId){
            $.get(restServerBaseURL + "org/userauth/info/"+authId, function(r){
                vm.userAuth = r.userAuth;
            });
        },
        reload: function () {
            vm.showList = true;
            var page = $("#jqGrid").jqGrid('getGridParam','page');
            $("#jqGrid").jqGrid('setGridParam',{ 
                page:page
            }).trigger("reloadGrid");
        },
        refresh: function () {
            vm.showList = true;
            window.location.reload();
        },
        auditForUserAccess:function (){
            vm.userAuth.authResult=$('input:radio[name=auditResult]:checked').val();
            $.ajax({
                type: "POST",
                url: restServerBaseURL + "org/userauth/audit",
                contentType: "application/json",
                data: JSON.stringify(vm.userAuth),
                success: function(r){
                    if(r.code == 0){
                        alert('操作成功', function(){
                            $("#ModelClose").click();
                        });
                    }else{
                        alert(r.msg,function(){
                            $("#ModelClose").click();
                        });
                    }
                }
            });
        }
        
    },created: function(){
        var search = window.location.search;
        var userId = "";
        if(search.indexOf("?") > -1){
            search = search.replace("?", "");
            userId = search.split('=')[1];
        }
        if(userId == ""){
            this.title = "新增";
            this.user = {};
        } else {
            this.title = "编辑";
            
            this.getInfo(userId);
        }
    }
});