change menu right

This commit is contained in:
Warunee Tamkoo 2023-11-09 10:14:46 +07:00
parent dc5d9f57b3
commit fb1c601b73

View file

@ -5,16 +5,8 @@ import { useRoute, useRouter } from "vue-router";
import { useDataStore } from "@/stores/data";
import { storeToRefs } from "pinia";
import { scroll, useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import type {
ScrollType,
notiType,
optionType,
} from "../interface/request/main/main";
import type { ScrollType } from "../interface/request/main/main";
import {
menuList,
tabListLogin,
@ -25,7 +17,7 @@ import {
tabList,
} from "../interface/request/main/main";
const { setVerticalScrollPosition, getVerticalScrollPosition } = scroll;
const { setVerticalScrollPosition } = scroll;
const store = useDataStore();
const route = useRoute();
const router = useRouter();
@ -42,40 +34,10 @@ const active = ref<number>(0);
const drawerL = ref<boolean>(false);
const fullname = ref<string>("");
const role = ref<string[]>([]);
const notiTrigger = ref<boolean>(false);
const text = ref<string>("");
const menuRight = ref<boolean>(false);
const listTab = ref<any>([]);
const notiList = ref<notiType[]>([
{
id: "1",
sender: "ท",
body: "ขอแก้ไขข้อมูลทะเบียนประวัติ",
timereceive: new Date(),
},
]);
const options = ref<optionType[]>([
{
icon: "mdi-account-cog",
label: "ผู้ดูแลระบบ",
value: "op1",
color: "primary",
},
{
icon: "mdi-account-group",
label: "เจ้าหน้าที่",
value: "op2",
color: "blue",
},
{
icon: "mdi-account-circle",
label: "บุคคล",
value: "op3",
color: "indigo",
},
]);
/**
* toggleBtnRight มย ขยาย drawer ขวา
*/
@ -95,19 +57,6 @@ const toggleBtnLeft = () => {
}
};
/**
* Event onScroll นำ ตำแหน top scroll
* ใช function updateScroll
*/
const onScroll = (scroll: ScrollType) => {
const { position } = scroll;
if (route.name == "PlacementPersonalDetail") {
updateScrollPlacement(position);
} else {
updateScroll(position);
}
};
/**
* updateScroll เป function active แทปดานขวา
*/
@ -205,8 +154,7 @@ onMounted(async () => {
});
const setListTab = () => {
// console.log(route.name);
menuRight.value = true
if (route.name == "login") {
listTab.value = tabListLogin;
} else if (route.name == "datamain") {
@ -217,14 +165,16 @@ const setListTab = () => {
listTab.value = tabRegistration;
} else if (route.name == "recruitmain") {
listTab.value = tabRecruit;
}
}
changeTab(listTab.value[0].tag);
if (route.name == "dashboard") {
listTab.value = [];
menuRight.value = false
}
window.scrollTo(0, 0);
};
watch(route, () => {
setListTab();
});
@ -320,7 +270,6 @@ const updateScrollPlacement = (position: number) => {
if (position === void 0) {
position = document.documentElement.scrollTop || document.body.scrollTop;
}
};
const activeBtnPlacement = () => {
@ -350,10 +299,6 @@ if (keycloak.tokenParsed != null) {
fullname.value = keycloak.tokenParsed.name;
role.value = keycloak.tokenParsed.role;
}
const clickTag = (val: string) => {
console.log(val);
router.push(val);
};
</script>
<!-- โครงเว -->
@ -361,7 +306,7 @@ const clickTag = (val: string) => {
<!-- แบบเก design แรก -->
<!-- <q-layout view="lHh Lpr lff"> -->
<!-- ปรบใหบหน รายละเอยดทะเบยนประว -->
<q-layout view="lHh LpR lff" @scroll="onScroll">
<q-layout view="lHh LpR lff">
<!-- header -->
<q-header flat class="bg-grey-2 text-dark" height-hint="7">
<q-toolbar style="padding: 0 2%">
@ -685,6 +630,7 @@ const clickTag = (val: string) => {
<!-- drawer page login -->
<q-drawer
v-if="menuRight"
side="right"
class="bg-grey-2"
show-if-above