/**
|
* 初始化敏感词管理详情对话框
|
*/
|
var TSysSensitiveWordsInfoDlg = {
|
tSysSensitiveWordsInfoData : {},
|
validateFields: {
|
content: {
|
validators: {
|
notEmpty: {
|
message: '敏感词不能为空'
|
}/*,
|
regexp: {
|
regexp: /^.{1,15}$/,
|
message: '敏感词最多15个字'
|
}*/
|
}
|
},
|
}
|
};
|
|
/**
|
* 验证数据是否为空
|
*/
|
TSysSensitiveWordsInfoDlg.validate = function () {
|
$('#sysSensitiveWordsForm').data("bootstrapValidator").resetForm();
|
$('#sysSensitiveWordsForm').bootstrapValidator('validate');
|
return $("#sysSensitiveWordsForm").data('bootstrapValidator').isValid();
|
};
|
|
|
/**
|
* 清除数据
|
*/
|
TSysSensitiveWordsInfoDlg.clearData = function() {
|
this.tSysSensitiveWordsInfoData = {};
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TSysSensitiveWordsInfoDlg.set = function(key, val) {
|
this.tSysSensitiveWordsInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
|
return this;
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TSysSensitiveWordsInfoDlg.get = function(key) {
|
return $("#" + key).val();
|
}
|
|
/**
|
* 关闭此对话框
|
*/
|
TSysSensitiveWordsInfoDlg.close = function() {
|
parent.layer.close(window.parent.TSysSensitiveWords.layerIndex);
|
}
|
|
/**
|
* 收集数据
|
*/
|
TSysSensitiveWordsInfoDlg.collectData = function() {
|
this
|
.set('id')
|
.set('createTime')
|
.set('content');
|
}
|
|
/**
|
* 提交添加
|
*/
|
TSysSensitiveWordsInfoDlg.addSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
if(!this.validate()){
|
return ;
|
}
|
var content = $("#content").val();
|
if (content.length > 15){
|
Feng.info("敏感词不能超过15个字");
|
return;
|
}
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tSysSensitiveWords/add", function(data){
|
Feng.success("添加成功!");
|
window.parent.TSysSensitiveWords.table.refresh();
|
TSysSensitiveWordsInfoDlg.close();
|
},function(data){
|
Feng.error("添加失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set(this.tSysSensitiveWordsInfoData);
|
ajax.start();
|
}
|
|
$(function() {
|
Feng.initValidator("sysSensitiveWordsForm", TSysSensitiveWordsInfoDlg.validateFields);
|
});
|