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

@ -976,7 +976,8 @@ const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const router = useRouter();
const route = useRoute();
const { date2Thai, success, dateToISO, messageError } = mixin;
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
mixin;
const myForm = ref<QForm | null>(null); //form data input
const name = ref<string>("");
const note = ref<string>("");
@ -1099,7 +1100,7 @@ watch(organizationName, (count: DataOption, prevCount: DataOption) => {
});
onMounted(async () => {
loaderPage(false);
hideLoader();
if (route.params.id != undefined) {
edit.value = true;
id.value = route.params.id.toString();
@ -1122,7 +1123,7 @@ const clickBack = () => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.periodExamId(id.value))
.then((res) => {
@ -1196,7 +1197,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1204,7 +1205,7 @@ const fetchData = async () => {
* get รายการ รหสหนวยงาน
*/
const fetchOrganizationShortName = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationShortName)
.then((res) => {
@ -1222,7 +1223,7 @@ const fetchOrganizationShortName = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1230,7 +1231,7 @@ const fetchOrganizationShortName = async () => {
* get รายการ หนวยงาน
*/
const fetchOrganizationOrganization = async (val: string) => {
loaderPage(true);
showLoader();
await http
.get(config.API.organization)
.then((res) => {
@ -1248,7 +1249,7 @@ const fetchOrganizationOrganization = async (val: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1256,7 +1257,7 @@ const fetchOrganizationOrganization = async (val: string) => {
* get รายการ ตำแหนงในสายงาน
*/
const fetchPositionPath = async (val: string) => {
loaderPage(true);
showLoader();
await http
.get(config.API.positionPath)
.then((res) => {
@ -1274,7 +1275,7 @@ const fetchPositionPath = async (val: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1355,7 +1356,7 @@ const sendData = () => {
};
const addData = async () => {
loaderPage(true);
showLoader();
await http
.post(config.API.periodExam, sendData())
.then(async (res) => {
@ -1370,12 +1371,12 @@ const addData = async () => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
const editData = async (id: string) => {
loaderPage(true);
showLoader();
await http
.put(config.API.periodExamId(id), sendData())
.then(async (res) => {
@ -1388,7 +1389,7 @@ const editData = async (id: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
@ -1415,13 +1416,13 @@ const uploadDocData = async () => {
fileDocDataUpload.value.forEach((file: any) => {
formData.append("", file);
});
loaderPage(true);
showLoader();
await http
.put(config.API.periodExamDoc(id.value), formData)
.then((res) => {})
.catch((e) => {})
.finally(async () => {
loaderPage(false);
hideLoader();
});
} else {
clickBack();
@ -1451,13 +1452,13 @@ const uploadImgData = async () => {
fileImgDataUpload.value.forEach((file: any) => {
formData.append("", file);
});
loaderPage(true);
showLoader();
await http
.put(config.API.periodExamImg(id.value), formData)
.then((res) => {})
.catch((e) => {})
.finally(async () => {
loaderPage(false);
hideLoader();
});
}
};
@ -1466,7 +1467,7 @@ const deleteDocData = async (docId: string) => {
const params = {
documentId: docId,
};
loaderPage(true);
showLoader();
await http
.delete(config.API.periodExamDoc(id.value.toString()), {
params,