Refactoring code module 04_registryPerson

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-18 17:24:21 +07:00
parent 1164d79122
commit eeb92dfb5d
46 changed files with 1935 additions and 2230 deletions

View file

@ -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":