2023-06-01 12:54:58 +07:00
|
|
|
<script setup lang="ts">
|
2024-01-19 10:20:07 +07:00
|
|
|
import { ref, onMounted, onUnmounted, watch } from "vue";
|
2023-06-01 12:54:58 +07:00
|
|
|
import keycloak from "@/plugins/keycloak";
|
|
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
|
|
import { useDataStore } from "@/stores/data";
|
|
|
|
|
import { storeToRefs } from "pinia";
|
|
|
|
|
import { scroll, useQuasar } from "quasar";
|
2023-08-16 12:55:07 +07:00
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
|
|
|
|
|
|
|
|
|
import http from "@/plugins/http";
|
|
|
|
|
import config from "@/app.config";
|
|
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
import type {
|
|
|
|
|
ScrollType,
|
|
|
|
|
notiType,
|
|
|
|
|
optionType,
|
|
|
|
|
} from "../interface/request/main/main";
|
2023-06-21 17:10:38 +07:00
|
|
|
import {
|
|
|
|
|
menuList,
|
|
|
|
|
tabList,
|
2023-06-28 17:22:44 +07:00
|
|
|
tabListPlacement,
|
2023-06-21 17:10:38 +07:00
|
|
|
} from "../interface/request/main/main";
|
2023-09-08 10:31:29 +07:00
|
|
|
import { useroleUserDataStore } from "@/stores/roleUser";
|
2023-06-01 12:54:58 +07:00
|
|
|
|
|
|
|
|
const { setVerticalScrollPosition, getVerticalScrollPosition } = scroll;
|
|
|
|
|
const store = useDataStore();
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const link = ref<string>("");
|
2023-08-16 12:55:07 +07:00
|
|
|
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
|
|
|
|
const {
|
|
|
|
|
showLoader,
|
|
|
|
|
hideLoader,
|
2023-09-11 10:22:45 +07:00
|
|
|
dialogRemove,
|
2023-08-16 12:55:07 +07:00
|
|
|
success,
|
|
|
|
|
messageError,
|
|
|
|
|
date2Thai,
|
2024-03-28 16:29:44 +07:00
|
|
|
dialogConfirm,
|
2023-08-16 12:55:07 +07:00
|
|
|
} = mixin;
|
2023-09-08 10:31:29 +07:00
|
|
|
const DataStore = useroleUserDataStore();
|
|
|
|
|
const { fetchroleUser } = DataStore;
|
2023-06-01 12:54:58 +07:00
|
|
|
|
2023-09-11 12:13:24 +07:00
|
|
|
const id = ref<string>("");
|
2023-06-01 12:54:58 +07:00
|
|
|
const $q = useQuasar();
|
|
|
|
|
const { tabData, loader } = storeToRefs(store);
|
|
|
|
|
const { changeTab } = store;
|
|
|
|
|
const miniState = ref<boolean>(false);
|
|
|
|
|
const drawerR = ref<boolean>(false);
|
|
|
|
|
const rightActive = ref<boolean>(false);
|
|
|
|
|
const resize = ref<number>(0);
|
|
|
|
|
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>("");
|
|
|
|
|
|
2024-01-18 12:00:52 +07:00
|
|
|
const notiList = ref<notiType[]>([]);
|
2023-06-01 12:54:58 +07:00
|
|
|
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",
|
|
|
|
|
},
|
|
|
|
|
]);
|
2023-08-16 12:55:07 +07:00
|
|
|
|
2024-01-19 10:20:07 +07:00
|
|
|
async function fetchmsgNoread() {
|
|
|
|
|
await http
|
|
|
|
|
.get(config.API.msgNoread())
|
|
|
|
|
.then((res) => {
|
|
|
|
|
totalNoti.value = res.data.result;
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
messageError($q, err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-22 10:31:53 +07:00
|
|
|
const statusLoad = ref<boolean>(false);
|
2024-01-18 12:00:52 +07:00
|
|
|
const getDataNotification = async (index: number, type: string) => {
|
2024-01-19 10:20:07 +07:00
|
|
|
const thaiOptions: Intl.DateTimeFormatOptions = {
|
|
|
|
|
hour: "2-digit",
|
|
|
|
|
minute: "2-digit",
|
|
|
|
|
};
|
2023-08-21 15:14:45 +07:00
|
|
|
await http
|
2024-01-19 10:20:07 +07:00
|
|
|
.get(config.API.msgNotificate + `?page=${index}&pageSize=${10}`)
|
2023-08-21 15:14:45 +07:00
|
|
|
.then((res: any) => {
|
2024-01-17 17:43:19 +07:00
|
|
|
const response = res.data.result.data;
|
2024-01-19 10:20:07 +07:00
|
|
|
totalInbox.value = res.data.result.total;
|
2024-01-18 12:00:52 +07:00
|
|
|
|
2024-01-19 10:20:07 +07:00
|
|
|
let list: notiType[] = [];
|
2024-01-18 12:00:52 +07:00
|
|
|
if (type === "DEL") {
|
2024-01-19 10:20:07 +07:00
|
|
|
notiList.value = [];
|
2024-01-18 12:00:52 +07:00
|
|
|
}
|
2024-01-19 10:20:07 +07:00
|
|
|
response.map((e: any) => {
|
|
|
|
|
list.push({
|
|
|
|
|
id: e.id,
|
|
|
|
|
sender:
|
|
|
|
|
e.createdFullName == "" || e.createdFullName == null
|
|
|
|
|
? "เจ้าหน้าที่"[0]
|
|
|
|
|
: e.createdFullName[0],
|
|
|
|
|
body: e.body ?? "",
|
|
|
|
|
timereceive: `${date2Thai(e.receiveDate)} ${new Date(
|
|
|
|
|
e.receiveDate
|
|
|
|
|
).toLocaleTimeString("th-TH", thaiOptions)} น.`,
|
|
|
|
|
isOpen: e.isOpen,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
notiList.value.push(...list);
|
2024-01-22 10:31:53 +07:00
|
|
|
statusLoad.value = totalInbox.value === 0 ? true : false;
|
2023-08-21 15:14:45 +07:00
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
2024-01-18 12:00:52 +07:00
|
|
|
messageError($q, e);
|
2023-08-21 15:14:45 +07:00
|
|
|
})
|
2024-01-22 10:31:53 +07:00
|
|
|
.finally(() => {});
|
2023-08-21 15:14:45 +07:00
|
|
|
};
|
2023-08-16 12:55:07 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
/**
|
|
|
|
|
* ให้แสดง แทปด้านขวา เมื่อเข้าหน้า รายละเอียดทะเบียนประวัติ
|
|
|
|
|
*/
|
|
|
|
|
const tabScroll = () => {
|
2023-07-24 17:29:21 +07:00
|
|
|
return route.name == "registryDetail";
|
2023-06-01 12:54:58 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* toggleBtnRight ปุ่มย่อ ขยาย drawer ขวา
|
|
|
|
|
*/
|
|
|
|
|
const toggleBtnRight = () => {
|
|
|
|
|
drawerR.value = !drawerR.value;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* toggleBtnLeft ปุ่มย่อ ขยาย drawer ซ้าย เมื่อหน้าจอ ย่อถึงขนาด 1024 px
|
|
|
|
|
* ปกติเป็นการย่อโดยใช้ Ministate
|
|
|
|
|
*/
|
|
|
|
|
const toggleBtnLeft = () => {
|
|
|
|
|
if (window.innerWidth < 1024) {
|
|
|
|
|
drawerL.value = !drawerL.value;
|
|
|
|
|
} else {
|
|
|
|
|
miniState.value = !miniState.value;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Event onScroll นำ ตำแหน่ง top ที่ scroll
|
|
|
|
|
* ใช้ function updateScroll
|
|
|
|
|
*/
|
|
|
|
|
const onScroll = (scroll: ScrollType) => {
|
|
|
|
|
const { position } = scroll;
|
2023-07-07 15:29:37 +07:00
|
|
|
if (route.name == "PlacementPersonalDetail") {
|
|
|
|
|
updateScrollPlacement(position);
|
|
|
|
|
} else {
|
|
|
|
|
updateScroll(position);
|
|
|
|
|
}
|
2023-06-01 12:54:58 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* updateScroll เป็น function active แทปด้านขวา
|
|
|
|
|
*/
|
|
|
|
|
const updateScroll = (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) {
|
|
|
|
|
const section = tabList[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 activeBtn = () => {
|
2023-07-24 17:29:21 +07:00
|
|
|
return route.name == "registryDetail" && rightActive.value;
|
2023-06-01 12:54:58 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* เมื่อเริ่มต้นโปรแกรมให้ฟัง event resize และ function myEventHandler
|
|
|
|
|
* set function myEventHandler เพราะ state ยังไม่เซ็ท , state เซ็ทเมื่อ หน้าจอเริ่ม ขยับหน้าจอ
|
|
|
|
|
* เริ่มเข้ามา state rightActive เป็น state ที่โชว์ ปุ่มขวา
|
|
|
|
|
* ยังจับ boolean ผิด จึงต้อง set
|
|
|
|
|
*/
|
2023-08-16 12:55:07 +07:00
|
|
|
onMounted(async () => {
|
2023-09-22 18:02:02 +07:00
|
|
|
if (keycloak.tokenParsed) {
|
|
|
|
|
await fetchroleUser(keycloak.tokenParsed.role);
|
|
|
|
|
}
|
2024-01-19 10:20:07 +07:00
|
|
|
await fetchmsgNoread();
|
|
|
|
|
// await getDataNotification(1, "NOMAL");
|
2023-06-01 12:54:58 +07:00
|
|
|
myEventHandler(null, false);
|
|
|
|
|
window.addEventListener("resize", (e: any) => {
|
|
|
|
|
myEventHandler(e, true);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* เมื่อออกจากโปรแกรม ให้ ยกเลิกการฟัง event resize
|
|
|
|
|
*/
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
window.removeEventListener("resize", (e: any) => {
|
|
|
|
|
myEventHandler(e, true);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param e event ของ resize
|
|
|
|
|
* @param setSCroll เช็คว่ามาจาก event หรือป่าว
|
|
|
|
|
* set state resize = ความกว้างหน้าเว็ป
|
|
|
|
|
* เมื่อความกว้าง น้อยกว่า 1024( เท่ากับ น้อยกว่า 1023) ให้ rightActive เป็น true แต่ถ้า rightActive true อยู่แล้วไม่ต้อง set
|
|
|
|
|
* เมื่อความกว้าง มากกว่าหรือเท่ากับ 1024 และเมื่อ rightActive เป็น true
|
|
|
|
|
* และ drawerR เป็น true ให้ rightActive เป็น true ถ้า drawerR เป็น false ให้ rightActive เป็น false
|
|
|
|
|
* rightActive = true ; แสดงปุ่ม drawer ด้าน ขวา
|
|
|
|
|
* rightActive = false; ไม่แสดงปุ่ม drawer ด้าน ขวา
|
|
|
|
|
*/
|
|
|
|
|
const myEventHandler = (e: any, setSCroll: boolean) => {
|
|
|
|
|
if (setSCroll) {
|
|
|
|
|
resize.value = e.target.innerWidth;
|
|
|
|
|
} else {
|
|
|
|
|
resize.value = window.innerWidth;
|
|
|
|
|
}
|
|
|
|
|
if (resize.value < 1024) {
|
|
|
|
|
if (!rightActive.value) {
|
|
|
|
|
rightActive.value = true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (rightActive.value) {
|
|
|
|
|
if (drawerR.value) {
|
|
|
|
|
rightActive.value = true;
|
|
|
|
|
} else {
|
|
|
|
|
rightActive.value = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ตรวจสอบ path นั้นๆ ว่ายังอยู่ที่ path นั้น แม้จะเป็น path ที่มี child แท็ปก็ยังจะ active อยู่เช่น
|
|
|
|
|
* ปกติ path จะ active เมื่อ path นั้นมีค่า ตรงตัวมันเช่น /main
|
|
|
|
|
* แต่จะไม่ active เมื่อ path นั้น มี child path /main/อื่นๆ
|
|
|
|
|
* @param path string
|
|
|
|
|
*/
|
|
|
|
|
const activeMenu = (path: string) => {
|
2024-02-15 11:46:25 +07:00
|
|
|
// if (path == "dashboard" && route.fullPath == "/") return true;
|
|
|
|
|
// if (path == "registry" && route.fullPath == "/registry-employee")
|
|
|
|
|
// return false;
|
|
|
|
|
// if (path == "registry" && route.fullPath.includes(`/registry-employee/edit`))
|
|
|
|
|
// return false;
|
|
|
|
|
// if (path == "registry" && route.fullPath.includes(`/registry-employee/add`))
|
|
|
|
|
// return false;
|
|
|
|
|
|
|
|
|
|
// if (path == "registry" && route.fullPath == "/") return false;
|
2023-08-10 17:58:18 +07:00
|
|
|
// if (path != "registry" && path == "registryEmployee" && route.fullPath == "/registryEmployee") return true;
|
2024-02-15 11:46:25 +07:00
|
|
|
// const bool = route.fullPath.includes(`/${path}`) || route.name === path;
|
|
|
|
|
const bool = route.name === path;
|
2023-08-10 17:58:18 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
return bool;
|
|
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
* เป็นฟังก์ชันที่รันตลอด เพื่อให้ active ตรงตามเงื่อนไขให้เป็น true
|
|
|
|
|
* @param tag string เป็นชื่อของ ตัวนั้นๆ
|
|
|
|
|
*/
|
|
|
|
|
const activeTab = (tag: string) => {
|
|
|
|
|
return tabData.value == tag;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* คลิกเพื่อให้ router หรือ scroll ไปยังตำแหน่งนั้นๆ
|
|
|
|
|
* @param tag string เป็นชื่อของ ตัวนั้นๆ
|
|
|
|
|
*/
|
|
|
|
|
const tagClick = (tag: string) => {
|
|
|
|
|
const hash = `#${tag}`;
|
|
|
|
|
const items = document.getElementById(tag);
|
|
|
|
|
const offset = Math.max(0, items == null ? 0 : items.offsetTop - 84);
|
|
|
|
|
// router.replace({ hash });
|
|
|
|
|
if (route.hash !== hash) {
|
|
|
|
|
const check = activeBtn();
|
2023-06-28 17:22:44 +07:00
|
|
|
if (check) {
|
2023-06-01 12:54:58 +07:00
|
|
|
// router.replace({ hash, position: { x: 0, y: 0 } });
|
|
|
|
|
// router.replace({ hash }).then(() => {
|
|
|
|
|
// setVerticalScrollPosition(window, offset, 300);
|
|
|
|
|
// });
|
|
|
|
|
drawerR.value = !drawerR.value;
|
|
|
|
|
setVerticalScrollPosition(window, offset, 300);
|
|
|
|
|
} else {
|
|
|
|
|
setVerticalScrollPosition(window, offset, 300);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
setVerticalScrollPosition(window, offset, 300);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2023-06-28 17:22:44 +07:00
|
|
|
//**** 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 หน้าจอแก้ไขข้อมูลส่วนตัวของผู้สอบผ่าน ****\\
|
|
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
/**
|
|
|
|
|
* logout keycloak
|
|
|
|
|
* confirm ก่อนออกจากระบบ
|
|
|
|
|
*/
|
|
|
|
|
const doLogout = () => {
|
2024-03-28 16:29:44 +07:00
|
|
|
dialogConfirm(
|
|
|
|
|
$q,
|
|
|
|
|
() => keycloak.logout(),
|
|
|
|
|
"ยืนยันการออกจากระบบ",
|
|
|
|
|
"ต้องการออกจากระบบใช่หรือไม่?"
|
|
|
|
|
);
|
2023-06-01 12:54:58 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ดิงชื่อผู้ใช้งานจาก keycloak
|
|
|
|
|
*/
|
|
|
|
|
if (keycloak.tokenParsed != null) {
|
|
|
|
|
fullname.value = keycloak.tokenParsed.name;
|
|
|
|
|
role.value = keycloak.tokenParsed.role;
|
|
|
|
|
}
|
2023-09-11 10:22:45 +07:00
|
|
|
|
2024-01-18 12:00:52 +07:00
|
|
|
const clickDelete = async (id: string, index: number) => {
|
|
|
|
|
dialogRemove($q, async () => {
|
|
|
|
|
showLoader();
|
|
|
|
|
await http
|
|
|
|
|
.delete(config.API.msgId(id))
|
|
|
|
|
.then(() => {
|
|
|
|
|
notiList.value.splice(index, 1);
|
|
|
|
|
success($q, "ลบข้อมูลสำเร็จ");
|
2024-01-19 10:20:07 +07:00
|
|
|
totalInbox.value--;
|
2024-01-18 12:00:52 +07:00
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(async () => {
|
2024-01-19 10:20:07 +07:00
|
|
|
notiList.value.length === 7 && getDataNotification(1, "DEL");
|
2024-01-18 12:00:52 +07:00
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
});
|
2023-09-11 10:22:45 +07:00
|
|
|
};
|
2024-01-17 17:43:19 +07:00
|
|
|
|
|
|
|
|
const totalInbox = ref<number>(0);
|
2024-01-19 10:20:07 +07:00
|
|
|
const totalNoti = ref<number>(0);
|
|
|
|
|
const round = ref<number>(0);
|
2024-01-19 15:24:40 +07:00
|
|
|
const page = ref<number>(0);
|
2024-01-19 10:20:07 +07:00
|
|
|
|
2024-01-17 17:43:19 +07:00
|
|
|
function onLoad(index: any, done: any) {
|
2024-01-19 16:10:58 +07:00
|
|
|
if (
|
|
|
|
|
notiList.value.length < totalInbox.value ||
|
|
|
|
|
(notiList.value.length === 0 && totalInbox.value === 0)
|
|
|
|
|
) {
|
|
|
|
|
page.value++;
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
done();
|
|
|
|
|
getDataNotification(page.value, "NOMAL");
|
|
|
|
|
}, 1500);
|
|
|
|
|
}
|
2024-01-17 17:43:19 +07:00
|
|
|
}
|
2024-01-19 10:20:07 +07:00
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => notiTrigger.value,
|
|
|
|
|
() => {
|
|
|
|
|
if (!notiTrigger.value) {
|
|
|
|
|
const updatedNotifications = notiList.value.map((item) => ({
|
|
|
|
|
...item,
|
|
|
|
|
isOpen: true,
|
|
|
|
|
}));
|
|
|
|
|
notiList.value = updatedNotifications;
|
|
|
|
|
fetchmsgNoread();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
2023-06-01 12:54:58 +07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<!-- โครงเว็บ -->
|
|
|
|
|
<template>
|
|
|
|
|
<!-- แบบเก่า design แรก -->
|
|
|
|
|
<!-- <q-layout view="lHh Lpr lff"> -->
|
|
|
|
|
<!-- ปรับให้กับหน้า รายละเอียดทะเบียนประวัติ -->
|
|
|
|
|
<q-layout view="lHh LpR lff" @scroll="onScroll">
|
|
|
|
|
<!-- header -->
|
|
|
|
|
<q-header flat class="bg-grey-2 text-dark" height-hint="7">
|
|
|
|
|
<q-toolbar style="padding: 0 2%">
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-btn
|
|
|
|
|
size="13px"
|
|
|
|
|
class="bg-grey-3"
|
|
|
|
|
flat
|
|
|
|
|
dense
|
|
|
|
|
round
|
|
|
|
|
@click="toggleBtnLeft"
|
|
|
|
|
aria-label="Menu"
|
|
|
|
|
>
|
|
|
|
|
<q-icon
|
|
|
|
|
:name="miniState == false ? 'mdi-backburger' : 'mdi-menu-open'"
|
|
|
|
|
size="20px"
|
|
|
|
|
color="grey-7"
|
|
|
|
|
/>
|
2023-06-01 12:54:58 +07:00
|
|
|
</q-btn>
|
|
|
|
|
|
|
|
|
|
<q-space />
|
|
|
|
|
|
|
|
|
|
<!-- Search -->
|
|
|
|
|
<!-- <q-input dense rounded standout v-model="text" placeholder="ค้นหา">
|
|
|
|
|
<template v-slot:prepend>
|
|
|
|
|
<q-icon name="mdi-magnify" size="20px" color="grey-7" />
|
|
|
|
|
</template>
|
|
|
|
|
</q-input> -->
|
|
|
|
|
<!-- <q-btn class="bg-grey-3" flat dense round>
|
|
|
|
|
<q-icon name="mdi-magnify" size="20px" color="grey-7" />
|
|
|
|
|
</q-btn>
|
|
|
|
|
-->
|
|
|
|
|
<!-- Notification -->
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-btn
|
|
|
|
|
round
|
|
|
|
|
dense
|
|
|
|
|
flat
|
|
|
|
|
size="13px"
|
|
|
|
|
class="q-mx-md bg-grey-3"
|
2024-01-19 10:20:07 +07:00
|
|
|
:color="totalNoti === 0 ? 'grey-6' : 'grey-8'"
|
2023-10-06 13:32:54 +07:00
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-icon name="mdi-bell" size="18px" color="grey-7" />
|
2024-01-19 11:22:41 +07:00
|
|
|
<q-badge
|
|
|
|
|
rounded
|
|
|
|
|
color="negative"
|
|
|
|
|
text-color="white"
|
|
|
|
|
floating
|
|
|
|
|
v-if="totalNoti !== 0"
|
|
|
|
|
>{{ totalNoti }}</q-badge
|
|
|
|
|
>
|
2024-01-22 10:31:53 +07:00
|
|
|
<q-menu v-model="notiTrigger" :offset="[0, 8]" style="width: 480px">
|
2024-01-19 15:24:40 +07:00
|
|
|
<div class="q-px-md q-py-sm row col-12 items-center">
|
2023-06-01 12:54:58 +07:00
|
|
|
<div class="text-subtitle1 text-weight-medium">การแจ้งเตือน</div>
|
2024-01-19 10:20:07 +07:00
|
|
|
<q-space />
|
2024-01-19 15:24:40 +07:00
|
|
|
<div class="text-grey-5" style="font-size: 12px">
|
|
|
|
|
ทั้งหมด {{ totalInbox }} ข้อความ
|
|
|
|
|
</div>
|
2023-06-01 12:54:58 +07:00
|
|
|
</div>
|
|
|
|
|
|
2024-01-22 10:31:53 +07:00
|
|
|
<q-infinite-scroll
|
|
|
|
|
@load="onLoad"
|
|
|
|
|
:offset="250"
|
|
|
|
|
v-if="statusLoad === false"
|
|
|
|
|
>
|
2024-01-19 16:10:58 +07:00
|
|
|
<div
|
|
|
|
|
v-for="(n, index) in notiList"
|
|
|
|
|
:key="index"
|
|
|
|
|
class="caption q-pa-xs"
|
|
|
|
|
>
|
2024-01-19 15:32:52 +07:00
|
|
|
<q-item
|
|
|
|
|
v-ripple
|
2024-01-19 16:10:58 +07:00
|
|
|
:class="
|
|
|
|
|
!n.isOpen ? 'mytry q-py-xs my-menu-link' : 'mytry q-py-xs'
|
|
|
|
|
"
|
2024-01-19 15:32:52 +07:00
|
|
|
dense
|
|
|
|
|
>
|
2024-01-17 17:43:19 +07:00
|
|
|
<q-item-section avatar top style="min-width: 40px">
|
|
|
|
|
<q-avatar color="primary" size="22px" text-color="white">
|
|
|
|
|
<span class="text-weight-medium text-uppercase">{{
|
2024-01-19 15:32:52 +07:00
|
|
|
n.body[0]
|
2024-01-17 17:43:19 +07:00
|
|
|
}}</span>
|
|
|
|
|
</q-avatar>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
<q-item-section>
|
|
|
|
|
<q-item-label caption class="text-black">{{
|
|
|
|
|
n.body
|
|
|
|
|
}}</q-item-label>
|
|
|
|
|
<q-item-label
|
|
|
|
|
caption
|
|
|
|
|
class="row items-center text-grey-7"
|
2024-01-19 10:20:07 +07:00
|
|
|
>{{ n.timereceive }}</q-item-label
|
2024-01-17 17:43:19 +07:00
|
|
|
>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
<q-btn
|
|
|
|
|
size="sm"
|
|
|
|
|
unelevated
|
|
|
|
|
dense
|
|
|
|
|
icon="mdi-close"
|
|
|
|
|
class="mybtn q-mx-xs"
|
2024-01-18 12:00:52 +07:00
|
|
|
@click="clickDelete(n.id, index)"
|
2024-01-17 17:43:19 +07:00
|
|
|
></q-btn>
|
|
|
|
|
</q-item>
|
2024-01-19 15:24:40 +07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<q-separator color="grey-2" />
|
|
|
|
|
|
2024-01-19 16:10:58 +07:00
|
|
|
<template
|
|
|
|
|
v-slot:loading
|
|
|
|
|
v-if="
|
|
|
|
|
notiList.length < totalInbox ||
|
|
|
|
|
(notiList.length === 0 && totalInbox === 0)
|
|
|
|
|
"
|
|
|
|
|
>
|
2024-01-17 17:43:19 +07:00
|
|
|
<div class="row justify-center q-my-md">
|
|
|
|
|
<q-spinner-dots color="primary" size="40px" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</q-infinite-scroll>
|
2024-01-22 10:31:53 +07:00
|
|
|
<div class="q-pa-md" v-else>
|
|
|
|
|
<q-banner rounded class="bg-amber-1 text-center">
|
|
|
|
|
<div class="text-yellow-10">
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-alert-box"
|
|
|
|
|
class="q-mx-xs"
|
|
|
|
|
size="sm"
|
|
|
|
|
color="yellow-10"
|
|
|
|
|
/>
|
|
|
|
|
ไมมีข้อมูล
|
|
|
|
|
</div>
|
|
|
|
|
</q-banner>
|
|
|
|
|
</div>
|
2023-06-01 12:54:58 +07:00
|
|
|
</q-menu>
|
|
|
|
|
</q-btn>
|
|
|
|
|
<div class="row items-center no-wrap">
|
|
|
|
|
<q-btn-dropdown size="md" dropdown-color="grey" flat>
|
|
|
|
|
<template v-slot:label>
|
|
|
|
|
<q-item v-close-popup class="q-pa-none">
|
|
|
|
|
<q-item-section :avatar="$q.screen.gt.xs">
|
|
|
|
|
<q-avatar color="grey-3">
|
|
|
|
|
<!-- <img src="https://cdn.quasar.dev/img/avatar.png" /> -->
|
|
|
|
|
<q-icon name="mdi-account" size="22px" color="grey-7" />
|
|
|
|
|
</q-avatar>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
<q-item-section class="text-left gt-xs">
|
|
|
|
|
<q-item-label class="text-caption text-weight-medium">{{
|
|
|
|
|
fullname
|
|
|
|
|
}}</q-item-label>
|
|
|
|
|
<!-- <q-item-label caption>เจ้าหน้าที่ ก.ก.</q-item-label> -->
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</template>
|
2023-10-06 13:32:54 +07:00
|
|
|
<div
|
|
|
|
|
class="row justify-center"
|
|
|
|
|
style="border-top: solid 3px #1bb19b !important; width: 273.797px"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<div class="column items-center col-12 q-py-md" color="grey-3">
|
|
|
|
|
<q-avatar size="72px" color="grey-4">
|
|
|
|
|
<q-icon name="mdi-account" color="grey-7" />
|
|
|
|
|
<!-- <img :src="require('@/assets/logo.png')" /> -->
|
|
|
|
|
</q-avatar>
|
|
|
|
|
<div class="text-subtitle2 q-mt-md q-mb-xs text-center">
|
|
|
|
|
{{ fullname }}
|
|
|
|
|
</div>
|
2023-10-10 14:32:19 +07:00
|
|
|
<div id="#logout">
|
|
|
|
|
<q-btn
|
|
|
|
|
color="primary"
|
|
|
|
|
label="ออกจากระบบ"
|
|
|
|
|
push
|
|
|
|
|
size="sm"
|
|
|
|
|
v-close-popup
|
|
|
|
|
@click="doLogout"
|
|
|
|
|
/><!-- -->
|
|
|
|
|
</div>
|
2023-10-16 13:28:48 +07:00
|
|
|
</div>
|
2023-06-01 12:54:58 +07:00
|
|
|
|
|
|
|
|
<div class="column col-12">
|
|
|
|
|
<q-separator />
|
|
|
|
|
<div class="column q-pb-md justify-center">
|
|
|
|
|
<div class="text-overline text-grey q-px-md q-pt-sm">
|
|
|
|
|
เลือกโหมด
|
|
|
|
|
</div>
|
|
|
|
|
<!-- <q-option-group v-model="group" :options="options" color="primary"/> -->
|
|
|
|
|
<q-list dense v-for="op in options" :key="op.label">
|
|
|
|
|
<q-item clickable>
|
|
|
|
|
<q-item-section avatar>
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-avatar
|
|
|
|
|
:color="op.color"
|
|
|
|
|
text-color="white"
|
|
|
|
|
:icon="op.icon"
|
|
|
|
|
size="20px"
|
|
|
|
|
font-size="12px"
|
|
|
|
|
/>
|
2023-06-01 12:54:58 +07:00
|
|
|
</q-item-section>
|
|
|
|
|
<q-item-section class="q-py-sm">{{
|
|
|
|
|
op.label
|
|
|
|
|
}}</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-btn-dropdown>
|
|
|
|
|
</div>
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-btn
|
|
|
|
|
size="13px"
|
|
|
|
|
class="bg-blue-1"
|
|
|
|
|
v-if="activeBtn() || activeBtnPlacement()"
|
|
|
|
|
flat
|
|
|
|
|
dense
|
|
|
|
|
round
|
|
|
|
|
@click="toggleBtnRight"
|
|
|
|
|
aria-label="Menu"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-icon name="mdi-menu" class="rotate-180" size="20px" color="blue" />
|
|
|
|
|
</q-btn>
|
|
|
|
|
</q-toolbar>
|
|
|
|
|
</q-header>
|
|
|
|
|
<!-- end header -->
|
|
|
|
|
|
|
|
|
|
<!-- drawer -->
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-drawer
|
|
|
|
|
side="left"
|
|
|
|
|
class="text-white"
|
|
|
|
|
style="background: #273238"
|
|
|
|
|
v-model="drawerL"
|
|
|
|
|
show-if-above
|
|
|
|
|
:width="260"
|
|
|
|
|
:breakpoint="1023"
|
|
|
|
|
:mini="miniState"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<!-- ส่วนของเมนู mini -->
|
|
|
|
|
<template v-slot:mini>
|
|
|
|
|
<q-scroll-area class="fit mini-slot cursor-pointer">
|
|
|
|
|
<q-toolbar class="q-py-md">
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-img
|
|
|
|
|
src="@/assets/logo.png"
|
|
|
|
|
spinner-color="white"
|
|
|
|
|
style="height: 32px; max-width: 32px"
|
|
|
|
|
/>
|
2023-06-01 12:54:58 +07:00
|
|
|
</q-toolbar>
|
|
|
|
|
<q-separator color="grey-9" />
|
|
|
|
|
<!-- เมนูย่อย ตอนย่อ -->
|
|
|
|
|
<q-list padding>
|
|
|
|
|
<div v-for="(menuItem, index) in menuList" :key="index">
|
|
|
|
|
<div v-if="role.includes(menuItem.role)">
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-item
|
|
|
|
|
clickable
|
|
|
|
|
v-ripple
|
|
|
|
|
:active="link === menuItem.label"
|
|
|
|
|
@click="link = menuItem.label"
|
2023-07-14 15:38:09 +07:00
|
|
|
active-class="text-primary menuActiveMini text-weight-medium"
|
2023-10-06 13:32:54 +07:00
|
|
|
v-if="
|
2024-04-19 13:58:58 +07:00
|
|
|
menuItem.key == 2 ||
|
|
|
|
|
menuItem.key == 0 ||
|
2023-10-06 13:32:54 +07:00
|
|
|
menuItem.key == 7 ||
|
|
|
|
|
menuItem.key == 8 ||
|
2023-10-16 13:28:48 +07:00
|
|
|
menuItem.key == 9 ||
|
2024-04-19 13:58:58 +07:00
|
|
|
menuItem.key == 10 ||
|
2024-03-12 16:33:01 +07:00
|
|
|
menuItem.key == 11 ||
|
2024-04-01 11:53:25 +07:00
|
|
|
menuItem.key == 12 ||
|
2024-04-19 13:58:58 +07:00
|
|
|
menuItem.key == 13 ||
|
|
|
|
|
menuItem.key == 14 ||
|
|
|
|
|
menuItem.key == 15 ||
|
|
|
|
|
menuItem.key == 16
|
2023-10-06 13:32:54 +07:00
|
|
|
"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<div class="row items-center no-wrap">
|
|
|
|
|
<q-icon :name="menuItem.icon" size="20px" class="q-ml-md" />
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-icon
|
|
|
|
|
name="mdi-dots-vertical"
|
|
|
|
|
size="13px"
|
|
|
|
|
color="grey-6"
|
|
|
|
|
/>
|
2023-06-01 12:54:58 +07:00
|
|
|
</div>
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-tooltip
|
|
|
|
|
anchor="center right"
|
|
|
|
|
self="center left"
|
|
|
|
|
:offset="[10, 10]"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
{{ menuItem.label }}
|
|
|
|
|
</q-tooltip>
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-menu
|
|
|
|
|
anchor="top right"
|
|
|
|
|
self="top left"
|
|
|
|
|
:offset="[5, 0]"
|
|
|
|
|
style="background: #273238; z-index: 9000"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-list class="text-white q-py-sm">
|
2023-10-06 13:32:54 +07:00
|
|
|
<div
|
|
|
|
|
v-for="(subMenu, i) in menuItem.children"
|
|
|
|
|
:key="i"
|
|
|
|
|
:to="{ name: `${subMenu.path}` }"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<!-- เมนูย่อย 2 ชั้น -->
|
2024-04-19 13:58:58 +07:00
|
|
|
<div
|
|
|
|
|
v-if="
|
|
|
|
|
menuItem.key == 2 ||
|
|
|
|
|
menuItem.key == 7 ||
|
|
|
|
|
menuItem.key == 12 ||
|
|
|
|
|
menuItem.key == 13
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<q-item
|
|
|
|
|
dense
|
|
|
|
|
clickable
|
|
|
|
|
v-if="
|
|
|
|
|
subMenu.key !== 2.0 &&
|
|
|
|
|
subMenu.key !== 7.1 &&
|
|
|
|
|
subMenu.key !== 12.0 &&
|
|
|
|
|
subMenu.key !== 13.0
|
|
|
|
|
"
|
|
|
|
|
>
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-item-section
|
|
|
|
|
>{{ subMenu.label }}
|
2023-06-01 12:54:58 +07:00
|
|
|
</q-item-section>
|
|
|
|
|
<q-item-section side>
|
|
|
|
|
<q-icon name="keyboard_arrow_right" />
|
|
|
|
|
</q-item-section>
|
|
|
|
|
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-menu
|
|
|
|
|
anchor="top end"
|
|
|
|
|
self="top start"
|
|
|
|
|
:offset="[5, 0]"
|
|
|
|
|
style="background: #273238; z-index: 9000"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-list class="text-white q-py-sm">
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-item
|
|
|
|
|
v-for="subMenu2 in subMenu.children"
|
|
|
|
|
:key="subMenu2.label"
|
|
|
|
|
:to="{ name: `${subMenu2.path}` }"
|
|
|
|
|
dense
|
|
|
|
|
class="q-pl-md text-body2"
|
|
|
|
|
active-class="text-primary active-item text-weight-medium"
|
|
|
|
|
clickable
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-item-section>
|
|
|
|
|
<q-item-label>{{
|
|
|
|
|
subMenu2.label
|
|
|
|
|
}}</q-item-label>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-menu>
|
|
|
|
|
</q-item>
|
|
|
|
|
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-item
|
|
|
|
|
v-else
|
|
|
|
|
dense
|
|
|
|
|
class="q-pl-md q-pr-xl text-body2"
|
|
|
|
|
active-class="text-primary active-item text-weight-medium"
|
|
|
|
|
clickable
|
|
|
|
|
:to="{ name: `${subMenu.path}` }"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-item-section>
|
|
|
|
|
<q-item-label>{{ subMenu.label }}</q-item-label>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- เมนูย่อย 1 ชั้น -->
|
|
|
|
|
<div v-else>
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-item
|
|
|
|
|
dense
|
|
|
|
|
class="q-pl-md q-pr-xl text-body2"
|
|
|
|
|
active-class="text-primary active-item text-weight-medium"
|
|
|
|
|
clickable
|
|
|
|
|
:to="{ name: `${subMenu.path}` }"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-item-section>
|
|
|
|
|
<q-item-label>{{ subMenu.label }}</q-item-label>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-menu>
|
|
|
|
|
</q-item>
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-item
|
|
|
|
|
clickable
|
|
|
|
|
v-ripple
|
|
|
|
|
:to="{ name: `${menuItem.path}` }"
|
|
|
|
|
:active="link === menuItem.label"
|
|
|
|
|
@click="link = menuItem.label"
|
|
|
|
|
active-class="text-primary menuActiveMini"
|
|
|
|
|
v-else
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-item-section avatar>
|
|
|
|
|
<q-avatar size="md" font-size="20px">
|
|
|
|
|
<q-icon :name="menuItem.icon" />
|
|
|
|
|
</q-avatar>
|
|
|
|
|
</q-item-section>
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-tooltip
|
|
|
|
|
anchor="center right"
|
|
|
|
|
self="center left"
|
|
|
|
|
:offset="[10, 10]"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
{{ menuItem.label }}
|
|
|
|
|
</q-tooltip>
|
|
|
|
|
</q-item>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-scroll-area>
|
|
|
|
|
</template>
|
|
|
|
|
<!-- จบส่วนของเมนู mini -->
|
|
|
|
|
|
|
|
|
|
<!-- ส่วนของเมนู -->
|
|
|
|
|
<q-scroll-area class="fit">
|
|
|
|
|
<q-toolbar class="q-py-md">
|
|
|
|
|
<q-toolbar-title shrink class="row items-center no-wrap">
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-img
|
|
|
|
|
src="@/assets/logo.png"
|
|
|
|
|
spinner-color="white"
|
|
|
|
|
style="height: 40px; max-width: 40px"
|
|
|
|
|
/>
|
2024-05-29 15:24:29 +07:00
|
|
|
<div class="row q-ml-sm">
|
2023-10-06 13:32:54 +07:00
|
|
|
<div
|
|
|
|
|
style="color: #ffffff; letter-spacing: 1px"
|
|
|
|
|
class="text-body2 text-weight-bolder"
|
|
|
|
|
>
|
2024-05-29 15:24:29 +07:00
|
|
|
ระบบ<span class="text-primary">บริหารทรัพยากรบุคคล</span>
|
2023-06-01 12:54:58 +07:00
|
|
|
</div>
|
2024-05-29 15:24:29 +07:00
|
|
|
<div class="text-caption text-white">ของกรุงเทพมหานคร</div>
|
2023-06-01 12:54:58 +07:00
|
|
|
</div>
|
|
|
|
|
</q-toolbar-title>
|
|
|
|
|
</q-toolbar>
|
|
|
|
|
<q-separator inset color="grey-9" />
|
|
|
|
|
<q-list padding>
|
|
|
|
|
<div v-for="(menuItem, index) in menuList" :key="index">
|
|
|
|
|
<!-- เมนูย่อย -->
|
|
|
|
|
<div v-if="role.includes(menuItem.role)">
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-expansion-item
|
|
|
|
|
group="somegroup"
|
|
|
|
|
class="menuSub"
|
|
|
|
|
expand-icon="mdi-chevron-down"
|
|
|
|
|
expanded-icon="mdi-chevron-up"
|
|
|
|
|
v-if="
|
2024-04-19 13:58:58 +07:00
|
|
|
menuItem.key == 2 ||
|
|
|
|
|
menuItem.key == 0 ||
|
2023-07-21 15:30:54 +07:00
|
|
|
menuItem.key == 7 ||
|
2023-10-06 13:32:54 +07:00
|
|
|
menuItem.key == 8 ||
|
2023-10-16 13:28:48 +07:00
|
|
|
menuItem.key == 9 ||
|
2024-04-19 13:58:58 +07:00
|
|
|
menuItem.key == 10 ||
|
2024-02-15 11:46:25 +07:00
|
|
|
menuItem.key == 11 ||
|
2024-04-01 11:53:25 +07:00
|
|
|
menuItem.key == 12 ||
|
2024-04-04 10:26:13 +07:00
|
|
|
menuItem.key == 13 ||
|
2024-04-19 13:58:58 +07:00
|
|
|
menuItem.key == 14 ||
|
|
|
|
|
menuItem.key == 15 ||
|
|
|
|
|
menuItem.key == 16
|
2023-10-06 13:32:54 +07:00
|
|
|
"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<template v-slot:header>
|
|
|
|
|
<q-item-section avatar>
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-avatar
|
|
|
|
|
:icon="menuItem.icon"
|
|
|
|
|
size="md"
|
|
|
|
|
font-size="20px"
|
|
|
|
|
/>
|
2023-06-01 12:54:58 +07:00
|
|
|
</q-item-section>
|
2023-07-17 10:38:48 +07:00
|
|
|
<q-item-section>{{ menuItem.label }}</q-item-section>
|
2023-06-01 12:54:58 +07:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<!-- เมนูย่อย 2 ชั้น (สรรหา) -->
|
2024-04-17 17:17:05 +07:00
|
|
|
<div
|
|
|
|
|
v-if="
|
2024-04-19 13:58:58 +07:00
|
|
|
menuItem.key == 2 ||
|
|
|
|
|
menuItem.key == 7 ||
|
|
|
|
|
menuItem.key == 12 ||
|
|
|
|
|
menuItem.key == 13
|
2024-04-17 17:17:05 +07:00
|
|
|
"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<div v-for="(subMenu, i) in menuItem.children" :key="i">
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-expansion-item
|
|
|
|
|
switch-toggle-side
|
|
|
|
|
dense-toggle
|
|
|
|
|
:label="subMenu.label"
|
2023-10-16 13:28:48 +07:00
|
|
|
v-if="
|
2024-04-19 13:58:58 +07:00
|
|
|
subMenu.key !== 2.0 &&
|
|
|
|
|
subMenu.key !== 7.1 &&
|
|
|
|
|
subMenu.key !== 12.0 &&
|
|
|
|
|
subMenu.key !== 13.0
|
2023-10-16 13:28:48 +07:00
|
|
|
"
|
2023-10-06 13:32:54 +07:00
|
|
|
class="expan2"
|
|
|
|
|
dense
|
|
|
|
|
>
|
|
|
|
|
<q-item
|
|
|
|
|
dense
|
|
|
|
|
class="menuSubHover"
|
|
|
|
|
active-class="text-primary active-item text-weight-bold menuSubAct"
|
|
|
|
|
clickable
|
|
|
|
|
v-for="subMenu2 in subMenu.children"
|
|
|
|
|
:key="subMenu2.key"
|
|
|
|
|
:to="{ name: `${subMenu2.path}` }"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-item-section>
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-item-label class="font-400 subLabel"
|
|
|
|
|
>{{ subMenu2.label }}
|
2023-07-17 10:38:48 +07:00
|
|
|
</q-item-label>
|
2023-06-01 12:54:58 +07:00
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-expansion-item>
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-item
|
|
|
|
|
v-else
|
|
|
|
|
dense
|
|
|
|
|
class="menuSubHover"
|
|
|
|
|
active-class="text-primary active-item text-weight-bold menuSubAct"
|
|
|
|
|
clickable
|
|
|
|
|
:to="{ name: `${subMenu.path}` }"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-item-section>
|
2023-10-16 13:28:48 +07:00
|
|
|
<q-item-label>{{ subMenu.label }} </q-item-label>
|
2023-06-01 12:54:58 +07:00
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- เมนูย่อย 1 ชั้น -->
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-item
|
|
|
|
|
v-else
|
|
|
|
|
dense
|
|
|
|
|
class="menuSubHover"
|
|
|
|
|
active-class="text-primary active-item text-weight-bold menuSubAct"
|
|
|
|
|
clickable
|
|
|
|
|
v-for="(subMenu, j) in menuItem.children"
|
|
|
|
|
:key="j"
|
|
|
|
|
:to="{ name: `${subMenu.path}` }"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-item-section>
|
2023-07-17 10:38:48 +07:00
|
|
|
<q-item-label class="font-400">{{
|
|
|
|
|
subMenu.label
|
|
|
|
|
}}</q-item-label>
|
2023-06-01 12:54:58 +07:00
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-expansion-item>
|
|
|
|
|
|
|
|
|
|
<!-- เมนูปกติ -->
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-item
|
|
|
|
|
class="text-weight-medium menu"
|
|
|
|
|
:active="activeMenu(menuItem.path)"
|
|
|
|
|
active-class="text-primary active-item text-weight-bold menuActive"
|
|
|
|
|
:to="{ name: `${menuItem.path}` }"
|
|
|
|
|
clickable
|
|
|
|
|
v-ripple
|
|
|
|
|
dense
|
|
|
|
|
exact
|
|
|
|
|
v-else
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-item-section avatar>
|
|
|
|
|
<q-avatar size="md" font-size="20px">
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-icon
|
|
|
|
|
:name="
|
|
|
|
|
menuItem.key === active
|
|
|
|
|
? menuItem.activeIcon
|
|
|
|
|
: menuItem.icon
|
|
|
|
|
"
|
|
|
|
|
/>
|
2023-06-01 12:54:58 +07:00
|
|
|
</q-avatar>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
|
|
|
|
|
<q-item-section>
|
|
|
|
|
<q-item-label>{{ menuItem.label }}</q-item-label>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-scroll-area>
|
|
|
|
|
</q-drawer>
|
|
|
|
|
|
|
|
|
|
<!-- drawer page registry/:id -->
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-drawer
|
|
|
|
|
side="right"
|
|
|
|
|
class="bg-grey-2"
|
|
|
|
|
show-if-above
|
|
|
|
|
v-if="tabScroll()"
|
|
|
|
|
v-model="drawerR"
|
|
|
|
|
:width="220"
|
|
|
|
|
:breakpoint="1023"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-scroll-area class="fit">
|
|
|
|
|
<q-list padding>
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-item
|
|
|
|
|
v-for="(tabItem, index) in tabList"
|
|
|
|
|
: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)"
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-item-section>
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-item-label
|
|
|
|
|
><q-icon size="11px" name="mdi-circle-medium" /><span
|
|
|
|
|
class="q-pl-xs"
|
|
|
|
|
>{{ tabItem.label }}</span
|
|
|
|
|
></q-item-label
|
|
|
|
|
>
|
2023-06-19 10:18:11 +07:00
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-scroll-area>
|
|
|
|
|
</q-drawer>
|
|
|
|
|
|
|
|
|
|
<!-- drawer page placement2/detail/:id -->
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-drawer
|
|
|
|
|
side="right"
|
|
|
|
|
class="bg-grey-2"
|
|
|
|
|
show-if-above
|
|
|
|
|
v-if="tabScrollPlacement()"
|
|
|
|
|
v-model="drawerR"
|
|
|
|
|
:width="220"
|
|
|
|
|
:breakpoint="1023"
|
|
|
|
|
>
|
2023-06-19 10:18:11 +07:00
|
|
|
<q-scroll-area class="fit">
|
|
|
|
|
<q-list padding>
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-item
|
|
|
|
|
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="activeTabPlacement(tabItem.tag)"
|
|
|
|
|
clickable
|
|
|
|
|
v-ripple
|
|
|
|
|
dense
|
|
|
|
|
exact
|
|
|
|
|
@click="tagClickPlacement(tabItem.tag)"
|
|
|
|
|
>
|
2023-06-19 10:18:11 +07:00
|
|
|
<q-item-section>
|
2023-10-06 13:32:54 +07:00
|
|
|
<q-item-label
|
|
|
|
|
><q-icon size="11px" name="mdi-circle-medium" /><span
|
|
|
|
|
class="q-pl-xs"
|
|
|
|
|
>{{ tabItem.label }}</span
|
|
|
|
|
></q-item-label
|
|
|
|
|
>
|
2023-06-01 12:54:58 +07:00
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-scroll-area>
|
|
|
|
|
</q-drawer>
|
|
|
|
|
<!-- drawer -->
|
|
|
|
|
|
|
|
|
|
<q-page-container class="bg-grey-2">
|
|
|
|
|
<q-page style="padding: 0 2%">
|
|
|
|
|
<router-view :key="$route.fullPath" />
|
|
|
|
|
</q-page>
|
|
|
|
|
</q-page-container>
|
|
|
|
|
<full-loader :visibility="loader" />
|
|
|
|
|
</q-layout>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style>
|
2024-01-19 10:20:07 +07:00
|
|
|
.my-menu-link {
|
|
|
|
|
background: #ebf9f7 !important;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
border: 1px solid #1bb19ab8;
|
|
|
|
|
color: #1bb19ab8 !important;
|
|
|
|
|
}
|
2023-07-07 15:29:37 +07:00
|
|
|
.menuSub .q-item__section--avatar,
|
|
|
|
|
.menu .q-item__section--avatar {
|
2023-06-27 13:43:38 +07:00
|
|
|
min-width: 0px;
|
|
|
|
|
}
|
2023-09-13 17:53:20 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
.menu {
|
|
|
|
|
padding-bottom: 5px;
|
|
|
|
|
padding-top: 5px;
|
|
|
|
|
border-radius: 0 100px 100px 0;
|
2023-06-27 13:43:38 +07:00
|
|
|
margin-right: 2%;
|
2023-06-01 12:54:58 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menuActive {
|
|
|
|
|
background: #212a2f;
|
|
|
|
|
border-radius: 0 100px 100px 0;
|
2023-06-27 13:43:38 +07:00
|
|
|
margin-right: 2%;
|
2023-06-01 12:54:58 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.menuActiveMini {
|
|
|
|
|
background: #212a2f;
|
|
|
|
|
}
|
2023-09-13 17:53:20 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
.menuSub .q-item {
|
|
|
|
|
border-radius: 0 100px 100px 0;
|
2023-06-27 13:43:38 +07:00
|
|
|
margin-right: 2%;
|
2023-07-17 10:38:48 +07:00
|
|
|
font-weight: 500;
|
2023-06-27 13:43:38 +07:00
|
|
|
}
|
2023-09-13 17:53:20 +07:00
|
|
|
|
2023-06-27 13:43:38 +07:00
|
|
|
.expan2 .q-item {
|
|
|
|
|
padding-left: 10%;
|
2023-06-01 12:54:58 +07:00
|
|
|
}
|
2023-09-13 17:53:20 +07:00
|
|
|
|
2023-07-21 15:30:54 +07:00
|
|
|
.subLabel {
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
width: 160px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
2023-07-21 13:57:47 +07:00
|
|
|
}
|
2023-09-13 17:53:20 +07:00
|
|
|
|
2023-07-17 10:38:48 +07:00
|
|
|
.font-400 {
|
|
|
|
|
font-weight: 400;
|
2023-07-14 13:22:49 +07:00
|
|
|
}
|
2023-09-13 17:53:20 +07:00
|
|
|
|
2023-07-07 15:29:37 +07:00
|
|
|
.expan2 .menuSubHover {
|
2023-06-01 12:54:58 +07:00
|
|
|
padding-left: 30%;
|
|
|
|
|
border-radius: 20px;
|
|
|
|
|
}
|
2023-09-13 17:53:20 +07:00
|
|
|
|
2023-07-07 15:29:37 +07:00
|
|
|
.menuSubHover {
|
2023-06-27 13:43:38 +07:00
|
|
|
padding-left: 25%;
|
|
|
|
|
border-radius: 20px;
|
|
|
|
|
}
|
2023-09-13 17:53:20 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
.menuSub .q-expansion-item__content {
|
|
|
|
|
background: #212a2f;
|
|
|
|
|
padding: 5px 0px;
|
|
|
|
|
margin-bottom: 5px;
|
|
|
|
|
}
|
2023-09-13 17:53:20 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
.tabNative {
|
|
|
|
|
color: grey;
|
|
|
|
|
padding-left: 8%;
|
|
|
|
|
border-radius: 100px 0px 0px 100px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tabActive {
|
|
|
|
|
padding-left: 8%;
|
|
|
|
|
background: #e4f2ff;
|
|
|
|
|
border-radius: 100px 0px 0px 100px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-card {
|
|
|
|
|
box-shadow: 3px 3px 20px -10px rgba(151, 150, 150, 0.261) !important;
|
|
|
|
|
}
|
2023-09-13 17:53:20 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
.q-card--bordered {
|
|
|
|
|
border: 1px solid #ededed;
|
|
|
|
|
box-shadow: none !important;
|
|
|
|
|
}
|
2023-09-13 17:53:20 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
.q-menu {
|
|
|
|
|
box-shadow: 3px 3px 10px 1px rgba(95, 95, 95, 0.15) !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.toptitle {
|
|
|
|
|
font-size: 1.2rem;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
margin-bottom: 1%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-field--outlined .q-field__control {
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-field--outlined .q-field__control:before {
|
|
|
|
|
border-color: #c8d3db;
|
|
|
|
|
}
|
2023-09-13 17:53:20 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
.btnManu {
|
|
|
|
|
min-height: 48px;
|
|
|
|
|
border-radius: 0px 100px 100px 0px;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-18 11:02:23 +07:00
|
|
|
/* .q-field--outlined .q-icon {
|
2023-06-01 12:54:58 +07:00
|
|
|
color: #7474747f;
|
|
|
|
|
}
|
2024-01-18 11:02:23 +07:00
|
|
|
*/
|
2023-07-19 10:46:40 +07:00
|
|
|
.q-card__actions .q-btn--rectangle {
|
|
|
|
|
padding: 0 14px !important;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
/* custom scrollbar */
|
|
|
|
|
::-webkit-scrollbar {
|
2023-07-19 10:46:40 +07:00
|
|
|
width: 12px;
|
|
|
|
|
height: 12px;
|
2023-06-01 12:54:58 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::-webkit-scrollbar-track {
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::-webkit-scrollbar-thumb {
|
|
|
|
|
background-color: #d6dee1;
|
|
|
|
|
border-radius: 20px;
|
2023-07-19 10:46:40 +07:00
|
|
|
border: 3px solid transparent;
|
2023-06-01 12:54:58 +07:00
|
|
|
background-clip: content-box;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::-webkit-scrollbar-thumb:hover {
|
|
|
|
|
background-color: #a8bbbf;
|
|
|
|
|
}
|
|
|
|
|
</style>
|