ปรับโค้ดวินัย
This commit is contained in:
parent
1483bbcac7
commit
c81b5db558
17 changed files with 93 additions and 196 deletions
|
|
@ -1,17 +1,15 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch, type PropType } from "vue";
|
||||
// import config from "@/app.config";
|
||||
// import http from "@/plugins/http";
|
||||
import { useQuasar } from "quasar";
|
||||
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 moment from "moment";
|
||||
|
||||
import type { CalendarOptions } from "@fullcalendar/core";
|
||||
import type { DataDateMonthObject } from "@/modules/09_leave/interface/response/leave";
|
||||
import type { ExtendHistoryObject } from "@/modules/11_discipline/interface/response/Main";
|
||||
|
||||
|
|
@ -80,19 +78,6 @@ const dateMonth = ref<DataDateMonthObject>({
|
|||
year: new Date().getFullYear(),
|
||||
});
|
||||
|
||||
/** function เรียกข่อมูล calendar*/
|
||||
// function getRandomColor() {
|
||||
// return (
|
||||
// "hsl(" +
|
||||
// 360 * Math.random() +
|
||||
// "," +
|
||||
// (25 + 70 * Math.random()) +
|
||||
// "%," +
|
||||
// (85 + 10 * Math.random()) +
|
||||
// "%)"
|
||||
// );
|
||||
// }
|
||||
|
||||
async function fetchCalendar() {
|
||||
showLoader();
|
||||
const defaultColor = "#e3fdda";
|
||||
|
|
@ -123,14 +108,6 @@ async function fetchCalendar() {
|
|||
}, 1000);
|
||||
}
|
||||
|
||||
// function generateGradientColors(length: number) {
|
||||
// const colors = [];
|
||||
// for (let i = 0; i < length; i++) {
|
||||
// colors.push(getRandomColor());
|
||||
// }
|
||||
// return colors;
|
||||
// }
|
||||
|
||||
/**
|
||||
* function convert เดือนปี
|
||||
* @param val เดือนปี
|
||||
|
|
|
|||
|
|
@ -70,6 +70,12 @@ const phone = ref("000-00000000");
|
|||
const reason = ref("ยกเลิกการลา");
|
||||
const model = ref(null);
|
||||
const modeCancel = ref(true);
|
||||
const dateMonth = ref<DataDateMonthObject>({
|
||||
month: new Date().getMonth(),
|
||||
year: new Date().getFullYear(),
|
||||
});
|
||||
|
||||
const dateYear = ref<number>(new Date().getFullYear());
|
||||
|
||||
async function fetchCalendar() {
|
||||
showLoader();
|
||||
|
|
@ -107,13 +113,6 @@ async function fetchCalendar() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* เรียกฟังก์ชันทั้งหมดตอนเรียกใช้ไฟล์นี้
|
||||
*/
|
||||
onMounted(async () => {
|
||||
fetchCalendar();
|
||||
});
|
||||
|
||||
/** function เปลี่ยนปฎิทิน*/
|
||||
function changCalendar() {
|
||||
fetchCalendar();
|
||||
|
|
@ -128,23 +127,18 @@ async function cancel(text: string) {
|
|||
modalCancel.value = true;
|
||||
modeCancel.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชั่นเปิด model
|
||||
* @param text
|
||||
*/
|
||||
const view = async (text: string) => {
|
||||
async function view(text: string){
|
||||
title.value = text;
|
||||
modalCancel.value = true;
|
||||
modeCancel.value = false;
|
||||
};
|
||||
|
||||
const dateMonth = ref<DataDateMonthObject>({
|
||||
month: new Date().getMonth(),
|
||||
year: new Date().getFullYear(),
|
||||
});
|
||||
|
||||
const dateYear = ref<number>(new Date().getFullYear());
|
||||
const updateMonth = async (e: DataDateMonthObject) => {
|
||||
async function updateMonth(e: DataDateMonthObject){
|
||||
if (e != null) {
|
||||
dateYear.value = e.year;
|
||||
|
||||
|
|
@ -152,10 +146,17 @@ const updateMonth = async (e: DataDateMonthObject) => {
|
|||
}
|
||||
};
|
||||
|
||||
const monthYearThai = (val: DataDateMonthObject) => {
|
||||
function monthYearThai(val: DataDateMonthObject){
|
||||
if (val == null) return "";
|
||||
else return monthYear2Thai(val.month, val.year);
|
||||
};
|
||||
|
||||
/**
|
||||
* เรียกฟังก์ชันทั้งหมดตอนเรียกใช้ไฟล์นี้
|
||||
*/
|
||||
onMounted(async () => {
|
||||
fetchCalendar();
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div class="q-ma-sm">
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import type {
|
|||
MyObjectInvestigateRef,
|
||||
} from "@/modules/11_discipline/interface/request/investigateFact";
|
||||
|
||||
import type { ArrayPersonAdd } from "@/modules/11_discipline/interface/response/investigate";
|
||||
import config from "@/app.config";
|
||||
import http from "@/plugins/http";
|
||||
|
||||
|
|
@ -137,23 +136,6 @@ const formData = reactive<FormData>({
|
|||
isDisciplinary: false,
|
||||
});
|
||||
|
||||
/** maping ref เข้าตัวแปรเพื่อเตรียมตรวจสอบ */
|
||||
const objectInvestigate: MyObjectInvestigateRef = {
|
||||
// complaint: complaintRef,
|
||||
// complaintdetail: complaintdetailRef,
|
||||
// investigationDescription: investigationDescriptionRef,
|
||||
// fault: faultRef,
|
||||
// investigationDetailOther: investigationDetailOtherRef,
|
||||
// fileComplaint: fileComplaintRef,
|
||||
// date: dateRef,
|
||||
// dateEnd: dateEndRef,
|
||||
// investigationDetail: investigationDetailRef,
|
||||
// daysExtend: daysExtendRef,
|
||||
// investigationStatusResult: investigationStatusResultRef,
|
||||
// investigationCauseText: investigationCauseTextRef,
|
||||
// result: resultRef,
|
||||
};
|
||||
|
||||
const rows = ref([]);
|
||||
const rowsChack = ref([]);
|
||||
const statusStep = computed(() => {
|
||||
|
|
@ -181,23 +163,8 @@ const calendarModalclose = () => (calendarModal.value = !calendarModal.value);
|
|||
|
||||
/*** ฟังก์ชั่นสำหรับ validate ฟอร์ม */
|
||||
function validateForm() {
|
||||
const hasError = [];
|
||||
for (const key in objectInvestigate) {
|
||||
if (Object.prototype.hasOwnProperty.call(objectInvestigate, key)) {
|
||||
const property = objectInvestigate[key];
|
||||
if (property.value && typeof property.value.validate === "function") {
|
||||
const isValid = property.value.validate();
|
||||
hasError.push(isValid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasError.every((result) => result === true)) {
|
||||
countNum.value = 1
|
||||
onSubmit();
|
||||
} else {
|
||||
console.log("ไม่ผ่าน ");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -581,14 +548,13 @@ function emitPerson(data: FormData[]) {
|
|||
Id: dataMapId,
|
||||
})
|
||||
.then((res) => {
|
||||
// router.push(`/discipline/investigatefacts`);
|
||||
getOc();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
getOc();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue