| | |
| | | * 初始化详情对话框 |
| | | */ |
| | | var TBroadcastInfoDlg = { |
| | | tBroadcastInfoData : {} |
| | | tBroadcastInfoData : {}, |
| | | validateFields: { |
| | | content: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '消息内容不能为空' |
| | | } |
| | | } |
| | | }, |
| | | sort: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '排序不能为空' |
| | | } |
| | | } |
| | | }, |
| | | show: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '请选择是否显示' |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 验证数据是否为空 |
| | | */ |
| | | TBroadcastInfoDlg.validate = function () { |
| | | $('#broadcastInfoForm').data("bootstrapValidator").resetForm(); |
| | | $('#broadcastInfoForm').bootstrapValidator('validate'); |
| | | return $("#broadcastInfoForm").data('bootstrapValidator').isValid(); |
| | | }; |
| | | |
| | | /** |
| | |
| | | .set('content') |
| | | .set('sort') |
| | | .set('status') |
| | | .set('show') |
| | | .set('upDown') |
| | | .set('createTime'); |
| | | } |
| | | |
| | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | |
| | | if(!this.validate()){ |
| | | return ; |
| | | } |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tBroadcast/add", function(data){ |
| | | Feng.success("添加成功!"); |
| | | window.parent.TBroadcast.table.refresh(); |
| | | TBroadcastInfoDlg.close(); |
| | | if(500 == data.code){ |
| | | Feng.error(data.message); |
| | | return; |
| | | }else { |
| | | Feng.success("添加成功!"); |
| | | window.parent.TBroadcast.table.refresh(); |
| | | TBroadcastInfoDlg.close(); |
| | | } |
| | | },function(data){ |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | |
| | | if(!this.validate()){ |
| | | return ; |
| | | } |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tBroadcast/update", function(data){ |
| | | Feng.success("修改成功!"); |
| | | window.parent.TBroadcast.table.refresh(); |
| | | TBroadcastInfoDlg.close(); |
| | | if(500 == data.code){ |
| | | Feng.error(data.message); |
| | | return; |
| | | }else { |
| | | Feng.success("修改成功!"); |
| | | window.parent.TBroadcast.table.refresh(); |
| | | TBroadcastInfoDlg.close(); |
| | | } |
| | | },function(data){ |
| | | Feng.error("修改失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | |
| | | } |
| | | |
| | | $(function() { |
| | | |
| | | Feng.initValidator("broadcastInfoForm", TBroadcastInfoDlg.validateFields); |
| | | }); |