/** * 初始化详情对话框 */ var TSystemConfigInfoDlg = { tSystemConfigInfoData : {}, validateFields: { phone: { validators: { notEmpty: { message: '联系电话不能为空' }, regexp: { regexp: /^1[3-9]\d{9}$/, message: '请输入合法手机号' } } }, } }; /** * 清除数据 */ TSystemConfigInfoDlg.clearData = function() { this.tSystemConfigInfoData = {}; } /** * 设置对话框中的数据 * * @param key 数据的名称 * @param val 数据的具体值 */ TSystemConfigInfoDlg.set = function(key, val) { this.tSystemConfigInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val; return this; } /** * 设置对话框中的数据 * * @param key 数据的名称 * @param val 数据的具体值 */ TSystemConfigInfoDlg.get = function(key) { return $("#" + key).val(); } /** * 关闭此对话框 */ TSystemConfigInfoDlg.close = function() { parent.layer.close(window.parent.TSystemConfig.layerIndex); } /** * 收集数据 */ TSystemConfigInfoDlg.collectData = function() { this .set('id') .set('type') .set('content'); } /** * 提交添加 */ TSystemConfigInfoDlg.addSubmit = function() { this.clearData(); this.collectData(); //提交信息 var ajax = new $ax(Feng.ctxPath + "/tSystemConfig/add", function(data){ Feng.success("添加成功!"); window.parent.TSystemConfig.table.refresh(); TSystemConfigInfoDlg.close(); },function(data){ Feng.error("添加失败!" + data.responseJSON.message + "!"); }); ajax.set(this.tSystemConfigInfoData); ajax.start(); } /** * 提交修改 */ TSystemConfigInfoDlg.editSubmit = function() { this.clearData(); this.collectData(); //提交信息 var ajax = new $ax(Feng.ctxPath + "/tSystemConfig/update", function(data){ Feng.success("修改成功!"); window.parent.TSystemConfig.table.refresh(); TSystemConfigInfoDlg.close(); },function(data){ Feng.error("修改失败!" + data.responseJSON.message + "!"); }); ajax.set(this.tSystemConfigInfoData); ajax.start(); } $(function() { });