kpi updated

This commit is contained in:
Warunee Tamkoo 2024-05-14 23:48:29 +07:00
parent 56a38622e5
commit 6c532a0202
8 changed files with 266 additions and 182 deletions

View file

@ -2,6 +2,8 @@
import { onMounted, ref, computed, watch } from "vue";
import Dialog from "@/modules/08_KPI/components/Tab/Dialog/04_FormCompetency.vue";
import DialogEvaluate from "@/modules/08_KPI/components/Tab/DialogEvaluate/02_Competenct.vue";
import DialogProgress from "@/modules/08_KPI/components/Tab/Dialog/DialogCommentProgress.vue";
import DialogProblem from "@/modules/08_KPI/components/Tab/Dialog/DialogCommentProblem.vue";
import { useQuasar, type QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
@ -104,7 +106,7 @@ const columns = ref<QTableProps["columns"]>([
]);
const visibleColumns = ref<string[]>(
store.tabOpen === 3
store.tabOpen === 3 && store.tabMain === "3"
? ["name", "level", "point", "weight", "summary"]
: ["name", "level", "weight"]
);
@ -159,11 +161,18 @@ function getData(type: string) {
if (total > 0) {
let weightAvg = weight / total;
let resultAvg = result / total;
let sum =
weightAvg != 0
? (resultAvg / weightAvg) * store.dataEvaluation.capacityPoint
: 0;
// resultEvaluation.value = sum.toFixed(2);
if (store.dataProfile.posExecutiveName != null) {
store.competencyScoreVal =
weightAvg != 0
? (resultAvg / weightAvg) * store.excusiveCompetencyScore
: 0;
} else {
store.competencyScoreVal =
weightAvg != 0
? (resultAvg / weightAvg) * store.competencyScore
: 0;
}
}
});
}
@ -200,16 +209,41 @@ function onEvaluate(type: string) {
const modalProgress = ref<boolean>(false);
const modalProblem = ref<boolean>(false);
const type = ref<string>("");
function openPopupProgress() {
const idList = ref<string>("");
function openPopupProgress(id: string) {
modalProgress.value = true;
type.value = rows.value ? "plan" : rows.value ? "role" : "special";
type.value = "capacity";
idList.value = id;
}
function openPopupProblem() {
function openPopupProblem(id: string) {
modalProblem.value = true;
type.value = rows.value ? "plan" : rows.value ? "role" : "special";
type.value = "capacity";
idList.value = id;
}
const isEditStep1 = computed(() => {
return (
(store.dataEvaluation.evaluationStatus === "NEW" &&
store.rolePerson === "USER" &&
store.tabMain === "1") ||
(store.dataEvaluation.evaluationStatus === "NEW_EVALUATOR" &&
store.rolePerson === "EVALUATOR" &&
store.tabMain === "1")
);
});
const isEditStep3 = computed(() => {
return (
(store.dataEvaluation.evaluationStatus === "EVALUATING" &&
store.rolePerson === "USER" &&
store.tabMain === "3") ||
(store.dataEvaluation.evaluationStatus === "EVALUATING_EVALUATOR" &&
store.rolePerson === "EVALUATOR" &&
store.tabMain === "3")
);
});
watch(
() => store.dataEvaluation.capacityPoint,
(newValue, oldValue) => {
@ -238,10 +272,7 @@ onMounted(() => {
<div class="col">
<span class="text-weight-medium">{{ item.name }}</span>
<q-btn
v-if="
store.dataEvaluation.evaluationStatus === 'NEW' &&
store.rolePerson === 'USER'
"
v-if="isEditStep1"
class="q-ml-xs"
flat
round
@ -257,7 +288,7 @@ onMounted(() => {
<q-space />
<q-btn
v-if="store.dataEvaluation.evaluationStatus == 'EVALUATING'"
v-if="isEditStep3"
flat
round
icon="mdi-clipboard-check-outline"
@ -366,7 +397,7 @@ onMounted(() => {
color="blue-6"
size="12px"
dense
@click="openPopupProgress()"
@click="openPopupProgress(props.row.id)"
>
<q-tooltip>รายงานความกาวหน</q-tooltip>
</q-btn>
@ -378,19 +409,13 @@ onMounted(() => {
size="12px"
dense
main="problem"
@click="openPopupProblem()"
@click="openPopupProblem(props.row.id)"
>
<q-tooltip>รายงานปญหา</q-tooltip>
</q-btn>
</div>
<div
v-if="
store.dataEvaluation.evaluationStatus === 'NEW' &&
store.rolePerson === 'USER' &&
store.tabMain === '1'
"
>
<div v-if="isEditStep1">
<q-btn
flat
round
@ -401,10 +426,6 @@ onMounted(() => {
<q-tooltip>แกไข </q-tooltip>
</q-btn>
<q-btn
v-if="
store.dataEvaluation.evaluationStatus === 'NEW' &&
store.rolePerson === 'USER'
"
flat
round
icon="delete"
@ -437,7 +458,16 @@ onMounted(() => {
:get-data="getData"
/>
<DialogProgress
v-model:modal="modalProgress"
v-model:type="type"
:idList="idList"
/>
<DialogProblem
v-model:modal="modalProblem"
v-model:type="type"
:idList="idList"
/>
</template>
<style scoped>