แก้ไข loader

This commit is contained in:
Thanit Konmek 2023-08-04 10:04:59 +07:00
parent f072224851
commit b663eedb09
147 changed files with 3095 additions and 3256 deletions

View file

@ -289,7 +289,7 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
@ -321,10 +321,9 @@ const emit = defineEmits(["update:statusEdit"]);
const route = useRoute();
const $q = useQuasar();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { date2Thai, success, messageError } = mixin;
const { date2Thai, success, messageError, showLoader, hideLoader } = mixin;
const edit = ref<boolean>(false);
const addressData = ref<Address>(defaultAddress);
const myform = ref<any>();
@ -582,7 +581,7 @@ const filterSelector = (val: any, update: Function, refData: string) => {
*/
const clickHistory = async () => {
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileAdrsHisId(route.params.id.toString()))
.then((res) => {
@ -610,7 +609,7 @@ const clickHistory = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -630,7 +629,7 @@ const getNewData = async () => {
const fetchData = async () => {
if (route.params.id) {
loaderPage(true);
showLoader();
await http
.get(config.API.profileAdrsId(route.params.id.toString()))
.then((res) => {
@ -649,7 +648,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
@ -682,7 +681,7 @@ const editData = async () => {
createdAt: new Date(),
createdFullName: "-",
};
loaderPage(true);
showLoader();
await http
.put(config.API.profileAdrsId(route.params.id.toString()), body)
.then((res) => {
@ -699,7 +698,7 @@ const editData = async () => {
};
const addData = async () => {
// loaderPage(true);
// showLoader();
// await http
// .put(config.API.profileInforId(route.params.id.toString()), body)
// .then((res) => {
@ -774,7 +773,7 @@ const selectSubDistrict = (e: string | null, name: string) => {
};
const fetchProvince = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.province)
.then((res) => {
@ -790,13 +789,13 @@ const fetchProvince = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchDistrict = async (id: string | null, position: string) => {
if (id != null && id != "") {
loaderPage(true);
showLoader();
await http
.get(config.API.listDistrict(id))
.then((res) => {
@ -817,14 +816,14 @@ const fetchDistrict = async (id: string | null, position: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
const fetchSubDistrict = async (id: string | null, position: string) => {
if (id != null && id != "") {
loaderPage(true);
showLoader();
await http
.get(config.API.listSubDistrict(id))
.then((res) => {
@ -849,7 +848,7 @@ const fetchSubDistrict = async (id: string | null, position: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};

View file

@ -261,7 +261,7 @@ import { onMounted, ref, watch } from "vue";
import { useRoute } from "vue-router";
import { useProfileDataStore } from "@/modules/04_registry/store";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import ProfileTable from "@/modules/04_registry/components/Table.vue";
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
import DialogFooter from "@/modules/04_registry/components/DialogFooter.vue";
@ -290,8 +290,7 @@ const props = defineProps({
const $q = useQuasar();
const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError } = mixin;
const route = useRoute();
@ -487,7 +486,7 @@ onMounted(async () => {
const fetchData = async () => {
if (profileId.value) {
loaderPage(true);
showLoader();
await http
.get(config.API.profileCertId(profileId.value))
.then((res) => {
@ -510,7 +509,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
@ -599,7 +598,7 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
showLoader();
await http
.post(config.API.profileCertId(profileId.value), {
id: id.value,
@ -625,7 +624,7 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
loaderPage(true);
showLoader();
await http
.put(config.API.profileCertId(id.value), {
id: id.value,
@ -659,7 +658,7 @@ const clickDelete = async () => {
persistent: true,
})
.onOk(async () => {
loaderPage(true);
showLoader();
await http
.delete(config.API.profileCertId(id.value))
.then((res) => {
@ -773,7 +772,7 @@ const clickHistory = async (row: RequestItemsObject) => {
? "ประวัติแก้ไขใบอนุญาตของลูกจ้าง"
: "ประวัติแก้ไขใบอนุญาตประกอบอาชีพ";
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileCertHisId(row.id))
.then((res) => {
@ -796,7 +795,7 @@ const clickHistory = async (row: RequestItemsObject) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -1089,7 +1089,7 @@
import { ref, onMounted } from "vue";
import type { QForm } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import { useQuasar } from "quasar";
import type {
Family,
@ -1124,10 +1124,9 @@ const emit = defineEmits(["update:statusEdit"]);
const route = useRoute();
const $q = useQuasar();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { date2Thai, success, messageError } = mixin;
const { date2Thai, success, messageError, showLoader, hideLoader } = mixin;
const edit = ref<boolean>(false);
const fix = ref<boolean>(true);
const myform = ref<QForm | null>(null);
@ -1233,7 +1232,7 @@ const refreshData = async () => {
};
const fetchPrefix = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.prefix)
.then((res) => {
@ -1249,7 +1248,7 @@ const fetchPrefix = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1279,7 +1278,7 @@ const deleteChildren = (items: childrenFamily) => {
const fetchHistory = async () => {
familyDataHistory.value = [];
loaderPage(true);
showLoader();
await http
.get(config.API.profileFamiHisId(route.params.id.toString()))
.then((res) => {
@ -1317,7 +1316,7 @@ const fetchHistory = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
if (familyDataHistory.value.length == 0) {
// modalError(
// $q,
@ -1340,7 +1339,7 @@ const fetchHistory = async () => {
const fetchData = async () => {
if (route.params.id) {
loaderPage(true);
showLoader();
await http
.get(config.API.profileFamiId(route.params.id.toString()))
.then((res) => {
@ -1393,13 +1392,13 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
}
};
const editData = async () => {
loaderPage(true);
showLoader();
const body: ResponseObject = {
couple: familyData.value.same == "1",
couplePrefixId: familyData.value.prefixIdC,
@ -1441,7 +1440,7 @@ const editData = async () => {
};
const addData = async () => {
// loaderPage(true);
// showLoader();
// await http
// .put(config.API.profileInforId(route.params.id.toString()), body)
// .then((res) => {

View file

@ -330,7 +330,7 @@
<script setup lang="ts">
import { onMounted, ref, watch } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import { useQuasar } from "quasar";
import type { Goverment } from "@/modules/04_registry/components/profileType";
import { defaultGoverment } from "@/modules/04_registry/components/profileType";
@ -363,10 +363,10 @@ const emit = defineEmits(["update:statusEdit"]);
const route = useRoute();
const $q = useQuasar();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError } = mixin;
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
mixin;
const profileStore = useProfileDataStore();
const { birthDate, retireText } = storeToRefs(profileStore);
const edit = ref<boolean>(false);
@ -611,7 +611,7 @@ watch(retireText, async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.profileGovId(route.params.id.toString()))
.then((res) => {
@ -637,7 +637,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
@ -647,7 +647,7 @@ const refreshData = async () => {
};
const editData = async () => {
loaderPage(true);
showLoader();
await http
.put(config.API.profileGovId(route.params.id.toString()), {
dateAppoint: dateToISO(govermentData.value.containDate),
@ -682,7 +682,7 @@ const handleDate = async (modelData: Date) => {
};
const fetchCalAgeGov = async (date: Date) => {
loaderPage(true);
showLoader();
const body = {
dateAppoint: date,
};
@ -696,7 +696,7 @@ const fetchCalAgeGov = async (date: Date) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
@ -705,7 +705,7 @@ const fetchCalAgeGov = async (date: Date) => {
*/
const clickHistory = async () => {
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileGovHisId(route.params.id.toString()))
.then((res) => {
@ -738,7 +738,7 @@ const clickHistory = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};

View file

@ -409,7 +409,7 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import { useQuasar } from "quasar";
import type {
Information,
@ -450,9 +450,16 @@ const emit = defineEmits(["update:statusEdit"]);
const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError, dialogMessage } = mixin;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const {
date2Thai,
success,
dateToISO,
messageError,
dialogMessage,
showLoader,
hideLoader,
} = mixin;
const profileStore = useProfileDataStore();
const { changeRetireText, changeBirth } = profileStore;
const edit = ref<boolean>(false);
@ -739,7 +746,7 @@ const onCancel = async () => {
* get รายการ อมลเกยวกบบคคล
*/
const fetchPerson = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.person)
.then((res) => {
@ -796,7 +803,7 @@ const fetchPerson = async () => {
})
.catch((e: any) => {})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -822,7 +829,7 @@ const changeCardID = (value: string | number | null) => {
};
const checkCitizen = async (id: string) => {
loaderPage(true);
showLoader();
await http
.get(config.API.profileCitizenId(id))
.then((res) => {
@ -847,7 +854,7 @@ const checkCitizen = async (id: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -856,7 +863,7 @@ const checkCitizen = async (id: string) => {
*/
const clickHistory = async () => {
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileInforHisId(route.params.id.toString()))
.then((res) => {
@ -897,7 +904,7 @@ const clickHistory = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -973,7 +980,7 @@ const calRetire = async (birth: Date) => {
birthDate: dateToISO(birth),
};
if (dateToISO(dateBefore.value) != dateToISO(birth)) {
loaderPage(true);
showLoader();
await http
.post(config.API.profileCalRetire, body)
.then((res: any) => {
@ -989,14 +996,14 @@ const calRetire = async (birth: Date) => {
changeRetireText(date2Thai(retire));
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
const fetchData = async () => {
if (route.params.id) {
loaderPage(true);
showLoader();
await http
.get(config.API.profileInforId(route.params.id.toString()))
.then(async (res: any) => {
@ -1034,7 +1041,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(async () => {
// loaderPage(false);
// hideLoader();
await props.fetchDataProfile();
});
}
@ -1061,7 +1068,7 @@ const editData = async () => {
profileType: informaData.value.profileType,
createdFullName: "-",
};
loaderPage(true);
showLoader();
await http
.put(config.API.profileInforId(route.params.id.toString()), body)
.then((res) => {
@ -1079,7 +1086,7 @@ const editData = async () => {
};
const addData = async () => {
// loaderPage(true);
// showLoader();
// await http
// .put(config.API.profileInforId(route.params.id.toString()), body)
// .then((res) => {

View file

@ -296,7 +296,7 @@ import { onMounted, ref, watch } from "vue";
import { useRoute } from "vue-router";
import { useProfileDataStore } from "@/modules/04_registry/store";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import ProfileTable from "@/modules/04_registry/components/Table.vue";
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
import DialogFooter from "@/modules/04_registry/components/DialogFooter.vue";
@ -341,8 +341,7 @@ const props = defineProps({
const $q = useQuasar();
const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const {
date2Thai,
@ -351,6 +350,8 @@ const {
messageError,
typeChangeName,
dialogMessage,
showLoader,
hideLoader,
} = mixin;
const route = useRoute();
const id = ref<string>("");
@ -550,7 +551,7 @@ onMounted(async () => {
});
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.profileChangeNameId(profileId.value))
.then((res) => {
@ -574,7 +575,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -582,7 +583,7 @@ const fetchData = async () => {
* get รายการ อมลเกยวกบบคคล
*/
const fetchPerson = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.person)
.then((res) => {
@ -599,7 +600,7 @@ const fetchPerson = async () => {
})
.catch((e: any) => {})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -701,7 +702,7 @@ const saveData = async () => {
if (lastName.value != undefined)
formData.append("lastName", lastName.value);
if (status.value != undefined) formData.append("status", status.value);
loaderPage(true);
showLoader();
await http
.post(config.API.profileChangeNameId(profileId.value), formData)
.then((res) => {
@ -747,7 +748,7 @@ const editData = async () => {
formData.append("firstName", firstName.value);
if (lastName.value != undefined) formData.append("lastName", lastName.value);
if (status.value != undefined) formData.append("status", status.value);
loaderPage(true);
showLoader();
await http
.put(config.API.profileChangeNameId(id.value), formData)
.then((res) => {
@ -775,7 +776,7 @@ const clickDelete = async () => {
persistent: true,
})
.onOk(async () => {
loaderPage(true);
showLoader();
await http
.delete(config.API.profileChangeNameId(id.value))
.then((res) => {
@ -885,7 +886,7 @@ const clickEditRow = () => {
*/
const clickHistory = async (row: RequestItemsObject) => {
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileChangeNameHisId(row.id))
.then((res) => {
@ -909,7 +910,7 @@ const clickHistory = async (row: RequestItemsObject) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};