fix: tab default tab

This commit is contained in:
puriphatt 2024-08-16 17:41:20 +07:00
parent 601537049d
commit 6af275330c

View file

@ -413,7 +413,7 @@ const workNameRef = ref();
const selectProduct = ref<ProductList[]>([]); const selectProduct = ref<ProductList[]>([]);
const currentWorkIndex = ref<number>(0); const currentWorkIndex = ref<number>(0);
const currentServiceTab = ref(1); const serviceTab = ref(1);
const propertiesDialog = ref<boolean>(false); const propertiesDialog = ref<boolean>(false);
const totalProduct = ref<number>(0); const totalProduct = ref<number>(0);
@ -901,7 +901,7 @@ async function assignFormDataProductService(id: string) {
const res = await fetchListServiceById(id); const res = await fetchListServiceById(id);
if (res) { if (res) {
currentServiceTab.value = 1; serviceTab.value = 1;
statusToggle.value = res.status === 'INACTIVE' ? false : true; statusToggle.value = res.status === 'INACTIVE' ? false : true;
profileUrl.value = res.imageUrl; profileUrl.value = res.imageUrl;
profileSubmit.value = true; profileSubmit.value = true;
@ -964,6 +964,7 @@ const prevProduct = ref<ProductCreate>({
}); });
function assignFormDataProduct(data: ProductList) { function assignFormDataProduct(data: ProductList) {
productTab.value = 1;
statusToggle.value = data.status === 'INACTIVE' ? false : true; statusToggle.value = data.status === 'INACTIVE' ? false : true;
profileUrl.value = `${baseUrl.value}/product/${data?.id}/image`; profileUrl.value = `${baseUrl.value}/product/${data?.id}/image`;
@ -1444,10 +1445,11 @@ watch(
icon="mdi-folder-multiple-plus" icon="mdi-folder-multiple-plus"
@click=" @click="
async () => { async () => {
serviceTab = 1;
clearFormGroup(); clearFormGroup();
clearFormService(); clearFormService();
await fetchListOfOptionBranch(); await fetchListOfOptionBranch();
currentServiceTab = 1; serviceTab = 1;
dialogService = true; dialogService = true;
} }
" "
@ -4164,8 +4166,8 @@ watch(
class="no-padding items-center rounded full-width" class="no-padding items-center rounded full-width"
:class="{ 'q-mt-xs': v > 1 }" :class="{ 'q-mt-xs': v > 1 }"
active-class="product-form-active" active-class="product-form-active"
:active="currentServiceTab === v" :active="serviceTab === v"
@click="currentServiceTab = v" @click="serviceTab = v"
> >
<span class="full-width q-py-sm" style="padding-inline: 20px"> <span class="full-width q-py-sm" style="padding-inline: 20px">
{{ v === 1 ? $t('serviceInformation') : $t('workInformation') }} {{ v === 1 ? $t('serviceInformation') : $t('workInformation') }}
@ -4179,7 +4181,7 @@ watch(
style="height: 100%; max-height: 100%; overflow-y: auto" style="height: 100%; max-height: 100%; overflow-y: auto"
> >
<BasicInformation <BasicInformation
v-if="currentServiceTab === 1" v-if="serviceTab === 1"
dense dense
service service
v-model:options-branch="branchOption" v-model:options-branch="branchOption"
@ -4192,7 +4194,7 @@ watch(
/> />
<FormServiceWork <FormServiceWork
v-if="currentServiceTab === 2" v-if="serviceTab === 2"
v-model:work-items="workItems" v-model:work-items="workItems"
dense dense
@addProduct=" @addProduct="
@ -4222,7 +4224,7 @@ watch(
</div> </div>
<div <div
class="col-2 surface-1 q-mx-lg q-mb-lg rounded bordered row" class="col-2 surface-1 q-mx-lg q-mb-lg rounded bordered row"
v-if="currentServiceTab === 1" v-if="serviceTab === 1"
style="overflow: hidden" style="overflow: hidden"
> >
<FormServiceProperties <FormServiceProperties
@ -4383,8 +4385,8 @@ watch(
class="no-padding items-center rounded full-width" class="no-padding items-center rounded full-width"
:class="{ 'q-mt-xs': v > 1 }" :class="{ 'q-mt-xs': v > 1 }"
active-class="product-form-active" active-class="product-form-active"
:active="currentServiceTab === v" :active="serviceTab === v"
@click="currentServiceTab = v" @click="serviceTab = v"
> >
<span class="full-width q-py-sm" style="padding-inline: 20px"> <span class="full-width q-py-sm" style="padding-inline: 20px">
{{ v === 1 ? $t('serviceInformation') : $t('workInformation') }} {{ v === 1 ? $t('serviceInformation') : $t('workInformation') }}
@ -4398,7 +4400,7 @@ watch(
style="height: 100%; max-height: 100%; overflow-y: auto" style="height: 100%; max-height: 100%; overflow-y: auto"
> >
<BasicInformation <BasicInformation
v-if="currentServiceTab === 1" v-if="serviceTab === 1"
:readonly="!infoServiceEdit" :readonly="!infoServiceEdit"
dense dense
service service
@ -4413,7 +4415,7 @@ watch(
/> />
<FormServiceWork <FormServiceWork
v-if="currentServiceTab === 2" v-if="serviceTab === 2"
:readonly="!infoServiceEdit" :readonly="!infoServiceEdit"
v-model:work-items="workItems" v-model:work-items="workItems"
dense dense
@ -4444,7 +4446,7 @@ watch(
</div> </div>
<div <div
class="col-2 surface-1 q-mx-lg q-mb-lg rounded bordered row" class="col-2 surface-1 q-mx-lg q-mb-lg rounded bordered row"
v-if="currentServiceTab === 1" v-if="serviceTab === 1"
style="overflow: hidden" style="overflow: hidden"
> >
<FormServiceProperties <FormServiceProperties