Refactoring code module 05_leave
This commit is contained in:
parent
763ec2fd95
commit
4253226ac3
23 changed files with 383 additions and 532 deletions
|
|
@ -1,8 +1,11 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useLeaveStore } from "@/modules/05_leave/store";
|
||||
|
||||
/** import type*/
|
||||
import type {
|
||||
|
|
@ -13,8 +16,6 @@ import type {
|
|||
} from "@/modules/05_leave/interface/response/leave";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
/** import componest*/
|
||||
import FormLeave from "@/modules/05_leave/components/formDetail/01_SickForm.vue";
|
||||
import FormChildbirth from "@/modules/05_leave/components/formDetail/04_HelpWifeBirthForm.vue";
|
||||
import FormHoliday from "@/modules/05_leave/components/formDetail/05_VacationForm.vue";
|
||||
|
|
@ -28,16 +29,9 @@ import FormSpouse from "@/modules/05_leave/components/formDetail/12_FollowSpouse
|
|||
import FormVocationalRehabilitation from "@/modules/05_leave/components/formDetail/13_RehabilitationForm.vue";
|
||||
import FormCancel from "@/modules/05_leave/components/formDetail/formCancel.vue";
|
||||
|
||||
/** import stort*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useLeaveStore } from "@/modules/05_leave/store";
|
||||
|
||||
/**ตัวแปร */
|
||||
const $q = useQuasar();
|
||||
const dataStore = useLeaveStore();
|
||||
const { convertStatud } = dataStore;
|
||||
const titleMain = ref<string>("รายละเอียดการลาของ");
|
||||
const titleMainCancle = ref<string>("รายละเอียดการยกเลิกการลาของ");
|
||||
const titleName = ref<string>("");
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
showLoader,
|
||||
|
|
@ -48,7 +42,11 @@ const {
|
|||
dialogConfirm,
|
||||
calculateDurationYmd,
|
||||
} = mixin;
|
||||
const $q = useQuasar();
|
||||
|
||||
const checkForm = ref<string>("");
|
||||
const titleMain = ref<string>("รายละเอียดการลาของ");
|
||||
const titleMainCancle = ref<string>("รายละเอียดการยกเลิกการลาของ");
|
||||
const titleName = ref<string>("");
|
||||
|
||||
/**Prop */
|
||||
const props = defineProps({
|
||||
|
|
@ -79,7 +77,6 @@ const props = defineProps({
|
|||
});
|
||||
|
||||
/**checkForm Form การลา*/
|
||||
const checkForm = ref<string>("");
|
||||
|
||||
/** Form รายละเอียดข้อมูล*/
|
||||
const formData = reactive<FremDetail>({
|
||||
|
|
@ -214,7 +211,6 @@ async function fetchDataDetail(id: string) {
|
|||
data.leaveLastStart && date2Thai(data.leaveLastStart);
|
||||
formData.leaveLastEnd =
|
||||
data.leaveLastStart && date2Thai(data.leaveLastEnd);
|
||||
// formData.leaveTotal = calculateDurationYmd(data.leaveStartDate, data.leaveEndDate)
|
||||
formData.leaveTotal = data.leaveTotal;
|
||||
formData.leavebirthDate =
|
||||
data.leaveBirthDate && date2Thai(data.leaveBirthDate);
|
||||
|
|
@ -272,7 +268,6 @@ async function fetchDataDetail(id: string) {
|
|||
formData.dear = data.dear ?? "-";
|
||||
checkLeaveType(
|
||||
formData.leaveTypeId,
|
||||
formData.leaveTypeName,
|
||||
formData.ordainDayLocationName,
|
||||
formData.studyDayTrainingSubject
|
||||
);
|
||||
|
|
@ -293,15 +288,12 @@ async function fetchDataDetail(id: string) {
|
|||
*/
|
||||
function checkLeaveType(
|
||||
leaveTypeId: string,
|
||||
leaveTypeName: string,
|
||||
ordainDayLocationName: string,
|
||||
studyDayTrainingSubject: string
|
||||
) {
|
||||
if (props.leaveType) {
|
||||
const filtertype = props.leaveType.find((e: any) => e.id === leaveTypeId);
|
||||
const type = filtertype.code;
|
||||
console.log(type);
|
||||
|
||||
if (type === "LV-001" || type === "LV-002" || type === "LV-003") {
|
||||
checkForm.value = "FormLeave";
|
||||
} else if (type === "LV-004") {
|
||||
|
|
@ -352,8 +344,6 @@ async function fetchDataCancelDetail(id: string) {
|
|||
formDataCancle.leaveResonDelete = data.leaveReasonDelete ?? "-";
|
||||
formDataCancle.leaveDetail = data.leaveDetail ?? "-";
|
||||
formDataCancle.leaveDocDelete = data.leaveDocDelete ?? null;
|
||||
|
||||
console.log(res);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -385,7 +375,6 @@ async function onClickSave() {
|
|||
"ต้องการยินยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
||||
);
|
||||
} else {
|
||||
console.log(hasError);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -573,7 +562,6 @@ watch(
|
|||
<q-card-section class="q-p-md row q-gutter-y-md">
|
||||
<div flat class="col-12">
|
||||
<div class="col-12 q-col-gutter-sm row items-center"></div>
|
||||
<!-- FormCancel -->
|
||||
<FormCancel :data="formDataCancle" />
|
||||
</div>
|
||||
</q-card-section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue