Layui 自定义“操作”一栏,根据条件显示按钮操作


<style>
    tbody .layui-table-cell{height: auto;white-space:normal;}
    tbody .layui-table-cell{overflow:visible;}
</style>
cols: [
                [
                    { field: 'title' , title: '爆料信息'},
                    { field: 'type' ,width: 140, align: 'center', title: '类型',templet: '#typeTpl'},
                    { field: 'status', width: 120, title: '状态', align: 'center', templet: function (d) {
                            var arrStatus = [['-','未审核'],['Y','通过'],['N','未通过']];
                            var html="<select name='status' lay-filter='status'>";
                            for(var i=0;i<arrStatus.length;i++){
                                var strselected = '';
                                if(arrStatus[i][0] == d.status){strselected = "selected"};
                                html=html+"<option value='"+arrStatus[i][0]+"' "+strselected+">"+arrStatus[i][1]+"</option>";
                            };
                            html = html +"</select>";
                            return html;
                        }},
                    { width: 80,title: '操作',align: 'center',templet: function (d) {
                            if(d.isSobey == 'Y'){
                                html = '<a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="tuisong" onclick="javascript:tuisong('+d.id+');">已推</a><br/>'
                            }else{
                                html = '<a class="layui-btn layui-btn-xs" lay-event="tuisong" onclick="javascript:tuisong('+d.id+');">推送</a><br/>'
                            }
                            html = html +'<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="edit">修改</a><br/><a class="layui-btn layui-btn-xs" lay-event="detail">详细</a>';
                            return html;
                        }}
                ]
            ],


最新回复 (0)
发新帖