Merge branch 'develop' into setthawut

This commit is contained in:
setthawutttty 2024-11-14 15:41:31 +07:00
commit d5a4541830
12 changed files with 130 additions and 41 deletions

View file

@ -103,5 +103,5 @@ export default {
/** View Work Flow*/ /** View Work Flow*/
viewWorkflow: `${organization}/view-workflow`, viewWorkflow: `${organization}/view-workflow`,
keycloakLogSSO: `${organization}/keycloak/log/sso`,
}; };

View file

@ -13,6 +13,6 @@ export default {
commandSysId: string, commandSysId: string,
search: 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}`, commandSalaryById: (id: string) => `${commandSalary}/${id}`,
}; };

View file

@ -41,29 +41,34 @@ const body = ref<string>(""); //ข้อความ
* นยนการจตอบกลบการสงขอความ * นยนการจตอบกลบการสงขอความ
*/ */
function onSubmit() { function onSubmit() {
dialogConfirm($q, async () => { dialogConfirm(
showLoader(); $q,
const pathAPI = async () => {
props.type === "Administrator" showLoader();
? config.API.msgNotiAdmin const pathAPI =
: config.API.replyMessage(props.idInbox); props.type === "Administrator"
const method = props.type === "Administrator" ? http.post : http.put; ? config.API.msgNotiAdmin
: config.API.replyMessage(props.idInbox);
const method = props.type === "Administrator" ? http.post : http.put;
await method(pathAPI, { await method(pathAPI, {
subject: subject.value, subject: subject.value,
body: body.value, body: body.value,
})
.then(() => {
success($q, "ส่งข้อความสำเร็จ");
onClose();
}) })
.catch((e) => { .then(() => {
messageError($q, e); success($q, "ส่งข้อความสำเร็จ");
}) onClose();
.finally(() => { })
hideLoader(); .catch((e) => {
}); messageError($q, e);
}); })
.finally(() => {
hideLoader();
});
},
"ยืนยันการส่งข้อความ",
"คุณต้องการส่งข้อความใช่หรือไม่?"
);
} }
function onClose() { function onClose() {
@ -91,7 +96,7 @@ function onClose() {
<div class="col-xs-12"> <div class="col-xs-12">
<div class="col-12 row q-py-sm items-center q-col-gutter-sm"> <div class="col-12 row q-py-sm items-center q-col-gutter-sm">
<q-input <q-input
class="full-width inputgreen cursor-pointer" class="full-width inputgreen cursor-pointer bg-white"
hide-bottom-space hide-bottom-space
outlined outlined
dense dense
@ -103,7 +108,7 @@ function onClose() {
<q-input <q-input
type="textarea" type="textarea"
class="full-width inputgreen cursor-pointer" class="full-width inputgreen cursor-pointer bg-white"
hide-bottom-space hide-bottom-space
outlined outlined
dense dense

View file

@ -440,7 +440,6 @@ watch(
<div class="row q-col-gutter-md"> <div class="row q-col-gutter-md">
<div class="col-12"> <div class="col-12">
<q-input <q-input
:readonly="isStatusEdit"
v-model="formData.username" v-model="formData.username"
outlined outlined
dense dense
@ -449,6 +448,7 @@ watch(
hide-bottom-space hide-bottom-space
class="inputgreen" class="inputgreen"
label="ชื่อผู้ใช้งาน" label="ชื่อผู้ใช้งาน"
readonly
> >
</q-input> </q-input>
</div> </div>

View file

@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import http from "@/plugins/http";
import config from "@/app.config";
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
const openDialog = defineModel<boolean>("openDialog", { const openDialog = defineModel<boolean>("openDialog", {
@ -9,7 +11,7 @@ const openDialog = defineModel<boolean>("openDialog", {
defineProps<{ defineProps<{
title: string; title: string;
close?: (...args: unknown[]) => void; close?: (...args: unknown[]) => void;
onSend: Function; downloadTxt: Function;
}>(); }>();
</script> </script>
@ -33,7 +35,7 @@ defineProps<{
color="blue" color="blue"
type="submit" type="submit"
icon="download" icon="download"
@click="onSend" @click="() => downloadTxt()"
><q-tooltip>ดาวนโหลด (.TXT)</q-tooltip></q-btn ><q-tooltip>ดาวนโหลด (.TXT)</q-tooltip></q-btn
> >
</q-card-actions> </q-card-actions>

View file

@ -22,12 +22,13 @@ import DialogDataDiff from "@/modules/03_logs/components/DialogDataDiff.vue";
const route = useRoute(); const route = useRoute();
import type { ResLog } from "@/modules/03_logs/interface/response/Main"; import type { ResLog } from "@/modules/03_logs/interface/response/Main";
import generateTxt from "@/plugins/generateTxt";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
const storeData = useDataStore(); const storeData = useDataStore();
const { logData, size, searchAfter, systemName, date } = storeToRefs(storeData); const { logData, size, searchAfter, systemName, date } = storeToRefs(storeData);
const { date2Thai, messageError, hideLoader,dateToISO } = useCounterMixin(); const { date2Thai, messageError, hideLoader, dateToISO } = useCounterMixin();
const startTime = ref<Date | null>(null); // const startTime = ref<Date | null>(null); //
const endTime = ref<Date | null>(null); // const endTime = ref<Date | null>(null); //
@ -452,16 +453,31 @@ function onSendCSV() {
params: queryString, params: queryString,
}) })
.then((res) => { .then((res) => {
const data = res.data const data = res.data;
genReportXLSX(data,`LOG_${date2Thai(new Date(startDate.value))}`) genReportXLSX(data, `LOG_${date2Thai(new Date(startDate.value))}`);
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
}) })
.finally(() => {}); .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 () => { onBeforeMount(async () => {
@ -872,6 +888,7 @@ onMounted(async () => {
() => { () => {
currentDataDiff = col.value; currentDataDiff = col.value;
currentlogData = { currentlogData = {
id: props.row.id,
startTimeStamp: props.row.startTimeStamp, startTimeStamp: props.row.startTimeStamp,
username: props.row.userName, username: props.row.userName,
host: props.row.host, host: props.row.host,
@ -911,7 +928,7 @@ onMounted(async () => {
<DialogDataDiff <DialogDataDiff
v-model:open-dialog="openDialog" v-model:open-dialog="openDialog"
title="รายละเอียดข้อมูล" title="รายละเอียดข้อมูล"
:onSend="onSend" :downloadTxt="downloadTxt"
:close=" :close="
() => { () => {
openDialog = false; openDialog = false;
@ -940,6 +957,7 @@ onMounted(async () => {
> >
{{ {{
{ {
id: "ID",
startTimeStamp: "เวลา", startTimeStamp: "เวลา",
username: "ผู้ใช้", username: "ผู้ใช้",
host: "Host", host: "Host",

View file

@ -12,6 +12,7 @@ interface ResRound {
} }
interface ResLog { interface ResLog {
id: string;
endTimeStamp: Date; endTimeStamp: Date;
dataDiff?: { dataDiff?: {
// //

View file

@ -105,6 +105,7 @@ const menuList = ref<{ icon: string; label: string; path: string }[]>([
]); ]);
onMounted(async () => { onMounted(async () => {
storeData.logData = await [];
// await storeData.fetchLog({ // await storeData.fetchLog({
// size: size.value, // size: size.value,
// systemName: systemName.value ?? undefined, // systemName: systemName.value ?? undefined,

View file

@ -174,6 +174,8 @@ function onSubmit() {
function selectInbox(data: CommandSysType) { function selectInbox(data: CommandSysType) {
activeOrderId.value = data.id; activeOrderId.value = data.id;
pagination.value.page = 1; pagination.value.page = 1;
filter.value = "";
fetchSalaryList(); fetchSalaryList();
} }

View file

@ -0,0 +1,49 @@
import axios from "axios";
import config from "@/app.config";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError } = mixin;
async function generateTxt(data: any, fileName: string) {
showLoader();
await axios
.post(`${config.API.reportTemplate}/txt`, data, {
headers: {
"Content-Type": "text/plain;charset=utf-8",
},
responseType: "blob",
})
.then((res) => {
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;

View file

@ -97,7 +97,7 @@ async function getDataNotification(index: number, type: string) {
minute: "2-digit", minute: "2-digit",
}; };
await http await http
.get(config.API.msgNotificate + `?page=${index}&pageSize=${10}`) .get(config.API.msgNotificate + `?page=${index}&pageSize=${15}`)
.then((res) => { .then((res) => {
const response = res.data.result.data; const response = res.data.result.data;
totalInbox.value = res.data.result.total; totalInbox.value = res.data.result.total;
@ -237,7 +237,8 @@ function doLogout() {
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
logout(); await http.post(config.API.keycloakLogSSO, { text: "ออกจากระบบ" });
await logout();
}, },
"ยืนยันการออกจากระบบ", "ยืนยันการออกจากระบบ",
"ต้องการออกจากระบบใช่หรือไม่?" "ต้องการออกจากระบบใช่หรือไม่?"
@ -286,9 +287,9 @@ function onLoad(index: any, done: Function) {
(notiList.value.length === 0 && totalInbox.value === 0) (notiList.value.length === 0 && totalInbox.value === 0)
) { ) {
page.value++; page.value++;
setTimeout(() => { setTimeout(async () => {
await getDataNotification(page.value, "NOMAL");
done(); done();
getDataNotification(page.value, "NOMAL");
}, 1500); }, 1500);
} }
} }
@ -443,7 +444,11 @@ onUnmounted(() => {
v-if="totalNoti !== 0" v-if="totalNoti !== 0"
>{{ totalNoti }}</q-badge >{{ totalNoti }}</q-badge
> >
<q-menu v-model="notiTrigger" :offset="[0, 8]" style="width: 480px"> <q-menu
v-model="notiTrigger"
:offset="[0, 8]"
style="width: 480px; height: 60vh"
>
<div class="q-px-md q-py-sm row col-12 items-center"> <div class="q-px-md q-py-sm row col-12 items-center">
<div class="text-subtitle1 text-weight-medium">การแจงเตอน</div> <div class="text-subtitle1 text-weight-medium">การแจงเตอน</div>
<q-space /> <q-space />

View file

@ -1,10 +1,16 @@
{ {
"extends": "@vue/tsconfig/tsconfig.node.json", "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": { "compilerOptions": {
"composite": true, "composite": true,
"types": ["node"], "types": ["node"],
"ignoreDeprecations": "5.0", "ignoreDeprecations": "5.0",
"verbatimModuleSyntax": true "verbatimModuleSyntax": true,
"module": "esnext"
} }
} }