Refactoring code module 08_registryEmployee

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-19 17:09:26 +07:00
parent bd33093d3e
commit 7091eaaeb9
31 changed files with 169 additions and 24405 deletions

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, watch, reactive } from "vue";
import { ref, watch, reactive } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
@ -36,35 +36,39 @@ const props = defineProps({
});
const formData = reactive<FormDataEmployee>({
citizenId: "",
prefix: "",
rank: "",
firstName: "",
lastName: "",
birthDate: null,
gender: "",
relationship: "",
nationality: "",
ethnicity: "",
religion: "",
bloodGroup: "",
phone: "",
citizenId: "", //
prefix: "", //
rank: "", //
firstName: "", //
lastName: "", //
birthDate: null, ////
gender: "", //
relationship: "", //
nationality: "", //
ethnicity: "", //
religion: "", //
bloodGroup: "", //
phone: "", //
employeeClass: "TEMP",
});
const prefixOpsMain = ref<DataOption[]>([]);
const prefixOps = ref<DataOption[]>([]);
const rankOpsMain = ref<DataOption[]>([]);
const rankOps = ref<DataOption[]>([]);
const genderOpsMain = ref<DataOption[]>([]);
const genderOps = ref<DataOption[]>([]);
const statusOpsMain = ref<DataOption[]>([]);
const statusOps = ref<DataOption[]>([]);
const religionOpsMain = ref<DataOption[]>([]);
const religionOps = ref<DataOption[]>([]);
const bloodOpsMain = ref<DataOption[]>([]);
const bloodOps = ref<DataOption[]>([]);
//
const prefixOpsMain = ref<DataOption[]>([]); //
const prefixOps = ref<DataOption[]>([]); //
const rankOpsMain = ref<DataOption[]>([]); //
const rankOps = ref<DataOption[]>([]); //
const genderOpsMain = ref<DataOption[]>([]); //
const genderOps = ref<DataOption[]>([]); //
const statusOpsMain = ref<DataOption[]>([]); //
const statusOps = ref<DataOption[]>([]); //
const religionOpsMain = ref<DataOption[]>([]); //
const religionOps = ref<DataOption[]>([]); //
const bloodOpsMain = ref<DataOption[]>([]); //
const bloodOps = ref<DataOption[]>([]); //
/**
* งกนดงขอมลเกยวกบขอมลสวนต
*/
function fetchDataPerson() {
showLoader();
http
@ -134,6 +138,10 @@ function fetchDataPerson() {
});
}
/**
* งกนเชคเลขบตรประจำตวซ
* @param citizenId เลขบตรประจำต
*/
function changeCardID(citizenId: string | number | null) {
if (citizenId != null && typeof citizenId == "string") {
if (citizenId.length == 13 && citizenId) {
@ -153,7 +161,13 @@ function changeCardID(citizenId: string | number | null) {
}
}
const filterSelector = (val: string, update: Function, refData: string) => {
/**
* function นหาขอม Option
* @param val คำคนหา
* @param update function
* @param refData ประเภท
*/
function filterSelector(val: string, update: Function, refData: string) {
switch (refData) {
case "prefix":
update(() => {
@ -207,14 +221,20 @@ const filterSelector = (val: string, update: Function, refData: string) => {
default:
break;
}
};
}
/**
* งกนคำนวนอาย
*/
function calculateMaxDate() {
const today = new Date();
today.setFullYear(today.getFullYear() - 18);
return today;
}
/**
* งกนบนทกขอมลลกจางชวคราว
*/
function onSubmit() {
dialogConfirm($q, async () => {
showLoader();
@ -232,6 +252,9 @@ function onSubmit() {
});
}
/**
* งกนป popup
*/
function closeDialog() {
modal.value = false;
formData.citizenId = "";