/**
|
* 初始化公告详情对话框
|
*/
|
var TNoticeInfoDlg = {
|
tNoticeInfoData : {},
|
editor: null,
|
validFields: {
|
title: Feng.def_valid_info( true, null, null, null, {
|
stringLength: {
|
max: 50,
|
message: "最多支持50个字符"
|
}
|
}),
|
coverPlan: Feng.def_valid_info(true),
|
content: Feng.def_valid_info(true)
|
}
|
};
|
|
/**
|
* 清除数据
|
*/
|
TNoticeInfoDlg.clearData = function() {
|
this.tNoticeInfoData = {};
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TNoticeInfoDlg.set = function(key, val) {
|
this.tNoticeInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
|
return this;
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TNoticeInfoDlg.get = function(key) {
|
return $("#" + key).val();
|
}
|
|
/**
|
* 关闭此对话框
|
*/
|
TNoticeInfoDlg.close = function() {
|
parent.layer.close(window.parent.TNotice.layerIndex);
|
}
|
|
/**
|
* 收集数据
|
*/
|
TNoticeInfoDlg.collectData = function() {
|
this
|
.set('id')
|
.set('title')
|
.set('source', this.sourceRadio.getValue())
|
.set('coverPlan')
|
.set('content');
|
}
|
|
/**
|
* 提交添加
|
*/
|
TNoticeInfoDlg.addSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
|
if ( !Feng.check_form( "formId")) { return; }
|
|
Feng.base_ajax( "/tNotice/add", this.tNoticeInfoData, function ( data) {
|
Feng.success( "添加成功");
|
TNoticeInfoDlg.close();
|
parent.TNotice.search();
|
});
|
|
}
|
|
/**
|
* 提交修改
|
*/
|
TNoticeInfoDlg.editSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
|
if ( !Feng.check_form( "formId")) { return; }
|
|
Feng.base_ajax( "/tNotice/update", this.tNoticeInfoData, function ( data) {
|
Feng.success( "修改成功");
|
TNoticeInfoDlg.close();
|
parent.TNotice.search();
|
});
|
}
|
|
$(function() {
|
Feng.initValidator( "formId", TNoticeInfoDlg.validFields);
|
});
|