From 82a8fc155ab01d05c03b36ae08611620d497ae2e Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 12 Nov 2024 18:07:33 +0700 Subject: [PATCH 1/6] =?UTF-8?q?=E0=B8=95=E0=B9=89=E0=B8=99=E0=B9=81?= =?UTF-8?q?=E0=B8=9A=E0=B8=9A=20=E0=B8=AA=E0=B8=B3=E0=B8=AB=E0=B8=A3?= =?UTF-8?q?=E0=B8=B1=E0=B8=9A=E0=B8=A5=E0=B8=87=E0=B9=83=E0=B8=99=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?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/05_command/api.command.ts | 2 +- src/modules/05_command/views/salaryLists.vue | 2 ++ src/views/MainLayout.vue | 12 ++++++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/api/05_command/api.command.ts b/src/api/05_command/api.command.ts index d9c4e897..9857f070 100644 --- a/src/api/05_command/api.command.ts +++ b/src/api/05_command/api.command.ts @@ -13,6 +13,6 @@ export default { commandSysId: string, search: string ) => - `${commandSalary}/admin?page=${page}&pageSize=${pageSize}&isActive=${isActive}&commandSysId=${commandSysId}&search=${search}`, + `${commandSalary}/admin?page=${page}&pageSize=${pageSize}&isActive=${isActive}&commandSysId=${commandSysId}&searchKeyword=${search}`, commandSalaryById: (id: string) => `${commandSalary}/${id}`, }; diff --git a/src/modules/05_command/views/salaryLists.vue b/src/modules/05_command/views/salaryLists.vue index 6d11fd44..26b1748e 100644 --- a/src/modules/05_command/views/salaryLists.vue +++ b/src/modules/05_command/views/salaryLists.vue @@ -174,6 +174,8 @@ function onSubmit() { function selectInbox(data: CommandSysType) { activeOrderId.value = data.id; pagination.value.page = 1; + filter.value = ""; + fetchSalaryList(); } diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index 8f887f18..23f8570d 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -97,7 +97,7 @@ async function getDataNotification(index: number, type: string) { minute: "2-digit", }; await http - .get(config.API.msgNotificate + `?page=${index}&pageSize=${10}`) + .get(config.API.msgNotificate + `?page=${index}&pageSize=${15}`) .then((res) => { const response = res.data.result.data; totalInbox.value = res.data.result.total; @@ -286,9 +286,9 @@ function onLoad(index: any, done: Function) { (notiList.value.length === 0 && totalInbox.value === 0) ) { page.value++; - setTimeout(() => { + setTimeout(async () => { + await getDataNotification(page.value, "NOMAL"); done(); - getDataNotification(page.value, "NOMAL"); }, 1500); } } @@ -443,7 +443,11 @@ onUnmounted(() => { v-if="totalNoti !== 0" >{{ totalNoti }} - +
การแจ้งเตือน
From a987e7565fa2e5b1a55c148f70b21387fe948a07 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 13 Nov 2024 09:43:28 +0700 Subject: [PATCH 2/6] fix config --- tsconfig.config.json | 10 ++++++++-- vite.config.ts | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tsconfig.config.json b/tsconfig.config.json index 92f9cb6e..48ba8afb 100644 --- a/tsconfig.config.json +++ b/tsconfig.config.json @@ -1,10 +1,16 @@ { "extends": "@vue/tsconfig/tsconfig.node.json", - "include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "playwright.config.*"], + "include": [ + "vite.config.*", + "vitest.config.*", + "cypress.config.*", + "playwright.config.*" + ], "compilerOptions": { "composite": true, "types": ["node"], "ignoreDeprecations": "5.0", - "verbatimModuleSyntax": true + "verbatimModuleSyntax": true, + "module": "esnext" } } diff --git a/vite.config.ts b/vite.config.ts index 4ca2354a..b7e8a8b8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -27,4 +27,5 @@ export default defineConfig({ server: { port: 3005, }, + base: "./", }); From a20159475617a8dcabaa4428bfea9bbcb301a7cc Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Wed, 13 Nov 2024 11:02:08 +0700 Subject: [PATCH 3/6] updated send message to admin --- src/components/Dialogs/PopupReplyInbox.vue | 51 ++++++++++++---------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/src/components/Dialogs/PopupReplyInbox.vue b/src/components/Dialogs/PopupReplyInbox.vue index 37600e2b..e8daf23c 100644 --- a/src/components/Dialogs/PopupReplyInbox.vue +++ b/src/components/Dialogs/PopupReplyInbox.vue @@ -41,29 +41,34 @@ const body = ref(""); //ข้อความ * ยืนยันการจตอบกลับการส่งข้อความ */ function onSubmit() { - dialogConfirm($q, async () => { - showLoader(); - const pathAPI = - props.type === "Administrator" - ? config.API.msgNotiAdmin - : config.API.replyMessage(props.idInbox); - const method = props.type === "Administrator" ? http.post : http.put; + dialogConfirm( + $q, + async () => { + showLoader(); + const pathAPI = + props.type === "Administrator" + ? config.API.msgNotiAdmin + : config.API.replyMessage(props.idInbox); + const method = props.type === "Administrator" ? http.post : http.put; - await method(pathAPI, { - subject: subject.value, - body: body.value, - }) - .then(() => { - success($q, "ส่งข้อความสำเร็จ"); - onClose(); + await method(pathAPI, { + subject: subject.value, + body: body.value, }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); - }); + .then(() => { + success($q, "ส่งข้อความสำเร็จ"); + onClose(); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); + }, + "ยืนยันการส่งข้อความ", + "คุณต้องการส่งข้อความใช่หรือไม่?" + ); } function onClose() { @@ -91,7 +96,7 @@ function onClose() {
Date: Wed, 13 Nov 2024 14:37:05 +0700 Subject: [PATCH 4/6] fixing --- .../03_logs/components/DialogDataDiff.vue | 6 ++- src/modules/03_logs/components/LogTable.vue | 30 +++++++++--- .../03_logs/interface/response/Main.ts | 1 + src/plugins/generateTxt.ts | 49 +++++++++++++++++++ vite.config.ts | 1 - 5 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 src/plugins/generateTxt.ts diff --git a/src/modules/03_logs/components/DialogDataDiff.vue b/src/modules/03_logs/components/DialogDataDiff.vue index bf10dde1..4c1bbdeb 100644 --- a/src/modules/03_logs/components/DialogDataDiff.vue +++ b/src/modules/03_logs/components/DialogDataDiff.vue @@ -1,4 +1,6 @@ @@ -33,7 +35,7 @@ defineProps<{ color="blue" type="submit" icon="download" - @click="onSend" + @click="() => downloadTxt()" >ดาวน์โหลด (.TXT) diff --git a/src/modules/03_logs/components/LogTable.vue b/src/modules/03_logs/components/LogTable.vue index f2936ad7..9eec6833 100644 --- a/src/modules/03_logs/components/LogTable.vue +++ b/src/modules/03_logs/components/LogTable.vue @@ -22,12 +22,13 @@ import DialogDataDiff from "@/modules/03_logs/components/DialogDataDiff.vue"; const route = useRoute(); import type { ResLog } from "@/modules/03_logs/interface/response/Main"; +import generateTxt from "@/plugins/generateTxt"; /** use*/ const $q = useQuasar(); const storeData = useDataStore(); const { logData, size, searchAfter, systemName, date } = storeToRefs(storeData); -const { date2Thai, messageError, hideLoader,dateToISO } = useCounterMixin(); +const { date2Thai, messageError, hideLoader, dateToISO } = useCounterMixin(); const startTime = ref(null); // เวลาเริ่มต้น const endTime = ref(null); //เวลาสินสุด @@ -452,16 +453,31 @@ function onSendCSV() { params: queryString, }) .then((res) => { - const data = res.data - genReportXLSX(data,`LOG_${date2Thai(new Date(startDate.value))}`) + const data = res.data; + genReportXLSX(data, `LOG_${date2Thai(new Date(startDate.value))}`); }) .catch((e) => { messageError($q, e); }) .finally(() => {}); } -function onSend() { - console.log(1); + +function downloadTxt() { + const queryString = { + id: currentlogData.value?.id, + }; + http + .get(`${config.API.log}/report/logsDetail`, { + params: queryString, + }) + .then((res) => { + const data = res.data; + generateTxt(data, `LOG_${date2Thai(new Date(startDate.value))}`); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => {}); } onBeforeMount(async () => { @@ -872,6 +888,7 @@ onMounted(async () => { () => { currentDataDiff = col.value; currentlogData = { + id: props.row.id, startTimeStamp: props.row.startTimeStamp, username: props.row.userName, host: props.row.host, @@ -911,7 +928,7 @@ onMounted(async () => { { + const data = res.data; + if (data) { + // สร้าง Blob จาก array buffer + const blob = new Blob([data], { type: "text/plain;charset=utf-8" }); + + // สร้าง URL สำหรับไฟล์ Blob + const url = URL.createObjectURL(blob); + + // สร้างลิงก์เพื่อดาวน์โหลดไฟล์ + const link = document.createElement("a"); + link.href = url; + link.download = `${fileName}.txt`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด + document.body.appendChild(link); + link.click(); + + // ลบ URL ที่สร้างขึ้นหลังจากใช้งาน + URL.revokeObjectURL(url); + } + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); +} + +export default generateTxt; diff --git a/vite.config.ts b/vite.config.ts index b7e8a8b8..4ca2354a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -27,5 +27,4 @@ export default defineConfig({ server: { port: 3005, }, - base: "./", }); From 355f7f58c796d9c4d06ffb8ba7a6111e17ca323d Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 13 Nov 2024 15:37:59 +0700 Subject: [PATCH 5/6] log logout --- src/api/02_organizational/api.organization.ts | 2 +- src/views/MainLayout.vue | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index 39c453eb..c9c1c79f 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -103,5 +103,5 @@ export default { /** View Work Flow*/ viewWorkflow: `${organization}/view-workflow`, - + keycloakLogSSO: `${organization}/keycloak/log/sso`, }; diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index 23f8570d..c4af8a47 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -237,7 +237,8 @@ function doLogout() { dialogConfirm( $q, async () => { - logout(); + await http.post(config.API.keycloakLogSSO, { text: "ออกจากระบบ" }); + await logout(); }, "ยืนยันการออกจากระบบ", "ต้องการออกจากระบบใช่หรือไม่?" From 9f50a73758ae30eb8766acaa5c858e0d9061537a Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Wed, 13 Nov 2024 16:05:17 +0700 Subject: [PATCH 6/6] fixing bug --- src/modules/02_users/components/Users/DialogFormUser.vue | 2 +- src/modules/03_logs/views/mainView.vue | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/02_users/components/Users/DialogFormUser.vue b/src/modules/02_users/components/Users/DialogFormUser.vue index 763a00d9..dd2b580d 100644 --- a/src/modules/02_users/components/Users/DialogFormUser.vue +++ b/src/modules/02_users/components/Users/DialogFormUser.vue @@ -440,7 +440,6 @@ watch(
diff --git a/src/modules/03_logs/views/mainView.vue b/src/modules/03_logs/views/mainView.vue index ecf012de..93817b75 100644 --- a/src/modules/03_logs/views/mainView.vue +++ b/src/modules/03_logs/views/mainView.vue @@ -105,6 +105,7 @@ const menuList = ref<{ icon: string; label: string; path: string }[]>([ ]); onMounted(async () => { + storeData.logData = await []; // await storeData.fetchLog({ // size: size.value, // systemName: systemName.value ?? undefined,