| | |
| | | TBroadcast.initColumn = function () { |
| | | return [ |
| | | {field: 'selectItem', radio: true}, |
| | | {title: '主键', field: 'id', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '消息内容', field: 'content', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '排序', field: 'sort', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '状态(1=正常,2=冻结,3=删除)', field: 'status', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '添加时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'} |
| | | {title: '主键', field: 'id', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '添加时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '消息内容', field: 'content', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '是否显示', field: 'isShow', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | if (row.isShow){ |
| | | return '<span>是</span>' |
| | | }else { |
| | | return '<span>否</span>' |
| | | } |
| | | } |
| | | }, |
| | | {title: '排序', field: 'sort', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '状态(1=正常,2=冻结,3=删除)', field: 'status', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '操作', visible: true, align: 'center', valign: 'middle',width:150, |
| | | formatter: function (value, row) { |
| | | if (row.isShow){ |
| | | return '<a href="#" onclick="TBroadcast.updateStatus('+row.id+')" style="color:red">下架</a>' |
| | | }else{ |
| | | return '<a href="#" onclick="TBroadcast.updateStatus('+row.id+')" style="color:blue">上架</a>' +' ' + |
| | | '<a href="#" onclick="TBroadcast.delete('+row.id+')" style="color:red">删除</a>' |
| | | } |
| | | } |
| | | } |
| | | ]; |
| | | }; |
| | | |
| | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | TBroadcast.delete = function () { |
| | | if (this.check()) { |
| | | var ajax = new $ax(Feng.ctxPath + "/tBroadcast/delete", function (data) { |
| | | Feng.success("删除成功!"); |
| | | TBroadcast.table.refresh(); |
| | | }, function (data) { |
| | | Feng.error("删除失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("tBroadcastId",this.seItem.id); |
| | | ajax.start(); |
| | | } |
| | | TBroadcast.delete = function (id) { |
| | | var ajax = new $ax(Feng.ctxPath + "/tBroadcast/delete", function (data) { |
| | | Feng.success("删除成功!"); |
| | | TBroadcast.table.refresh(); |
| | | }, function (data) { |
| | | Feng.error("删除失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("tBroadcastId",id); |
| | | ajax.start(); |
| | | }; |
| | | |
| | | /** |
| | |
| | | */ |
| | | TBroadcast.search = function () { |
| | | var queryData = {}; |
| | | queryData['condition'] = $("#condition").val(); |
| | | queryData['createTime'] = $("#createTime").val(); |
| | | queryData['content'] = $("#content").val(); |
| | | TBroadcast.table.refresh({query: queryData}); |
| | | }; |
| | | |
| | | /** |
| | | * 重置 |
| | | */ |
| | | TBroadcast.resetSearch = function (){ |
| | | $("#createTime").val(''); |
| | | $("#content").val(''); |
| | | TBroadcast.search(); |
| | | } |
| | | |
| | | $(function () { |
| | | var defaultColunms = TBroadcast.initColumn(); |
| | | var table = new BSTable(TBroadcast.id, "/tBroadcast/list", defaultColunms); |