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
$(function() {
    //cheackForm("valuefrom");
    $("title").text("系统字典管理 - " + systemTitle);
});
var vm = new Vue({
    el: '#rapp',
    data: {
        showList: true,
        title: null,
        fieldvalue: {},
        form1: null
    },
    methods: {
        saveOrUpdate: function () {
            if ($("#valuefrom").valid()) {
                if (vm.title == "新增") {
                    var url = "sys/fieldvalue/save";
                }
                if (vm.title == "编辑") {
                    var url = "sys/fieldvalue/update";
                }
                $.ajax({
                    type: "POST",
                    url: restServerBaseURL + url,
                    contentType: "application/json",
                    data: JSON.stringify(vm.fieldvalue),
                    success: function (r) {
                        if (r.code === 0) {
                            alert('操作成功', function () {
                                if (vm.title == "新增") {
                                    window.location.href = window.location.href+r.valueid;
                                }else{
                                    window.location.reload();
                                }
                                if(parent.opener.vm && parent.opener.vm.reload){
                                    parent.opener.vm.reload();
                                }
                            });
                        } else {
                            alert(r.msg);
                        }
                    }
                });
            }
        },
        getInfo: function (valueid) {
            $.get(restServerBaseURL + "sys/fieldvalue/info/" + valueid, function (r) {
                vm.fieldvalue = r.fieldvalue;
            });
        },
        getUser: function() {
            $.ajax({
                type: "get",
                url: restServerBaseURL + "org/user/info",
                async: true,
                dataType: 'json',
                success: function (data) {
                    if (data.code != 0) {
                        alert(data.msg);
                        return;
                    } else {
                        vm.fieldvalue.rcreateuser = data.user.nickname;
                    }
                }
            });
        }
    },
    created: function(){
        var search = window.location.search;
        var fkey = "";
        var valueid = "";
        search = search.replace("?", "");
        var Param = search.split('&');
        fkey = Param[0].split('=')[1];
        valueid = Param[1].split('=')[1];
        if(valueid == ""){
            this.title = "新增";
            this.fieldvalue = { fkey: fkey};
            this.getUser();
        } else {
            this.title = "编辑";
 
            this.getInfo(valueid);
        }
    }
});