Refactoring code module 08_registryEmployee
This commit is contained in:
parent
bd33093d3e
commit
7091eaaeb9
31 changed files with 169 additions and 24405 deletions
|
|
@ -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 = "";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue