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*/
viewWorkflow: `${organization}/view-workflow`,
keycloakLogSSO: `${organization}/keycloak/log/sso`,
};

View file

@ -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}`,
};

View file

@ -41,29 +41,34 @@ const body = ref<string>(""); //ข้อความ
* นยนการจตอบกลบการสงขอความ
*/
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() {
<div class="col-xs-12">
<div class="col-12 row q-py-sm items-center q-col-gutter-sm">
<q-input
class="full-width inputgreen cursor-pointer"
class="full-width inputgreen cursor-pointer bg-white"
hide-bottom-space
outlined
dense
@ -103,7 +108,7 @@ function onClose() {
<q-input
type="textarea"
class="full-width inputgreen cursor-pointer"
class="full-width inputgreen cursor-pointer bg-white"
hide-bottom-space
outlined
dense

View file

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

View file

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

View file

@ -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<Date | null>(null); //
const endTime = ref<Date | null>(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 () => {
<DialogDataDiff
v-model:open-dialog="openDialog"
title="รายละเอียดข้อมูล"
:onSend="onSend"
:downloadTxt="downloadTxt"
:close="
() => {
openDialog = false;
@ -940,6 +957,7 @@ onMounted(async () => {
>
{{
{
id: "ID",
startTimeStamp: "เวลา",
username: "ผู้ใช้",
host: "Host",

View file

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

View file

@ -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,

View file

@ -174,6 +174,8 @@ function onSubmit() {
function selectInbox(data: CommandSysType) {
activeOrderId.value = data.id;
pagination.value.page = 1;
filter.value = "";
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",
};
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;
@ -237,7 +237,8 @@ function doLogout() {
dialogConfirm(
$q,
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)
) {
page.value++;
setTimeout(() => {
setTimeout(async () => {
await getDataNotification(page.value, "NOMAL");
done();
getDataNotification(page.value, "NOMAL");
}, 1500);
}
}
@ -443,7 +444,11 @@ onUnmounted(() => {
v-if="totalNoti !== 0"
>{{ 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="text-subtitle1 text-weight-medium">การแจงเตอน</div>
<q-space />

View file

@ -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"
}
}