diff --git a/src/modules/14_KPI/components/detailList/01_Assessment.vue b/src/modules/14_KPI/components/detailList/01_Assessment.vue index 6f0111e78..c5675fe92 100644 --- a/src/modules/14_KPI/components/detailList/01_Assessment.vue +++ b/src/modules/14_KPI/components/detailList/01_Assessment.vue @@ -1,5 +1,5 @@ @@ -232,7 +224,10 @@ onMounted(() => { - + diff --git a/src/modules/14_KPI/components/detailList/TabMain.vue b/src/modules/14_KPI/components/detailList/TabMain.vue index 9fa876e73..1f9e7cc17 100644 --- a/src/modules/14_KPI/components/detailList/TabMain.vue +++ b/src/modules/14_KPI/components/detailList/TabMain.vue @@ -14,7 +14,8 @@ const store = useKPIDataStore(); const route = useRoute(); const isReadonly = (route.name === "KPIDetail" ? true : false); - +const indicatorScore = defineModel("indicatorScore", { default: 0 }); +const competencyScore = defineModel("competencyScore", { default: 0 }); const itemsTab = ref([ { name: "1", @@ -40,6 +41,7 @@ const itemsTab = ref([ const splitterModel = ref(12); + @@ -76,7 +78,11 @@ const splitterModel = ref(12); :name="tab.name" class="q-pa-none" > - + diff --git a/src/modules/14_KPI/components/detailList/Topic/02_Competency.vue b/src/modules/14_KPI/components/detailList/Topic/02_Competency.vue index 6e101e4dd..1ef5a0f8e 100644 --- a/src/modules/14_KPI/components/detailList/Topic/02_Competency.vue +++ b/src/modules/14_KPI/components/detailList/Topic/02_Competency.vue @@ -20,6 +20,9 @@ import { useRoute } from "vue-router"; const dataListCriteria = defineModel("dataListCriteria", { required: true, }); +const competencyScore = defineModel("competencyScore", { + default: 0, +}); const sortedDataListCriteria = computed(() => { return dataListCriteria.value.sort((a, b) => a.level - b.level); @@ -115,7 +118,6 @@ const rows = ref([]); const lists = ref([]); const resultEvaluation = ref(0); function getData(type: string) { - showLoader(); http .get(config.API.kpiUserCapacity + `?id=${id.value}&type=${type}`) .then(async (res) => { @@ -157,9 +159,8 @@ function getData(type: string) { ? (resultAvg / weightAvg) * store.dataEvaluation.capacityPoint : 0; resultEvaluation.value = sum.toFixed(2); + competencyScore.value = sum; } - // end cal summary - hideLoader(); }); } @@ -193,10 +194,12 @@ function onEvaluate(type: string) { } onMounted(() => { - for (let index = 0; index < store.competencyType.length; index++) { - const element = store.competencyType[index]; - getData(element.id); - } + setTimeout(() => { + for (let index = 0; index < store.competencyType.length; index++) { + const element = store.competencyType[index]; + getData(element.id); + } + }, 1000); }); diff --git a/src/modules/14_KPI/store/KPIStore.ts b/src/modules/14_KPI/store/KPIStore.ts index f695ddb6e..18533052d 100644 --- a/src/modules/14_KPI/store/KPIStore.ts +++ b/src/modules/14_KPI/store/KPIStore.ts @@ -12,6 +12,7 @@ export const useKPIDataStore = defineStore("KPIDataStore", () => { plannedPoint: 0, rolePoint: 0, specialPoint: 0, + capacityPoint: 0, }); const competencyType = ref([ diff --git a/src/modules/14_KPI/views/detail.vue b/src/modules/14_KPI/views/detail.vue index d0b061b50..b7f83f3c4 100644 --- a/src/modules/14_KPI/views/detail.vue +++ b/src/modules/14_KPI/views/detail.vue @@ -9,6 +9,7 @@ import TabMain from "@/modules/14_KPI/components/detailList/TabMain.vue"; import { useCounterMixin } from "@/stores/mixin"; import { useKPIDataStore } from "@/modules/14_KPI/store/KPIStore"; +import { time } from "console"; // import type { FormProfile } from "@/modules/08_KPI/interface/request/index"; @@ -20,7 +21,8 @@ const store = useKPIDataStore(); const $q = useQuasar(); const mixin = useCounterMixin(); const { showLoader, hideLoader, messageError } = mixin; - +const indicatorScore = ref(0); +const competencyScore = ref(0); const formProfile = reactive({ fullName: "", position: "", @@ -35,7 +37,6 @@ const formProfile = reactive({ const router = useRouter(); function fetchEvaluation() { - showLoader(); http .get(config.API.kpiUserEvaluation + `/${id.value}`) .then((res) => { @@ -47,14 +48,10 @@ function fetchEvaluation() { }) .catch((e) => { messageError($q, e); - }) - .finally(() => { - hideLoader(); }); } function getProfile() { - showLoader(); http .get(config.API.profilePosition()) .then((res) => { @@ -69,14 +66,10 @@ function getProfile() { }) .catch((e) => { messageError($q, e); - }) - .finally(() => { - hideLoader(); }); } async function fetchProfile(id: string) { - showLoader(); await http .get( config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, `profile-${id}`) @@ -86,16 +79,14 @@ async function fetchProfile(id: string) { }) .catch(() => { // profilePicture.value = avatar; - }) - .finally(() => { - hideLoader(); }); } /** save */ function onSave() {} -onMounted(() => { +onMounted(async () => { + showLoader(); fetchEvaluation(); getProfile(); }); @@ -112,7 +103,12 @@ onMounted(() => { flat color="primary" class="q-mr-sm" - @click="isReadonly ? router.push(`/KPI-list`) : router.push(`/KPI`)" + @click=" + () => { + store.dataEvaluation = {}; + isReadonly ? router.push(`/KPI-list`) : router.push(`/KPI`); + } + " /> {{ id ? `รายละเอียดแบบประเมิน` : `เพิ่มแบบประเมิน` }} @@ -214,9 +210,9 @@ onMounted(() => { คะแนนประเมิน - {{ - formProfile.score - }} + {{ (indicatorScore + competencyScore).toFixed(2) }} + @@ -226,7 +222,10 @@ onMounted(() => { - +