Merge branch 'develop' into working

This commit is contained in:
Tanyalak 2023-06-29 11:05:21 +07:00
commit 3a8ecb9d82
32 changed files with 1900 additions and 2373 deletions

View file

@ -13,7 +13,7 @@ import type {
import {
menuList,
tabList,
tabList_placement,
tabListPlacement,
} from "../interface/request/main/main";
const { setVerticalScrollPosition, getVerticalScrollPosition } = scroll;
@ -71,10 +71,6 @@ const tabScroll = () => {
return route.name == "registryDetail";
};
const tabScroll2 = () => {
return route.name == "placement2Detail";
};
/**
* toggleBtnRight มย ขยาย drawer ขวา
*/
@ -101,7 +97,7 @@ const toggleBtnLeft = () => {
const onScroll = (scroll: ScrollType) => {
const { position } = scroll;
updateScroll(position);
updateScroll2(position);
updateScrollPlacement(position);
};
/**
@ -161,60 +157,6 @@ const activeBtn = () => {
return route.name == "registryDetail" && rightActive.value;
};
const updateScroll2 = (position: number) => {
// position undifind position top scroll
if (position === void 0) {
position = document.documentElement.scrollTop || document.body.scrollTop;
}
let last;
/**
* วนหา id ของ div
*/
for (const i in tabList_placement) {
const section = tabList_placement[i];
const item = document.getElementById(section.tag);
/**
* วนหา id ของ div หนาน
* เมอหาไมเจอใหไปตอตวตอไป
* เมอเจอแล ให ตำแหนงบนสดของ div มากกวาหรอเทาก ตำแหน top scroll บวกก แทปดานบน 155
* last เป undifind ให last เทาก tag แล หยดล
* าไมใช undifind ให last เทาก tag แล ปหาต กรณ div นยาว
*/
if (item === null) {
continue;
}
if (item.offsetTop >= position + 155) {
if (last === void 0) {
last = section.tag;
}
break;
} else {
last = section.tag;
}
}
/**
* last ไมเทาก undifind
* ใช เซ active ใหเปนแทปส
* และใช scrollIntoView ายตำแหน activeโดยการเลอนไปหา
*/
if (last !== void 0) {
changeTab(last);
const tocEl = document.getElementById("tab--" + last);
if (tocEl) {
tocEl.scrollIntoView({ block: "nearest" });
}
}
};
/**
* ใหแสดง แทปดานขวา เมอเขาหน รายละเอยดหนอยงานอนๆ และ rightActive เทาก true
*/
const activeBtn2 = () => {
return route.name == "placement2Detail" && rightActive.value;
};
/**
* เมอเรมตนโปรแกรมให event resize และ function myEventHandler
* set function myEventHandler เพราะ state งไมเซ , state เซทเม หนาจอเร ขยบหนาจอ
@ -298,8 +240,7 @@ const tagClick = (tag: string) => {
// router.replace({ hash });
if (route.hash !== hash) {
const check = activeBtn();
const check2 = activeBtn2();
if (check || check2) {
if (check) {
// router.replace({ hash, position: { x: 0, y: 0 } });
// router.replace({ hash }).then(() => {
// setVerticalScrollPosition(window, offset, 300);
@ -314,6 +255,71 @@ const tagClick = (tag: string) => {
}
};
//**** Tab Right ****\\
const tabScrollPlacement = () => {
return route.name == "PlacementPersonalDetail";
};
const updateScrollPlacement = (position: number) => {
if (position === void 0) {
position = document.documentElement.scrollTop || document.body.scrollTop;
}
let last;
for (const i in tabListPlacement) {
const section = tabListPlacement[i];
const item = document.getElementById(section.tag);
if (item === null) {
continue;
}
if (item.offsetTop >= position + 100) {
if (last === void 0) {
last = section.tag;
}
break;
} else {
last = section.tag;
}
}
if (last !== void 0) {
changeTab(last);
const tocEl = document.getElementById("tab--" + last);
if (tocEl) {
tocEl.scrollIntoView({ block: "nearest" });
}
}
};
const activeBtnPlacement = () => {
return route.name == "PlacementPersonalDetail" && rightActive.value;
};
const activeTabPlacement = (tag: string) => {
return tabData.value == tag;
};
const tagClickPlacement = (tag: string) => {
const hash = `#${tag}`;
const items = document.getElementById(tag);
const offset = Math.max(0, items == null ? 0 : items.offsetTop + 50);
// router.replace({ hash });
if (route.hash !== hash) {
const checkPlacement = activeBtnPlacement();
if (checkPlacement) {
drawerR.value = !drawerR.value;
setVerticalScrollPosition(window, offset, 300);
} else {
setVerticalScrollPosition(window, offset, 300);
}
} else {
setVerticalScrollPosition(window, offset, 300);
}
};
//**** End Tab Right ****\\
/**
* logout keycloak
* confirm อนออกจากระบบ
@ -500,7 +506,7 @@ if (keycloak.tokenParsed != null) {
<q-btn
size="13px"
class="bg-blue-1"
v-if="activeBtn() || activeBtn2()"
v-if="activeBtn() || activeBtnPlacement()"
flat
dense
round
@ -848,7 +854,7 @@ if (keycloak.tokenParsed != null) {
side="right"
class="bg-grey-2"
show-if-above
v-if="tabScroll2()"
v-if="tabScrollPlacement()"
v-model="drawerR"
:width="220"
:breakpoint="1023"
@ -856,17 +862,17 @@ if (keycloak.tokenParsed != null) {
<q-scroll-area class="fit">
<q-list padding>
<q-item
v-for="(tabItem, index) in tabList_placement"
v-for="(tabItem, index) in tabListPlacement"
:key="index"
:id="'tab--' + tabItem.tag"
class="tabNative"
active-class="text-blue-7 active-item text-weight-medium tabActive"
:active="activeTab(tabItem.tag)"
:active="activeTabPlacement(tabItem.tag)"
clickable
v-ripple
dense
exact
@click="tagClick(tabItem.tag)"
@click="tagClickPlacement(tabItem.tag)"
>
<q-item-section>
<q-item-label