new loader

This commit is contained in:
Thanit Konmek 2023-06-09 14:25:41 +07:00
parent fd7aae2f5d
commit fe6c712a18
95 changed files with 1189 additions and 950 deletions

View file

@ -551,7 +551,8 @@ const { profileData, changeProfileColumns } = store;
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError } = mixin;
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
mixin;
const route = useRoute();
const id = ref<string>("");
const date = ref<Date>(new Date());
@ -1311,7 +1312,7 @@ const filterSelector = (val: any, update: Function, filtername: string) => {
};
const nodeTree = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.profileOrganizRoot)
.then((res: any) => {
@ -1325,7 +1326,7 @@ const nodeTree = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1333,7 +1334,7 @@ const nodeTree = async () => {
* get รายการ ตำแหน
*/
const fetchPosition = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.position)
.then((res) => {
@ -1410,12 +1411,12 @@ const fetchPosition = async () => {
})
.catch((e: any) => {})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.profileSalaryId(profileId.value))
.then((res) => {
@ -1457,7 +1458,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1467,7 +1468,7 @@ const onSelected = async (id: string) => {
const fetchOrganization = async (id: string) => {
if (selected.value != "") {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationName(id))
.then((res) => {
@ -1478,13 +1479,13 @@ const fetchOrganization = async (id: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
}
};
const fetchPositionNumber = async (id: string) => {
loaderPage(true);
showLoader();
await http
.get(config.API.getPositionNumberIdByOcId(id))
.then((res) => {
@ -1500,7 +1501,7 @@ const fetchPositionNumber = async (id: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1663,7 +1664,7 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loaderPage(true);
showLoader();
await http
.post(config.API.profileSalaryId(profileId.value), {
date: dateToISO(date.value),
@ -1698,7 +1699,7 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
loaderPage(true);
showLoader();
await http
.put(config.API.profileSalaryId(id.value), {
date: dateToISO(date.value),
@ -1741,7 +1742,7 @@ const clickDelete = async () => {
persistent: true,
})
.onOk(async () => {
loaderPage(true);
showLoader();
await http
.delete(config.API.profileSalaryId(id.value))
.then((res) => {
@ -1883,7 +1884,7 @@ const clickEditRowRef = () => {
*/
const clickHistory = async (row: RequestItemsObject) => {
modalHistory.value = true;
loaderPage(true);
showLoader();
await http
.get(config.API.profileSalaryHisId(row.id))
.then((res) => {
@ -1925,7 +1926,7 @@ const clickHistory = async (row: RequestItemsObject) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};