2024-04-17 15:44:13 +07:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import useUserStore from 'src/stores/user';
|
|
|
|
|
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
|
|
|
|
|
const hqId = defineModel<string | null | undefined>('hqId');
|
|
|
|
|
const brId = defineModel<string | null | undefined>('brId');
|
|
|
|
|
const userType = defineModel<string>('userType');
|
|
|
|
|
const userRole = defineModel<string>('userRole');
|
2024-04-18 09:05:32 +07:00
|
|
|
const username = defineModel<string | null | undefined>('username');
|
2024-04-17 15:44:13 +07:00
|
|
|
const userCode = defineModel<string>('userCode');
|
|
|
|
|
|
|
|
|
|
defineProps<{
|
|
|
|
|
dense?: boolean;
|
|
|
|
|
outlined?: boolean;
|
|
|
|
|
readonly?: boolean;
|
|
|
|
|
separator?: boolean;
|
2024-04-18 09:05:32 +07:00
|
|
|
usernameReadonly?: boolean;
|
2024-04-17 15:44:13 +07:00
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
async function selectHq(id: string) {
|
|
|
|
|
if (!id) return;
|
|
|
|
|
brId.value = '';
|
|
|
|
|
userStore.userOption.brOpts = [];
|
|
|
|
|
await userStore.fetchBrOption(id);
|
2024-04-18 18:18:31 +07:00
|
|
|
if (userStore.userOption.brOpts.length === 1) {
|
|
|
|
|
brId.value = userStore.userOption.brOpts[0].value;
|
|
|
|
|
}
|
2024-04-17 15:44:13 +07:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<template>
|
2024-04-22 10:53:56 +07:00
|
|
|
<div class="col-3 app-text-muted">
|
|
|
|
|
• {{ $t('formDialogTitleInformation') }}
|
|
|
|
|
</div>
|
2024-04-17 15:44:13 +07:00
|
|
|
<div class="col-9 row q-col-gutter-md">
|
|
|
|
|
<q-select
|
2024-04-22 10:53:56 +07:00
|
|
|
id="select-hq-id"
|
2024-04-17 15:44:13 +07:00
|
|
|
:dense="dense"
|
2024-06-27 04:42:48 +00:00
|
|
|
outlined
|
2024-04-17 15:44:13 +07:00
|
|
|
:readonly="readonly"
|
|
|
|
|
:hide-dropdown-icon="readonly"
|
|
|
|
|
emit-value
|
|
|
|
|
map-options
|
|
|
|
|
options-dense
|
|
|
|
|
hide-bottom-space
|
2024-04-22 14:05:07 +07:00
|
|
|
class="col-4"
|
2024-04-18 18:18:31 +07:00
|
|
|
v-model="hqId"
|
2024-04-17 15:44:13 +07:00
|
|
|
option-label="label"
|
|
|
|
|
option-value="value"
|
2024-04-22 10:53:56 +07:00
|
|
|
:label="$t('formDialogInputCode')"
|
2024-04-17 15:44:13 +07:00
|
|
|
:options="userStore.userOption.hqOpts"
|
2024-04-22 10:53:56 +07:00
|
|
|
:rules="[(val: string) => !!val || $t('formDialogInputHqIdValidate')]"
|
2024-04-17 15:44:13 +07:00
|
|
|
@update:model-value="(val: string) => selectHq(val)"
|
|
|
|
|
/>
|
|
|
|
|
<q-select
|
2024-04-22 10:53:56 +07:00
|
|
|
id="select-br-id"
|
2024-04-17 15:44:13 +07:00
|
|
|
:dense="dense"
|
2024-06-27 04:42:48 +00:00
|
|
|
outlined
|
2024-04-17 15:44:13 +07:00
|
|
|
:readonly="readonly"
|
|
|
|
|
:hide-dropdown-icon="readonly"
|
|
|
|
|
emit-value
|
|
|
|
|
map-options
|
|
|
|
|
options-dense
|
2024-04-18 18:18:31 +07:00
|
|
|
clearable
|
2024-04-17 15:44:13 +07:00
|
|
|
hide-bottom-space
|
2024-04-22 14:05:07 +07:00
|
|
|
class="col-4"
|
2024-04-18 18:18:31 +07:00
|
|
|
v-model="brId"
|
2024-04-22 10:53:56 +07:00
|
|
|
:label="$t('formDialogInputBrId')"
|
2024-04-17 15:44:13 +07:00
|
|
|
option-label="label"
|
|
|
|
|
option-value="value"
|
|
|
|
|
:options="userStore.userOption.brOpts"
|
|
|
|
|
/>
|
2024-04-22 14:05:07 +07:00
|
|
|
<q-input
|
2024-04-25 04:05:48 +00:00
|
|
|
for="input-username"
|
2024-04-22 14:05:07 +07:00
|
|
|
:dense="dense"
|
2024-06-27 04:42:48 +00:00
|
|
|
outlined
|
2024-04-22 14:05:07 +07:00
|
|
|
:readonly="usernameReadonly"
|
|
|
|
|
emit-value
|
|
|
|
|
map-options
|
|
|
|
|
options-dense
|
|
|
|
|
hide-bottom-space
|
|
|
|
|
class="col-4"
|
|
|
|
|
:label="$t('formDialogInputUsername')"
|
|
|
|
|
v-model="username"
|
|
|
|
|
:rules="[
|
|
|
|
|
(val: string) =>
|
|
|
|
|
val.length > 2 || $t('formDialogInputUsernameValidate'),
|
|
|
|
|
]"
|
|
|
|
|
/>
|
2024-04-17 15:44:13 +07:00
|
|
|
<q-select
|
2024-04-22 10:53:56 +07:00
|
|
|
id="select-user-type"
|
2024-04-17 15:44:13 +07:00
|
|
|
:dense="dense"
|
2024-06-27 04:42:48 +00:00
|
|
|
outlined
|
2024-04-17 15:44:13 +07:00
|
|
|
:readonly="readonly"
|
|
|
|
|
:hide-dropdown-icon="readonly"
|
|
|
|
|
emit-value
|
|
|
|
|
map-options
|
|
|
|
|
options-dense
|
|
|
|
|
hide-bottom-space
|
2024-04-22 14:05:07 +07:00
|
|
|
class="col-6"
|
2024-04-17 15:44:13 +07:00
|
|
|
option-value="value"
|
|
|
|
|
option-label="label"
|
2024-04-22 10:53:56 +07:00
|
|
|
:label="$t('formDialogInputUserType')"
|
2024-04-17 15:44:13 +07:00
|
|
|
v-model="userType"
|
|
|
|
|
:options="userStore.userOption.userTypeOpts"
|
2024-04-22 10:53:56 +07:00
|
|
|
:rules="[(val: string) => !!val || $t('formDialogInputUserTypeValidate')]"
|
2024-04-17 15:44:13 +07:00
|
|
|
/>
|
|
|
|
|
<q-select
|
2024-04-22 10:53:56 +07:00
|
|
|
id="select-user-role"
|
2024-04-17 15:44:13 +07:00
|
|
|
:dense="dense"
|
2024-06-27 04:42:48 +00:00
|
|
|
outlined
|
2024-04-17 15:44:13 +07:00
|
|
|
:readonly="readonly"
|
|
|
|
|
:hide-dropdown-icon="readonly"
|
|
|
|
|
emit-value
|
|
|
|
|
map-options
|
|
|
|
|
options-dense
|
|
|
|
|
hide-bottom-space
|
2024-04-22 14:05:07 +07:00
|
|
|
class="col-6"
|
2024-04-22 10:53:56 +07:00
|
|
|
:label="$t('formDialogInputUserRole')"
|
2024-04-17 15:44:13 +07:00
|
|
|
option-label="label"
|
|
|
|
|
option-value="value"
|
|
|
|
|
v-model="userRole"
|
|
|
|
|
:options="userStore.userOption.roleOpts"
|
2024-04-22 10:53:56 +07:00
|
|
|
:rules="[(val: string) => !!val || $t('formDialogInputUserRoleValidate')]"
|
2024-04-17 15:44:13 +07:00
|
|
|
/>
|
2024-04-22 14:05:07 +07:00
|
|
|
<!-- <q-input
|
2024-04-22 10:53:56 +07:00
|
|
|
id="input-user-code"
|
2024-04-17 15:44:13 +07:00
|
|
|
:dense="dense"
|
2024-04-19 09:06:38 +07:00
|
|
|
:outlined="readonly ? false : outlined"
|
|
|
|
|
:borderless="readonly"
|
2024-04-17 15:44:13 +07:00
|
|
|
readonly
|
|
|
|
|
hide-bottom-space
|
|
|
|
|
class="col-3"
|
2024-04-22 10:53:56 +07:00
|
|
|
:label="$t('formDialogInputUserCode')"
|
2024-04-17 15:44:13 +07:00
|
|
|
v-model="userCode"
|
2024-04-22 14:05:07 +07:00
|
|
|
/> -->
|
2024-04-17 15:44:13 +07:00
|
|
|
</div>
|
|
|
|
|
<q-separator
|
|
|
|
|
v-if="separator"
|
|
|
|
|
class="col-12 q-mb-md"
|
|
|
|
|
style="padding-block: 0.5px; margin-top: 32px"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|