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

@ -986,16 +986,15 @@ import type {
} from "@/modules/02_organizational/interface/index/Main";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
import ProfileTable from "@/modules/04_registry/components/Table.vue";
const dataStore = useDataStore();
const { loaderPage } = dataStore;
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>("");
@ -1137,7 +1136,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();
@ -1160,7 +1159,7 @@ const clickBack = () => {
};
const fetchData = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.periodExamId(id.value))
.then((res) => {
@ -1239,7 +1238,7 @@ const fetchData = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1247,7 +1246,7 @@ const fetchData = async () => {
* get รายการ รหสหนวยงาน
*/
const fetchOrganizationShortName = async () => {
loaderPage(true);
showLoader();
await http
.get(config.API.organizationShortName)
.then((res) => {
@ -1265,7 +1264,7 @@ const fetchOrganizationShortName = async () => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1273,7 +1272,7 @@ const fetchOrganizationShortName = async () => {
* get รายการ หนวยงาน
*/
const fetchOrganizationOrganization = async (val: string) => {
loaderPage(true);
showLoader();
await http
.get(config.API.organization)
.then((res) => {
@ -1291,7 +1290,7 @@ const fetchOrganizationOrganization = async (val: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1299,7 +1298,7 @@ const fetchOrganizationOrganization = async (val: string) => {
* get รายการ ตำแหนงในสายงาน
*/
const fetchPositionPath = async (val: string) => {
loaderPage(true);
showLoader();
await http
.get(config.API.positionPath)
.then((res) => {
@ -1317,7 +1316,7 @@ const fetchPositionPath = async (val: string) => {
messageError($q, e);
})
.finally(() => {
loaderPage(false);
hideLoader();
});
};
@ -1410,7 +1409,7 @@ const sendData = () => {
};
const addData = async () => {
loaderPage(true);
showLoader();
await http
.post(config.API.periodExam, sendData())
.then(async (res) => {
@ -1425,12 +1424,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) => {
@ -1443,7 +1442,7 @@ const editData = async (id: string) => {
messageError($q, e);
})
.finally(async () => {
loaderPage(false);
hideLoader();
});
};
@ -1470,13 +1469,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();
@ -1506,13 +1505,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();
});
}
};
@ -1521,7 +1520,7 @@ const deleteDocData = async (docId: string) => {
const params = {
documentId: docId,
};
loaderPage(true);
showLoader();
await http
.delete(config.API.periodExamDoc(id.value.toString()), {
params,