From 7d452e9c0da88f277e940698bdf4c3487c955a9f Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Mon, 24 Mar 2025 16:42:24 +0700 Subject: [PATCH 1/7] =?UTF-8?q?=E0=B8=AA=E0=B8=B4=E0=B8=97=E0=B8=98?= =?UTF-8?q?=E0=B8=B4=E0=B9=8C=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B8=A1=E0=B8=B9=E0=B8=A5=E0=B8=97?= =?UTF-8?q?=E0=B8=B0=E0=B9=80=E0=B8=9A=E0=B8=B5=E0=B8=A2=E0=B8=99=E0=B8=9B?= =?UTF-8?q?=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4=E0=B8=95?= =?UTF-8?q?=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88=E0=B8=87/?= =?UTF-8?q?=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99=E0=B9=80=E0=B8=94=E0=B8=B7?= =?UTF-8?q?=E0=B8=AD=E0=B8=99=20=E0=B8=A3=E0=B8=AD=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/interface/request/main/main.ts | 6 + .../RolePositionSalary/DialogAddPerson.vue | 321 ++++++++++ src/modules/02_users/interface/index/Main.ts | 1 + src/modules/02_users/router.ts | 12 + .../02_users/views/06_rolePositionSalary.vue | 546 ++++++++++++++++++ 5 files changed, 886 insertions(+) create mode 100644 src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue create mode 100644 src/modules/02_users/views/06_rolePositionSalary.vue diff --git a/src/interface/request/main/main.ts b/src/interface/request/main/main.ts index 93b3d0b2..7e0ab73d 100644 --- a/src/interface/request/main/main.ts +++ b/src/interface/request/main/main.ts @@ -128,6 +128,12 @@ const menuList = readonly([ path: "responsibilities", role: ["SUPER_ADMIN", "ADMIN"], }, + { + key: 2.0, + label: "ทะเบียนประวัติตำแหน่ง/เงินเดือน", + path: "rolePositionSalary", + role: ["SUPER_ADMIN", "ADMIN"], + }, ], }, { diff --git a/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue b/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue new file mode 100644 index 00000000..7984fecf --- /dev/null +++ b/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue @@ -0,0 +1,321 @@ + + + + + diff --git a/src/modules/02_users/interface/index/Main.ts b/src/modules/02_users/interface/index/Main.ts index fa7cfeba..3e7e4f47 100644 --- a/src/modules/02_users/interface/index/Main.ts +++ b/src/modules/02_users/interface/index/Main.ts @@ -58,6 +58,7 @@ interface DataTree { createdFullName: string; createdUserId: string; id: string | null; + orgTreeId?: string | null; lastUpdateFullName: string; lastUpdateUserId: string; lastUpdatedAt: string; diff --git a/src/modules/02_users/router.ts b/src/modules/02_users/router.ts index 1c7fbc2d..958a2b80 100644 --- a/src/modules/02_users/router.ts +++ b/src/modules/02_users/router.ts @@ -21,6 +21,10 @@ const roleOrgview = () => const responsIbilitiesView = () => import("@/modules/02_users/views/05_responsIbilities.vue"); +/** roleOrganization */ +const rolePositionSalary = () => + import("@/modules/02_users/views/06_rolePositionSalary.vue"); + export default [ { path: "/users", @@ -73,6 +77,14 @@ export default [ Role: ["SUPER_ADMIN", "ADMIN"], }, }, + { + path: "/roles-position-salary", + name: "rolePositionSalary", + component: rolePositionSalary, + meta: { + Role: ["SUPER_ADMIN", "ADMIN"], + }, + }, { path: "/responsibilities", diff --git a/src/modules/02_users/views/06_rolePositionSalary.vue b/src/modules/02_users/views/06_rolePositionSalary.vue new file mode 100644 index 00000000..b00b8b51 --- /dev/null +++ b/src/modules/02_users/views/06_rolePositionSalary.vue @@ -0,0 +1,546 @@ + + + + + From 46f312f0f10f5e0e0f6549f3f3c21e77c16afbd2 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 26 Mar 2025 11:47:37 +0700 Subject: [PATCH 2/7] =?UTF-8?q?=E0=B8=AA=E0=B8=B4=E0=B8=97=E0=B8=98?= =?UTF-8?q?=E0=B8=B4=E0=B9=8C=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B8=A1=E0=B8=B9=E0=B8=A5=E0=B8=97?= =?UTF-8?q?=E0=B8=B0=E0=B9=80=E0=B8=9A=E0=B8=B5=E0=B8=A2=E0=B8=99=E0=B8=9B?= =?UTF-8?q?=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4=E0=B8=95?= =?UTF-8?q?=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88=E0=B8=87/?= =?UTF-8?q?=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99=E0=B9=80=E0=B8=94=E0=B8=B7?= =?UTF-8?q?=E0=B8=AD=E0=B8=99=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/02_organizational/api.organization.ts | 2 ++ .../components/RolePositionSalary/DialogAddPerson.vue | 6 ++++-- src/modules/02_users/views/06_rolePositionSalary.vue | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index 80a976f5..93d2241c 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -101,7 +101,9 @@ export default { /** กำหนดสิทธิ์จัดการโครงสร้าง */ permissionOrg: `${organization}/permission-org`, + permissioProfileOrg: `${organization}/permission-profile`, permissionOrgProfile: `${organization}/permission-org/profile`, // คนที่มีสิทธิ์จัดการโครงสร้าง + permissionProfile: `${organization}/permission-profile/profile`, // คนที่มีสิทธิ์จัดการโครงสร้าง /** หมอบหมาย*/ commandSysAssign: `${organization}/commandSys/assign`, diff --git a/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue b/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue index 7984fecf..4a00cbf0 100644 --- a/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue +++ b/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue @@ -96,7 +96,7 @@ async function onSearchListPerson(newPage: boolean = false) { selected.value = []; showLoader(); await http - .get(config.API.permissionOrgProfile, { + .get(config.API.permissionProfile, { params: qurey, }) .then((res) => { @@ -131,7 +131,7 @@ function onSubmitPerson() { personId: arrayId, }; await http - .post(config.API.permissionOrg, body) + .post(config.API.permissioProfileOrg, body) .then(async () => { await props.fetchData?.(false); success($q, "เพิ่มราชชื่อสำเร็จ"); @@ -170,6 +170,8 @@ function onClose() { qurey.searchKeyword = ""; rows.value = []; selected.value = []; + isEdit.value = false; + isCheck.value = false; } /** diff --git a/src/modules/02_users/views/06_rolePositionSalary.vue b/src/modules/02_users/views/06_rolePositionSalary.vue index b00b8b51..236a3122 100644 --- a/src/modules/02_users/views/06_rolePositionSalary.vue +++ b/src/modules/02_users/views/06_rolePositionSalary.vue @@ -192,7 +192,7 @@ async function fetchListPerson(newPage: boolean = false) { qureyBody.page = newPage ? 1 : qureyBody.page; showLoader(); await http - .post(config.API.permissionOrgProfile, qureyBody) + .post(config.API.permissionProfile, qureyBody) .then(async (res) => { const data = await res.data.result; maxPage.value = Math.ceil(data.total / qureyBody.pageSize); // คำนวนหาจำนวนหน้า @@ -216,7 +216,7 @@ function onDeletePerson(id: string) { dialogRemove($q, async () => { showLoader(); await http - .delete(config.API.permissionOrg + `/${id}`) + .delete(config.API.permissioProfileOrg + `/${id}`) .then(async () => { // ถ้า maxPage.value ไม่เท่ากับ 1 ให้ โหลดข้อมูลรายชื่อคนที่มีสิทธิ์จัดการโครงสร้างหน้าปัจจุบัน if (maxPage.value !== 1) { From 3d16eeedceb18a34b3b3a4828767d382c7a37b94 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 26 Mar 2025 16:29:37 +0700 Subject: [PATCH 3/7] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/02_users/views/06_rolePositionSalary.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/02_users/views/06_rolePositionSalary.vue b/src/modules/02_users/views/06_rolePositionSalary.vue index 236a3122..44e9321d 100644 --- a/src/modules/02_users/views/06_rolePositionSalary.vue +++ b/src/modules/02_users/views/06_rolePositionSalary.vue @@ -470,7 +470,7 @@ onMounted(async () => {
{
Date: Wed, 26 Mar 2025 16:33:53 +0700 Subject: [PATCH 4/7] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88?= =?UTF-8?q?=E0=B8=A1=E0=B9=80=E0=B9=80=E0=B8=88=E0=B9=89=E0=B8=87=E0=B9=80?= =?UTF-8?q?=E0=B8=95=E0=B8=B7=E0=B8=AD=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RolePositionSalary/DialogAddPerson.vue | 68 +++++++++++-------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue b/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue index 4a00cbf0..c7d911fb 100644 --- a/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue +++ b/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue @@ -17,8 +17,14 @@ import DialogHeader from "@/components/DialogHeader.vue"; const $q = useQuasar(); const store = useDataStoreUser(); -const { showLoader, hideLoader, messageError, success, dialogConfirm } = - useCounterMixin(); +const { + showLoader, + hideLoader, + messageError, + success, + dialogConfirm, + dialogMessageNotify, +} = useCounterMixin(); const modal = defineModel("modal", { required: true }); const orgId = defineModel("orgId", { required: true }); @@ -120,33 +126,37 @@ async function onSearchListPerson(newPage: boolean = false) { */ function onSubmitPerson() { const arrayId = selected.value.map((e: DataProfile) => e.id); - dialogConfirm( - $q, - async () => { - showLoader(); - const body = { - nodeId: orgId.value, - isEdit: isEdit.value, - isCheck: isCheck.value, - personId: arrayId, - }; - await http - .post(config.API.permissioProfileOrg, body) - .then(async () => { - await props.fetchData?.(false); - success($q, "เพิ่มราชชื่อสำเร็จ"); - onClose(); - }) - .catch((err) => { - messageError($q, err); - }) - .finally(() => { - hideLoader(); - }); - }, - "ยืนยันการเพิ่มรายชื่อ", - "ต้องการยืนยันการเพิ่มรายชื่อนี้หรือไม่ ?" - ); + if (isEdit.value == false && isCheck.value == false) { + dialogMessageNotify($q, "กรุณาเลือกสิทธิ์อย่างน้อย 1 สิทธิ์"); + } else { + dialogConfirm( + $q, + async () => { + showLoader(); + const body = { + nodeId: orgId.value, + isEdit: isEdit.value, + isCheck: isCheck.value, + personId: arrayId, + }; + await http + .post(config.API.permissioProfileOrg, body) + .then(async () => { + await props.fetchData?.(false); + success($q, "เพิ่มราชชื่อสำเร็จ"); + onClose(); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); + }, + "ยืนยันการเพิ่มรายชื่อ", + "ต้องการยืนยันการเพิ่มรายชื่อนี้หรือไม่ ?" + ); + } } /** From 367a249bf3c18a6fe0cc8ec816f2994d08efad55 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 26 Mar 2025 16:47:23 +0700 Subject: [PATCH 5/7] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=84?= =?UTF-8?q?=E0=B8=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../02_users/components/RolePositionSalary/DialogAddPerson.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue b/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue index c7d911fb..f57464ab 100644 --- a/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue +++ b/src/modules/02_users/components/RolePositionSalary/DialogAddPerson.vue @@ -143,7 +143,7 @@ function onSubmitPerson() { .post(config.API.permissioProfileOrg, body) .then(async () => { await props.fetchData?.(false); - success($q, "เพิ่มราชชื่อสำเร็จ"); + success($q, "เพิ่มรายชื่อสำเร็จ"); onClose(); }) .catch((err) => { From f3cc448795cbe4bfa718930079cbbda913c4c652 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 26 Mar 2025 16:48:26 +0700 Subject: [PATCH 6/7] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=84?= =?UTF-8?q?=E0=B8=B3=20=E0=B8=81=E0=B8=B3=E0=B8=AB=E0=B8=99=E0=B8=94?= =?UTF-8?q?=E0=B8=AB=E0=B8=99=E0=B9=89=E0=B8=B2=E0=B8=97=E0=B8=B5=E0=B9=88?= =?UTF-8?q?=E0=B8=88=E0=B8=B1=E0=B8=94=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B9=82?= =?UTF-8?q?=E0=B8=84=E0=B8=A3=E0=B8=87=E0=B8=AA=E0=B8=A3=E0=B9=89=E0=B8=B2?= =?UTF-8?q?=E0=B8=87=20(=E0=B9=81=E0=B8=9A=E0=B8=9A=E0=B8=A3=E0=B9=88?= =?UTF-8?q?=E0=B8=B2=E0=B8=87)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../02_users/components/RoleOrganization/DialogAddPerson.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/02_users/components/RoleOrganization/DialogAddPerson.vue b/src/modules/02_users/components/RoleOrganization/DialogAddPerson.vue index c11273ab..1b2f0da3 100644 --- a/src/modules/02_users/components/RoleOrganization/DialogAddPerson.vue +++ b/src/modules/02_users/components/RoleOrganization/DialogAddPerson.vue @@ -130,7 +130,7 @@ function onSubmitPerson() { .post(config.API.permissionOrg, body) .then(async () => { await props.fetchData?.(false); - success($q, "เพิ่มราชชื่อสำเร็จ"); + success($q, "เพิ่มรายชื่อสำเร็จ"); onClose(); }) .catch((err) => { From 55756ef9c30c7538e8c11f80f3fc04648c4ba987 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 27 Mar 2025 16:54:04 +0700 Subject: [PATCH 7/7] cookie sso --- src/plugins/auth.ts | 5 +++-- src/views/MainLayout.vue | 8 ++++++-- src/views/auth.vue | 2 +- src/views/login.vue | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/plugins/auth.ts b/src/plugins/auth.ts index d8f0e94f..9d95e775 100644 --- a/src/plugins/auth.ts +++ b/src/plugins/auth.ts @@ -10,8 +10,9 @@ interface AuthResponse { const authenticated = async () => ((await getToken()) ? true : false); -async function setAuthen(r: AuthResponse) { +async function setAuthen(r: AuthResponse, val: string) { await setCookie(ACCESS_TOKEN, r.access_token, r.expires_in); + setCookie("SSO", val, r.expires_in); window.location.href = "/"; } @@ -70,4 +71,4 @@ async function tokenParsed() { return JSON.parse(jsonPayload); } -export { getToken, authenticated, logout, setAuthen, tokenParsed }; +export { getToken, authenticated, logout, setAuthen, tokenParsed, getCookie }; diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index f22ca37c..87386a4a 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -6,7 +6,7 @@ import { useQuasar } from "quasar"; import { useRoute } from "vue-router"; import config from "@/app.config"; import http from "@/plugins/http"; -import { logout, tokenParsed } from "@/plugins/auth"; +import { logout, tokenParsed, getCookie } from "@/plugins/auth"; import checkPermission from "@/plugins/checkPermission"; import { useCounterMixin } from "@/stores/mixin"; import { useDataStore } from "@/stores/data"; @@ -372,6 +372,8 @@ watch( } ); +const isSsoToken = ref(false); + /** * ฮุกนี้จะถูกเรียกก่อนที่คอมโพเนนต์จะถูก onMounted * กำหนดบทบาทและชื่อผู้ใช้งานจาก Keycloak @@ -381,6 +383,8 @@ onBeforeMount(async () => { // ดิงชื่อผู้ใช้งานจาก keycloak const tokenParsedData: any = await tokenParsed(); + const SSO_TOKEN = await getCookie("SSO"); + isSsoToken.value = SSO_TOKEN === "y" ? true : false; if (tokenParsedData != null) { fullname.value = tokenParsedData.name; role.value = tokenParsedData.role; @@ -623,7 +627,7 @@ onUnmounted(() => {
--> - + { expires_in: route.query.expires ? route.query.expires : 36000, refresh_token: route.query.accessToken, }; - setAuthen(params); + setAuthen(params, "y"); } }); diff --git a/src/views/login.vue b/src/views/login.vue index 8e5e8548..06fe7bc2 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -36,7 +36,7 @@ async function onSubmit() { }, }) .then((res) => { - setAuthen(res.data.result); + setAuthen(res.data.result, "n"); }) .catch((err) => { $q.dialog({