/**
|
* 初始化详情对话框
|
*/
|
var TSystemBulletinInfoDlg = {
|
tSystemBulletinInfoData : {},
|
validateFields: {
|
introduce: {
|
validators: {
|
notEmpty: {
|
message: '介绍不能为空'
|
}
|
}
|
},
|
}
|
};
|
|
/**
|
* 验证数据是否为空
|
*/
|
TSystemBulletinInfoDlg.validate = function () {
|
$('#systemBulletinInfoForm').data("bootstrapValidator").resetForm();
|
$('#systemBulletinInfoForm').bootstrapValidator('validate');
|
return $("#systemBulletinInfoForm").data('bootstrapValidator').isValid();
|
};
|
|
/**
|
* 清除数据
|
*/
|
TSystemBulletinInfoDlg.clearData = function() {
|
this.tSystemBulletinInfoData = {};
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TSystemBulletinInfoDlg.set = function(key, val) {
|
this.tSystemBulletinInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
|
return this;
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TSystemBulletinInfoDlg.get = function(key) {
|
return $("#" + key).val();
|
}
|
|
/**
|
* 关闭此对话框
|
*/
|
TSystemBulletinInfoDlg.close = function() {
|
parent.layer.close(window.parent.TSystemBulletin.layerIndex);
|
}
|
|
/**
|
* 收集数据
|
*/
|
TSystemBulletinInfoDlg.collectData = function() {
|
if(UE.getEditor('content').hasContents()){
|
$('#content').val(UE.getEditor('content').getContent());
|
}
|
this
|
.set('id')
|
.set('introduce')
|
.set('img')
|
.set('content')
|
.set('status')
|
.set('state')
|
.set('createTime');
|
}
|
|
/**
|
* 提交添加
|
*/
|
TSystemBulletinInfoDlg.addSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
|
if(!this.validate()){
|
return ;
|
}
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tSystemBulletin/add", function(data){
|
Feng.success("添加成功!");
|
window.parent.TSystemBulletin.table.refresh();
|
TSystemBulletinInfoDlg.close();
|
},function(data){
|
Feng.error("添加失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set(this.tSystemBulletinInfoData);
|
ajax.start();
|
}
|
|
/**
|
* 提交添加
|
*/
|
TSystemBulletinInfoDlg.addSend = function() {
|
|
this.clearData();
|
this.collectData();
|
|
if(!this.validate()){
|
return ;
|
}
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tSystemBulletin/addSend", function(data){
|
Feng.success("发送成功!");
|
window.parent.TSystemBulletin.table.refresh();
|
TSystemBulletinInfoDlg.close();
|
},function(data){
|
Feng.error("发送失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set(this.tSystemBulletinInfoData);
|
ajax.start();
|
}
|
|
/**
|
* 提交修改
|
*/
|
TSystemBulletinInfoDlg.editSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
|
if(!this.validate()){
|
return ;
|
}
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tSystemBulletin/update", function(data){
|
Feng.success("修改成功!");
|
window.parent.TSystemBulletin.table.refresh();
|
TSystemBulletinInfoDlg.close();
|
},function(data){
|
Feng.error("修改失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set(this.tSystemBulletinInfoData);
|
ajax.start();
|
}
|
|
/**
|
* 提交修改发送
|
*/
|
TSystemBulletinInfoDlg.editSend = function() {
|
|
this.clearData();
|
this.collectData();
|
|
if(!this.validate()){
|
return ;
|
}
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tSystemBulletin/editSend", function(data){
|
Feng.success("发送成功!");
|
window.parent.TSystemBulletin.table.refresh();
|
TSystemBulletinInfoDlg.close();
|
},function(data){
|
Feng.error("发送失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set(this.tSystemBulletinInfoData);
|
ajax.start();
|
}
|
|
$(function() {
|
TSystemBulletinInfoDlg.editor = UE.getEditor('content');
|
Feng.initValidator("systemBulletinInfoForm", TSystemBulletinInfoDlg.validateFields);
|
});
|