1,在index.html 设置需要权限的放方法
<div class="layuimini-container">
<div class="layuimini-main">
<table id="currentTable" class="layui-table layui-hide"
data-auth-add="{:auth('enterprise/add')}"
data-auth-edit="{:auth('enterprise/edit')}"
data-auth-delete="{:auth('enterprise/delete')}"
lay-filter="currentTable">
</table>
</div>
</div>
2.然在index.js 进行配置
define(["jquery", "easy-admin"], function ($, ea) {
var init = {
table_elem: '#currentTable',
table_render_id: 'currentTableRenderId',
index_url: 'enterprise.vote/index',
add_url: 'enterprise.vote/add',
edit_url: 'enterprise.vote/edit',
delete_url: 'enterprise.vote/delete',
export_url: 'enterprise.vote/export',
modify_url: 'enterprise.vote/modify',
stock_url:'enterprise.vote/stock',
};
var Controller = {
index: function () {
ea.table.render({
init: init,
toolbar: ['refresh', 'delete'],
cols: [[
{type: 'checkbox'},
{field: 'id', title: 'id'},
// {field: 'enterprise_id', title: '企业id'},
{field: 'activity.title', title: '活动名称'},
{field: 'enterprise_name', title: '企业名称'},
{field: 'vote_number', title: '投票数'},
{
width: 250,
title: '操作',
templet: ea.table.tool,
operat: [
[ {
text: '增加投票',
url: init.stock_url,
method: 'open',
auth: 'stock', //检测权限名称
class: 'layui-btn layui-btn-xs layui-btn-normal',
}],
]
}
]],
});
ea.listen();
},
add: function () {
ea.listen();
},
edit: function () {
ea.listen();
},
stock:function(){ //要进行监听的方法
ea.listen();
}
};
return Controller;
});