feat: System usermanage permission

This commit is contained in:
zhangzhanwei 2025-06-26 14:34:49 +08:00 committed by zhanweizhang7
parent 683b0bcf18
commit abcf96a29c

View File

@ -3,7 +3,12 @@
<h2 class="mb-16">{{ $t('views.userManage.title') }}</h2> <h2 class="mb-16">{{ $t('views.userManage.title') }}</h2>
<el-card> <el-card>
<div class="flex-between mb-16"> <div class="flex-between mb-16">
<el-button type="primary" @click="createUser">{{ <el-button type="primary" @click="createUser"
v-hasPermission="[
RoleConst.ADMIN,
PermissionConst.USER_CREATE
]"
>{{
$t('views.userManage.createUser') $t('views.userManage.createUser')
}} }}
</el-button> </el-button>
@ -124,11 +129,13 @@
size="small" size="small"
v-model="row.is_active" v-model="row.is_active"
:before-change="() => changeState(row)" :before-change="() => changeState(row)"
v-if="hasPermission([RoleConst.ADMIN,PermissionConst.USER_EDIT],'OR')"
/> />
</span> </span>
<el-divider direction="vertical"/> <el-divider direction="vertical"/>
<span class="mr-8"> <span class="mr-8">
<el-button type="primary" text @click.stop="editUser(row)" :title="$t('common.edit')"> <el-button type="primary" text @click.stop="editUser(row)" :title="$t('common.edit')"
v-if="hasPermission([RoleConst.ADMIN,PermissionConst.USER_EDIT],'OR')" >
<el-icon><EditPen/></el-icon> <el-icon><EditPen/></el-icon>
</el-button> </el-button>
</span> </span>
@ -139,6 +146,7 @@
text text
@click.stop="editPwdUser(row)" @click.stop="editPwdUser(row)"
:title="$t('views.userManage.setting.updatePwd')" :title="$t('views.userManage.setting.updatePwd')"
v-if="hasPermission([RoleConst.ADMIN,PermissionConst.USER_EDIT],'OR')"
> >
<el-icon><Lock/></el-icon> <el-icon><Lock/></el-icon>
</el-button> </el-button>
@ -150,6 +158,7 @@
text text
@click.stop="deleteUserManage(row)" @click.stop="deleteUserManage(row)"
:title="$t('common.delete')" :title="$t('common.delete')"
v-if="hasPermission([RoleConst.ADMIN,PermissionConst.USER_DELETE],'OR')"
> >
<el-icon><Delete/></el-icon> <el-icon><Delete/></el-icon>
</el-button> </el-button>
@ -173,6 +182,8 @@ import {MsgSuccess, MsgConfirm} from '@/utils/message'
import {t} from '@/locales' import {t} from '@/locales'
import {ValidCount, ValidType} from "@/enums/common.ts"; import {ValidCount, ValidType} from "@/enums/common.ts";
import useStore from "@/stores"; import useStore from "@/stores";
import { PermissionConst, RoleConst } from '@/utils/permission/data'
import {hasPermission} from '@/utils/permission/index'
const {user, common} = useStore() const {user, common} = useStore()
const search_type = ref('username') const search_type = ref('username')