Compare commits

..

No commits in common. "2a27dadff71b1c1f05a0938048ce8c487de1584b" and "b845cdaeab881a270ffd5a2bbe4840f8581a562d" have entirely different histories.

3 changed files with 22 additions and 34 deletions

View file

@ -9,7 +9,6 @@ import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useKpiDataStore } from "@/modules/08_KPI/store";
import avatar from "@/assets/avatar_user.jpg";
import type { FormProfile } from "@/modules/08_KPI/interface/request/index";
import type {
@ -108,13 +107,11 @@ async function getAvatar(id: string) {
.then(async (res) => {
const data = await res.data.result;
if (data.avatarName) {
fetchProfile(id, data.avatarName);
await fetchProfile(id, data.avatarName);
}
})
.catch((e) => {
messageError($q, e);
imgProfile.value = avatar;
store.dataEvaluation.avartar = avatar;
})
.finally(() => {
isLoadAvatar.value = false;
@ -122,16 +119,12 @@ async function getAvatar(id: string) {
}
/** ดึงข้อมูล เพื่อเก็บรูปโปรไฟล์ */
function fetchProfile(id: string, avatarName: string) {
http
async function fetchProfile(id: string, avatarName: string) {
await http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, avatarName))
.then((res) => {
.then(async (res) => {
store.dataEvaluation.avartar = res.data.downloadUrl;
imgProfile.value = res.data.downloadUrl;
})
.catch(() => {
imgProfile.value = avatar;
store.dataEvaluation.avartar = avatar;
});
}
@ -215,7 +208,7 @@ async function getOrgOp() {
name: `${i.prefix}${i.firstName} ${i.lastName}`,
}))
.find(
(i: EvaOptionType) => i.id == store.dataEvaluation.commanderHighId,
(i: EvaOptionType) => i.id == store.dataEvaluation.commanderHighId
);
isLoadCommander.value = false;
})
@ -232,21 +225,21 @@ function filterOption(val: string, update: Function, refData: string) {
case "evaluatorIdOp":
update(() => {
evaluatorIdOp.value = evaluatorIdMainOp.value.filter(
(v: DataOptions) => v.name.indexOf(val) > -1,
(v: DataOptions) => v.name.indexOf(val) > -1
);
});
break;
case "commanderIdOp":
update(() => {
commanderIdOp.value = commanderIdMainOp.value.filter(
(v: DataOptions) => v.name.indexOf(val) > -1,
(v: DataOptions) => v.name.indexOf(val) > -1
);
});
break;
case "commanderHighOp":
update(() => {
commanderHighOp.value = commanderHighMainOp.value.filter(
(v: DataOptions) => v.name.indexOf(val) > -1,
(v: DataOptions) => v.name.indexOf(val) > -1
);
});
break;
@ -285,7 +278,7 @@ function sendToEvaluatore() {
}
},
"ยืนยันการส่งข้อตกลงให้ผู้ประเมินอนุมัติ",
"ต้องการยืนยันส่งข้อตกลงนี้ให้ผู้ประเมินอนุมัติใช่หรือไม่?",
"ต้องการยืนยันส่งข้อตกลงนี้ให้ผู้ประเมินอนุมัติใช่หรือไม่?"
);
}
@ -315,7 +308,7 @@ function sendToEvaluateEvaluatore() {
}
},
"ยืนยันการส่งให้ผู้ประเมินรายงานผลสำเร็จของงาน",
"ต้องการยืนยันส่งให้ผู้ประเมินรายงานผลสำเร็จของงานใช่หรือไม่?",
"ต้องการยืนยันส่งให้ผู้ประเมินรายงานผลสำเร็จของงานใช่หรือไม่?"
);
}
@ -345,7 +338,7 @@ function requireEdit() {
}
},
"ยืนยันการขอแก้ไขข้อตกลง",
"ต้องการยืนยันการขอแก้ไขข้อตกลงนี้ใช่หรือไม่?",
"ต้องการยืนยันการขอแก้ไขข้อตกลงนี้ใช่หรือไม่?"
);
}
@ -418,7 +411,7 @@ async function goToSummary() {
store.excusiveIndicator2ScoreVal +
store.competencyScoreVal
).toFixed(2),
},
}
)
.then((res) => {});
@ -434,7 +427,7 @@ async function goToSummary() {
});
},
"ยืนยันการส่งไปสรุปผลการประเมิน",
"ต้องการยืนยันส่งไปสรุปผลการประเมินใช่หรือไม่?",
"ต้องการยืนยันส่งไปสรุปผลการประเมินใช่หรือไม่?"
);
}
@ -524,7 +517,7 @@ async function downloadReport() {
store.dataEvaluation.prefix +
store.dataEvaluation.firstName +
" " +
store.dataEvaluation.lastName,
store.dataEvaluation.lastName
);
})
.catch((e) => {
@ -563,7 +556,7 @@ async function clickUpload(file: any) {
const foundKey: string | undefined = Object.keys(res.data).find(
(key) =>
res.data[key]?.fileName !== undefined &&
res.data[key]?.fileName !== "",
res.data[key]?.fileName !== ""
);
foundKey &&
uploadFileDoc(res.data[foundKey]?.uploadUrl, fileUpload.value);
@ -573,7 +566,7 @@ async function clickUpload(file: any) {
});
},
"ยืนยันการอัปโหลดไฟล์",
"ต้องการยืนยันการอัปโหลดไฟล์นี้หรือไม่ ?",
"ต้องการยืนยันการอัปโหลดไฟล์นี้หรือไม่ ?"
);
}
@ -630,7 +623,7 @@ function deleteFile(fileName: string) {
showLoader();
http
.delete(
config.API.file("แบบกำหนดข้อตกลง", "KPI", id.value) + `/${fileName}`,
config.API.file("แบบกำหนดข้อตกลง", "KPI", id.value) + `/${fileName}`
)
.catch((e) => {
messageError($q, e);

View file

@ -151,7 +151,6 @@ async function getAvatar(id: string) {
})
.catch((e) => {
messageError($q, e);
profileImg.value = avatar;
});
}
@ -169,15 +168,14 @@ function getList(id: string) {
});
}
function getImg(id: string, pathName: string) {
http
async function getImg(id: string, pathName: string) {
await http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, pathName))
.then((res) => {
profileImg.value = res.data.downloadUrl;
})
.catch((e) => {
profileImg.value = avatar;
// messageError($q, e);
messageError($q, e);
hideLoader();
});
}
@ -190,7 +188,7 @@ function onSearch() {
rows.value = onSearchDataTable(
filter.value,
rowsData.value,
columns.value ? columns.value : [],
columns.value ? columns.value : []
);
}

View file

@ -74,7 +74,7 @@ async function checkUser() {
await dataStore.getProFileType();
kpiDataStore.dataProfile = data; // Set dataProfile in kpiDataStore
if (data.avatarName) {
getImg(data.profileId, data.avatarName);
await getImg(data.profileId, data.avatarName);
} else {
dataStore.profileImg = avatar;
}
@ -106,9 +106,6 @@ function getImg(id: string, pathName: string) {
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, pathName))
.then((res) => {
dataStore.profileImg = res.data.downloadUrl;
})
.catch(() => {
dataStore.profileImg = avatar;
});
}