2025-09-05 09:26:14 +08:00
|
|
|
const btnList = [
|
|
|
|
|
{ label: '', type: '', disFlag: '' },
|
|
|
|
|
{ label: '新增', type: 'add', disFlag: 'isEdit', icon: 'icon-add' },
|
2025-09-05 16:40:35 +08:00
|
|
|
{ label: '查看', type: 'read', disFlag: 'isQuery' },
|
|
|
|
|
{ label: '修改', type: 'edit', disFlag: 'isEdit' },
|
|
|
|
|
{ label: '删除', type: 'del', disFlag: 'isEdit', icon: 'icon-del' }
|
|
|
|
|
// { label: '批量删除', type: 'del', disFlag: 'isEdit', icon: 'icon-del' }
|
2025-09-05 09:26:14 +08:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
// arr:按钮数组
|
|
|
|
|
// permissions:{
|
|
|
|
|
// isControl: true;
|
|
|
|
|
// isEdit: true;
|
|
|
|
|
// isQuery: true;
|
|
|
|
|
// }
|
|
|
|
|
function getBtns(arr) {
|
2025-09-09 09:33:14 +08:00
|
|
|
// const permissions =
|
|
|
|
|
// JSON.parse(localStorage.getItem('user')) || {}
|
2025-09-05 09:26:14 +08:00
|
|
|
const btns = []
|
|
|
|
|
btnList.forEach((item) => {
|
|
|
|
|
if (arr.includes(item.label)) {
|
2025-09-05 16:40:35 +08:00
|
|
|
// item.disabled = !Boolean(permissions[item.disFlag])
|
2025-09-05 09:26:14 +08:00
|
|
|
btns.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
return btns
|
|
|
|
|
}
|
|
|
|
|
export { btnList, getBtns }
|