Refactor Code ระบบลา

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-12-15 09:58:02 +07:00
parent 75dfc3b004
commit 9498748c94
16 changed files with 202 additions and 349 deletions

View file

@ -7,14 +7,14 @@ import type { dataPost } from "@/modules/09_leave/interface/request/changeRound"
/** importComponents */
import Dialogform from "@/modules/09_leave/components/4_ChangeRound/DialogForm.vue";
import Modal from "@/modules/05_placement/components/AppointEmployee/Modal.vue";
/** importStore */
import { useCounterMixin } from "@/stores/mixin";
import { useChangeRoundDataStore } from "@/modules/09_leave/stores/ChangeRoundStore";
/** useStore */
const mixin = useCounterMixin();
const { dialogConfirm, date2Thai, dialogMessageNotify } = mixin;
const { dialogMessageNotify } = mixin;
const dataStore = useChangeRoundDataStore();
/** use */
@ -43,8 +43,6 @@ function Openmodal(check: string, detail: any) {
modal.value = true;
dataStore.fetchDatainHistory();
}
console.log(detail);
}
/** Function closePopup */

View file

@ -31,13 +31,6 @@ const leaveStore = useLeavelistDataStore();
<q-tab-panel name="2"> <Tab2 /> </q-tab-panel>
</q-tab-panels>
<!-- <ToolBar @update:querySting="updatePaging" />
<TableList
:page="querySting.page"
:rowsPerPage="querySting.pageSize"
:maxPage="maxPage"
@update:querySting="updatePaging"
/> -->
</q-card>
</div>
</template>

View file

@ -15,8 +15,8 @@ const mixin = useCounterMixin();
const dataStore = useRoundDataStore();
const { fetchData } = dataStore;
const { showLoader, hideLoader, messageError, dialogRemove, success } = mixin;
const $q = useQuasar(); // noti quasar
const $q = useQuasar(); // noti quasar
const attrs = ref<any>(useAttrs());
const modal = ref<boolean>(false);
@ -91,7 +91,6 @@ function closeDialog() {
/** pagination */
const pagination = ref({
// sortBy: "desc",
descending: false,
page: 1,
rowsPerPage: 10,

View file

@ -1,23 +1,29 @@
<script setup lang="ts">
import { onMounted, ref, watch } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
import { useSpecialTimeStore } from "@/modules/09_leave/stores/SpecialTimeStore";
import DialogReason from "@/components/Dialogs/PopupReason.vue";
import DialogApprove from "@/modules/09_leave/components/4_specialTime/DialogApprove.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import type { DataDateMonthObject } from "@/modules/09_leave/interface/request/specialTime";
import { useRouter } from "vue-router";
import { identity } from "@fullcalendar/core/internal";
/**ตัวแปรที่ใช้ */
/** importType*/
import type { DataDateMonthObject } from "@/modules/09_leave/interface/request/specialTime";
/** importComponents*/
import DialogReason from "@/components/Dialogs/PopupReason.vue";
import DialogApprove from "@/modules/09_leave/components/4_specialTime/DialogApprove.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { useSpecialTimeStore } from "@/modules/09_leave/stores/SpecialTimeStore";
const dataSpecialTime = useSpecialTimeStore();
const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const router = useRouter();
const { hideLoader, monthYear2Thai, messageError, showLoader, success } = mixin;
const emit = defineEmits(["update:change-page"]);
/**ตัวแปรที่ใช้ */
const modalUnapprove = ref(false);
const modalApprove = ref(false);
const detailData = ref<any>();
@ -30,18 +36,19 @@ const dateDialog = ref<string>("");
const dateFixDialog = ref<string>("");
const dateYear = ref<number>(new Date().getFullYear());
/**ฟังก์ชั่นไม่อนุมัติ */
const unapprove = async (fullname: string, personId: string) => {
/**
* งกนไมอน
* @param fullname
* @param personId personId
*/
async function unapprove(fullname: string, personId: string) {
id.value = personId;
dialogTitle.value = " ไม่อนุมัติคำขอ"// + fullname;
dialogTitle.value = " ไม่อนุมัติคำขอ"; // + fullname;
name.value = fullname;
modalUnapprove.value = true;
}
// rejectData();
};
/** function Model */
//
/** function openDialog */
function openModal(
data: any,
check: string,
@ -58,9 +65,9 @@ function openModal(
if (check === "PENDING") {
detailData.value = data;
}
console.log(data);
}
//
/** function closeDialog */
const closeDialog = () => {
modalUnapprove.value = false;
modalApprove.value = false;
@ -69,32 +76,28 @@ const closeDialog = () => {
/** API reject */
const clickSave = async (reason: string) => {
showLoader();
modalUnapprove.value = false;
const body = {
reason: reason,
};
await http
.put(config.API.specialTimeReject(id.value), body)
.then((res) => {
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
dataSpecialTime.fetchData();
await dataSpecialTime.fetchData();
hideLoader();
});
console.log(reason);
};
// paging
const pageSize = ref<number>(10);
/**
* งก api เปลยนหน
* @param pageVal page
* @param pageSizeVal pagesize
*/
// Pagination - initial pagination
const initialPagination = ref<any>({
sortBy: null,
@ -102,7 +105,7 @@ const initialPagination = ref<any>({
page: 1,
rowsPerPage: pageSize, // set page
});
const emit = defineEmits(["update:change-page"]);
// Pagination - page & change page & get new data
const currentPage = ref<number>(1);
watch(
@ -131,6 +134,7 @@ const resetFilter = () => {
filterRef.value.focus();
}
};
/** function ค้นหาข้อมูลแล้วอัปเดท*/
function filterFn() {
updatePagination(filterKeyword.value);

View file

@ -1,22 +1,10 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { ref } from "vue";
/** import Components */
import Tab1 from "@/modules/09_leave/components/1_Work/Tab1.vue";
import Tab2 from "@/modules/09_leave/components/1_Work/Tab2.vue";
// /** importStores */
// import { useCounterMixin } from "@/stores/mixin";
// import { useWorklistDataStore } from "@/modules/09_leave/stores/WorkStore";
/** use Store */
// const mixin = useCounterMixin();
// const workStore = useWorklistDataStore();
// const { dateToISO, date2Thai, showLoader, hideLoader } = mixin;
// const { fetchListLog, fetchListTime } = workStore;
const tab = ref("1");
</script>
<template>
@ -41,22 +29,15 @@ const tab = ref("1");
<q-separator />
<q-tab-panels v-model="tab" animated >
<q-tab-panels v-model="tab" animated>
<q-tab-panel name="1">
<!-- <TableList1 /> -->
<!-- <ToolBar /> -->
<Tab1 />
<!-- <TableList /> -->
</q-tab-panel>
<q-tab-panel name="2">
<!-- <TabList2Vue /> -->
<!-- <ToolBarDate /> -->
<Tab2 />
<!-- <TableList /> -->
</q-tab-panel>
</q-tab-panels>
<!-- </q-card> -->
</q-card>
</div>
</template>