/**
|
* 初始化用户留言管理详情对话框
|
*/
|
var TProblemInfoDlg = {
|
tProblemInfoData : {},
|
validateFields: {
|
answer: {
|
validators: {
|
notEmpty: {
|
message: '回复内容不能为空'
|
}/*,
|
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){
|
Feng.info("回复内容不能超过500个字");
|
return;
|
}
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tProblem/immediately", function(data){
|
Feng.success("处理成功!");
|
window.parent.TProblem.table.refresh();
|
TProblemInfoDlg.close();
|
},function(data){
|
Feng.error("处理失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("tProblemId",$("#tProblemId").val());
|
ajax.set("answer",answer);
|
ajax.start();
|
}
|
|
|
$(function() {
|
Feng.initValidator("problemInfoForm", TProblemInfoDlg.validateFields);
|
});
|