แก้ kpi
This commit is contained in:
parent
b71ca2ddf5
commit
2ccafd5a7b
2 changed files with 35 additions and 25 deletions
|
|
@ -71,22 +71,20 @@ async function fetchEvaluation() {
|
|||
formProfile.status = store.convertStatus(data.evaluationStatus);
|
||||
formProfile.result = store.convertResults(data.evaluationResults);
|
||||
store.checkCompetencyDefaultCompetencyLevel();
|
||||
await getAvatar(data.profileId);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
});
|
||||
}
|
||||
|
||||
/** ดึงข้อมูลโปรไฟล์ */
|
||||
async function getProfile() {
|
||||
async function getAvatar(id: string) {
|
||||
await http
|
||||
.get(config.API.profilePosition())
|
||||
.get(config.API.orgCheckAvatar(id))
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
store.dataProfile = await data;
|
||||
|
||||
if (data.avatarName) {
|
||||
await fetchProfile(data.profileId, data.avatarName);
|
||||
await fetchProfile(id, data.avatarName);
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
@ -222,7 +220,7 @@ function filterOption(val: string, update: Function, refData: string) {
|
|||
|
||||
/** ดึงข้อมูลทั้งหมดในหน้า */
|
||||
async function getAll() {
|
||||
await Promise.all([fetchEvaluation(), getProfile(), getOrgOp()]);
|
||||
await Promise.all([fetchEvaluation(), getOrgOp()]);
|
||||
await store.checkStep();
|
||||
}
|
||||
|
||||
|
|
@ -321,7 +319,7 @@ function openGovernment() {
|
|||
|
||||
/** เช็ค สถานะการทดลองงาน */
|
||||
function openStatus() {
|
||||
router.push(`/probation-detail/${store.dataEvaluation.profileId}`);
|
||||
router.push(`/probation-detail/${store.dataEvaluation.id}`);
|
||||
}
|
||||
|
||||
/** ส่งให้ผู้ประเมิน */
|
||||
|
|
@ -532,7 +530,7 @@ onMounted(async () => {
|
|||
: ""
|
||||
}}</span>
|
||||
<p class="q-mb-none">
|
||||
{{ findOrgName(store.dataProfile) }}
|
||||
{{ findOrgName(store.dataEvaluation) }}
|
||||
</p>
|
||||
</div>
|
||||
<q-space v-if="$q.screen.gt.xs" />
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import avatar from "@/assets/avatar_user.jpg";
|
|||
import { ref, reactive, onMounted } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import { useRouter } from "vue-router";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
|
@ -32,6 +32,7 @@ const rowsData = ref<ListMain[]>([]);
|
|||
const mode = ref<boolean>($q.screen.gt.xs);
|
||||
const profileImg = ref<string>("");
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const formData = reactive<ProbationFormType>({
|
||||
prefix: "",
|
||||
|
|
@ -113,7 +114,8 @@ function onResize(size: any) {
|
|||
function getMain() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.profilePosition())
|
||||
.get(config.API.kpiEvaluation + `/${route.params.id.toString()}`)
|
||||
// .get(config.API.profilePosition())
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
formData.prefix = data.prefix;
|
||||
|
|
@ -129,24 +131,35 @@ function getMain() {
|
|||
profileId.value = data.profileId;
|
||||
const promises = [];
|
||||
promises.push(getList(data.profileId));
|
||||
if (data.avatarName) {
|
||||
promises.push(getImg(data.profileId, data.avatarName));
|
||||
} else {
|
||||
profileImg.value = avatar;
|
||||
}
|
||||
promises.push(getAvatar(data.profileId));
|
||||
|
||||
await Promise.all(promises);
|
||||
hideLoader();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
})
|
||||
.finally(() => {});
|
||||
}
|
||||
|
||||
async function getAvatar(id: string) {
|
||||
await http
|
||||
.get(config.API.orgCheckAvatar(id))
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
if (data.avatarName) {
|
||||
getImg(id, data.avatarName);
|
||||
} else {
|
||||
profileImg.value = avatar;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
});
|
||||
}
|
||||
|
||||
function getList(id: string) {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.probationMain(id))
|
||||
.then((res) => {
|
||||
|
|
@ -156,14 +169,11 @@ function getList(id: string) {
|
|||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
async function getImg(id: string, pathName: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, pathName))
|
||||
.then((res) => {
|
||||
|
|
@ -171,8 +181,6 @@ async function getImg(id: string, pathName: string) {
|
|||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
|
@ -242,7 +250,11 @@ onMounted(async () => {
|
|||
{{ formData.position ? formData.position : "-" }}
|
||||
</span>
|
||||
<span>
|
||||
{{ formData.isProbation ? `(ทดลองปฏิบัติหน้าที่ราชการฯ)` : "" }}
|
||||
{{
|
||||
formData.isProbation
|
||||
? `(ทดลองปฏิบัติหน้าที่ราชการฯ)`
|
||||
: ""
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue