This commit is contained in:
setthawutttty 2024-11-12 17:25:53 +07:00
parent 7881c9e2ef
commit 7a55c19511
3 changed files with 27 additions and 2 deletions

View file

@ -8,6 +8,7 @@ import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/modules/03_logs/stores/main";
import { storeToRefs } from "pinia";
import genReportXLSX from "@/plugins/genreportxlsx";
import type {
Pagination,
@ -26,7 +27,7 @@ import type { ResLog } from "@/modules/03_logs/interface/response/Main";
const $q = useQuasar();
const storeData = useDataStore();
const { logData, size, searchAfter, systemName, date } = storeToRefs(storeData);
const { date2Thai, messageError, hideLoader } = useCounterMixin();
const { date2Thai, messageError, hideLoader,dateToISO } = useCounterMixin();
const startTime = ref<Date | null>(null); //
const endTime = ref<Date | null>(null); //
@ -436,7 +437,28 @@ function updateDate() {
}
function onSendCSV() {
console.log(1);
const queryString = {
rootId: qureyBody.rootId ?? undefined,
size: size.value ?? undefined,
search: inputSearch.value ?? undefined,
systemName: systemName.value ?? undefined,
searchAfter: searchAfter.value ?? undefined,
sort: sortTime.value,
startDate: new Date(startDate.value) ?? undefined,
endDate: new Date(endDate.value) ?? undefined,
};
http
.get(config.API.reportLog, {
params: queryString,
})
.then((res) => {
const data = res.data
genReportXLSX(data,`LOG_${date2Thai(new Date(startDate.value))}`)
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
}
function onSend() {
console.log(1);