refactor: chech role
This commit is contained in:
parent
1df80aeb02
commit
db12f4f75e
2 changed files with 18 additions and 83 deletions
|
|
@ -1,5 +1,6 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { getRole } from 'src/services/keycloak';
|
||||
|
||||
import { createSelect, SelectProps } from './select';
|
||||
import SelectInput from '../SelectInput.vue';
|
||||
|
|
@ -29,6 +30,7 @@ type ExclusiveProps = {
|
|||
codeOnly?: boolean;
|
||||
selectFirstValue?: boolean;
|
||||
branchVirtual?: boolean;
|
||||
checkRole?: string[];
|
||||
};
|
||||
|
||||
const props = defineProps<SelectProps<typeof getList> & ExclusiveProps>();
|
||||
|
|
@ -98,7 +100,12 @@ function setDefaultValue() {
|
|||
"
|
||||
:hide-selected="false"
|
||||
:fill-input="false"
|
||||
:rules="[(v: string) => !!v || $t('form.error.required')]"
|
||||
:rules="[
|
||||
(v: string) =>
|
||||
checkRole?.some((v) => getRole()?.includes(v)) ||
|
||||
!!v ||
|
||||
$t('form.error.required'),
|
||||
]"
|
||||
@filter="filter"
|
||||
>
|
||||
<template #append v-if="clearable">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue