无关风月
2025-05-08 9486766c806fe1d9e082b2fd02ea1cc558f1b443
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
/**
 * 初始化用户留言管理详情对话框
 */
var language = $("#language").val()
var TProblemInfoDlg = {
    tProblemInfoData : {},
    validateFields: {
        answer: {
            validators: {
                notEmpty: {
                    message:  language==1?'回复内容不能为空':(language==2?'The reply cannot be empty':'Jawaban tidak dapat kosong')
                }/*,
                regexp: {
                    regexp: /^.{1,500}$/,
                    message: '回复内容不能超过500个长度'
                }*/
            }
        },
    }
};
 
/**
 * 验证数据是否为空
 */
TProblemInfoDlg.validate = function () {
    $('#problemInfoForm').data("bootstrapValidator").resetForm();
    $('#problemInfoForm').bootstrapValidator('validate');
    return $("#problemInfoForm").data('bootstrapValidator').isValid();
};
 
/**
 * 清除数据
 */
TProblemInfoDlg.clearData = function() {
    this.tProblemInfoData = {};
}
 
/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
TProblemInfoDlg.set = function(key, val) {
    this.tProblemInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
    return this;
}
 
/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
TProblemInfoDlg.get = function(key) {
    return $("#" + key).val();
}
 
/**
 * 关闭此对话框
 */
TProblemInfoDlg.close = function() {
    parent.layer.close(window.parent.TProblem.layerIndex);
}
 
/**
 * 收集数据
 */
TProblemInfoDlg.collectData = function() {
    this
    .set('id')
    .set('userId')
    .set('content')
    .set('answer')
    .set('handleUserId')
    .set('handleTime')
    .set('insertTime')
    .set('state');
}
 
/**
 * 立即处理
 */
TProblemInfoDlg.immediately = function() {
 
    this.clearData();
    this.collectData();
    if(!this.validate()){
        return ;
    }
    var answer = $("#answer").val();
    if (answer.length > 500){
        if(language==1){
            Feng.info("内容不能超过500个字");
        }else if(language==2){
            Feng.info("content should not exceed 500 words");
        }else {
            Feng.info("isi tidak dapat melebihi 500 kata");
        }
        return;
    }
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/tProblem/immediately", function(data){
        if(language==1){
            Feng.success("处理成功!");
        }else if(language==2){
            Feng.success("Deal with success!");
        }else {
            Feng.success("Menghadapi sukses!");
        }
        window.parent.TProblem.table.refresh();
        TProblemInfoDlg.close();
    },function(data){
        if(language==1){
            Feng.error("处理失败!" + data.responseJSON.message + "!");
        }else if(language==2){
            Feng.error("Fail!" + data.responseJSON.message + "!");
        }else {
            Feng.error("Gagal!" + data.responseJSON.message + "!");
        }
 
    });
    ajax.set("tProblemId",$("#tProblemId").val());
    ajax.set("answer",answer);
    ajax.start();
}
 
 
$(function() {
    Feng.initValidator("problemInfoForm", TProblemInfoDlg.validateFields);
});