fix(02): table color and map role

This commit is contained in:
puriphatt 2024-08-09 10:05:31 +00:00
parent aed271da3d
commit f555747005
2 changed files with 16 additions and 2 deletions

View file

@ -224,7 +224,7 @@ onMounted(async () => {
:label="$t('userRole')" :label="$t('userRole')"
:options="roleOptions" :options="roleOptions"
:rules="[ :rules="[
(val: string) => !!val || $t('formDialogInputPrefixNameValidate'), (val: string) => !!val || $t('formDialogInputUserRoleValidate'),
]" ]"
@filter="roleFilter" @filter="roleFilter"
> >

View file

@ -689,6 +689,13 @@ onMounted(async () => {
flowStore.rotate(); flowStore.rotate();
}); });
function mapRole(value: string) {
const option = userStore.userOption.roleOpts.find(
(option) => option.value === value,
);
return option ? option.label : '-';
}
watch( watch(
() => selectorLabel.value, () => selectorLabel.value,
async (label) => { async (label) => {
@ -1152,6 +1159,13 @@ watch(
'status-inactive': props.row.status === 'INACTIVE', 'status-inactive': props.row.status === 'INACTIVE',
}" }"
:props="props" :props="props"
:style="
props.rowIndex % 2 !== 0
? $q.dark.isActive
? 'background: hsl(var(--gray-11-hsl)/0.2)'
: `background: #f9fafc`
: ''
"
> >
<q-td <q-td
class="text-center" class="text-center"
@ -1262,7 +1276,7 @@ watch(
<q-td v-if="fieldSelected.includes('userRole')"> <q-td v-if="fieldSelected.includes('userRole')">
<span class="tags tags__purple"> <span class="tags tags__purple">
{{ props.row.userRole || '-' }} {{ mapRole(props.row.userRole) }}
</span> </span>
</q-td> </q-td>