API รายการลา
This commit is contained in:
parent
6d12f50399
commit
035696b5b0
18 changed files with 273 additions and 196 deletions
|
|
@ -134,8 +134,7 @@ async function fetchListTimeRecord() {
|
|||
await http
|
||||
.get(
|
||||
config.API.timeRecord() +
|
||||
`?startDate=${querySting.startDate}&endDate=${querySting.startDate}
|
||||
&status=${querySting.status}&page=${querySting.page}&pageSize=${querySting.pageSize}&keyword=${querySting.keyword}`
|
||||
`?startDate=${querySting.startDate}&endDate=${querySting.startDate}&status=${querySting.status}&page=${querySting.page}&pageSize=${querySting.pageSize}&keyword=${querySting.keyword}`
|
||||
)
|
||||
.then((res) => {
|
||||
maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
import { ref, reactive, onMounted } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/** importStore */
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
||||
|
|
@ -11,6 +14,7 @@ const APIDATA = useLeavelistDataStoreTest();
|
|||
|
||||
/** importType */
|
||||
import type { FremData } from "@/modules/09_leave/interface/request/leave";
|
||||
import type { LeaveType } from "@/modules/09_leave/interface/response/leave";
|
||||
|
||||
/** importForm*/
|
||||
import FormMain from "@/modules/09_leave/components/2_Leave/formDetail/formMain.vue"; // from ซ้าย
|
||||
|
|
@ -18,7 +22,7 @@ import FormLeave from "@/modules/09_leave/components/2_Leave/formDetail/formLeav
|
|||
import FormChildbirth from "@/modules/09_leave/components/2_Leave/formDetail/formChildbirth.vue"; // ลาไปช่วยเหลือภริยาที่คลอดบุตร
|
||||
import FormHoliday from "@/modules/09_leave/components/2_Leave/formDetail/formHoliday.vue"; //ลาพักผ่อน
|
||||
import FormUpasom from "@/modules/09_leave/components/2_Leave/formDetail/formUpasom.vue"; // ลาอุปสมบท
|
||||
import FormHajj from "@/modules/09_leave/components/2_Leave/formDetail/formHajj.vue"; //ลาประกอบพิธีฮัจย์
|
||||
import FormHajj from "@/modules/09_leave/components/2_Leave/formDetail/formHajj.vue"; //ลาประกอบพิธีฮัจญ์
|
||||
import FormCheckSelect from "@/modules/09_leave/components/2_Leave/formDetail/formCheckSelect.vue"; //ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล
|
||||
import FormStudy from "@/modules/09_leave/components/2_Leave/formDetail/formStudy.vue"; //ลาไปศึกษา
|
||||
import FormLeaveToTraining from "@/modules/09_leave/components/2_Leave/formDetail/formLeaveToTraining.vue"; // ลาไปฝึกอบรม ปฏิบัติการวิจัย หรือดูงาน
|
||||
|
|
@ -29,7 +33,8 @@ import FormVocationalRehabilitation from "@/modules/09_leave/components/2_Leave/
|
|||
/** use */
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogConfirm, showLoader, hideLoader, date2Thai } = mixin;
|
||||
const { dialogConfirm, showLoader, hideLoader, date2Thai, messageError } =
|
||||
mixin;
|
||||
const stores = useLeavelistDataStore();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
|
@ -61,7 +66,7 @@ const formData = reactive<FremData>({
|
|||
organizationName: "", //สังกัดผู้ยื่นขอ
|
||||
leaveTypeName: "", // Name ประเภทการลา
|
||||
leaveTypeId: "", //Id ประเภทการลา
|
||||
fullname: "", //คำนำหน้า ชื่อ นามสกุล คนขอลา
|
||||
fullName: "", //คำนำหน้า ชื่อ นามสกุล คนขอลา
|
||||
dateSendLeave: new Date(), // วันที่ยื่นใบลา
|
||||
leaveDateStart: new Date(), //วันเริ่มการลา
|
||||
leaveDateEnd: new Date(), //วันสิ้นสุดการลา
|
||||
|
|
@ -97,7 +102,7 @@ const formData = reactive<FremData>({
|
|||
ordainDayOrdination: new Date(), //สถานที่บวช วันอุปสมบท(ลาอุปสมบท)
|
||||
ordainDayBuddhistLentName: "", //สถานที่จำพรรษา ชื่อวัด(ลาอุปสมบท)
|
||||
ordainDayBuddhistLentAddress: "", //สถานที่จำพรรษา ที่อยู่(ลาอุปสมบท)
|
||||
hajjDayStatus: false, //เคย/ไม่เคยไปประกอบพิธีฮัจย์ (ให้เลือก) (ลาประกอบพิธีฮัจย์)
|
||||
hajjDayStatus: false, //เคย/ไม่เคยไปประกอบพิธีฮัจญ์ (ให้เลือก) (ลาประกอบพิธีฮัจญ์)
|
||||
absentDaySummon: "", //ได้รับหมายเรียกของ (ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล)
|
||||
absentDayLocation: "", //ที่ (ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล)
|
||||
absentDayRegistorDate: new Date(), //ลงวันที่ (ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล)
|
||||
|
|
@ -122,10 +127,10 @@ const formData = reactive<FremData>({
|
|||
step: "",
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
// showLoader();
|
||||
if (paramsId) {
|
||||
fetchDetailLeave(paramsId);
|
||||
await fetchDetailLeave(paramsId);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -133,90 +138,117 @@ onMounted(() => {
|
|||
* Function fetch รายละเอียดของข้อมูล
|
||||
* @param paramsId รับ ID จาก paramID
|
||||
*/
|
||||
function fetchDetailLeave(paramsId: string) {
|
||||
const dataAPI = APIDATA.data;
|
||||
const data = dataAPI.filter((e: any) => e.id === paramsId);
|
||||
console.log(data);
|
||||
data.map((e: any) => {
|
||||
formData.id = e.id;
|
||||
formData.reasonCommander = e.reasonCommander;
|
||||
formData.reasonOligarch = e.reasonOligarch;
|
||||
formData.positionName = e.positionName;
|
||||
formData.positionLevelName = e.positionLevelName;
|
||||
formData.organizationName = e.organizationName;
|
||||
formData.leaveTypeName = e.leaveTypeName
|
||||
? e.leaveTypeName
|
||||
: stores.convertLeave(e.leaveTypeId);
|
||||
formData.leaveTypeId = e.leaveTypeId;
|
||||
formData.fullname = e.fullname;
|
||||
formData.dateSendLeave = e.dateSendLeave && date2Thai(e.dateSendLeave);
|
||||
formData.leaveDateStart = e.leaveDateStart && date2Thai(e.leaveDateStart);
|
||||
formData.leaveDateEnd = e.leaveDateEnd && date2Thai(e.leaveDateEnd);
|
||||
formData.leaveCount = e.leaveCount;
|
||||
formData.status = e.status && e.status;
|
||||
formData.leaveLimit = e.leaveLimit;
|
||||
formData.leaveSummary = e.leaveSummary;
|
||||
formData.leaveRemain = e.leaveRemain;
|
||||
formData.leaveWrote = e.leaveWrote;
|
||||
formData.leaveAddress = e.leaveAddress;
|
||||
formData.leaveNumber = e.leaveNumber;
|
||||
formData.leaveDetail = e.leaveDetail;
|
||||
formData.leaveDocument = e.leaveDocument;
|
||||
formData.leaveDraftDocument = e.leaveDraftDocument;
|
||||
formData.leaveLastStart = e.leaveLastStart && date2Thai(e.leaveLastStart);
|
||||
formData.leaveLastEnd = e.leaveLastStart && date2Thai(e.leaveLastEnd);
|
||||
formData.leaveTotal = e.leaveTotal;
|
||||
formData.leavebirthDate = e.leavebirthDate && date2Thai(e.leavebirthDate);
|
||||
formData.leavegovernmentDate =
|
||||
e.leavegovernmentDate && date2Thai(e.leavegovernmentDate);
|
||||
formData.leaveSalary = e.leaveSalary;
|
||||
formData.leaveSalaryText = e.leaveSalaryText;
|
||||
formData.leaveTypeDay =
|
||||
e.leaveTypeDay && stores.convertLeaveDaytype(e.leaveTypeDay);
|
||||
formData.wifeDayName = e.wifeDayName;
|
||||
formData.wifeDayDateBorn =
|
||||
e.wifeDayDateBorn && date2Thai(e.wifeDayDateBorn);
|
||||
formData.restDayOldTotal = e.restDayOldTotal;
|
||||
formData.restDayCurrentTotal = e.restDayCurrentTotal;
|
||||
formData.ordainDayStatus = e.ordainDayStatus;
|
||||
formData.ordainDayLocationName = e.ordainDayLocationName;
|
||||
formData.ordainDayLocationAddress = e.ordainDayLocationAddress;
|
||||
formData.ordainDayLocationNumber = e.ordainDayLocationNumber;
|
||||
formData.ordainDayOrdination =
|
||||
e.ordainDayOrdination && date2Thai(e.ordainDayOrdination);
|
||||
formData.ordainDayBuddhistLentName = e.ordainDayBuddhistLentName;
|
||||
formData.ordainDayBuddhistLentAddress = e.ordainDayBuddhistLentAddress;
|
||||
formData.hajjDayStatus = e.hajjDayStatus;
|
||||
formData.absentDaySummon = e.absentDaySummon;
|
||||
formData.absentDayLocation = e.absentDayLocation;
|
||||
formData.absentDayRegistorDate =
|
||||
e.absentDayRegistorDate && date2Thai(e.absentDayRegistorDate);
|
||||
formData.absentDayGetIn = e.absentDayGetIn;
|
||||
formData.absentDayAt = e.absentDayAt;
|
||||
formData.studyDaySubject = e.studyDaySubject;
|
||||
formData.studyDayDegreeLevel = e.studyDayDegreeLevel;
|
||||
formData.studyDayUniversityName = e.studyDayUniversityName;
|
||||
formData.studyDayTrainingSubject = e.studyDayTrainingSubject;
|
||||
formData.studyDayTrainingName = e.studyDayTrainingName;
|
||||
formData.studyDayCountry = e.studyDayCountry;
|
||||
formData.studyDayScholarship = e.studyDayScholarship;
|
||||
formData.coupleDayName = e.coupleDayName;
|
||||
formData.coupleDayPosition = e.coupleDayPosition;
|
||||
formData.coupleDayLevel = e.coupleDayLevel;
|
||||
formData.coupleDayLevelCountry = e.coupleDayLevelCountry;
|
||||
formData.coupleDayCountryHistory = e.coupleDayCountryHistory;
|
||||
formData.coupleDayTotalHistory = e.coupleDayTotalHistory;
|
||||
formData.coupleDayStartDateHistory =
|
||||
e.coupleDayStartDateHistory && date2Thai(e.coupleDayStartDateHistory);
|
||||
formData.coupleDayEndDateHistory =
|
||||
e.coupleDayEndDateHistory && date2Thai(e.coupleDayEndDateHistory);
|
||||
formData.coupleDaySumTotalHistory = e.coupleDaySumTotalHistory;
|
||||
formData.step = e.step;
|
||||
});
|
||||
async function fetchDetailLeave(paramsId: string) {
|
||||
showLoader();
|
||||
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;
|
||||
formData.reasonOligarch = data.reasonOligarch;
|
||||
formData.positionName = data.positionName;
|
||||
formData.positionLevelName = data.positionLevelName;
|
||||
formData.organizationName = data.organizationName;
|
||||
formData.leaveTypeName = data.leaveTypeName;
|
||||
formData.leaveTypeId = data.leaveTypeId;
|
||||
formData.fullName = data.fullName;
|
||||
formData.dateSendLeave =
|
||||
data.dateSendLeave && date2Thai(data.dateSendLeave);
|
||||
formData.leaveDateStart =
|
||||
data.leaveStartDate && date2Thai(data.leaveStartDate);
|
||||
formData.leaveDateEnd = data.leaveEndDate && date2Thai(data.leaveEndDate);
|
||||
formData.leaveCount = data.leaveCount;
|
||||
formData.status = data.status && data.status;
|
||||
formData.leaveLimit = data.leaveLimit;
|
||||
formData.leaveSummary = data.leaveSummary;
|
||||
formData.leaveRemain = data.leaveRemain;
|
||||
formData.leaveWrote = data.leaveWrote;
|
||||
formData.leaveAddress = data.leaveAddress;
|
||||
formData.leaveNumber = data.leaveNumber;
|
||||
formData.leaveDetail = data.leaveDetail;
|
||||
formData.leaveDocument = data.leaveDocument;
|
||||
formData.leaveDraftDocument = data.leaveDraftDocument;
|
||||
formData.leaveLastStart =
|
||||
data.leaveLastStart && date2Thai(data.leaveLastStart);
|
||||
formData.leaveLastEnd =
|
||||
data.leaveLastStart && date2Thai(data.leaveLastEnd);
|
||||
formData.leaveTotal = data.leaveTotal;
|
||||
formData.leavebirthDate =
|
||||
data.leavebirthDate && date2Thai(data.leavebirthDate);
|
||||
formData.leavegovernmentDate =
|
||||
data.leavegovernmentDate && date2Thai(data.leavegovernmentDate);
|
||||
formData.leaveSalary = data.leaveSalary;
|
||||
formData.leaveSalaryText = data.leaveSalaryText;
|
||||
formData.leaveTypeDay =
|
||||
data.leaveTypeDay && stores.convertLeaveDaytype(data.leaveTypeDay);
|
||||
formData.wifeDayName = data.wifeDayName;
|
||||
formData.wifeDayDateBorn =
|
||||
data.wifeDayDateBorn && date2Thai(data.wifeDayDateBorn);
|
||||
formData.restDayOldTotal = data.restDayOldTotal;
|
||||
formData.restDayCurrentTotal = data.restDayCurrentTotal;
|
||||
formData.ordainDayStatus = data.ordainDayStatus;
|
||||
formData.ordainDayLocationName = data.ordainDayLocationName;
|
||||
formData.ordainDayLocationAddress = data.ordainDayLocationAddress;
|
||||
formData.ordainDayLocationNumber = data.ordainDayLocationNumber;
|
||||
formData.ordainDayOrdination =
|
||||
data.ordainDayOrdination && date2Thai(data.ordainDayOrdination);
|
||||
formData.ordainDayBuddhistLentName = data.ordainDayBuddhistLentName;
|
||||
formData.ordainDayBuddhistLentAddress = data.ordainDayBuddhistLentAddress;
|
||||
formData.hajjDayStatus = data.hajjDayStatus;
|
||||
formData.absentDaySummon = data.absentDaySummon;
|
||||
formData.absentDayLocation = data.absentDayLocation;
|
||||
formData.absentDayRegistorDate =
|
||||
data.absentDayRegistorDate && date2Thai(data.absentDayRegistorDate);
|
||||
formData.absentDayGetIn = data.absentDayGetIn;
|
||||
formData.absentDayAt = data.absentDayAt;
|
||||
formData.studyDaySubject = data.studyDaySubject;
|
||||
formData.studyDayDegreeLevel = data.studyDayDegreeLevel;
|
||||
formData.studyDayUniversityName = data.studyDayUniversityName;
|
||||
formData.studyDayTrainingSubject = data.studyDayTrainingSubject;
|
||||
formData.studyDayTrainingName = data.studyDayTrainingName;
|
||||
formData.studyDayCountry = data.studyDayCountry;
|
||||
formData.studyDayScholarship = data.studyDayScholarship;
|
||||
formData.coupleDayName = data.coupleDayName;
|
||||
formData.coupleDayPosition = data.coupleDayPosition;
|
||||
formData.coupleDayLevel = data.coupleDayLevel;
|
||||
formData.coupleDayLevelCountry = data.coupleDayLevelCountry;
|
||||
formData.coupleDayCountryHistory = data.coupleDayCountryHistory;
|
||||
formData.coupleDayTotalHistory = data.coupleDayTotalHistory;
|
||||
formData.coupleDayStartDateHistory =
|
||||
data.coupleDayStartDateHistory &&
|
||||
date2Thai(data.coupleDayStartDateHistory);
|
||||
formData.coupleDayEndDateHistory =
|
||||
data.coupleDayEndDateHistory && date2Thai(data.coupleDayEndDateHistory);
|
||||
formData.coupleDaySumTotalHistory = data.coupleDaySumTotalHistory;
|
||||
formData.step = data.step;
|
||||
await fectOptionType();
|
||||
|
||||
/** ส่งประเภทของการลาไป Function เช็คประเภทการลา*/
|
||||
checkLeaveType(formData.leaveTypeId ? formData.leaveTypeId : "");
|
||||
// hideLoader();
|
||||
/** ส่งประเภทของการลาไป Function เช็คประเภทการลา*/
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
const leaveType = ref<LeaveType[]>();
|
||||
/** function เรียกประเภทการลา */
|
||||
async function fectOptionType() {
|
||||
await http
|
||||
.get(config.API.leaveType())
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
leaveType.value = res.data.result;
|
||||
checkLeaveType(formData.leaveTypeId, formData.leaveTypeName);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
/**Status Form การลา*/
|
||||
const checkForm = ref<string>("");
|
||||
|
|
@ -224,29 +256,35 @@ const checkForm = ref<string>("");
|
|||
* Function เช็คประเภทการลา
|
||||
* @param type รับค่า
|
||||
*/
|
||||
function checkLeaveType(type: string) {
|
||||
if (type === "leave1" || type === "leave2" || type === "leave3") {
|
||||
checkForm.value = "FormLeave";
|
||||
} else if (type === "leave4") {
|
||||
checkForm.value = "FormChildbirth";
|
||||
} else if (type === "leave5") {
|
||||
checkForm.value = "FormHoliday";
|
||||
} else if (type === "leave6") {
|
||||
checkForm.value = "FormUpasom";
|
||||
} else if (type === "leave7") {
|
||||
checkForm.value = "FormHajj";
|
||||
} else if (type === "leave8") {
|
||||
checkForm.value = "FormCheckSelect";
|
||||
} else if (type === "leave9") {
|
||||
checkForm.value = "FormStudy";
|
||||
} else if (type === "leave10") {
|
||||
checkForm.value = "FormLeaveToTraining";
|
||||
} else if (type === "leave11") {
|
||||
checkForm.value = "FormLeaveToWorkInternational";
|
||||
} else if (type === "leave12") {
|
||||
checkForm.value = "FormSpouse";
|
||||
} else if (type === "leave13") {
|
||||
checkForm.value = "FormVocationalRehabilitation";
|
||||
function checkLeaveType(leaveTypeId: string, leaveTypeName: string) {
|
||||
if (leaveType.value) {
|
||||
const filtertype: LeaveType | undefined = leaveType.value.find(
|
||||
(e: any) => e.id === leaveTypeId
|
||||
);
|
||||
const type = filtertype?.code;
|
||||
if (type === "LV-001" || type === "LV-002" || type === "LV-003") {
|
||||
checkForm.value = "FormLeave";
|
||||
} else if (type === "LV-004") {
|
||||
checkForm.value = "FormChildbirth";
|
||||
} else if (type === "LV-005") {
|
||||
checkForm.value = "FormHoliday";
|
||||
} else if (type === "LV-006") {
|
||||
checkForm.value = "FormUpasom";
|
||||
} else if (type === "LV-006" && leaveTypeName === "พิธีฮัจญ์ฯ") {
|
||||
checkForm.value = "FormHajj";
|
||||
} else if (type === "LV-007") {
|
||||
checkForm.value = "FormCheckSelect";
|
||||
} else if (type === "LV-008" && leaveTypeName === "ลาไปศีกษา") {
|
||||
checkForm.value = "FormStudy";
|
||||
} else if (type === "LV-008") {
|
||||
checkForm.value = "FormLeaveToTraining";
|
||||
} else if (type === "LV-009") {
|
||||
checkForm.value = "FormLeaveToWorkInternational";
|
||||
} else if (type === "LV-010") {
|
||||
checkForm.value = "FormSpouse";
|
||||
} else if (type === "LV-011") {
|
||||
checkForm.value = "FormVocationalRehabilitation";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -323,7 +361,7 @@ function clickSave() {
|
|||
class="q-mr-sm"
|
||||
@click="router.push(`/leave`)"
|
||||
/>
|
||||
รายละเอียดการลาของ {{ formData.fullname }}
|
||||
รายละเอียดการลาของ {{ formData.fullName }}
|
||||
</div>
|
||||
<div>
|
||||
<q-btn
|
||||
|
|
@ -373,10 +411,7 @@ function clickSave() {
|
|||
<div class="col-12 row">
|
||||
<div class="col-xs-5 col-sm-3 text-grey-8">ประเภทการลา</div>
|
||||
<div class="col text-primary">
|
||||
{{
|
||||
formData.leaveTypeId &&
|
||||
stores.convertLeave(formData.leaveTypeId)
|
||||
}}
|
||||
{{ formData.leaveTypeName }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 row">
|
||||
|
|
@ -384,7 +419,7 @@ function clickSave() {
|
|||
ชื่อ - นามสกุล
|
||||
</div>
|
||||
<div class="col text-weight-medium">
|
||||
{{ formData.fullname }}
|
||||
{{ formData.fullName }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -409,7 +444,7 @@ function clickSave() {
|
|||
class="col-12 items-center row q-px-md q-py-sm"
|
||||
>
|
||||
<div class="text-h6 text-weight-bold text-light-blue-6">
|
||||
{{ formData.leaveTotal }}
|
||||
{{ formData.leaveSummary }}
|
||||
</div>
|
||||
<div class="col-12 text-subtitle2 text-weight-regular">
|
||||
<span class="gt-xs">ใช้ไป</span>
|
||||
|
|
@ -464,7 +499,7 @@ function clickSave() {
|
|||
:data="formData"
|
||||
/>
|
||||
|
||||
<!-- ลาประกอบพิธีฮัจย์ -->
|
||||
<!-- ลาประกอบพิธีฮัจญ์ -->
|
||||
<FormHajj v-else-if="checkForm === 'FormHajj'" :data="formData" />
|
||||
|
||||
<!-- ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล -->
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from "vue";
|
||||
import { ref, reactive, onMounted, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
|
@ -29,34 +29,35 @@ const $q = useQuasar(); //ใช้ noti quasar
|
|||
|
||||
//
|
||||
const querySting = reactive<QuerySting>({
|
||||
year: new Date().getFullYear(), //*ปีในการยื่นขอใบลา(ใช้เป็น คศ.)
|
||||
type: "00000000-0000-0000-0000-000000000000", //*Id ประเภทการลา
|
||||
status: "ALL", //*สถานะการของลา
|
||||
year: leaveStore.filter.year, //*ปีในการยื่นขอใบลา(ใช้เป็น คศ.)
|
||||
type: leaveStore.filter.type, //*Id ประเภทการลา
|
||||
status: leaveStore.filter.status, //*สถานะการของลา
|
||||
page: 1, //*หน้า
|
||||
pageSize: 10, //*จำนวนแถวต่อหน้า
|
||||
keyword: "", //keyword ค้นหา
|
||||
keyword: leaveStore.filter.keyword, //keyword ค้นหา
|
||||
});
|
||||
const maxPage = ref<number>(1);
|
||||
|
||||
//** เรียกข้อมูลจาก API*/
|
||||
async function fecthLeaveList() {
|
||||
// showLoader();
|
||||
// await http
|
||||
// .post(config.API.leaveList(), querySting)
|
||||
// .then((res) => {
|
||||
// console.log(res);
|
||||
|
||||
// maxPage.value = Math.ceil(data.length / querySting.pageSize);
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// messageError($q, err);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// hideLoader();
|
||||
// });
|
||||
const data = APIDATA.data;
|
||||
maxPage.value = Math.ceil(data.length / querySting.pageSize);
|
||||
fetchListLeave(data); /** ส่งข้อมูลไป stores*/
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.leaveList(), querySting)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
const data = res.data.result;
|
||||
maxPage.value = Math.ceil(data.total / querySting.pageSize);
|
||||
fetchListLeave(data.data); /** ส่งข้อมูลไป stores*/
|
||||
console.log(maxPage.value);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
// const data = APIDATA.data;
|
||||
// maxPage.value = Math.ceil(data.length / querySting.pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -83,6 +84,13 @@ async function updatePaging(
|
|||
onMounted(async () => {
|
||||
await fecthLeaveList();
|
||||
});
|
||||
|
||||
watch(
|
||||
() => leaveStore.tabView,
|
||||
async () => {
|
||||
leaveStore.tabView === "list" && (await fecthLeaveList());
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<template>
|
||||
<q-toolbar class="text-primary" style="padding: 0">
|
||||
|
|
|
|||
|
|
@ -27,31 +27,31 @@ const { fetchListLeaveReject } = leaveStore;
|
|||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
|
||||
const querySting = reactive<QuerySting>({
|
||||
year: new Date().getFullYear(), //*ปีในการยื่นขอใบลา(ใช้เป็น คศ.)
|
||||
type: "00000000-0000-0000-0000-000000000000", //*Id ประเภทการลา
|
||||
status: "ALL", //*สถานะการของลา
|
||||
year: leaveStore.filter.year, //*ปีในการยื่นขอใบลา(ใช้เป็น คศ.)
|
||||
type: leaveStore.filter.type, //*Id ประเภทการลา
|
||||
status: leaveStore.filter.status, //*สถานะการของลา
|
||||
page: 1, //*หน้า
|
||||
pageSize: 5, //*จำนวนแถวต่อหน้า
|
||||
keyword: "", //keyword ค้นหา
|
||||
keyword: leaveStore.filter.keyword, //keyword ค้นหา
|
||||
});
|
||||
const maxPage = ref<number>(1);
|
||||
|
||||
//** เรียกข้อมูลจาก API*/
|
||||
async function fecthLeaveList() {
|
||||
// showLoader();
|
||||
// await http
|
||||
// .post(config.API.leaveListDelete(), querySting)
|
||||
// .then((res) => {
|
||||
// console.log(res);
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.leaveListDelete(), querySting)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
|
||||
// maxPage.value = Math.ceil(data.length / querySting.pageSize);
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// messageError($q, err);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// hideLoader();
|
||||
// });
|
||||
maxPage.value = Math.ceil(data.length / querySting.pageSize);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
const data = APIDATA.data;
|
||||
|
||||
fetchListLeaveReject(data); /** ส่งข้อมูลไป stores*/
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@ const columnsLeave = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "fullname",
|
||||
name: "fullName",
|
||||
align: "left",
|
||||
label: "ผู้ยื่นใบลา",
|
||||
sortable: true,
|
||||
field: "fullname",
|
||||
field: "fullName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
|
|
@ -66,7 +66,7 @@ const columnsLeave = ref<QTableProps["columns"]>([
|
|||
const visibleColumnsLeave = ref<string[]>([
|
||||
"no",
|
||||
"leaveTypeName",
|
||||
"fullname",
|
||||
"fullName",
|
||||
"dateSendLeave",
|
||||
"status",
|
||||
]);
|
||||
|
|
@ -91,11 +91,11 @@ const columnsReject = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "fullname",
|
||||
name: "fullName",
|
||||
align: "left",
|
||||
label: "ผู้ยื่นยกเลิกใบลา",
|
||||
sortable: true,
|
||||
field: "fullname",
|
||||
field: "fullName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
|
|
@ -121,7 +121,7 @@ const columnsReject = ref<QTableProps["columns"]>([
|
|||
const visibleReject = ref<string[]>([
|
||||
"no",
|
||||
"leaveTypeName",
|
||||
"fullname",
|
||||
"fullName",
|
||||
"dateSendLeave",
|
||||
"status",
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ function updateQuerySting(
|
|||
|
||||
/** function ค้นหาข้อมูลใน Table*/
|
||||
async function filterListLeave() {
|
||||
updateQuerySting(1, 0, filter);
|
||||
updateQuerySting(1, 0, leaveStore.filter);
|
||||
}
|
||||
|
||||
/** Option*/
|
||||
|
|
@ -150,7 +150,7 @@ onMounted(async () => {
|
|||
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="filter.year"
|
||||
v-model="leaveStore.filter.year"
|
||||
class="col-2"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
|
|
@ -167,7 +167,7 @@ onMounted(async () => {
|
|||
dense
|
||||
lazy-rules
|
||||
outlined
|
||||
:model-value="Number(filter.year) + 543"
|
||||
:model-value="Number(leaveStore.filter.year) + 543"
|
||||
:label="`${'ปีงบประมาณ'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
|
|
@ -189,7 +189,7 @@ onMounted(async () => {
|
|||
map-options
|
||||
outlined
|
||||
dense
|
||||
v-model="filter.type"
|
||||
v-model="leaveStore.filter.type"
|
||||
:options="optionType"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
|
|
@ -215,7 +215,7 @@ onMounted(async () => {
|
|||
map-options
|
||||
outlined
|
||||
dense
|
||||
v-model="filter.status"
|
||||
v-model="leaveStore.filter.status"
|
||||
:options="optionStatus"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
|
|
@ -240,7 +240,7 @@ onMounted(async () => {
|
|||
for="filterTable"
|
||||
dense
|
||||
outlined
|
||||
v-model="filter.keyword"
|
||||
v-model="leaveStore.filter.keyword"
|
||||
label="ค้นหา"
|
||||
@keydown.enter.prevent="filterListLeave"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ console.log(props);
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">จำนวนวันที่ลา</div>
|
||||
<div class="col">{{ props.data.leaveCount }}</div>
|
||||
<div class="col">{{ props.data.leaveTotal }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">ได้รับหมายเรียกของ</div>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ const props = defineProps({
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">จำนวนวันที่ลา</div>
|
||||
<div class="col">{{ props.data.leaveCount }}</div>
|
||||
<div class="col">{{ props.data.leaveTotal }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">ชื่อภรรยา</div>
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@ const props = defineProps({
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">จำนวนวันที่ลา</div>
|
||||
<div class="col">{{ props.data.leaveCount }}</div>
|
||||
<div class="col">{{ props.data.leaveTotal }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">วันที่เข้ารับราชการ</div>
|
||||
<div class="col">{{ props.data.leavegovernmentDate }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">เคย/ไม่เคยไปประกอบพิธีฮัจย์</div>
|
||||
<div class="col text-grey-8">เคย/ไม่เคยไปประกอบพิธีฮัจญ์</div>
|
||||
<div class="col">{{ props.data.hajjDayStatus ? "เคย" : "ไม่เคย" }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ const props = defineProps({
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">จำนวนวันที่ลา</div>
|
||||
<div class="col">{{ props.data.leaveCount }}</div>
|
||||
<div class="col">{{ props.data.leaveTotal }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8"></div>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ const props = defineProps({
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">จำนวนวันที่ลา</div>
|
||||
<div class="col">{{ props.data.leaveCount }}</div>
|
||||
<div class="col">{{ props.data.leaveTotal }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8"></div>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ const props = defineProps({
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">จำนวนวันที่ลา</div>
|
||||
<div class="col">{{ props.data.leaveCount }}</div>
|
||||
<div class="col">{{ props.data.leaveTotal }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">วันเดือนปีเกิด</div>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ console.log(props);
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4 text-grey-8">ชื่อผู้ยื่นขอ</div>
|
||||
<div class="col">{{ props.data.fullname }}</div>
|
||||
<div class="col">{{ props.data.fullName }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4 text-grey-8">ตำแหน่งผู้ยืนขอ</div>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ const props = defineProps({
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">จำนวนวันที่ลา</div>
|
||||
<div class="col">{{ props.data.leaveCount }}</div>
|
||||
<div class="col">{{ props.data.leaveTotal }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">วันเดือนปีเกิด</div>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ const props = defineProps({
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">จำนวนวันที่ลา</div>
|
||||
<div class="col">{{ props.data.leaveCount }}</div>
|
||||
<div class="col">{{ props.data.leaveTotal }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-grey-8">วันเดือนปีเกิด</div>
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ interface FremData {
|
|||
positionName: string; //ตำแหน่งผู้ยื่นขอ
|
||||
positionLevelName: string; //ระดับผู้ยื่นขอ
|
||||
organizationName: string; //สังกัดผู้ยื่นขอ
|
||||
leaveTypeName: string | null; //Name ประเภทการลา
|
||||
leaveTypeId: string | null; //Id ประเภทการลา
|
||||
fullname: string; //คำนำหน้า ชื่อ นามสกุล คนขอลา
|
||||
leaveTypeName: string; //Name ประเภทการลา
|
||||
leaveTypeId: string; //Id ประเภทการลา
|
||||
fullName: string; //คำนำหน้า ชื่อ นามสกุล คนขอลา
|
||||
dateSendLeave: Date | null; //วันที่ยื่นใบลา
|
||||
leaveDateStart: Date | null; //วันเริ่มการลา
|
||||
leaveDateEnd: Date | null; //วันสิ้นสุดการลา
|
||||
|
|
|
|||
|
|
@ -2,10 +2,18 @@ interface DataRows {
|
|||
id: string; //*Id การยื่นขอลา
|
||||
leaveTypeName: string | null; //Name ประเภทการลา
|
||||
leaveTypeId: string; //Id ประเภทการลา
|
||||
fullname: string; //คำนำหน้า ชื่อ นามสกุล คนขอลา
|
||||
fullName: string; //คำนำหน้า ชื่อ นามสกุล คนขอลา
|
||||
dateSendLeave: string | null; //วันที่ยื่นใบลา
|
||||
status: string | null; //ส
|
||||
}
|
||||
interface ListLeave {
|
||||
id: string; //*Id การยื่นขอลา
|
||||
leaveTypeName: string | null; //Name ประเภทการลา
|
||||
leaveTypeId: string; //Id ประเภทการลา
|
||||
fullName: string; //คำนำหน้า ชื่อ นามสกุล คนขอลา
|
||||
dateSendLeave: Date | null; //วันที่ยื่นใบลา
|
||||
status: string | null; //ส
|
||||
}
|
||||
interface FormData {
|
||||
id: string;
|
||||
leaveType: string;
|
||||
|
|
@ -18,5 +26,17 @@ interface DataDateMonthObject {
|
|||
month: number;
|
||||
year: number;
|
||||
}
|
||||
interface LeaveType {
|
||||
code: string;
|
||||
createdAt: Date;
|
||||
createdFullName: string;
|
||||
createdUserId: string;
|
||||
id: string;
|
||||
lastUpdateFullName: string;
|
||||
lastUpdateUserId: string;
|
||||
lastUpdatedAt: Date | null;
|
||||
limit: Number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type { DataRows, FormData, DataDateMonthObject };
|
||||
export type { DataRows, FormData, DataDateMonthObject, ListLeave, LeaveType };
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ref, reactive } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/** importType*/
|
||||
import type { DateFilter } from "@/modules/09_leave/interface/request/leave";
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { DataRows } from "@/modules/09_leave/interface/response/leave";
|
||||
import type {
|
||||
DataRows,
|
||||
ListLeave,
|
||||
} from "@/modules/09_leave/interface/response/leave";
|
||||
import type { FremData } from "@/modules/09_leave/interface/request/leave";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
|
|
@ -16,6 +20,13 @@ export const useLeavelistDataStore = defineStore("leave", () => {
|
|||
|
||||
/** ข้อมูล Tab 1*/
|
||||
const tabView = ref<string>("list");
|
||||
/** filter*/
|
||||
const filter = reactive<DateFilter>({
|
||||
year: new Date().getFullYear(), //*ปีในการยื่นขอใบลา(ใช้เป็น คศ.)
|
||||
type: "00000000-0000-0000-0000-000000000000", //*Id ประเภทการลา
|
||||
status: "ALL", //*สถานะการของลา
|
||||
keyword: "", //keyword ค้นหา
|
||||
});
|
||||
|
||||
/**ข้อมูลใน Table*/
|
||||
const mainData = ref<any>([]);
|
||||
|
|
@ -29,14 +40,14 @@ export const useLeavelistDataStore = defineStore("leave", () => {
|
|||
* ฟังก์ชั่น fetchListLeave
|
||||
* @param data รับข้อมูลจาก Page
|
||||
*/
|
||||
async function fetchListLeave(data: any[]) {
|
||||
let datalist = data.map((e: FremData) => ({
|
||||
async function fetchListLeave(data: ListLeave[]) {
|
||||
let datalist = data.map((e: ListLeave) => ({
|
||||
id: e.id,
|
||||
leaveTypeName: e.leaveTypeId && convertLeave(e.leaveTypeId),
|
||||
leaveTypeName: e.leaveTypeName,
|
||||
leaveTypeId: e.leaveTypeId,
|
||||
fullname: e.fullname,
|
||||
fullName: e.fullName,
|
||||
dateSendLeave: e.dateSendLeave && date2Thai(e.dateSendLeave),
|
||||
status: convertSatatus(e.status),
|
||||
status: e.status && convertSatatus(e.status),
|
||||
}));
|
||||
|
||||
mainData.value = datalist;
|
||||
|
|
@ -52,7 +63,7 @@ export const useLeavelistDataStore = defineStore("leave", () => {
|
|||
id: e.id,
|
||||
leaveTypeName: e.leaveTypeId && convertLeave(e.leaveTypeId),
|
||||
leaveTypeId: e.leaveTypeId,
|
||||
fullname: e.fullname,
|
||||
fullName: e.fullName,
|
||||
dateSendLeave: e.dateSendLeave && date2Thai(e.dateSendLeave),
|
||||
status: convertSatatus2(e.status),
|
||||
}));
|
||||
|
|
@ -75,6 +86,8 @@ export const useLeavelistDataStore = defineStore("leave", () => {
|
|||
return "อนุมัติ";
|
||||
case "REJECT":
|
||||
return "ไม่อนุมัติ";
|
||||
case "DELETE":
|
||||
return "ยกเลิก";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,6 +188,8 @@ export const useLeavelistDataStore = defineStore("leave", () => {
|
|||
/** ข้อมูล Main*/
|
||||
tabMenu,
|
||||
/** ข้อมูล Tab1*/
|
||||
/** filter */
|
||||
filter,
|
||||
tabView,
|
||||
/**ข้อมูลใน Table */
|
||||
rows,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue