KPI + UI สรุปผล

This commit is contained in:
STW_TTTY\stwtt 2024-06-20 16:35:41 +07:00
parent defcfd56da
commit abd7cd8beb
13 changed files with 1011 additions and 75 deletions

View file

@ -1,9 +1,26 @@
import { defineStore } from "pinia";
import { ref, reactive } from "vue";
import { ref, reactive, watch } from "vue";
import type { DataOptions } from "./interface/index/Main";
import type { FormQuery } from "@/modules/08_KPI/interface/request/index";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
export const useKpiDataStore = defineStore("KPIDate", () => {
const $q = useQuasar();
const mixin = useCounterMixin();
const {
dialogConfirm,
success,
showLoader,
hideLoader,
messageError,
findPosMasterNoOld,
findOrgNameOld,
date2Thai,
} = mixin;
const tabMainevaluator = ref<string>("1");
const yearRound = ref<number>(new Date().getFullYear());
const formQuery = reactive<FormQuery>({
@ -13,7 +30,7 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
keyword: "",
});
const selected = ref([]);
const work = ref<boolean>(false);
const tabMain = ref<string>("1");
const dataProfile = ref<any>({
profileId: null,
@ -313,6 +330,47 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
const indicatorScoreVal = ref<number>(0); // สรุปผลการประเมินผลสัมฤทธิ์ของงานที่ได้
const competencyScoreVal = ref<number>(0); // ผลการประเมินสมรรถนะที่ได้กี่คะแนน
function getDataWork() {
showLoader();
http
.get(config.API.orgPosition + `/${dataProfile.value.profileId}`)
.then((res) => {
const data = res.data.result.isProbation;
work.value = data;
if (data) {
indicatorScore.value = 50;
competencyScore.value = 40;
excusiveCompetencyScore.value = 40;
competencyDevScore.value = 10
} else {
indicatorScore.value = 70;
competencyScore.value = 20;
excusiveCompetencyScore.value = 20;
competencyDevScore.value = 30
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
watch(
() => tabMain.value,
() => {
if (tabMain.value == "3" && tabOpen.value == 3) {
getDataWork();
} else {
indicatorScore.value = 70;
competencyScore.value = 20;
excusiveCompetencyScore.value = 20;
competencyDevScore.value = 30
}
}
);
return {
tabMain,
dataProfile,
@ -356,5 +414,6 @@ export const useKpiDataStore = defineStore("KPIDate", () => {
formQuery,
yearRound,
selected,
work,
};
});