diff --git a/src/modules/08_KPI/views/form.vue b/src/modules/08_KPI/views/form.vue index 272baad..f770c90 100644 --- a/src/modules/08_KPI/views/form.vue +++ b/src/modules/08_KPI/views/form.vue @@ -477,9 +477,6 @@ onMounted(async () => { -
{ >ส่งให้ผู้ประเมินรายงานผลสำเร็จของงาน - + (""); const rows = ref([]); const $q = useQuasar(); const mixin = useCounterMixin(); -const { - messageError, - dialogConfirm, - findOrgName, - showLoader, - hideLoader, - date2Thai, -} = mixin; +const { messageError, findOrgName, showLoader, hideLoader, date2Thai } = mixin; -const filter = ref(""); const mode = ref($q.screen.gt.xs); const profileImg = ref(""); const router = useRouter(); -const route = useRoute(); -const idEva = ref(route.params.id as string); + const formData = reactive({ prefix: "", firstName: "", @@ -42,16 +33,8 @@ const formData = reactive({ }); const sizeImg = ref(""); -/** ข้อมูลที่เเสดงในตาราง */ -const visibleColumns = ref([ - "no", - "date_start", - "date_finish", - "mentors", - "commander", -]); - -/** หัวตาราง */ +/** Table */ +const filter = ref(""); const columns = ref([ { name: "no", @@ -101,22 +84,25 @@ const columns = ref([ style: "font-size: 14px", }, ]); +const visibleColumns = ref([ + "no", + "date_start", + "date_finish", + "mentors", + "commander", +]); function onResize(size: any) { const width = size.width > 100 ? 100 : size.width; sizeImg.value = `${width}px`; } -function onMobile(type: string) { - router.push(`/registry/${type}`); -} - function getMain() { showLoader(); http - .get(config.API.orgPosition + `/${idEva.value}`) + .get(config.API.profilePosition()) .then(async (res) => { - const data = res.data.result; + const data = await res.data.result; formData.prefix = data.prefix; formData.firstName = data.firstName; formData.lastName = data.lastName; @@ -127,12 +113,15 @@ function getMain() { formData.posLevelName = data.posLevelName; formData.org = findOrgName(data); profileId.value = data.profileId; + const promises = []; + promises.push(getList(data.profileId)); if (data.avatarName) { - getImg(data.profileId, data.avatarName); + promises.push(getImg(data.profileId, data.avatarName)); } else { profileImg.value = avatar; } - await getList(data.profileId); + + await Promise.all(promises); }) .catch((e) => { messageError($q, e); @@ -143,17 +132,24 @@ function getMain() { } function getList(id: string) { + showLoader(); http .get(config.API.probationMain(id)) .then((res) => { const data = res.data.data; rows.value = data; }) - .catch((e) => {}) - .finally(() => {}); + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); } -function getImg(id: string, pathName: string) { - http + +async function getImg(id: string, pathName: string) { + showLoader(); + await http .get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, pathName)) .then((res) => { profileImg.value = res.data.downloadUrl; @@ -161,7 +157,9 @@ function getImg(id: string, pathName: string) { .catch((e) => { messageError($q, e); }) - .finally(() => {}); + .finally(() => { + hideLoader(); + }); } function onDetail(id: string) { @@ -203,7 +201,7 @@ onMounted(async () => {
- @@ -212,7 +210,7 @@ onMounted(async () => {
ตำแหน่งในสายงาน
-
ระดับ
+
ประเภทตำแหน่ง
สังกัด
@@ -220,7 +218,13 @@ onMounted(async () => { {{ formData.position ? formData.position : "-" }}
- {{ formData.posLevelName ? formData.posLevelName : "-" }} + {{ + formData.posTypeName + ? formData.posLevelName + ? `${formData.posTypeName}(${formData.posLevelName})` + : formData.posTypeName + : "-" + }}
{{ formData.org ? formData.org : "-" }}