Refactoring code 09_leave

This commit is contained in:
STW_TTTY\stwtt 2024-09-18 17:26:53 +07:00
parent d20fdb0190
commit 94eb31fc26
27 changed files with 289 additions and 577 deletions

View file

@ -1,32 +1,24 @@
import { defineStore } from "pinia";
import { ref, reactive } from "vue";
import type {
changeShow,
dataRowChangeRound,
dataRowChangeRoundHistory,
historyShow,
} from "@/modules/09_leave/interface/response/changeRound";
import type { dataPost } from "@/modules/09_leave/interface/request/changeRound";
import type { QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import { ref } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type {
changeShow,
historyShow,
DataInterface,
} from "@/modules/09_leave/interface/response/changeRound";
import type { QTableProps } from "quasar";
const mixin = useCounterMixin();
const $q = useQuasar();
const {
date2Thai,
messageError,
showLoader,
dialogMessageNotify,
dialogConfirm,
success,
hideLoader,
} = mixin;
const { date2Thai, messageError, showLoader, hideLoader } = mixin;
const checkCilck = ref<boolean>(false);
const profileId = ref<string>("");
// store ลา >> รอบการปฏิบัติงาน
export const useChangeRoundDataStore = defineStore(
"changeRoundDataStore",
() => {
@ -200,17 +192,12 @@ export const useChangeRoundDataStore = defineStore(
await http
.get(
config.API.leaveRoundById(profileId.value) +
// {
// page: page.value,
// pageSize: pageSize.value,
// keyword: filter.value,
// }
`?page=${page.value}&pageSize=${pageSize.value}&keyword=${filter.value}`
)
.then((res) => {
const dataHistory = res.data.result.data;
rowsHistory.value = [];
dataHistory.map((e: any) => {
dataHistory.map((e: DataInterface) => {
rowsHistory.value.push({
round: e.round,
startTimeMorning: e.startTimeMorning,
@ -223,6 +210,7 @@ export const useChangeRoundDataStore = defineStore(
maxPage.value = Math.ceil(total.value / pageSize.value);
maxPage.value = maxPage.value < 1 ? 1 : maxPage.value;
});
console.log(rowsHistory.value);
})
.catch((err) => {
messageError($q, err);