แก้ load ระบบ kpi
This commit is contained in:
parent
1ae9e85af9
commit
d642f663f3
4 changed files with 48 additions and 61 deletions
|
|
@ -16,13 +16,20 @@ import { useKpiDataStore } from "@/modules/08_KPI/store";
|
|||
|
||||
import type { ListCriteria } from "@/modules/08_KPI/interface/request/index";
|
||||
|
||||
const score = defineModel("score", { type: Number, default: 0 });
|
||||
const indicatorScore = defineModel("indicatorScore", {
|
||||
type: Number,
|
||||
default: 0,
|
||||
});
|
||||
const competencyScore = defineModel("competencyScore", {
|
||||
type: Number,
|
||||
default: 0,
|
||||
});
|
||||
const dataListCriteria = ref<ListCriteria[]>([]);
|
||||
|
||||
const modalCriteria = ref<boolean>(false);
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
||||
const { hideLoader, messageError } = useCounterMixin();
|
||||
const store = useKpiDataStore();
|
||||
|
||||
const evaluationId = ref<string>(route.params.id.toString());
|
||||
|
|
@ -37,7 +44,6 @@ const totalResults3 = ref<number>(0);
|
|||
// const resultWork = ref<number>(0);
|
||||
|
||||
function fetchListPlanned() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.kpiAchievement("planned") + `?id=${evaluationId.value}`)
|
||||
.then((res) => {
|
||||
|
|
@ -64,14 +70,10 @@ function fetchListPlanned() {
|
|||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
function fetchListRole() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.kpiAchievement("role") + `?id=${evaluationId.value}`)
|
||||
.then((res) => {
|
||||
|
|
@ -98,14 +100,10 @@ function fetchListRole() {
|
|||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
function fetchAssigned() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.kpiAchievement("special") + `?id=${evaluationId.value}`)
|
||||
.then((res) => {
|
||||
|
|
@ -133,9 +131,6 @@ function fetchAssigned() {
|
|||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -143,10 +138,9 @@ function onInfo() {
|
|||
modalCriteria.value = true;
|
||||
}
|
||||
|
||||
const totalCompetency = ref<number>(0);
|
||||
const resultWork = computed(() => {
|
||||
const total = totalResults1.value + totalResults2.value + totalResults3.value;
|
||||
score.value = total;
|
||||
indicatorScore.value = total;
|
||||
return total.toFixed(2);
|
||||
});
|
||||
|
||||
|
|
@ -159,25 +153,9 @@ function getCriteria() {
|
|||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
watch(
|
||||
() => totalCompetency.value,
|
||||
(newValue, oldValue) => {
|
||||
if (newValue !== oldValue) {
|
||||
score.value =
|
||||
totalResults1.value +
|
||||
totalResults2.value +
|
||||
totalResults3.value +
|
||||
newValue;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => store.dataEvaluation.plannedPoint,
|
||||
(newValue, oldValue) => {
|
||||
|
|
@ -210,6 +188,9 @@ onMounted(() => {
|
|||
fetchListPlanned();
|
||||
fetchListRole();
|
||||
fetchAssigned();
|
||||
setTimeout(() => {
|
||||
hideLoader();
|
||||
}, 1000);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -286,7 +267,7 @@ onMounted(() => {
|
|||
|
||||
<Competency
|
||||
v-model:dataListCriteria="dataListCriteria"
|
||||
v-model:total-competency="totalCompetency"
|
||||
v-model:competencyScore="competencyScore"
|
||||
/>
|
||||
</div>
|
||||
</q-scroll-area>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue