var mmg; function initGrid(){ var h = WST.pageHeight(); var cols = [ {title:'品牌名称', name:'brandName', width: 100}, {title:'品牌介绍', name:'brandDesc', width: 100,renderer: function(val,item,rowIndex){ return "

"+item['brandDesc']+"

"; }}, {title:'商铺', name:'shopName', width: 100,renderer: function(val,item,rowIndex){ return "

"+item['shopName']+"

"; }}, {title:'主营分类', name:'catName', width: 100,renderer: function(val,item,rowIndex){ return "

"+item['catName']+"

"; }}, {title:'品牌图标', name:'img', width: 100, renderer: function(val,item,rowIndex){ return ""; }}, {title:'操作', name:'' ,width:70, align:'center', renderer: function(val,item,rowIndex){ var h = ""; if(WST.GRANT.PPGL_02)h += "修改 "; if(WST.GRANT.PPGL_03)h += "删除 "; return h; }} ]; mmg = $('.mmg').mmGrid({height: h-85,indexCol: true,indexColWidth:50, cols: cols,method:'POST', url: WST.U('admin/brands/pageQuery'), fullWidthRows: true, autoLoad: true, plugins: [ $('#pg').mmPaginator({}) ] }); } function loadGrid(){ mmg.load({page:1,key:$('#key').val(),id:$('#catId').val()}); } function toEdit(id){ location.href=WST.U('admin/brands/toEdit','id='+id); } function toEdits(id){ var params = WST.getParams('.ipt'); params.id = id; var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000}); $.post(WST.U('admin/brands/'+((id>0)?"edit":"add")),params,function(data,textStatus){ layer.close(loading); var json = WST.toAdminJson(data); if(json.status=='1'){ WST.msg(json.msg,{icon:1}); setTimeout(function(){ location.href=WST.U('admin/brands/index'); },1000); }else{ WST.msg(json.msg,{icon:2}); } }); } function toDel(id){ var box = WST.confirm({content:"您确定要删除该品牌吗?",yes:function(){ var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000}); $.post(WST.U('admin/brands/del'),{id:id},function(data,textStatus){ layer.close(loading); var json = WST.toAdminJson(data); if(json.status=='1'){ WST.msg(json.msg,{icon:1}); layer.close(box); loadGrid(); }else{ WST.msg(json.msg,{icon:2}); } }); }}); } function toolTip(){ $('body').mousemove(function(e){ var windowH = $(window).height(); if(e.pageY >= windowH*0.8){ var top = windowH*0.233; $('.imged').css('margin-top',-top); }else{ var top = windowH*0.06; $('.imged').css('margin-top',-top); } }); }