From 656211f03f16e9e461ad19ccc18e5b5fb11cdbf9 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 22 Apr 2024 18:11:24 +0700 Subject: [PATCH 1/2] =?UTF-8?q?=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B8=82=E0=B8=AD=E0=B8=A3=E0=B8=B1=E0=B8=9A?= =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B9=80=E0=B8=A1=E0=B8=B4=E0=B8=99?= =?UTF-8?q?=E0=B8=9C=E0=B8=A5=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=9B=E0=B8=8F?= =?UTF-8?q?=E0=B8=B4=E0=B8=9A=E0=B8=B1=E0=B8=95=E0=B8=B4=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=8A=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=A3=E0=B8=B0=E0=B8=94?= =?UTF-8?q?=E0=B8=B1=E0=B8=9A=E0=B8=9A=E0=B8=B8=E0=B8=84=E0=B8=84=E0=B8=A5?= =?UTF-8?q?=20=3D>=20form=20=E0=B9=81=E0=B8=9A=E0=B8=9A=E0=B8=9B=E0=B8=A3?= =?UTF-8?q?=E0=B8=B0=E0=B9=80=E0=B8=A1=E0=B8=B4=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/KPI/api.kpis.ts | 4 ++ src/modules/08_KPI/interface/request/index.ts | 23 ++++--- src/modules/08_KPI/store.ts | 34 +++++++++- src/modules/08_KPI/views/form.vue | 63 ++++++++++++++----- src/modules/08_KPI/views/main.vue | 32 ++-------- 5 files changed, 100 insertions(+), 56 deletions(-) diff --git a/src/api/KPI/api.kpis.ts b/src/api/KPI/api.kpis.ts index c8e30b4..21f6403 100644 --- a/src/api/KPI/api.kpis.ts +++ b/src/api/KPI/api.kpis.ts @@ -1,5 +1,6 @@ import env from "../index"; +const url = `${env.API_URI}/salary`; const kpiPeriod = `${env.API_URI}/kpi/period`; const kpiEvaluation = `${env.API_URI}/kpi/user/evaluation`; const kpiPlan = `${env.API_URI}/kpi/plan`; @@ -11,4 +12,7 @@ export default { kpiPlan, KpiCapacity, file: KpiFile, + + fileByFile: (name: string, group: string, id: string, fileName: string) => + `${url}/file/${name}/${group}/${id}/${fileName}`, }; diff --git a/src/modules/08_KPI/interface/request/index.ts b/src/modules/08_KPI/interface/request/index.ts index b869e94..dd8d0e6 100644 --- a/src/modules/08_KPI/interface/request/index.ts +++ b/src/modules/08_KPI/interface/request/index.ts @@ -1,22 +1,21 @@ interface FormProfile { fullName: string; - prefix: string; - firstName: string; - lastName: string; + position: string; type: string; level: string; - status: string; + status: string | undefined; + result: string | undefined; score: string; - avartar:string + avartar: string; } -interface FormDataAssigned{ - indicator:string - target:string - unit:string - weigth:string - definition:string +interface FormDataAssigned { + indicator: string; + target: string; + unit: string; + weigth: string; + definition: string; } -export type { FormProfile ,FormDataAssigned}; +export type { FormProfile, FormDataAssigned }; diff --git a/src/modules/08_KPI/store.ts b/src/modules/08_KPI/store.ts index 3fc35ae..450757a 100644 --- a/src/modules/08_KPI/store.ts +++ b/src/modules/08_KPI/store.ts @@ -6,5 +6,37 @@ export const useKpiDataStore = defineStore("KPIDate", () => { const dataProfile = ref(); const dataEvaluation = ref(); - return { tabMain, dataProfile, dataEvaluation }; + function convertStatus(val: string) { + switch (val) { + case "PENDING": + return "รอดำเนินการ"; + case "INPROGRESS": + return "กําลังดำเนินการ"; + case "DONE": + return "ประเมินเสร็จสิ้น"; + default: + break; + } + } + + function convertResults(val: string) { + switch (val) { + case "PENDING": + return "รอดำเนินการ"; + case "PASSED": + return "ผ่านการประเมิน"; + case "NOTPASSED": + return "ไม่ผ่านการประเมิน"; + default: + break; + } + } + + return { + tabMain, + dataProfile, + dataEvaluation, + convertStatus, + convertResults, + }; }); diff --git a/src/modules/08_KPI/views/form.vue b/src/modules/08_KPI/views/form.vue index cc3645c..288fb0e 100644 --- a/src/modules/08_KPI/views/form.vue +++ b/src/modules/08_KPI/views/form.vue @@ -19,15 +19,13 @@ const mixin = useCounterMixin(); const { showLoader, hideLoader, messageError } = mixin; const formProfile = reactive({ - fullName: "นางสาวกัณฐิมา กาฬสินธุ์", - prefix: "นางสาว", - firstName: "กัณฐิมา", - lastName: "กาฬสินธุ์", - position: "หัวหน้าสำนักงาน", - type: "บริหาร", - level: "ชำนาญการพิเศษ", - status: "จัดเตรียมข้อมูล", - score: "100", + fullName: "", + position: "", + type: "", + level: "", + status: "", + result: "", + score: "-", avartar: "https://cdn.quasar.dev/img/boy-avatar.png", }); @@ -40,7 +38,9 @@ function fetchEvaluation() { .then((res) => { const data = res.data.result; store.dataEvaluation = data; - console.log(data); + formProfile.status = store.convertStatus(data.evaluationStatus); + formProfile.result = store.convertResults(data.evaluationResults); + fetchProfile(data.profileId); }) .catch((e) => { messageError($q, e); @@ -57,9 +57,11 @@ function getProfile() { .then((res) => { const data = res.data.result; store.dataProfile = data; - console.log(data); formProfile.fullName = `${data.prefix}${data.firstName} ${data.lastName}`; + formProfile.position = data.position; + formProfile.type = data.posTypeName; + formProfile.level = data.posLevelName; }) .catch((e) => { messageError($q, e); @@ -69,6 +71,23 @@ function getProfile() { }); } +async function fetchProfile(id: string) { + showLoader(); + await http + .get( + config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `profile-${id}`) + ) + .then(async (res) => { + formProfile.avartar = res.data.downloadUrl; + }) + .catch(() => { + // profilePicture.value = avatar; + }) + .finally(() => { + hideLoader(); + }); +} + /** save */ function onSave() {} @@ -101,11 +120,11 @@ onMounted(() => {
- +
@@ -155,7 +174,7 @@ onMounted(() => {
- ประเภท + ประเภทตำแหน่ง {{ formProfile.type }} @@ -163,7 +182,7 @@ onMounted(() => {
- ระดับชั้นงาน + ระดับตำแหน่ง {{ formProfile.level }} @@ -177,6 +196,14 @@ onMounted(() => { }}
+
+
+ ผลการประเมิน + {{ + formProfile.result + }} +
+
คะแนนประเมิน @@ -202,4 +229,10 @@ onMounted(() => { .bg-toolbar { background-color: #f2fbfa; } + +.absolute-center-left { + position: absolute; + top: 50%; + transform: translateY(-50%); +} diff --git a/src/modules/08_KPI/views/main.vue b/src/modules/08_KPI/views/main.vue index 6e003f9..0bfd07f 100644 --- a/src/modules/08_KPI/views/main.vue +++ b/src/modules/08_KPI/views/main.vue @@ -11,9 +11,11 @@ import type { QTableProps } from "quasar"; import DialogHeader from "@/components/DialogHeader.vue"; import { useCounterMixin } from "@/stores/mixin"; +import { useKpiDataStore } from "@/modules/08_KPI/store"; const $q = useQuasar(); const mixin = useCounterMixin(); +const store = useKpiDataStore(); const router = useRouter(); const { showLoader, hideLoader, messageError, date2Thai, dialogConfirm } = mixin; @@ -46,7 +48,7 @@ const columns = ref([ field: "evaluationStatus", headerStyle: "font-size: 14px", style: "font-size: 14px", - format: (v) => convertStatus(v), + format: (v) => store.convertStatus(v), sort: (a: string, b: string) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, @@ -58,7 +60,7 @@ const columns = ref([ field: "evaluationResults", headerStyle: "font-size: 14px", style: "font-size: 14px", - format: (v) => convertResults(v), + format: (v) => store.convertResults(v), sort: (a: string, b: string) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, @@ -219,32 +221,6 @@ function updatePagination(newPagination: any) { formQuery.pageSize = newPagination.rowsPerPage; } -function convertStatus(val: string) { - switch (val) { - case "PENDING": - return "รอดำเนินการ"; - case "INPROGRESS": - return "กําลังดำเนินการ"; - case "DONE": - return "ประเมินเสร็จสิ้น"; - default: - break; - } -} - -function convertResults(val: string) { - switch (val) { - case "PENDING": - return "รอดำเนินการ"; - case "PASSED": - return "ผ่านการประเมิน"; - case "NOTPASSED": - return "ไม่ผ่านการประเมิน"; - default: - break; - } -} - watch( () => formQuery.pageSize, () => { From cb8878c7a34fe643b6a07efd570cd84e946568d5 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 22 Apr 2024 18:12:33 +0700 Subject: [PATCH 2/2] =?UTF-8?q?=E0=B9=81=E0=B8=9A=E0=B8=9A=E0=B8=9B?= =?UTF-8?q?=E0=B8=A3=E0=B8=B0=E0=B9=80=E0=B8=A1=E0=B8=B4=E0=B8=99=20=3D>?= =?UTF-8?q?=20=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=20avatar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/08_KPI/views/form.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/08_KPI/views/form.vue b/src/modules/08_KPI/views/form.vue index 288fb0e..36b21e2 100644 --- a/src/modules/08_KPI/views/form.vue +++ b/src/modules/08_KPI/views/form.vue @@ -26,7 +26,7 @@ const formProfile = reactive({ status: "", result: "", score: "-", - avartar: "https://cdn.quasar.dev/img/boy-avatar.png", + avartar: "", }); const router = useRouter();