ปรับ code การลา
This commit is contained in:
parent
10bbc9794a
commit
3ee1a64a78
12 changed files with 49 additions and 852 deletions
|
|
@ -1,34 +1,37 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch, onMounted } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
import type { CalendarOptions } from "@fullcalendar/core";
|
||||
import FullCalendar from "@fullcalendar/vue3";
|
||||
import dayGridPlugin from "@fullcalendar/daygrid";
|
||||
import type { CalendarOptions } from "@fullcalendar/core";
|
||||
import timeGridPlugin from "@fullcalendar/timegrid";
|
||||
import interactionPlugin from "@fullcalendar/interaction";
|
||||
import allLocales from "@fullcalendar/core/locales-all";
|
||||
import listPlugin from "@fullcalendar/list";
|
||||
import { colors, useQuasar } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useRouter } from "vue-router";
|
||||
import keycloak from "@/plugins/keycloak";
|
||||
import moment from "moment";
|
||||
|
||||
/** importType*/
|
||||
import type {
|
||||
DataDateMonthObject,
|
||||
ResCalendar,
|
||||
} from "@/modules/09_leave/interface/response/leave";
|
||||
|
||||
/** importStore*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
||||
import moment from "moment";
|
||||
|
||||
/** use*/
|
||||
const leaveStore = useLeavelistDataStore();
|
||||
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
||||
const { showLoader, hideLoader, messageError, monthYear2Thai } = mixin;
|
||||
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
|
||||
const { showLoader, hideLoader, messageError, monthYear2Thai } = mixin;
|
||||
|
||||
const keycloakId = ref<string>(
|
||||
keycloak.tokenParsed ? keycloak.tokenParsed.sub!.toString() : ""
|
||||
);
|
||||
|
|
@ -73,6 +76,7 @@ const dateMonth = ref<DataDateMonthObject>({
|
|||
});
|
||||
const mainData = ref<ResCalendar[]>([]);
|
||||
|
||||
/** function เรียกข้อมูล Calendar*/
|
||||
async function fetchDataCalendar() {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -125,6 +129,10 @@ async function fetchDataCalendar() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function convert ชื่อ
|
||||
* @param id profile
|
||||
*/
|
||||
function convertKeycloakId(id: any) {
|
||||
const filterName = mainData.value.find(
|
||||
(e: ResCalendar) => e.keycloakId === id
|
||||
|
|
@ -165,10 +173,10 @@ function redirectToDetail(id: string) {
|
|||
* เรียกฟังก์ชันทั้งหมดตอนเรียกใช้ไฟล์นี้
|
||||
*/
|
||||
onMounted(async () => {
|
||||
// filterVal.value.push(keycloakId.value);
|
||||
await fetchDataCalendar();
|
||||
});
|
||||
|
||||
/** function เปลี่ยน calendar*/
|
||||
async function changCalendar() {
|
||||
await fetchDataCalendar();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,7 @@ import genReport from "@/plugins/genreport";
|
|||
/** importStore */
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
||||
import { useLeavelistDataStoreTest } from "@/modules/09_leave/stores/ListLeave";
|
||||
import DialogReason from "@/components/Dialogs/PopupReason.vue";
|
||||
const APIDATA = useLeavelistDataStoreTest();
|
||||
|
||||
/** importType */
|
||||
import type { FremData } from "@/modules/09_leave/interface/request/leave";
|
||||
|
|
@ -62,7 +60,7 @@ const closeDialog = () => {
|
|||
*/
|
||||
const filesUpload = ref<any>(null);
|
||||
function upLoadFile() {
|
||||
console.log("upload", filesUpload.value);
|
||||
// console.log("upload", filesUpload.value);
|
||||
}
|
||||
|
||||
/** Form รายละเอียดข้อมูล*/
|
||||
|
|
@ -153,9 +151,8 @@ async function fetchDetailLeave(paramsId: string) {
|
|||
await http
|
||||
.get(config.API.leaveListById(paramsId))
|
||||
.then(async (res) => {
|
||||
console.log(res);
|
||||
const data = res.data.result;
|
||||
console.log(data);
|
||||
|
||||
formData.id = data.id;
|
||||
formData.reasonCommander = data.reasonCommander
|
||||
? data.reasonCommander
|
||||
|
|
@ -287,11 +284,9 @@ async function fetchDetailLeave(paramsId: string) {
|
|||
: "-";
|
||||
formData.approveStep = data.approveStep;
|
||||
formData.dear = data.dear ? data.dear : "-";
|
||||
console.log(formData);
|
||||
|
||||
await fectOptionType();
|
||||
|
||||
/** ส่งประเภทของการลาไป Function เช็คประเภทการลา*/
|
||||
await fectOptionType();
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -307,7 +302,6 @@ async function fectOptionType() {
|
|||
await http
|
||||
.get(config.API.leaveType())
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
leaveType.value = res.data.result;
|
||||
checkLeaveType(formData.leaveTypeId, formData);
|
||||
})
|
||||
|
|
@ -440,8 +434,6 @@ function clickSave(reason: string) {
|
|||
"ยืนยันไม่อนุมัติ",
|
||||
"ต้องการยืนยันไม่อนุมัติใช่หรือไม่ ?"
|
||||
);
|
||||
|
||||
console.log("NOT");
|
||||
}
|
||||
if (dialogTitle.value === "ส่งไปยังผู้มีอำนาจ") {
|
||||
dialogConfirm(
|
||||
|
|
@ -471,10 +463,8 @@ async function onClickDownloadFile(id: string, fileName: string, type: string) {
|
|||
await http
|
||||
.get(config.API.leaveReport(id))
|
||||
.then(async (res) => {
|
||||
console.log(res);
|
||||
const data = res.data.result;
|
||||
await genReport(data, fileName, type);
|
||||
console.log(type);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ const formData = reactive<FremData>({
|
|||
leaveTotal: 0, //จำนวนวันที่ลา(Auto)
|
||||
leavebirthDate: new Date(), //วันเดือนปีเกิด(Auto)
|
||||
leavegovernmentDate: new Date(), //วันที่เข้ารับราชการ(Auto)
|
||||
leaveSalary: 0, //เงินเดือนปัจจุบัน(Auto)
|
||||
leaveSalary: "", //เงินเดือนปัจจุบัน(Auto)
|
||||
leaveSalaryText: "", //เงินเดือนปัจจุบัน(เขียนเป็นคำอ่าน)
|
||||
leaveTypeDay: "", //ประเภทการลาในวันนั้นเช่น
|
||||
wifeDayName: "", //ชื่อภรรยา(ลาไปช่วยเหลือภริยาที่คลอดบุตร)
|
||||
|
|
@ -167,23 +167,21 @@ async function fetchDetailDeleteLeave(paramsId: string) {
|
|||
.get(config.API.leaveListDeleteByid(paramsId))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
console.log(data.id);
|
||||
(formDataReject.id = data.id),
|
||||
(formDataReject.leaveTypeName = data.leaveTypeName),
|
||||
(formDataReject.fullName = data.fullName),
|
||||
(formDataReject.status = data.status);
|
||||
(formDataReject.leaveDocDelete = data.leaveDocDelete),
|
||||
(formDataReject.leaveReasonDelete = data.leaveReasonDelete
|
||||
? data.leaveReasonDelete
|
||||
: "-"),
|
||||
(formDataReject.leaveWrote = data.leaveWrote),
|
||||
(formDataReject.leaveAddress = data.leaveAddress),
|
||||
(formDataReject.leaveNumber = data.leaveNumber),
|
||||
(formDataReject.leaveDetail = data.leaveDetail),
|
||||
(formDataReject.leaveTotal = data.leaveTotal),
|
||||
(formDataReject.leaveStartDate = data.leaveStartDate),
|
||||
(formDataReject.leaveEndDate = data.leaveEndDate),
|
||||
console.log(formData);
|
||||
formDataReject.id = data.id;
|
||||
formDataReject.leaveTypeName = data.leaveTypeName;
|
||||
formDataReject.fullName = data.fullName;
|
||||
formDataReject.status = data.status;
|
||||
formDataReject.leaveDocDelete = data.leaveDocDelete;
|
||||
formDataReject.leaveReasonDelete = data.leaveReasonDelete
|
||||
? data.leaveReasonDelete
|
||||
: "-";
|
||||
formDataReject.leaveWrote = data.leaveWrote;
|
||||
formDataReject.leaveAddress = data.leaveAddress;
|
||||
formDataReject.leaveNumber = data.leaveNumber;
|
||||
formDataReject.leaveDetail = data.leaveDetail;
|
||||
formDataReject.leaveTotal = data.leaveTotal;
|
||||
formDataReject.leaveStartDate = data.leaveStartDate;
|
||||
formDataReject.leaveEndDate = data.leaveEndDate;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -199,7 +197,6 @@ async function fetchDetailLeave(paramsId: string) {
|
|||
.get(config.API.leaveListById(paramsId))
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
console.log(data);
|
||||
formData.id = data.id;
|
||||
formData.reasonCommander = data.reasonCommander;
|
||||
formData.reasonOligarch = data.reasonOligarch;
|
||||
|
|
@ -295,7 +292,6 @@ async function fectOptionType() {
|
|||
await http
|
||||
.get(config.API.leaveType())
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
leaveType.value = res.data.result;
|
||||
checkLeaveType(formData.leaveTypeId, formData.leaveTypeName);
|
||||
})
|
||||
|
|
@ -379,8 +375,6 @@ function clickSave(reason: string) {
|
|||
"ยืนยันการอนุมัติการยกเลิก",
|
||||
"ต้องการยืนยันการอนุมัติการยกเลิกใช่หรือไม่ ?"
|
||||
);
|
||||
// modalApprove.value = false;
|
||||
console.log("Yes");
|
||||
}
|
||||
if (dialogTitle.value === "ไม่อนุมัติการยกเลิก") {
|
||||
dialogConfirm(
|
||||
|
|
@ -402,8 +396,6 @@ function clickSave(reason: string) {
|
|||
"ยืนยันไม่อนุมัติการยกเลิก",
|
||||
"ต้องการยืนยันไม่อนุมัติการยกเลิกใช่หรือไม่ ?"
|
||||
);
|
||||
// modalApprove.value = false;
|
||||
console.log("NOT");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -412,7 +404,6 @@ async function onClickDownloadFile(id: string, fileName: string, type: string) {
|
|||
await http
|
||||
.get(config.API.leaveReportReject(id))
|
||||
.then(async (res) => {
|
||||
console.log(res);
|
||||
const data = res.data.result;
|
||||
await genReport(data, fileName, type);
|
||||
})
|
||||
|
|
|
|||
|
|
@ -18,14 +18,12 @@ import CalendarView from "@/modules/09_leave/components/2_Leave/Calendar.vue";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
||||
|
||||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
const mixin = useCounterMixin();
|
||||
const leaveStore = useLeavelistDataStore();
|
||||
|
||||
const { date2Thai, dateToISO, showLoader, hideLoader, messageError } = mixin;
|
||||
const { showLoader, hideLoader, messageError } = mixin;
|
||||
|
||||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
|
||||
//
|
||||
const querySting = reactive<QuerySting>({
|
||||
year: leaveStore.filter.year, //*ปีในการยื่นขอใบลา(ใช้เป็น คศ.)
|
||||
type: leaveStore.filter.type, //*Id ประเภทการลา
|
||||
|
|
|
|||
|
|
@ -16,12 +16,10 @@ import ToolBar from "@/modules/09_leave/components/2_Leave/ToolBarLeave.vue";
|
|||
/**importStroe*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
||||
import { useLeavelistDataStoreTest } from "@/modules/09_leave/stores/ListLeave";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const leaveStore = useLeavelistDataStore();
|
||||
const APIDATA = useLeavelistDataStoreTest();
|
||||
const { date2Thai, dateToISO, showLoader, hideLoader, messageError } = mixin;
|
||||
const { showLoader, hideLoader, messageError } = mixin;
|
||||
const { fetchListLeaveReject } = leaveStore;
|
||||
|
||||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
|
|
@ -51,10 +49,7 @@ async function fecthLeaveList() {
|
|||
.post(config.API.leaveListDelete(), querySting)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
console.log(data);
|
||||
|
||||
maxPage.value = Math.ceil(data.total / querySting.pageSize);
|
||||
console.log(maxPage.value);
|
||||
fetchListLeaveReject(data.data); /** ส่งข้อมูลไป stores*/
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -85,7 +80,6 @@ async function updatePaging(
|
|||
querySting.pageSize = pageSize ? pageSize : querySting.pageSize;
|
||||
querySting.keyword = dateFilter ? dateFilter.keyword : querySting.keyword;
|
||||
|
||||
console.log(querySting);
|
||||
await fecthLeaveList();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,21 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from "vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import type { DateFilter } from "@/modules/09_leave/interface/request/leave";
|
||||
import type {
|
||||
DataOption,
|
||||
DataOption2,
|
||||
} from "@/modules/09_leave/interface/index/Main";
|
||||
import type { DataOption } from "@/modules/09_leave/interface/index/Main";
|
||||
|
||||
/** importStores*/
|
||||
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
const leaveStore = useLeavelistDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
const $q = useQuasar();
|
||||
|
||||
const { messageError } = mixin;
|
||||
|
||||
const props = defineProps({
|
||||
rowsPerPage: {
|
||||
|
|
@ -98,6 +102,7 @@ const optionStatusMain = ref<DataOption[]>(
|
|||
leaveStore.tabMenu == "1" ? optionStatus.value : optionStatus2.value
|
||||
);
|
||||
|
||||
/** function เรียกข้อมูลสถานะ*/
|
||||
async function fetchOption() {
|
||||
await http
|
||||
.get(config.API.leaveType())
|
||||
|
|
@ -115,7 +120,7 @@ async function fetchOption() {
|
|||
optionType.value = optionTypeMain.value;
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,8 +89,6 @@ function validateForm() {
|
|||
}
|
||||
if (hasError.every((result) => result === true)) {
|
||||
onSubmit();
|
||||
} else {
|
||||
console.log(hasError);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,8 +66,6 @@ function validateForm() {
|
|||
}
|
||||
if (hasError.every((result) => result === true)) {
|
||||
onSubmit();
|
||||
} else {
|
||||
console.log(hasError);
|
||||
}
|
||||
}
|
||||
const dataToday = ref<Date>(new Date());
|
||||
|
|
|
|||
|
|
@ -73,8 +73,6 @@ function validateForm() {
|
|||
}
|
||||
if (hasError.every((result) => result === true)) {
|
||||
onSubmit();
|
||||
} else {
|
||||
console.log(hasError);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, useAttrs } from "vue";
|
||||
|
||||
/** import Type*/
|
||||
import type { Pagination } from "@/modules/04_registry/interface/index/Main";
|
||||
|
||||
/** import Stoer*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useSpecialTimeStore } from "@/modules/09_leave/stores/SpecialTimeStore";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue