feat: 添加系统级管理专属页面权限

This commit is contained in:
2025-02-26 22:56:56 +08:00
parent 47c00b1227
commit fef47ca7d9
5 changed files with 46 additions and 8 deletions

View File

@@ -139,6 +139,8 @@ type GetPermissionListParams = {
fixedTag?: boolean; fixedTag?: boolean;
/** 隐藏标签页 */ /** 隐藏标签页 */
hiddenTag?: boolean; hiddenTag?: boolean;
/** 是否为管理员专属页面 */
isAdmin?: boolean;
}; };
/**获取权限列表 */ /**获取权限列表 */
@@ -196,6 +198,8 @@ type AddPermissionParams = {
parent_id: string; parent_id: string;
/** 菜单类型 */ /** 菜单类型 */
menu_type: number; menu_type: number;
/**是否为管理员专属页面 */
is_admin: boolean;
}; };
/** /**
* 添加权限 * 添加权限

View File

@@ -94,7 +94,7 @@ const onSubmit = async (formEl: FormInstance) => {
> >
<h3 class="my-8">个人信息</h3> <h3 class="my-8">个人信息</h3>
<el-form ref="userInfoFormRef" label-position="top" :model="userInfo"> <el-form ref="userInfoFormRef" label-position="top" :model="userInfo">
<el-form-item label="头像"> <el-form-item label="头像" prop="avatar">
<el-avatar <el-avatar
:size="80" :size="80"
:src="userInfo.avatar ? `/api/${userInfo.avatar}` : Avatar" :src="userInfo.avatar ? `/api/${userInfo.avatar}` : Avatar"
@@ -114,7 +114,7 @@ const onSubmit = async (formEl: FormInstance) => {
</el-button> </el-button>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="账号" prop="userId"> <el-form-item label="账号" prop="username">
<el-input <el-input
v-model="userInfo.username" v-model="userInfo.username"
placeholder="请输入账号~" placeholder="请输入账号~"
@@ -123,7 +123,7 @@ const onSubmit = async (formEl: FormInstance) => {
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="姓名" label="姓名"
prop="name" prop="nickname"
:rules="[ :rules="[
{ {
required: true, required: true,

View File

@@ -91,6 +91,19 @@ const showParentOptions: Array<OptionsType> = [
} }
]; ];
const isAdminOptions: Array<OptionsType> = [
{
label: "是",
tip: "只有系统管理员才能查看",
value: true
},
{
label: "否",
tip: "系统内所有成员可见",
value: false
}
];
const frameLoadingOptions: Array<OptionsType> = [ const frameLoadingOptions: Array<OptionsType> = [
{ {
label: "开启", label: "开启",
@@ -128,6 +141,7 @@ interface FormItemProps {
fixed_tag: boolean; fixed_tag: boolean;
show_link: boolean; show_link: boolean;
show_parent: boolean; show_parent: boolean;
is_admin: boolean;
} }
interface FormProps { interface FormProps {
formInline: FormItemProps; formInline: FormItemProps;
@@ -169,7 +183,8 @@ const props = withDefaults(defineProps<FormProps>(), {
hidden_tag: false, hidden_tag: false,
fixed_tag: false, fixed_tag: false,
show_link: true, show_link: true,
show_parent: false show_parent: false,
is_admin: false
}) })
}); });
@@ -418,6 +433,19 @@ defineExpose({ getRef });
/> />
</el-form-item> </el-form-item>
</re-col> </re-col>
<re-col v-if="newFormInline.menu_type < 3" :value="12" :xs="24" :sm="24">
<el-form-item label="管理专属">
<Segmented
:modelValue="newFormInline.is_admin ? 0 : 1"
:options="isAdminOptions"
@change="
({ option: { value } }) => {
newFormInline.is_admin = value;
}
"
/>
</el-form-item>
</re-col>
<re-col <re-col
v-show="newFormInline.menu_type !== 3" v-show="newFormInline.menu_type !== 3"

View File

@@ -180,7 +180,8 @@ export const usePermission = () => {
hidden_tag: row?.hidden_tag ?? false, hidden_tag: row?.hidden_tag ?? false,
fixed_tag: row?.fixed_tag ?? false, fixed_tag: row?.fixed_tag ?? false,
show_link: row?.show_link ?? true, show_link: row?.show_link ?? true,
show_parent: row?.show_parent ?? false show_parent: row?.show_parent ?? false,
is_admin: row?.is_admin ?? false
} }
}, },
width: "45%", width: "45%",
@@ -214,7 +215,8 @@ export const usePermission = () => {
hidden_tag: row?.hidden_tag ?? false, hidden_tag: row?.hidden_tag ?? false,
fixed_tag: row?.fixed_tag ?? false, fixed_tag: row?.fixed_tag ?? false,
show_link: row?.show_link ?? true, show_link: row?.show_link ?? true,
show_parent: row?.show_parent ?? false show_parent: row?.show_parent ?? false,
is_admin: row?.is_admin ?? false
} }
}), }),
beforeSure: (done, { options }) => { beforeSure: (done, { options }) => {
@@ -257,7 +259,8 @@ export const usePermission = () => {
hidden_tag: false, hidden_tag: false,
fixed_tag: false, fixed_tag: false,
show_link: true, show_link: true,
show_parent: false show_parent: false,
is_admin: false
}; };
for (let key in addForm) { for (let key in addForm) {
// 检查第二个字典是否包含相同的键 // 检查第二个字典是否包含相同的键
@@ -295,7 +298,8 @@ export const usePermission = () => {
hidden_tag: false, hidden_tag: false,
fixed_tag: false, fixed_tag: false,
show_link: true, show_link: true,
show_parent: false show_parent: false,
is_admin: false
}; };
for (let key in updateForm) { for (let key in updateForm) {
// 检查第二个字典是否包含相同的键 // 检查第二个字典是否包含相同的键

2
types/system.d.ts vendored
View File

@@ -118,6 +118,8 @@ export type PermissionInfo = {
show_link: boolean; show_link: boolean;
/** 是否显示父菜单 */ /** 是否显示父菜单 */
show_parent: boolean; show_parent: boolean;
/**是否为管理员专属页面 */
is_admin: boolean;
}; };
/**角色信息类型 */ /**角色信息类型 */