refactor: ♻️ 优化CURD组件权限处理
将权限属性名从 auth 统一修改为 perm,保持命名一致性 更新 permPrefix 替代 pageName 作为权限前缀标识 优化权限检查逻辑,未设置权限标识的按钮默认显示
This commit is contained in:
@@ -2,7 +2,7 @@ import UserAPI, { type UserForm } from "@/api/system/user.api";
|
||||
import type { IModalConfig } from "@/components/CURD/types";
|
||||
|
||||
const modalConfig: IModalConfig<UserForm> = {
|
||||
pageName: "sys:user",
|
||||
permPrefix: "sys:user",
|
||||
dialog: {
|
||||
title: "新增用户",
|
||||
width: 800,
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { UserPageQuery } from "@/api/system/user.api";
|
||||
import type { IContentConfig } from "@/components/CURD/types";
|
||||
|
||||
const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
// pageName: "sys:demo", // 不写不进行按钮权限校验
|
||||
permPrefix: "sys:user", // 不写不进行按钮权限校验
|
||||
table: {
|
||||
border: true,
|
||||
highlightCurrentRow: true,
|
||||
@@ -50,7 +50,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
{
|
||||
name: "custom1",
|
||||
text: "自定义1",
|
||||
auth: "custom",
|
||||
perm: "add",
|
||||
attrs: { icon: "plus", color: "#626AEF" },
|
||||
},
|
||||
],
|
||||
@@ -117,7 +117,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
{
|
||||
name: "reset_pwd",
|
||||
text: "重置密码",
|
||||
auth: "password:reset",
|
||||
perm: "password:reset",
|
||||
attrs: {
|
||||
icon: "refresh-left",
|
||||
// color: "#626AEF", // 使用 text 属性,颜色不生效
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { IContentConfig } from "@/components/CURD/types";
|
||||
|
||||
const contentConfig: IContentConfig = {
|
||||
// pageName: "sys:demo", // 不写不进行按钮权限校验
|
||||
// permPrefix: "sys:demo", // 不写不进行按钮权限校验
|
||||
table: {
|
||||
showOverflowTooltip: true,
|
||||
},
|
||||
@@ -118,7 +118,7 @@ const contentConfig: IContentConfig = {
|
||||
{
|
||||
name: "reset_pwd",
|
||||
text: "重置密码",
|
||||
auth: "password:reset",
|
||||
perm: "password:reset",
|
||||
attrs: { icon: "refresh-left", type: "primary" },
|
||||
render(row) {
|
||||
// 根据条件,显示或隐藏
|
||||
|
||||
@@ -4,7 +4,7 @@ import { DeviceEnum } from "@/enums/settings/device.enum";
|
||||
import { useAppStore } from "@/store";
|
||||
|
||||
const modalConfig: IModalConfig<UserForm> = {
|
||||
pageName: "sys:user",
|
||||
permPrefix: "sys:user",
|
||||
component: "drawer",
|
||||
drawer: {
|
||||
title: "修改用户",
|
||||
|
||||
@@ -2,7 +2,7 @@ import DeptAPI from "@/api/system/dept.api";
|
||||
import type { ISearchConfig } from "@/components/CURD/types";
|
||||
|
||||
const searchConfig: ISearchConfig = {
|
||||
pageName: "sys:user",
|
||||
permPrefix: "sys:user",
|
||||
formItems: [
|
||||
{
|
||||
tips: "支持模糊搜索",
|
||||
|
||||
Reference in New Issue
Block a user