/** * 初始化短信记录详情对话框 */ var TSmsrecordInfoDlg = { tSmsrecordInfoData : {} }; /** * 清除数据 */ TSmsrecordInfoDlg.clearData = function() { this.tSmsrecordInfoData = {}; } /** * 设置对话框中的数据 * * @param key 数据的名称 * @param val 数据的具体值 */ TSmsrecordInfoDlg.set = function(key, val) { this.tSmsrecordInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val; return this; } /** * 设置对话框中的数据 * * @param key 数据的名称 * @param val 数据的具体值 */ TSmsrecordInfoDlg.get = function(key) { return $("#" + key).val(); } /** * 关闭此对话框 */ TSmsrecordInfoDlg.close = function() { parent.layer.close(window.parent.TSmsrecord.layerIndex); } /** * 收集数据 */ TSmsrecordInfoDlg.collectData = function() { this .set('id') .set('type') .set('phone') .set('code') .set('content') .set('createTime'); } /** * 提交添加 */ TSmsrecordInfoDlg.addSubmit = function() { this.clearData(); this.collectData(); //提交信息 var ajax = new $ax(Feng.ctxPath + "/tSmsrecord/add", function(data){ Feng.success("添加成功!"); window.parent.TSmsrecord.table.refresh(); TSmsrecordInfoDlg.close(); },function(data){ Feng.error("添加失败!" + data.responseJSON.message + "!"); }); ajax.set(this.tSmsrecordInfoData); ajax.start(); } /** * 提交修改 */ TSmsrecordInfoDlg.editSubmit = function() { this.clearData(); this.collectData(); //提交信息 var ajax = new $ax(Feng.ctxPath + "/tSmsrecord/update", function(data){ Feng.success("修改成功!"); window.parent.TSmsrecord.table.refresh(); TSmsrecordInfoDlg.close(); },function(data){ Feng.error("修改失败!" + data.responseJSON.message + "!"); }); ajax.set(this.tSmsrecordInfoData); ajax.start(); } $(function() { });