แก้ไข 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

@ -563,7 +563,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";
@ -592,10 +592,17 @@ 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, dialogMessage } = mixin;
const {
date2Thai,
success,
dateToISO,
messageError,
dialogMessage,
showLoader,
hideLoader,
} = mixin;
const route = useRoute();
const id = ref<string>("");
const date = ref<Date>(new Date());
@ -1281,14 +1288,14 @@ onMounted(async () => {
});
const fetchDataSelector = async () => {
loaderPage(true);
showLoader();
await fetchEmployeePosition();
await fetchEmployeePositionSide();
await fetchEmployeeLevel();
await fetchEmployeeGroup();
await fetchAgency();
await nodeTree();
loaderPage(false);
hideLoader();
};
//
const fetchEmployeePosition = async () => {
@ -1383,7 +1390,7 @@ const fetchAgency = async () => {
};
const nodeTree = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.profileOrganizRoot)
.then((res: any) => {
@ -1397,7 +1404,7 @@ const nodeTree = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1469,7 +1476,7 @@ const filterSelector = (val: any, update: Function, filtername: string) => {
const fetchData = async () => {
if (profileId.value) {
loaderPage(true);
showLoader();
await http
.get(config.API.profileSalaryEmployeeId(profileId.value))
.then((res) => {
@ -1509,13 +1516,13 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
const fetchPositionNumber = async (id: string) => {
// loaderPage(true);
// showLoader();
if (id == null || id == "") return;
await http
.get(config.API.getPositionNumberIdByOcId(id))
@ -1532,7 +1539,7 @@ const fetchPositionNumber = async (id: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1696,7 +1703,7 @@ const clickSave = async () => {
*/
const saveData = async () => {
if (profileId.value) {
loaderPage(true);
showLoader();
await http
.post(config.API.profileSalaryEmployeeId(profileId.value), {
amount: amount.value,
@ -1731,7 +1738,7 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
loaderPage(true);
showLoader();
await http
.put(config.API.profileSalaryEmployeeId(id.value), {
amount: amount.value,
@ -1765,7 +1772,7 @@ const editData = async () => {
* ลบขอม
*/
const fetchDataDelete = async () => {
loaderPage(true);
showLoader();
await http
.delete(config.API.profileSalaryId(id.value))
.then((res) => {
@ -1935,7 +1942,7 @@ const clickEditRowRef = () => {
*/
const clickHistory = async (row: RequestItemsEmployee) => {
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileSalaryHisId(row.id))
.then((res) => {
@ -1974,7 +1981,7 @@ const clickHistory = async (row: RequestItemsEmployee) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};