This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-12 15:43:51 +07:00
parent 0f86f97d91
commit 483155dc18
32 changed files with 10140 additions and 9400 deletions

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted, onUnmounted, watch } from "vue";
import keycloak from "@/plugins/keycloak";
import { useRoute, useRouter } from "vue-router";
import { useDataStore } from "@/stores/data";
@ -20,6 +20,8 @@ import {
tabListLogin,
tabListDatamain,
tabStructuremain,
tabRegistration,
tabRecruit,
tabList,
// tabListPlacement,
} from "../interface/request/main/main";
@ -91,8 +93,6 @@ const tabScroll = () => {
return route.name == "registryDetail";
};
const tabLogin = async () => {
await setListTab();
let namePath = menuList[1].children.find((e: any) => e.path === route.path);
if (namePath) {
return true;
@ -135,7 +135,7 @@ const onScroll = (scroll: ScrollType) => {
* updateScroll เป function active แทปดานขวา
*/
const updateScroll = (position: number) => {
console.log(position);
// console.log(position);
// position undifind position top scroll
if (position === void 0) {
@ -149,6 +149,29 @@ const updateScroll = (position: number) => {
for (const i in listTab.value) {
const section = listTab.value[i];
const item = document.getElementById(section.tag);
// console.log(section.childern);
if (section.childern) {
for (const x in section.childern) {
const sectionchildern = section.childern[x];
const itemchildern = document.getElementById(sectionchildern.tag);
console.log(sectionchildern);
if (itemchildern === null) {
continue;
}
if (itemchildern.offsetTop >= position + 155) {
console.log(last);
if (last === void 0) {
last = sectionchildern.tag;
}
break;
} else {
last = sectionchildern.tag;
}
}
}
/**
* วนหา id ของ div หนาน
* เมอหาไมเจอใหไปตอตวตอไป
@ -174,6 +197,7 @@ const updateScroll = (position: number) => {
* ใช เซ active ใหเปนแทปส
* และใช scrollIntoView ายตำแหน activeโดยการเลอนไปหา
*/
if (last !== void 0) {
changeTab(last);
const tocEl = document.getElementById("tab--" + last);
@ -204,14 +228,23 @@ onMounted(async () => {
});
const setListTab = () => {
console.log(route.name);
if (route.name == "manual") {
listTab.value = tabListLogin;
} else if (route.name == "datamain") {
listTab.value = tabListDatamain;
} else if (route.name == "structuremain") {
listTab.value = tabStructuremain;
} else if (route.name == "registmain") {
listTab.value = tabRegistration;
} else if (route.name == "recruitmain") {
listTab.value = tabRecruit;
}
};
watch(route, () => {
setListTab();
});
/**
* เมอออกจากโปรแกรม ให ยกเลกการฟ event resize
@ -866,26 +899,49 @@ const clickTag = (val: string) => {
>
<q-scroll-area class="fit">
<q-list padding>
<q-item
v-for="(tabItem, index) in listTab"
:key="index"
:id="'tab--' + tabItem.tag"
class="tabNative"
active-class="text-blue-7 active-item text-weight-medium tabActive"
:active="activeTab(tabItem.tag)"
clickable
v-ripple
dense
exact
@click="tagClick(tabItem.tag)"
>
<q-item-section>
<q-item-label
><q-icon size="11px" name="mdi-circle-medium" />
<span class="q-pl-xs">{{ tabItem.label }}</span>
</q-item-label>
</q-item-section>
</q-item>
<div v-for="(tabItem, index) in listTab" :key="index">
<q-item
:id="'tab--' + tabItem.tag"
class="tabNative"
active-class="text-blue-7 active-item text-weight-medium tabActive"
:active="activeTab(tabItem.tag)"
clickable
v-ripple
dense
exact
@click="tagClick(tabItem.tag)"
>
<q-item-section>
<q-item-label
><q-icon size="11px" name="mdi-circle-medium" />
<span class="q-pl-xs">{{ tabItem.label }}</span>
</q-item-label>
</q-item-section>
</q-item>
<div v-if="route.name == 'recruitmain'">
<q-item
v-if="route.name == 'recruitmain'"
v-for="(childItem, childIndex) in tabItem.childern"
:key="'child-' + childIndex"
:id="'tab--' + childItem.tag"
class="tabNative child-tab"
active-class="text-blue-7 active-item text-weight-medium tabActive"
:active="activeTab(childItem.tag)"
clickable
v-ripple
dense
exact
@click="tagClick(childItem.tag)"
>
<q-item-section>
<q-item-label>
<!-- <q-icon size="11px" name="mdi-circle-small" /> -->
<span class="q-pl-xl">{{ childItem.label }}</span>
</q-item-label>
</q-item-section>
</q-item>
</div>
</div>
</q-list>
</q-scroll-area>
</q-drawer>