ข้อมูลทะเบียนประวัติ => loader

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-07-03 16:57:18 +07:00
parent 3d59d4ed2b
commit fe713eea70
2 changed files with 32 additions and 21 deletions

View file

@ -8,9 +8,9 @@ import config from "@/app.config";
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry"; import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
interface ArrayFileList { interface ArrayFileList {
id:string id: string;
pathName:string pathName: string;
fileName:string fileName: string;
} }
const fileList = ref<ArrayFileList[]>([]); const fileList = ref<ArrayFileList[]>([]);
const store = useRegistryInFormationStore(); const store = useRegistryInFormationStore();
@ -48,7 +48,9 @@ function getData() {
messageError($q, e); messageError($q, e);
}) })
.finally(() => { .finally(() => {
hideLoader(); setTimeout(() => {
hideLoader();
}, 1500);
}); });
} }
@ -56,7 +58,7 @@ function getData() {
* ดาวนโหลดลงคไฟล * ดาวนโหลดลงคไฟล
* @param fileName file name * @param fileName file name
*/ */
function downloadFile(fileName: string) { function downloadFile(fileName: string) {
showLoader(); showLoader();
http http
.get( .get(

View file

@ -46,26 +46,35 @@ function onMobile(type: string) {
function getMain() { function getMain() {
showLoader(); showLoader();
http.get(config.API.profilePosition()).then((res) => { http
const data = res.data.result; .get(config.API.profilePosition())
formData.prefix = data.prefix; .then(async (res) => {
formData.firstName = data.firstName; const data = res.data.result;
formData.lastName = data.lastName; formData.prefix = data.prefix;
formData.position = data.position; formData.firstName = data.firstName;
formData.lastName = data.lastName;
formData.position = data.position;
formData.posTypeName = data.posTypeName; formData.posTypeName = data.posTypeName;
formData.posExecutiveName = data.posExecutiveName; formData.posExecutiveName = data.posExecutiveName;
formData.posLevelName = data.posLevelName; formData.posLevelName = data.posLevelName;
store.profileId = data.profileId; store.profileId = data.profileId;
if (data.avatarName) { if (data.avatarName) {
getImg(data.profileId, data.avatarName); await getImg(data.profileId, data.avatarName);
} else { } else {
profileImg.value = avatar; profileImg.value = avatar;
} }
}); })
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
} }
function getImg(id: string, pathName: string) { function getImg(id: string, pathName: string) {
showLoader();
http http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, pathName)) .get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, pathName))
.then((res) => { .then((res) => {