Refactoring code module 04_registryPerson
This commit is contained in:
parent
1164d79122
commit
eeb92dfb5d
46 changed files with 1935 additions and 2230 deletions
|
|
@ -13,18 +13,17 @@ import type {
|
|||
zipCodeOption,
|
||||
} from "@/modules/04_registryPerson/interface/index/Main";
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
showLoader,
|
||||
hideLoader,
|
||||
|
||||
messageError,
|
||||
} = mixin;
|
||||
|
||||
export const useAddressDataStore = defineStore("addess", () => {
|
||||
const $q = useQuasar();
|
||||
const profileIdBefore = ref<string>("");
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
showLoader,
|
||||
hideLoader,
|
||||
date2Thai,
|
||||
messageError,
|
||||
convertDate,
|
||||
dateToISO,
|
||||
} = mixin;
|
||||
|
||||
const Ops = ref<AddressOps>({
|
||||
provinceOps: [],
|
||||
|
|
@ -73,6 +72,9 @@ export const useAddressDataStore = defineStore("addess", () => {
|
|||
return ops.find((r: { id: string }) => r.id === id) || {};
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชันดึงข้อมูลจังหวัด
|
||||
*/
|
||||
async function fetchProvince() {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -94,6 +96,11 @@ export const useAddressDataStore = defineStore("addess", () => {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชันดึงข้อมูล เขต / อำเภอ
|
||||
* @param id จังหวัด
|
||||
* @param position ที่อยู่ตามทะเบียนบ้าน, ที่อยู่ปัจจุบัน
|
||||
*/
|
||||
async function fetchDistrict(id: string | null, position: string) {
|
||||
if (!id) return;
|
||||
showLoader();
|
||||
|
|
@ -122,6 +129,11 @@ export const useAddressDataStore = defineStore("addess", () => {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชันดึงข้อมูล แขวง / ตำบล
|
||||
* @param id เขต / อำเภอ
|
||||
* @param position ที่อยู่ตามทะเบียนบ้าน, ที่อยู่ปัจจุบัน
|
||||
*/
|
||||
async function fetchSubDistrict(id: string | null, position: string) {
|
||||
if (!id) return;
|
||||
showLoader();
|
||||
|
|
@ -153,6 +165,12 @@ export const useAddressDataStore = defineStore("addess", () => {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังกชันค้นหาข้อมูลใน select
|
||||
* @param val คำที่ต้องการค้นหา
|
||||
* @param update function
|
||||
* @param refData ประเภทตัวเลือก
|
||||
*/
|
||||
function filterSelector(val: any, update: Function, refData: string) {
|
||||
switch (refData) {
|
||||
case "provinceOps":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue