fix: ตรวจสอบ input
This commit is contained in:
parent
96107502ac
commit
6e27e51bba
1 changed files with 12 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { getRole } from 'src/services/keycloak';
|
||||
import { CustomerBranch } from 'src/stores/customer/types';
|
||||
import { onMounted, ref } from 'vue';
|
||||
|
||||
|
|
@ -41,6 +42,8 @@ defineEmits<{
|
|||
|
||||
onMounted(async () => {
|
||||
|
||||
|
||||
|
||||
if(!!props.optionsBranch) {
|
||||
|
||||
registeredBranchId.value = props.optionsBranch[0].id ;
|
||||
|
|
@ -73,7 +76,15 @@ onMounted(async () => {
|
|||
option-value="id"
|
||||
v-model="registeredBranchId"
|
||||
:options="optionsBranch"
|
||||
:rules="[(val) => !!val]"
|
||||
:rules="[
|
||||
(val) => {
|
||||
const roles = getRole() || [];
|
||||
const isSpecialRole = ['admin', 'system', 'head_of_admin'].some(role => roles.includes(role));
|
||||
return isSpecialRole || !!val || 'กรุณากรอกข้อมูล';
|
||||
}
|
||||
]"
|
||||
|
||||
clearable
|
||||
/>
|
||||
|
||||
<q-input
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue